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 *, struct ECPGtype *, struct ECPGstruct_member **);
37 struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
38 struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
39 struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
41 
42 /* Frees a type. */
44 void ECPGfree_type(struct ECPGtype *);
45 
46 /* Dump a type.
47  The type is dumped as:
48  type-tag <comma> reference-to-variable <comma> arrsize <comma> size <comma>
49  Where:
50  type-tag is one of the simple types or varchar.
51  reference-to-variable can be a reference to a struct element.
52  arrsize is the size of the array in case of array fetches. Otherwise 0.
53  size is the maxsize in case it is a varchar. Otherwise it is the size of
54  the variable (required to do array fetches of structs).
55  */
56 void ECPGdump_a_type(FILE *, const char *, struct ECPGtype *, const int,
57  const char *, struct ECPGtype *, const int,
58  const char *, const char *, char *,
59  const char *, const char *);
60 
61 /* A simple struct to keep a variable and its type. */
63 {
64  struct ECPGtype *type;
65  const char *name;
66 };
67 
68 extern const char *ecpg_type_name(enum ECPGttype type);
69 
70 /* some stuff for whenever statements */
72 {
79  W_STOP
80 };
81 
82 struct when
83 {
84  enum WHEN_TYPE code;
85  char *command;
86  char *str;
87 };
88 
89 struct index
90 {
91  char *index1;
92  char *index2;
93  char *str;
94 };
95 
96 struct su_symbol
97 {
98  char *su;
99  char *symbol;
100 };
101 
102 struct prep
103 {
104  char *name;
105  char *stmt;
106  char *type;
107 };
108 
109 struct exec
110 {
111  char *name;
112  char *type;
113 };
114 
115 struct this_type
116 {
117  enum ECPGttype type_enum;
118  char *type_str;
120  char *type_index;
121  char *type_sizeof;
122 };
123 
125 {
126  char *path;
128 };
129 
130 struct cursor
131 {
132  char *name;
133  char *function;
134  char *command;
135  char *connection;
136  bool opened;
141  struct cursor *next;
142 };
143 
145 {
146  char *name;
147  char *connection;
149 };
150 
151 struct typedefs
152 {
153  char *name;
154  struct this_type *type;
157  struct typedefs *next;
158 };
159 
160 struct _defines
161 {
162  char *olddef;
163  char *newdef;
165  void *used;
166  struct _defines *next;
167 };
168 
169 /* This is a linked list of the variable names and types. */
170 struct variable
171 {
172  char *name;
173  struct ECPGtype *type;
175  struct variable *next;
176 };
177 
178 struct arguments
179 {
182  struct arguments *next;
183 };
184 
185 struct descriptor
186 {
187  char *name;
188  char *connection;
189  struct descriptor *next;
190 };
191 
193 {
194  char *variable;
195  enum ECPGdtype value;
196  struct assignment *next;
197 };
198 
200 {
202 };
203 
205 {
206  char *str;
207  char *name;
208 };
209 
210 struct describe
211 {
212  int input;
213  char *stmt_name;
214 };
215 
216 #endif /* _ECPG_PREPROC_TYPE_H */
ECPGttype
Definition: ecpgtype.h:42
ECPGdtype
Definition: ecpgtype.h:72
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:65
struct ECPGtype * type
Definition: type.h:64
Definition: type.h:18
union ECPGtype::@146 u
char * type_name
Definition: type.h:20
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:161
struct _defines * next
Definition: type.h:166
char * olddef
Definition: type.h:162
int pertinent
Definition: type.h:164
char * newdef
Definition: type.h:163
void * used
Definition: type.h:165
struct _include_path * next
Definition: type.h:127
char * path
Definition: type.h:126
struct variable * indicator
Definition: type.h:181
struct arguments * next
Definition: type.h:182
struct variable * variable
Definition: type.h:180
char * variable
Definition: type.h:194
enum ECPGdtype value
Definition: type.h:195
struct assignment * next
Definition: type.h:196
Definition: type.h:131
bool opened
Definition: type.h:136
char * command
Definition: type.h:134
struct arguments * argsinsert_oos
Definition: type.h:138
struct arguments * argsinsert
Definition: type.h:137
char * name
Definition: type.h:132
char * connection
Definition: type.h:135
struct arguments * argsresult_oos
Definition: type.h:140
struct cursor * next
Definition: type.h:141
struct arguments * argsresult
Definition: type.h:139
struct declared_list * next
Definition: type.h:148
char * connection
Definition: type.h:147
char * name
Definition: type.h:146
Definition: type.h:211
char * stmt_name
Definition: type.h:213
int input
Definition: type.h:212
char * connection
Definition: type.h:188
struct descriptor * next
Definition: type.h:110
char * name
Definition: type.h:111
char * type
Definition: type.h:112
char * str
Definition: type.h:206
char * name
Definition: type.h:207
Definition: type.h:90
char * str
Definition: type.h:93
char * index2
Definition: type.h:92
char * index1
Definition: type.h:91
Definition: type.h:103
char * type
Definition: type.h:106
char * stmt
Definition: type.h:105
char * name
Definition: type.h:104
Definition: type.h:97
char * su
Definition: type.h:98
char * symbol
Definition: type.h:99
char * type_index
Definition: type.h:120
char * type_dimension
Definition: type.h:119
char * type_sizeof
Definition: type.h:121
char * type_str
Definition: type.h:118
enum ECPGttype type_enum
Definition: type.h:117
Definition: type.h:152
int brace_level
Definition: type.h:156
char * name
Definition: type.h:153
struct ECPGstruct_member * struct_member_list
Definition: type.h:155
struct typedefs * next
Definition: type.h:157
struct this_type * type
Definition: type.h:154
char * name
Definition: type.h:172
struct ECPGtype * type
Definition: type.h:173
struct variable * next
int brace_level
Definition: type.h:174
Definition: type.h:83
char * str
Definition: type.h:86
char * command
Definition: type.h:85
enum WHEN_TYPE code
Definition: type.h:84
errortype
Definition: type.h:200
@ ET_WARNING
Definition: type.h:201
@ ET_ERROR
Definition: type.h:201
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *)
Definition: type.c:37
void ECPGfree_struct_member(struct ECPGstruct_member *)
Definition: type.c:641
void ECPGmake_struct_member(const char *, struct ECPGtype *, struct ECPGstruct_member **)
Definition: type.c:77
void ECPGfree_type(struct ECPGtype *)
Definition: type.c:655
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *, char *)
Definition: type.c:111
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *)
Definition: type.c:121
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype, char *, int)
Definition: type.c:96
void ECPGdump_a_type(FILE *, const char *, struct ECPGtype *, const int, const char *, struct ECPGtype *, const int, const char *, const char *, char *, const char *, const char *)
Definition: type.c:241
WHEN_TYPE
Definition: type.h:72
@ W_STOP
Definition: type.h:79
@ W_GOTO
Definition: type.h:77
@ W_SQLPRINT
Definition: type.h:76
@ W_BREAK
Definition: type.h:75
@ W_CONTINUE
Definition: type.h:74
@ W_DO
Definition: type.h:78
@ W_NOTHING
Definition: type.h:73
const char * ecpg_type_name(enum ECPGttype type)
Definition: typename.c:17