PostgreSQL Source Code  git master
type.h
Go to the documentation of this file.
1 /*
2  * src/interfaces/ecpg/preproc/type.h
3  */
4 #ifndef _ECPG_PREPROC_TYPE_H
5 #define _ECPG_PREPROC_TYPE_H
6 
7 #include "ecpgtype.h"
8 
9 struct ECPGtype;
11 {
12  char *name;
13  struct ECPGtype *type;
15 };
16 
17 struct ECPGtype
18 {
19  enum ECPGttype type;
20  char *type_name; /* For struct and union types it is the struct
21  * name */
22  char *size; /* For array it is the number of elements. For
23  * varchar it is the maxsize of the area. */
24  char *struct_sizeof; /* For a struct this is the sizeof() type as
25  * string */
26  union
27  {
28  struct ECPGtype *element; /* For an array this is the type of the
29  * element */
30  struct ECPGstruct_member *members; /* A pointer to a list of members. */
31  } u;
32  int counter;
33 };
34 
35 /* Everything is malloced. */
36 void ECPGmake_struct_member(const char *name, struct ECPGtype *type,
37  struct ECPGstruct_member **start);
38 struct ECPGtype *ECPGmake_simple_type(enum ECPGttype type, char *size, int counter);
39 struct ECPGtype *ECPGmake_array_type(struct ECPGtype *type, char *size);
41  enum ECPGttype type, char *type_name,
42  char *struct_sizeof);
44 
45 /* Frees a type. */
47 void ECPGfree_type(struct ECPGtype *type);
48 
49 /* Dump a type.
50  The type is dumped as:
51  type-tag <comma> reference-to-variable <comma> arrsize <comma> size <comma>
52  Where:
53  type-tag is one of the simple types or varchar.
54  reference-to-variable can be a reference to a struct element.
55  arrsize is the size of the array in case of array fetches. Otherwise 0.
56  size is the maxsize in case it is a varchar. Otherwise it is the size of
57  the variable (required to do array fetches of structs).
58  */
59 void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type,
60  const int brace_level, const char *ind_name,
61  struct ECPGtype *ind_type, const int ind_brace_level,
62  const char *prefix, const char *ind_prefix,
63  char *arr_str_size, const char *struct_sizeof,
64  const char *ind_struct_sizeof);
65 
66 /* A simple struct to keep a variable and its type. */
68 {
69  struct ECPGtype *type;
70  const char *name;
71 };
72 
73 extern const char *ecpg_type_name(enum ECPGttype type);
74 
75 /* some stuff for whenever statements */
77 {
84  W_STOP
85 };
86 
87 struct when
88 {
89  enum WHEN_TYPE code;
90  char *command;
91  char *str;
92 };
93 
94 struct index
95 {
96  char *index1;
97  char *index2;
98  char *str;
99 };
100 
101 struct su_symbol
102 {
103  char *su;
104  char *symbol;
105 };
106 
107 struct prep
108 {
109  char *name;
110  char *stmt;
111  char *type;
112 };
113 
114 struct exec
115 {
116  char *name;
117  char *type;
118 };
119 
120 struct this_type
121 {
123  enum ECPGttype type_enum;
124  char *type_str;
126  char *type_index;
127  char *type_sizeof;
128 };
129 
131 {
132  char *path;
134 };
135 
136 struct cursor
137 {
138  char *name;
139  char *function;
140  char *command;
141  char *connection;
142  bool opened;
147  struct cursor *next;
148 };
149 
151 {
152  char *name;
153  char *connection;
155 };
156 
157 struct typedefs
158 {
159  char *name;
160  struct this_type *type;
163  struct typedefs *next;
164 };
165 
166 struct _defines
167 {
168  char *olddef;
169  char *newdef;
171  void *used;
172  struct _defines *next;
173 };
174 
175 /* This is a linked list of the variable names and types. */
176 struct variable
177 {
178  char *name;
179  struct ECPGtype *type;
181  struct variable *next;
182 };
183 
184 struct arguments
185 {
188  struct arguments *next;
189 };
190 
191 struct descriptor
192 {
193  char *name;
194  char *connection;
195  struct descriptor *next;
196 };
197 
199 {
200  char *variable;
201  enum ECPGdtype value;
202  struct assignment *next;
203 };
204 
206 {
208 };
209 
211 {
212  char *str;
213  char *name;
214 };
215 
216 struct describe
217 {
218  int input;
219  char *stmt_name;
220 };
221 
222 #endif /* _ECPG_PREPROC_TYPE_H */
ECPGttype
Definition: ecpgtype.h:42
ECPGdtype
Definition: ecpgtype.h:72
const char * name
Definition: encode.c:561
char * name
Definition: type.h:12
struct ECPGtype * type
Definition: type.h:13
struct ECPGstruct_member * next
Definition: type.h:14
const char * name
Definition: type.h:70
struct ECPGtype * type
Definition: type.h:69
Definition: type.h:18
char * type_name
Definition: type.h:20
union ECPGtype::@147 u
char * struct_sizeof
Definition: type.h:24
enum ECPGttype type
Definition: type.h:19
struct ECPGstruct_member * members
Definition: type.h:30
char * size
Definition: type.h:22
struct ECPGtype * element
Definition: type.h:28
int counter
Definition: type.h:32
Definition: type.h:167
struct _defines * next
Definition: type.h:172
char * olddef
Definition: type.h:168
int pertinent
Definition: type.h:170
char * newdef
Definition: type.h:169
void * used
Definition: type.h:171
struct _include_path * next
Definition: type.h:133
char * path
Definition: type.h:132
struct variable * indicator
Definition: type.h:187
struct arguments * next
Definition: type.h:188
struct variable * variable
Definition: type.h:186
char * variable
Definition: type.h:200
enum ECPGdtype value
Definition: type.h:201
struct assignment * next
Definition: type.h:202
Definition: type.h:137
bool opened
Definition: type.h:142
char * command
Definition: type.h:140
struct arguments * argsinsert_oos
Definition: type.h:144
struct arguments * argsinsert
Definition: type.h:143
char * name
Definition: type.h:138
char * connection
Definition: type.h:141
struct arguments * argsresult_oos
Definition: type.h:146
struct cursor * next
Definition: type.h:147
struct arguments * argsresult
Definition: type.h:145
struct declared_list * next
Definition: type.h:154
char * connection
Definition: type.h:153
char * name
Definition: type.h:152
Definition: type.h:217
char * stmt_name
Definition: type.h:219
int input
Definition: type.h:218
char * connection
Definition: type.h:194
struct descriptor * next
Definition: type.h:115
char * name
Definition: type.h:116
char * type
Definition: type.h:117
char * str
Definition: type.h:212
char * name
Definition: type.h:213
Definition: type.h:95
char * str
Definition: type.h:98
char * index2
Definition: type.h:97
char * index1
Definition: type.h:96
Definition: type.h:108
char * type
Definition: type.h:111
char * stmt
Definition: type.h:110
char * name
Definition: type.h:109
char * su
Definition: type.h:103
char * symbol
Definition: type.h:104
char * type_index
Definition: type.h:126
char * type_dimension
Definition: type.h:125
char * type_sizeof
Definition: type.h:127
char * type_str
Definition: type.h:124
char * type_storage
Definition: type.h:122
enum ECPGttype type_enum
Definition: type.h:123
Definition: type.h:158
int brace_level
Definition: type.h:162
char * name
Definition: type.h:159
struct ECPGstruct_member * struct_member_list
Definition: type.h:161
struct typedefs * next
Definition: type.h:163
struct this_type * type
Definition: type.h:160
char * name
Definition: type.h:178
struct ECPGtype * type
Definition: type.h:179
struct variable * next
int brace_level
Definition: type.h:180
Definition: type.h:88
char * str
Definition: type.h:91
char * command
Definition: type.h:90
enum WHEN_TYPE code
Definition: type.h:89
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *type, char *size)
Definition: type.c:111
errortype
Definition: type.h:206
@ ET_WARNING
Definition: type.h:207
@ ET_ERROR
Definition: type.h:207
void ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
Definition: type.c:77
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype type, char *size, int counter)
Definition: type.c:96
void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type, const int brace_level, const char *ind_name, struct ECPGtype *ind_type, const int ind_brace_level, const char *prefix, const char *ind_prefix, char *arr_str_size, const char *struct_sizeof, const char *ind_struct_sizeof)
Definition: type.c:241
void ECPGfree_struct_member(struct ECPGstruct_member *rm)
Definition: type.c:641
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *rm)
Definition: type.c:37
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *rm, enum ECPGttype type, char *type_name, char *struct_sizeof)
Definition: type.c:121
void ECPGfree_type(struct ECPGtype *type)
Definition: type.c:655
WHEN_TYPE
Definition: type.h:77
@ W_STOP
Definition: type.h:84
@ W_GOTO
Definition: type.h:82
@ W_SQLPRINT
Definition: type.h:81
@ W_BREAK
Definition: type.h:80
@ W_CONTINUE
Definition: type.h:79
@ W_DO
Definition: type.h:83
@ W_NOTHING
Definition: type.h:78
const char * ecpg_type_name(enum ECPGttype type)
Definition: typename.c:17