/* * Template file for C-sourcecode-output * (new format with initialized structures) * * ORCS version 2.18 2020-08-20 * * %N will be replaced by the RSC filename (without path) * %n will be replaced by the RSC filename * (in lowercase and without .rsc extension) * %R will be replaced by the RSC filename * (according to namerules and without .rsc extension) * %h will be replaced by the extension of include files * %d marks the place where the actual data is written * %D will output the definitions of the object names * * %s: Number of all strings * %S: Number of free strings * %U: Number of USERDEFs * %i: Number of all images * %B: Number of BITBLKs * %F: Number of free images * %I: Number of ICONBLKs * %C: Number of CICONBLKs * %c: Number of CICONs * %t: Number of TEDINFOs * %O: Number of OBJECTs * %T: Number of TREEs * %%: the '%'-character * * The first line of output is after %BEGIN% */ %BEGIN% /* * GEM resource C output of %n * * created by ORCS %V */ #if !defined(__GNUC__) || !defined(__mc68000__) #include #endif #ifndef __STDC__ # ifdef __PUREC__ # define __STDC__ 1 # endif #endif #ifdef OS_WINDOWS # include # define SHORT _WORD # ifdef __WIN32__ # define _WORD signed short # else # define _WORD signed int # pragma option -zE_FARDATA # endif #else # ifdef __TURBOC__ # include # define CP (_WORD *) # endif #endif #ifdef OS_UNIX # include # define SHORT _WORD #else # ifdef __GNUC__ # ifndef __PORTAES_H__ # if __GNUC__ < 4 # include # ifndef _WORD # define _WORD int # endif # define CP (char *) # else # include # ifndef _WORD # define _WORD short # endif # define CP (short *) # endif # define CW (short *) # endif # endif #endif #ifdef __SOZOBONX__ # include #else # ifdef SOZOBON # include # endif #endif #ifdef MEGAMAX # include # include # include # define _WORD int # define SHORT int #endif #ifndef _VOID # define _VOID void #endif #ifndef OS_NORMAL # define OS_NORMAL 0x0000 #endif #ifndef OS_SELECTED # define OS_SELECTED 0x0001 #endif #ifndef OS_CROSSED # define OS_CROSSED 0x0002 #endif #ifndef OS_CHECKED # define OS_CHECKED 0x0004 #endif #ifndef OS_DISABLED # define OS_DISABLED 0x0008 #endif #ifndef OS_OUTLINED # define OS_OUTLINED 0x0010 #endif #ifndef OS_SHADOWED # define OS_SHADOWED 0x0020 #endif #ifndef OS_WHITEBAK # define OS_WHITEBAK 0x0040 #endif #ifndef OS_DRAW3D # define OS_DRAW3D 0x0080 #endif #ifndef OF_NONE # define OF_NONE 0x0000 #endif #ifndef OF_SELECTABLE # define OF_SELECTABLE 0x0001 #endif #ifndef OF_DEFAULT # define OF_DEFAULT 0x0002 #endif #ifndef OF_EXIT # define OF_EXIT 0x0004 #endif #ifndef OF_EDITABLE # define OF_EDITABLE 0x0008 #endif #ifndef OF_RBUTTON # define OF_RBUTTON 0x0010 #endif #ifndef OF_LASTOB # define OF_LASTOB 0x0020 #endif #ifndef OF_TOUCHEXIT # define OF_TOUCHEXIT 0x0040 #endif #ifndef OF_HIDETREE # define OF_HIDETREE 0x0080 #endif #ifndef OF_INDIRECT # define OF_INDIRECT 0x0100 #endif #ifndef OF_FL3DIND # define OF_FL3DIND 0x0200 #endif #ifndef OF_FL3DBAK # define OF_FL3DBAK 0x0400 #endif #ifndef OF_FL3DACT # define OF_FL3DACT 0x0600 #endif #ifndef OF_MOVEABLE # define OF_MOVEABLE 0x0800 #endif #ifndef OF_POPUP # define OF_POPUP 0x1000 #endif #ifndef R_CICONBLK # define R_CICONBLK 17 #endif #ifndef R_CICON # define R_CICON 18 #endif #ifndef G_SWBUTTON # define G_SWBUTTON 34 #endif #ifndef G_POPUP # define G_POPUP 35 #endif #ifndef G_EDIT # define G_EDIT 37 #endif #ifndef G_SHORTCUT # define G_SHORTCUT 38 #endif #ifndef G_SLIST # define G_SLIST 39 #endif #ifndef G_EXTBOX # define G_EXTBOX 40 #endif #ifndef G_OBLINK # define G_OBLINK 41 #endif #ifndef _WORD # ifdef WORD # define _WORD WORD # else # ifdef __PUREC__ # define _WORD int # else # define _WORD short # endif # endif #endif #ifndef _UBYTE # define _UBYTE char #endif #ifndef _BOOL # define _BOOL int #endif #ifndef _LONG # ifdef LONG # define _LONG LONG # else # define _LONG long # endif #endif #ifndef _ULONG # ifdef ULONG # define _ULONG ULONG # else # define _ULONG unsigned long # endif #endif #ifndef _LONG_PTR # define _LONG_PTR _LONG #endif #ifndef C_UNION #ifdef __PORTAES_H__ # define C_UNION(x) { (_LONG_PTR)(x) } #endif #ifdef __GEMLIB__ # define C_UNION(x) { (_LONG_PTR)(x) } #endif #ifdef __PUREC__ # define C_UNION(x) { (_LONG_PTR)(x) } #endif #ifdef __ALCYON__ # define C_UNION(x) x #endif #endif #ifndef C_UNION # define C_UNION(x) (_LONG_PTR)(x) #endif #ifndef SHORT # define SHORT short #endif #ifndef CP # define CP (SHORT *) #endif #ifndef CW # define CW (_WORD *) #endif #undef RSC_STATIC_FILE #define RSC_STATIC_FILE 1 #include "%n.%h" #ifndef RSC_NAMED_FUNCTIONS # define RSC_NAMED_FUNCTIONS 0 #endif #ifndef __ALCYON__ #undef defRSHInit #undef defRSHInitBit #undef defRSHInitStr #ifndef RsArraySize #define RsArraySize(array) (_WORD)(sizeof(array)/sizeof(array[0])) #define RsPtrArraySize(type, array) (type *)array, RsArraySize(array) #endif #define defRSHInit( aa, bb ) RSHInit( aa, bb, RsPtrArraySize(OBJECT *, rs_trindex), RsArraySize(rs_object) ) #define defRSHInitBit( aa, bb ) RSHInitBit( aa, bb, RsPtrArraySize(BITBLK *, rs_frimg) ) #define defRSHInitStr( aa, bb ) RSHInitStr( aa, bb, RsPtrArraySize(_UBYTE *, rs_frstr) ) #endif #ifdef __STDC__ #ifndef W_Cicon_Setpalette extern _BOOL W_Cicon_Setpalette(_WORD *_palette); #endif #ifndef hrelease_objs extern void hrelease_objs(OBJECT *_ob, _WORD _num_objs); #endif #ifndef hfix_objs extern void *hfix_objs(RSHDR *_hdr, OBJECT *_ob, _WORD _num_objs); #endif #endif #ifndef RLOCAL # if RSC_STATIC_FILE # ifdef LOCAL # define RLOCAL LOCAL # else # define RLOCAL static # endif # else # define RLOCAL # endif #endif #ifndef N_ # define N_(x) #endif #if RSC_STATIC_FILE #undef NUM_STRINGS #undef NUM_BB #undef NUM_IB #undef NUM_CIB #undef NUM_CIC #undef NUM_TI #undef NUM_FRSTR #undef NUM_FRIMG #undef NUM_OBS #undef NUM_TREE #undef NUM_UD #define NUM_STRINGS %s #define NUM_BB %B #define NUM_IB %I #define NUM_CIB %C #define NUM_CIC %c #define NUM_TI %t #define NUM_FRSTR %S #define NUM_FRIMG %F #define NUM_OBS %O #define NUM_TREE %T #define NUM_UD %U #endif %d #if RSC_STATIC_FILE #if RSC_NAMED_FUNCTIONS #ifdef __STDC__ _WORD %n_rsc_load(_WORD wchar, _WORD hchar) #else _WORD %n_rsc_load(wchar, hchar) _WORD wchar; _WORD wchar; #endif { #ifndef RSC_HAS_PALETTE # define RSC_HAS_PALETTE 0 #endif #ifndef RSC_USE_PALETTE # define RSC_USE_PALETTE 0 #endif #if RSC_HAS_PALETTE || RSC_USE_PALETTE W_Cicon_Setpalette(&rgb_palette[0][0]); #endif #if NUM_OBS != 0 { _WORD Obj; OBJECT *tree; for (Obj = 0, tree = rs_object; Obj < NUM_OBS; Obj++, tree++) { tree->ob_x = wchar * (tree->ob_x & 0xff) + (tree->ob_x >> 8); tree->ob_y = hchar * (tree->ob_y & 0xff) + (tree->ob_y >> 8); tree->ob_width = wchar * (tree->ob_width & 0xff) + (tree->ob_width >> 8); tree->ob_height = hchar * (tree->ob_height & 0xff) + (tree->ob_height >> 8); } hfix_objs(NULL, rs_object, NUM_OBS); } #endif return 1; } #ifdef __STDC__ _WORD %n_rsc_gaddr(_WORD type, _WORD idx, void *gaddr) #else _WORD %n_rsc_gaddr(type, idx, gaddr) _WORD type; _WORD idx; void *gaddr; #endif { switch (type) { #if NUM_TREE != 0 case R_TREE: if (idx < 0 || idx >= NUM_TREE) return 0; *((OBJECT **)gaddr) = rs_trindex[idx]; break; #endif #if NUM_OBS != 0 case R_OBJECT: if (idx < 0 || idx >= NUM_OBS) return 0; *((OBJECT **)gaddr) = &rs_object[idx]; break; #endif #if NUM_TI != 0 case R_TEDINFO: if (idx < 0 || idx >= NUM_TI) return 0; *((TEDINFO **)gaddr) = &rs_tedinfo[idx]; break; #endif #if NUM_IB != 0 case R_ICONBLK: if (idx < 0 || idx >= NUM_IB) return 0; *((ICONBLK **)gaddr) = &rs_iconblk[idx]; break; #endif #if NUM_BB != 0 case R_BITBLK: if (idx < 0 || idx >= NUM_BB) return 0; *((BITBLK **)gaddr) = &rs_bitblk[idx]; break; #endif #if NUM_FRSTR != 0 case R_STRING: if (idx < 0 || idx >= NUM_FRSTR) return 0; *((char **)gaddr) = (char *)(rs_frstr[idx]); break; #endif #if NUM_FRIMG != 0 case R_IMAGEDATA: if (idx < 0 || idx >= NUM_FRIMG) return 0; *((BITBLK **)gaddr) = rs_frimg[idx]; break; #endif #if NUM_OBS != 0 case R_OBSPEC: if (idx < 0 || idx >= NUM_OBS) return 0; *((_LONG **)gaddr) = &rs_object[idx].ob_spec.index; break; #endif #if NUM_TI != 0 case R_TEPTEXT: if (idx < 0 || idx >= NUM_TI) return 0; *((char ***)gaddr) = (char **)(&rs_tedinfo[idx].te_ptext); break; #endif #if NUM_TI != 0 case R_TEPTMPLT: if (idx < 0 || idx >= NUM_TI) return 0; *((char ***)gaddr) = (char **)(&rs_tedinfo[idx].te_ptmplt); break; #endif #if NUM_TI != 0 case R_TEPVALID: if (idx < 0 || idx >= NUM_TI) return 0; *((char ***)gaddr) = (char **)(&rs_tedinfo[idx].te_pvalid); break; #endif #if NUM_IB != 0 case R_IBPMASK: if (idx < 0 || idx >= NUM_IB) return 0; *((char ***)gaddr) = (char **)(&rs_iconblk[idx].ib_pmask); break; #endif #if NUM_IB != 0 case R_IBPDATA: if (idx < 0 || idx >= NUM_IB) return 0; *((char ***)gaddr) = (char **)(&rs_iconblk[idx].ib_pdata); break; #endif #if NUM_IB != 0 case R_IBPTEXT: if (idx < 0 || idx >= NUM_IB) return 0; *((char ***)gaddr) = (char **)(&rs_iconblk[idx].ib_ptext); break; #endif #if NUM_BB != 0 case R_BIPDATA: if (idx < 0 || idx >= NUM_BB) return 0; *((char ***)gaddr) = (char **)(&rs_bitblk[idx].bi_pdata); break; #endif #if NUM_FRSTR != 0 case R_FRSTR: if (idx < 0 || idx >= NUM_FRSTR) return 0; *((char ***)gaddr) = (char **)(&rs_frstr[idx]); break; #endif #if NUM_FRIMG != 0 case R_FRIMG: if (idx < 0 || idx >= NUM_FRIMG) return 0; *((BITBLK ***)gaddr) = &rs_frimg[idx]; break; #endif default: return 0; } return 1; } #ifdef __STDC__ _WORD %n_rsc_free(void) #else _WORD %n_rsc_free() #endif { #if NUM_OBS != 0 hrelease_objs(rs_object, NUM_OBS); #endif return 1; } #endif /* RSC_NAMED_FUNCTIONS */ #else /* !RSC_STATIC_FILE */ #if 0 _WORD rs_numstrings = %s; _WORD rs_numfrstr = %S; _WORD rs_nuser = %U; _WORD rs_numimages = %i; _WORD rs_numbb = %B; _WORD rs_numfrimg = %F; _WORD rs_numib = %I; _WORD rs_numcib = %C; _WORD rs_numti = %t; _WORD rs_numobs = %O; _WORD rs_numtree = %T; char rs_name[] = "%n.rsc"; _WORD _rsc_format = 2; /* RSC_FORM_SOURCE2 */ #endif #endif /* RSC_STATIC_FILE */