Header And Logo

PostgreSQL
| The world's most advanced open source database.

type.h

Go to the documentation of this file.
00001 /*
00002  * src/interfaces/ecpg/preproc/type.h
00003  */
00004 #ifndef _ECPG_PREPROC_TYPE_H
00005 #define _ECPG_PREPROC_TYPE_H
00006 
00007 #include "ecpgtype.h"
00008 
00009 struct ECPGtype;
00010 struct ECPGstruct_member
00011 {
00012     char       *name;
00013     struct ECPGtype *type;
00014     struct ECPGstruct_member *next;
00015 };
00016 
00017 struct ECPGtype
00018 {
00019     enum ECPGttype type;
00020     char       *type_name;      /* For struct and union types it is the struct
00021                                  * name */
00022     char       *size;           /* For array it is the number of elements. For
00023                                  * varchar it is the maxsize of the area. */
00024     char       *struct_sizeof;  /* For a struct this is the sizeof() type as
00025                                  * string */
00026     union
00027     {
00028         struct ECPGtype *element;       /* For an array this is the type of
00029                                          * the element */
00030         struct ECPGstruct_member *members;      /* A pointer to a list of
00031                                                  * members. */
00032     }           u;
00033     int         counter;
00034 };
00035 
00036 /* Everything is malloced. */
00037 void        ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **);
00038 struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
00039 struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
00040 struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
00041 struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *);
00042 
00043 /* Frees a type. */
00044 void        ECPGfree_struct_member(struct ECPGstruct_member *);
00045 void        ECPGfree_type(struct ECPGtype *);
00046 
00047 /* Dump a type.
00048    The type is dumped as:
00049    type-tag <comma> reference-to-variable <comma> arrsize <comma> size <comma>
00050    Where:
00051    type-tag is one of the simple types or varchar.
00052    reference-to-variable can be a reference to a struct element.
00053    arrsize is the size of the array in case of array fetches. Otherwise 0.
00054    size is the maxsize in case it is a varchar. Otherwise it is the size of
00055        the variable (required to do array fetches of structs).
00056  */
00057 void ECPGdump_a_type(FILE *, const char *, struct ECPGtype *, const int,
00058                 const char *, struct ECPGtype *, const int,
00059                 const char *, const char *, char *,
00060                 const char *, const char *);
00061 
00062 /* A simple struct to keep a variable and its type. */
00063 struct ECPGtemp_type
00064 {
00065     struct ECPGtype *type;
00066     const char *name;
00067 };
00068 
00069 extern const char *ecpg_type_name(enum ECPGttype type);
00070 
00071 /* some stuff for whenever statements */
00072 enum WHEN_TYPE
00073 {
00074     W_NOTHING,
00075     W_CONTINUE,
00076     W_BREAK,
00077     W_SQLPRINT,
00078     W_GOTO,
00079     W_DO,
00080     W_STOP
00081 };
00082 
00083 struct when
00084 {
00085     enum WHEN_TYPE code;
00086     char       *command;
00087     char       *str;
00088 };
00089 
00090 struct index
00091 {
00092     char       *index1;
00093     char       *index2;
00094     char       *str;
00095 };
00096 
00097 struct su_symbol
00098 {
00099     char       *su;
00100     char       *symbol;
00101 };
00102 
00103 struct prep
00104 {
00105     char       *name;
00106     char       *stmt;
00107     char       *type;
00108 };
00109 
00110 struct this_type
00111 {
00112     enum ECPGttype type_enum;
00113     char       *type_str;
00114     char       *type_dimension;
00115     char       *type_index;
00116     char       *type_sizeof;
00117 };
00118 
00119 struct _include_path
00120 {
00121     char       *path;
00122     struct _include_path *next;
00123 };
00124 
00125 struct cursor
00126 {
00127     char       *name;
00128     char       *function;
00129     char       *command;
00130     char       *connection;
00131     bool        opened;
00132     struct arguments *argsinsert;
00133     struct arguments *argsinsert_oos;
00134     struct arguments *argsresult;
00135     struct arguments *argsresult_oos;
00136     struct cursor *next;
00137 };
00138 
00139 struct typedefs
00140 {
00141     char       *name;
00142     struct this_type *type;
00143     struct ECPGstruct_member *struct_member_list;
00144     int         brace_level;
00145     struct typedefs *next;
00146 };
00147 
00148 struct _defines
00149 {
00150     char       *old;
00151     char       *new;
00152     int         pertinent;
00153     void       *used;
00154     struct _defines *next;
00155 };
00156 
00157 /* This is a linked list of the variable names and types. */
00158 struct variable
00159 {
00160     char       *name;
00161     struct ECPGtype *type;
00162     int         brace_level;
00163     struct variable *next;
00164 };
00165 
00166 struct arguments
00167 {
00168     struct variable *variable;
00169     struct variable *indicator;
00170     struct arguments *next;
00171 };
00172 
00173 struct descriptor
00174 {
00175     char       *name;
00176     char       *connection;
00177     struct descriptor *next;
00178 };
00179 
00180 struct assignment
00181 {
00182     char       *variable;
00183     enum ECPGdtype value;
00184     struct assignment *next;
00185 };
00186 
00187 enum errortype
00188 {
00189     ET_WARNING, ET_ERROR, ET_FATAL
00190 };
00191 
00192 struct fetch_desc
00193 {
00194     char       *str;
00195     char       *name;
00196 };
00197 
00198 #endif   /* _ECPG_PREPROC_TYPE_H */