leo@philmds.UUCP (Leo de Wit) (01/05/89)
The resource question asked lately reminded me of a problem (bug ?) I had encountered using GEM, about a year or longer ago. Using the resource functions (notably rsrc_load(), rsrc_gaddr(), rsrc_free()) I can load resources that, for instance, contain object trees like forms and menus. Nice. Using fsel_input() I have a standard way for the user to search and specify a pathname (directory and filename). Also nice. But trying to use both in the same program failed; when an fsel_input() was done after a rsrc_load() the resource tree contained garbage. It looks as if fsel_input() uses the rsrc_load() function itself, and since a program can only have one resource file loaded at a time (am I correct ?), it put its own resource on top of mine. I worked around it by saving the relevant data (button states) and restoring them after the fsel_input() and a new rsrc_load(), but it didn't seem very nice to me (having to reread the resource file, saving / restoring states etc.). Anyone familiar with this particular problem? Is it a known bug / restriction? Any chance for it to get fixed in a new GEM version? Leo.
klute%trillian.irb@unido.uucp (Rainer Klute) (01/06/89)
In article <908@philmds.UUCP> leo@philmds.UUCP (Leo de Wit) writes: >Using the resource functions (notably rsrc_load(), rsrc_gaddr(), >rsrc_free()) I can load resources that, for instance, contain object >trees like forms and menus. Nice. > >Using fsel_input() I have a standard way for the user to search and >specify a pathname (directory and filename). Also nice. > >But trying to use both in the same program failed; when an fsel_input() >was done after a rsrc_load() the resource tree contained garbage. >It looks as if fsel_input() uses the rsrc_load() function itself, and >since a program can only have one resource file loaded at a time (am I >correct ?), it put its own resource on top of mine. I'm quite surprised to hear about such a behavior of your program. I use the same sequence (rsrc_load, fsel_input) over and over again in my programs and *never* encountered such a bug. I guess it is a bug in your own code. Rainer Klute ---- klute@irb.informatik.uni-dortmund.de Universitaet Dortmund, IRB |)|/ klute@unido.uucp, klute@unido.bitnet Postfach 500500 |\|\ ...uunet!mcvax!unido!klute D-4600 Dortmund 50 ---- Tel.: +49 231 7554663
mui@atari.UUCP (Derek Mui) (01/07/89)
in article <908@philmds.UUCP>, leo@philmds.UUCP (Leo de Wit) says: > > ........; when an fsel_input() > was done after a rsrc_load() the resource tree contained garbage. > It looks as if fsel_input() uses the rsrc_load() function itself, and > since a program can only have one resource file loaded at a time (am I > correct ?), it put its own resource on top of mine. > I just tried a test program on the MEGA ST and it seemed to work fine. Did anybody encounter this problem before? Please give me some more information. Thanks. ----------------------------------------- Derek Mui {..ames!atari!mui} The above opinioins are my own and nobody Atari Corp elses. -----------------------------------------
leo@philmds.UUCP (Leo de Wit) (01/07/89)
In article <826@laura.UUCP> klute%trillian.irb@unido.UUCP (Rainer Klute) writes: |In article <908@philmds.UUCP> leo@philmds.UUCP (Leo de Wit) [that's me] writes: |>Using the resource functions (notably rsrc_load(), rsrc_gaddr(), |>rsrc_free()) I can load resources that, for instance, contain object |>trees like forms and menus. Nice. |> |>Using fsel_input() I have a standard way for the user to search and |>specify a pathname (directory and filename). Also nice. |> |>But trying to use both in the same program failed; when an fsel_input() |>was done after a rsrc_load() the resource tree contained garbage. |>It looks as if fsel_input() uses the rsrc_load() function itself, and |>since a program can only have one resource file loaded at a time (am I |>correct ?), it put its own resource on top of mine. | |I'm quite surprised to hear about such a behavior of your |program. I use the same sequence (rsrc_load, fsel_input) over |and over again in my programs and *never* encountered such a |bug. I guess it is a bug in your own code. Trying and retrying with new and old versions of my program (the new version did NOT have the problem) I found the cause of the trouble: The initial startup code that Lattice C (the compiler I'm using) adds to a program, ensures that the program uses all but 4K of memory. This is the default; it can be overruled by specifying a value for the (global) variable _mneed, which sets the memory needed explicitly, or by supplying a commandline parameter for the program of the form %workspace. The old version (the one with the problem) used the default memory scheme ("all but 4K"). The resource file I was using was about 2K. If I'm correct, resource files are loaded into remaining memory, so that was the cause of the trouble (4K - 2K == 2K remains, what proved to be too little for whatever tricks fsel_input had to perform). (Funny detail: when I used the default memory scheme on the new version, fsel_input returned immediately). Moral: always ensure that your program using resource files leaves enough remaining memory for these files to get loaded (and some 4K extra too). Perhaps it had been better if rscr_load refused to load into such a small remaining amount of memory, or fsel_input complained about lack of memory. Well, you can't have it all... Sorry if I caused any confusion on the net, but I think this is a useful lesson anyway. Cheers! Leo.
julius@yugas.UUCP (Julius OKLAMCAK) (01/07/89)
In article <908@philmds.UUCP>, leo@philmds.UUCP (Leo de Wit) writes: > [lead-up deleted] > >But trying to use both in the same program failed; when an fsel_input() >was done after a rsrc_load() the resource tree contained garbage. >It looks as if fsel_input() uses the rsrc_load() function itself, and >since a program can only have one resource file loaded at a time (am I >correct ?), it put its own resource on top of mine. > > [rest deleted] You must be doing something wrong. All (most? :-) GEM applications load a resource file and use the Item/File Selector. Check your initialization code... Check your compiler/libraries... It does work! -- Julius Oklamcak All views are my own. Atari (Canada) Corp. Just say NO! to the abuse and ...!uunet!nexus!yugas!julius destruction of the environment.