/****************************************************************/ /* FIXTREE - by Guy L. Albertelli */ /* 4142 Highland Dr. */ /* Mogadore, Oh. 44260 */ /* */ /* ************ SHAREWARE ************ */ /* */ /* for the benefit of the ST community */ /* */ /* ************ SHAREWARE ************ */ /* */ /* This set of routines will convert a resource file */ /* in source format (.RSH) that has been compiled and */ /* linked with these routines to a working resource file */ /* for GEM. Conceptually this could eliminate the need */ /* for RSC files (provided the compiler can compile the */ /* necessary code. */ /* */ /* USAGE: */ /* After the appl_init call, call fix_tree with */ /* the symbol NUM_TREE as a parameter. That symbol is */ /* defined in the .RSH file. After that call all the */ /* rsrc_ calls are valid except rsrc_load and rsrc_free. */ /* If you want to load a new resource file then call */ /* unfix_tree() to remove the effects of fix_tree. */ /* */ /* NOTE: Never call fix_tree twice, all hell will break */ /* loose. */ /* */ /****************************************************************/ /****************************************************************/ /* Modified by Chor-ming Lung 12/23/87 */ /* for Megamax and Mark Williams C */ /* */ /* I think this file was written for Alcyon C. */ /* The problems that Mark Williams C and Megamax C */ /* encounter with this file are : */ /* 1. Some int and long items are actually pointer of */ /* something else. */ /* 2. rs_tedinfo[].te_ptext/te_ptmplt/te_pvalid in .C file */ /* generated by RCS are integer index for rs_strings. */ /* Actually, their definitions are char pointers. But, */ /* rs_tedinfo[k].te_ptext=rs_strings[rs_tedinfo[k].te_ptext*/ /* is not acceptable. */ /* 3. rs_object[].ob_spec is a long number in Mark William C. */ /* It is a char pointer in Megamax C. */ /* Note: The offending codes have been commented out */ /* Note: Mark Williams' C preprocessor defines GEMDOS,M68000 */ /* That is the way to handle problem 3. */ /****************************************************************/ /****************************************************************/ /* Note from Jinfu Chen 1/23/88 */ /* Thanks to Lung for fixing the codes. */ /* However, he left out the char pointer typecast for MMC */ /* so the text info still didn't work when compiled under */ /* MMC. Fix is simple, just change the fix_tree2 to char */ /* pointer instead of int */ /****************************************************************/ /****************************************************************/ /* INCLUDE FILES */ /****************************************************************/ /* original include files for Alcyon C ? #include "portab.h" #include "obdefs.h" #include "define.h" #include "gemdefs.h" */ #include #include #include /****************************************************************/ /* RESOURCE DATA */ /****************************************************************/ extern BYTE *rs_strings[]; extern LONG rs_frstr[]; extern BITBLK rs_bitblk[]; extern LONG rs_frimg[]; extern ICONBLK rs_iconblk[]; extern TEDINFO rs_tedinfo[]; extern OBJECT rs_object[]; extern LONG rs_trindex[]; extern struct foobar { WORD dummy; WORD *image; } rs_imdope[]; /****************************************************************/ /* EXTERNALS */ /****************************************************************/ extern WORD global[]; /****************************************************************/ /* Take the .RSH code from the RCS output and make it a */ /* usable set of resource trees. This code will do the */ /* basic items that rsrc_load() would do without requiring */ /* a file to load. */ /* */ /* INPUT: */ /* num number of trees in .RSH file (NUM_TREE) */ /****************************************************************/ /****************************************************************/ /* Note from Lung: */ /* My RCS can generate .C code but no .RSH code. The file */ /* SAMPLE.RSH seems not correct. I use RCS to generate */ /* .C file and recompile FIXTRTST.C. It runs flawlessly. */ /****************************************************************/ fix_tree(num) WORD num; { /* LONG *pl; */ WORD i,j; long fix_tree3(); fix_tree1( &global[5], &rs_trindex[0]); /* pl = &global[5]; *pl = &rs_trindex; */ for (i=0;i