|
ocssw
1.0
|
00001 /* 00002 $Header: /app/shared/RCS/irix-5.2/seawifsd/src/hdfio/Shared.V4.4/L012_Util/util/usr/initsetup.h,v 1.2 1995/12/07 17:29:29 seawifsd Exp seawifsd $ 00003 $Log: initsetup.h,v $ 00004 Revision 1.2 1995/12/07 17:29:29 seawifsd 00005 added 'count' in parameter block. 00006 00007 Revision 1.1 1995/08/03 20:10:42 seawifsd 00008 Initial revision 00009 00010 */ 00011 00012 #ifndef INITSETUP_H_ 00013 #define INITSETUP_H_ 00014 00015 00016 typedef struct initParamStruct { 00017 char *name; /* name of the parameter */ 00018 int type; /* type of the parameter */ 00019 int count; /* number of parameter in the array */ 00020 int size; /* size of the each parameter(in bytes) */ 00021 void *data; /* ptr to the parameter */ 00022 } initParamType; 00023 00024 typedef struct initBlockStruct { 00025 char *fname; /* filename associated with the block */ 00026 char *name; /* name of the parameter block */ 00027 int nmax; /* maximum entries can be stored */ 00028 int nuse; /* currently occupied entries */ 00029 initParamType *params;/* parameter block data area */ 00030 } initBlockType; 00031 00032 #define PARAMBLOCK_INC 5 00033 00034 #define PARAMTYPE_intType 1 00035 #define PARAMTYPE_shortType 2 00036 #define PARAMTYPE_longType 3 00037 #define PARAMTYPE_floatType 4 00038 #define PARAMTYPE_doubleType 5 00039 00040 /* 00041 paramblockdef(bnam) : 00042 declare parameter block 00043 00044 paramblockinit(bnam,fnam): 00045 associate a file 'fnam' that contains values for the 00046 parameter in parameter block 'bnam'. And initialize 00047 the values. 00048 00049 paramdef(nam,typ): 00050 this is the same as normal declaration of 'typ nam'. 00051 00052 parammark(bnam,nam,typ,cnt): 00053 link a variable 'nam' of type 'typ' that contain 'cnt' 00054 number of data object(1 for not array) with the parameter 00055 block 'bnam'. 00056 00057 */ 00058 00059 00060 #define paramblockdef(bnam) initBlockType bnam 00061 #define paramblockinit(bnam,fnam) { \ 00062 bnam.fname = fnam; \ 00063 bnam.name = #bnam ; \ 00064 bnam.nmax = 0 ; \ 00065 bnam.nuse = 0 ; \ 00066 bnam.params = NULL ; \ 00067 } 00068 00069 #define paramblockinc(bnam) { \ 00070 if (bnam.nuse >= bnam.nmax) { \ 00071 bnam.nmax += PARAMBLOCK_INC ; \ 00072 bnam.params = (initParamType *)realloc(bnam.params,bnam.nmax * sizeof(initParamType)) ; \ 00073 } \ 00074 } 00075 00076 #define PARAMTYPECONST(typ) PARAMTYPE_ ## typ ## Type 00077 #define paramdef(nam,typ) typ nam 00078 #define parammark(bnam,nam,typ,cnt) { \ 00079 /* increase holding area if needed */ \ 00080 paramblockinc(bnam) ; \ 00081 /* fill in values in the structure */ \ 00082 bnam.params[bnam.nuse].name = #nam ; \ 00083 bnam.params[bnam.nuse].type = PARAMTYPECONST(typ) ; \ 00084 bnam.params[bnam.nuse].count = cnt ; \ 00085 bnam.params[bnam.nuse].size = sizeof(typ) ; \ 00086 bnam.params[bnam.nuse].data = (void *)&(nam) ; \ 00087 /* increase counter */ \ 00088 bnam.nuse ++ ; \ 00089 } 00090 00091 #include "usrhdr.h" 00092 #include "usrmac.h" 00093 #include "initsetup_proto.h" 00094 00095 #endif /* !INITSETUP_H_ */
1.7.6.1