00001 /* asParse - parse out an autoSql .as file. */ 00002 00003 #ifndef ASPARSE_H 00004 #define ASPARSE_H 00005 00006 enum asTypes 00007 /* Different low level types (not including lists and objects) */ 00008 { 00009 t_double, /* double precision floating point. */ 00010 t_float, /* single precision floating point. */ 00011 t_char, /* character or fixed size character array. */ 00012 t_int, /* signed 32 bit integer */ 00013 t_uint, /* unsigned 32 bit integer */ 00014 t_short, /* signed 16 bit integer */ 00015 t_ushort, /* unsigned 16 bit integer */ 00016 t_byte, /* signed 8 bit integer */ 00017 t_ubyte, /* unsigned 8 bit integer */ 00018 t_off, /* 64 bit integer. */ 00019 t_string, /* varchar/char * (variable size string up to 255 chars) */ 00020 t_lstring, /* variable sized large string. */ 00021 t_object, /* composite object - object/table - forms lists. */ 00022 t_simple, /* simple composite object - forms arrays. */ 00023 t_enum, /* enumerated symbolic values */ 00024 t_set, /* set of symbolic values */ 00025 }; 00026 00027 struct asTypeInfo 00028 { 00029 enum asTypes type; /* Numeric ID of low level type. */ 00030 char *name; /* Text ID of low level type. */ 00031 bool isUnsigned; /* True if an unsigned int of some type. */ 00032 bool stringy; /* True if a string or blob. */ 00033 char *sqlName; /* SQL type name. */ 00034 char *cName; /* C type name. */ 00035 char *listyName; /* What functions that load a list are called. */ 00036 char *nummyName; /* What functions that load a number are called. */ 00037 char *outFormat; /* Output format for printf. %d, %u, etc. */ 00038 }; 00039 00040 struct asColumn 00041 /* Info on one column/field */ 00042 { 00043 struct asColumn *next; /* Next column. */ 00044 char *name; /* Column name. */ 00045 char *comment; /* Comment string on column. */ 00046 struct asTypeInfo *lowType; /* Root type info. */ 00047 char *obName; /* Name of object or table. */ 00048 struct asObject *obType; /* Name of composite object. */ 00049 int fixedSize; /* 0 if not fixed size, otherwise size of list. */ 00050 char *linkedSizeName; /* Points to variable that holds size of list. */ 00051 struct asColumn *linkedSize; /* Column for linked size. */ 00052 bool isSizeLink; /* Flag to tell if have read link. */ 00053 bool isList; /* TRUE if a list. */ 00054 bool isArray; /* TRUE if an array. */ 00055 struct slName *values; /* values for symbolic types */ 00056 }; 00057 00058 struct asObject 00059 /* Info on whole asObject. */ 00060 { 00061 struct asObject *next; 00062 char *name; /* Name of object. */ 00063 char *comment; /* Comment describing object. */ 00064 struct asColumn *columnList; /* List of columns. */ 00065 bool isTable; /* True if a table. */ 00066 bool isSimple; /* True if a simple object. */ 00067 }; 00068 00069 struct asObject *asParseFile(char *fileName); 00070 /* Parse autoSql .as file. */ 00071 00072 struct asObject *asParseText(char *text); 00073 /* Parse autoSql from text (as opposed to file). */ 00074 00075 #endif /* ASPARSE_H */
1.5.2