/common/home/bel/bella/lnx/exports/build/current/all/sys-tools/xfer-generator/main.h

00001 #ifndef _MAIN_H
00002 #define _MAIN_H
00003 
00096     // definition of java Listener interface
00097 #define XGEN_JAVA_PATH_LISTENER "de.gsi.bel.xfer.XferListener"
00098 #define XGEN_JAVA_PATH_PRINTER "de.gsi.bel.xfer.XferPrinter"
00099 #define XGEN_JAVA_LISTENER "XferListener"
00100 #define XGEN_JAVA_LISTENER_HANDLER \
00101     "public void handleMessage( XferPrinter xp )"
00102 
00103 #define XGEN_JAVA_PATH_UNION "de.gsi.bel.xfer.Union"
00104 #define XGEN_JAVA_PATH_NATIVE "de.gsi.bel.xfer.Native"
00105 #define XGEN_JAVA_UNION "Union"
00106 #define XGEN_CONSTANT_INTERFACE "Constants"
00107 
00108 #define XGEN_XFER_JAR "xferjava.jar"
00109 
00110 #define XGEN_JAVA_CONST_IMPORT1 "java.util.HashMap"
00111 
00112     // definition of tag names
00113 #define XGEN_ROOT_TAG        "xfer"
00114 #define XGEN_NAMESPACE_TAG   "namespace"
00115 #define XGEN_VERSION_TAG     "version"
00116 #define XGEN_CONST_TAG       "const"
00117 #define XGEN_MEMBER_TAG      "member"
00118 #define XGEN_ENUM_TAG        "enum"
00119 #define XGEN_RECORD_TAG      "class"
00120 #define XGEN_UNION_TAG       "union"
00121 #define XGEN_VALUE_TAG       "value"
00122 
00123 
00124     // primitive types
00125 #define XGEN_INT_TAG     "integer"
00126 #define XGEN_LONG_TAG     "long"
00127 #define XGEN_FP_TAG      "fp"
00128 #define XGEN_BYTE_TAG    "byte"
00129 #define XGEN_STR_TAG     "string"
00130 #define XGEN_BOOLEAN_TAG  "boolean"
00131 #define XGEN_OBJECT_TAG  "object"
00132 #define XGEN_NATIVE_TAG  "native"
00133 
00134     // typesection
00135 #define XGEN_TYPEDEFS_TAG  "subclasses"
00136 
00137     // item  attributes
00138 #define XGEN_TYPE_TAG      "type"
00139 #define XGEN_NAME_TAG      "name"
00140 #define XGEN_SIZE_TAG      "size"
00141 #define XGEN_MAJOR_TAG     "major"
00142 #define XGEN_MINOR_TAG     "minor"
00143 
00144     // item modifier tag
00145 #define XGEN_ITEMOF_TAG  "item-of"
00146 #define XGEN_VECTOROF_TAG  "list-of"
00147 #define XGEN_ARRAYOF_TAG   "array-of"
00148 
00149 
00150 // type ids
00151 #define XGEN_RECORD_TYPE 0x01
00152 #define XGEN_UNION_TYPE 0x02
00153 // primitive types
00154 #define XGEN_INT_TYPE 0x03
00155 #define XGEN_FP_TYPE 0x04
00156 #define XGEN_BYTE_TYPE 0x05
00157 #define XGEN_STR_TYPE 0x06
00158 #define XGEN_BOOLEAN_TYPE 0x07
00159 // generic object
00160 #define XGEN_OBJECT_TYPE 0x08
00161 // language specific object reference, not used for xfer
00162 #define XGEN_NATIVE_TYPE 0x09
00163 // another primitive type
00164 #define XGEN_LONG_TYPE 0x0A
00165 
00166     // type attribute modifiers
00167 #define XGEN_ITEM_TYPE  0x0100
00168 #define XGEN_VECTOR_TYPE   0x0200
00169 #define XGEN_ARRAY_TYPE 0x0400
00170 
00171 // version found in xml-file for object
00172 typedef struct
00173 {
00174   char *major;
00175   char *minor;
00176 } xgen_version_t;
00177 
00178 // namespace found in xml-file for object
00179 typedef struct
00180 {
00181   char *prefix;
00182 } xgen_namespace_t;
00183 // max length of an identifier
00184 #define XGEN_MAXNAME 256
00185 
00186 typedef struct xgen_rec_s xgen_rec_t;
00187 //----------------------------------------------------------------
00188 // descripiton of an record element
00189 typedef struct
00190 {
00191   char *type; // int,fp,...,  record name, union name,...
00192   int  attr;  // attribute of type: item, array, vector
00193   char *name; // name of item
00194   char *rem;  // comment of xml
00195   int size;   // array: number of array elements
00196   xgen_rec_t *prec; // for non primitive type pointer to type description
00197 } xgen_item_t;
00198 
00199 
00200 // description  of a record or union type
00201 struct xgen_rec_s
00202 {
00203   int   typeid; // record or union
00204   char *type; // name of type-definition
00205   char *rem;  // comment of xml
00206   int  no;   // number of items
00207   xgen_item_t  *pitem; // items in record or union
00208   int link_ctr; // link counter
00209   int prim_flag; // only primitive data types in record or union
00210   int root_flag; // set if record is root element
00211 };
00212 
00213 // info of xml-file stored in a list of record descriptions
00214 #define XGEN_MAX_REC 256
00215 typedef struct xgen_rec_list_s
00216 {
00217 int no;                           // number of records or union
00218 xgen_rec_t *prec[XGEN_MAX_REC];   // list of records
00219 } xgen_rec_list_t;
00220 
00221 typedef struct
00222 {
00223   char *name;
00224   int typetag;
00225   union 
00226   {
00227     char *str;
00228     int i;
00229     long long int li;
00230     double d;
00231     char b;
00232     unsigned char bl;
00233   } val;
00234 } xgen_value_t;
00235 
00236 // constant
00237 typedef struct 
00238 {
00239   xgen_value_t value;
00240   char *rem;  // comment of xml
00241 } xgen_const_t;
00242 
00243 // set of constants
00244 typedef struct 
00245 {
00246   int no;
00247 #define XGEN_MAX_CONST 512
00248   xgen_const_t *pconst[XGEN_MAX_CONST]; 
00249 } xgen_const_list_t;
00250 
00251 // enum
00252 //
00253 typedef struct
00254 {
00255   char *name;
00256   char *rem;  // comment of xml
00257   int value;
00258 } xgen_enum_member_t;
00259 
00260 typedef struct
00261 {
00262   char *name;
00263   char *rem;  // comment of xml
00264   int no;
00265 #define XGEN_MAX_ENUM_MEMBER 128
00266   xgen_enum_member_t *pmember[XGEN_MAX_ENUM_MEMBER];
00267 } xgen_enum_t;
00268 
00269 // set of enums
00270 typedef struct 
00271 {
00272   int no;
00273 #define XGEN_MAX_ENUMS 512
00274   xgen_enum_t *penum[XGEN_MAX_ENUMS]; 
00275 } xgen_enum_list_t;
00276 
00277 #ifdef LATER_QUESTION
00278 
00279 #endif
00280 
00281 typedef enum
00282 {
00283   XGEN_LANG_C=0,
00284   XGEN_LANG_JAVA,
00285   XGEN_LANG_MAX
00286 } xgen_lang_e;
00287 
00288 typedef struct
00289 {
00290   int verbose;
00291   int force;
00292   int keeptmp;
00293   char *myproc;
00294   int fdout;
00295   int fdin;
00296   char *fnin;
00297 
00298   char prog[1024];
00299 
00300   char *outpath[XGEN_LANG_MAX];
00301   char *tmppath[XGEN_LANG_MAX];
00302   char *outfn[XGEN_LANG_MAX];
00303   int lng_no;
00304   int lng[XGEN_LANG_MAX];
00305 
00306   char *ccopts_user;
00307   char *ldopts_user;
00308 
00309   xgen_rec_list_t *psort;
00310   xgen_const_list_t *pcl;
00311   xgen_enum_list_t *penl;
00312   xgen_namespace_t *pns;
00313   xgen_version_t *pver;
00314 
00315 #define XGEN_MAX_INC 32 // sollte reichen ;-)
00316   int incpath_no[XGEN_LANG_MAX];
00317   char *incpath[XGEN_MAX_INC][XGEN_LANG_MAX];
00318   char *dtdpath; 
00319   int shared;
00320   char *sharedversion;
00321   char *sharedversionso;
00322   char *java_package;
00323 } gl_data;
00324 
00325 
00326 extern char *XGEN_TMPDIR[XGEN_LANG_MAX];
00327 
00328 int mk_author( FILE *, char * );
00329 int gen_c( void );
00330 int gen_java( void );
00331 int type_check( char *type, int mode );
00332 int do_cmd( char *cmd );
00333 int init_dir( char *);
00334 int is_dir( char *);
00335 int rm_dir(int, char*);
00336 void sub_nl( char *s );
00337 
00338 #endif

Generated on 4 Mar 2014 for xfergen by  doxygen 1.4.7