PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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
9struct ECPGtype;
11{
12 char *name;
13 struct ECPGtype *type;
15};
16
18{
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;
33};
34
35/* Everything is malloced. */
36void ECPGmake_struct_member(const char *name, struct ECPGtype *type,
37 struct ECPGstruct_member **start);
38struct ECPGtype *ECPGmake_simple_type(enum ECPGttype type, const char *size, int counter);
39struct ECPGtype *ECPGmake_array_type(struct ECPGtype *type, const char *size);
41 enum ECPGttype type,
42 const char *type_name,
43 const char *struct_sizeof);
45
46/* Frees a type. */
48void ECPGfree_type(struct ECPGtype *type);
49
50/* Dump a type.
51 The type is dumped as:
52 type-tag <comma> reference-to-variable <comma> arrsize <comma> size <comma>
53 Where:
54 type-tag is one of the simple types or varchar.
55 reference-to-variable can be a reference to a struct element.
56 arrsize is the size of the array in case of array fetches. Otherwise 0.
57 size is the maxsize in case it is a varchar. Otherwise it is the size of
58 the variable (required to do array fetches of structs).
59 */
60void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type,
61 const int brace_level, const char *ind_name,
62 struct ECPGtype *ind_type, const int ind_brace_level,
63 const char *prefix, const char *ind_prefix,
64 char *arr_str_size, const char *struct_sizeof,
65 const char *ind_struct_sizeof);
66
67/* A simple struct to keep a variable and its type. */
69{
70 struct ECPGtype *type;
71 const char *name;
72};
73
74extern const char *ecpg_type_name(enum ECPGttype type);
75
76/* some stuff for whenever statements */
78{
85 W_STOP
86};
87
88struct when
89{
91 char *command;
92 char *str;
93};
94
95struct index
96{
97 const char *index1;
98 const char *index2;
99 const char *str;
100};
101
103{
104 const char *su;
105 const char *symbol;
106};
107
108struct prep
109{
110 const char *name;
111 const char *stmt;
112 const char *type;
113};
114
115struct exec
116{
117 const char *name;
118 const char *type;
119};
120
122{
125 char *type_str;
129};
130
132{
133 char *path;
135};
136
137struct cursor
138{
139 char *name;
140 char *function;
141 char *command;
143 bool opened;
148 struct cursor *next;
149};
150
152{
153 char *name;
156};
157
159{
160 char *name;
164 struct typedefs *next;
165};
166
167/*
168 * Info about a defined symbol (macro), coming from a -D command line switch
169 * or a define command in the program. These are stored in a simple list.
170 * Because ecpg supports compiling multiple files per run, we have to remember
171 * the command-line definitions and be able to revert to those; this motivates
172 * storing cmdvalue separately from value.
173 * name and value are separately-malloc'd strings; cmdvalue typically isn't.
174 * used is NULL unless we are currently expanding the macro, in which case
175 * it points to the buffer before the one scanning the macro; we reset it
176 * to NULL upon returning to that buffer. This is used to prevent recursive
177 * expansion of the macro.
178 */
180{
181 char *name; /* symbol's name */
182 char *value; /* current value, or NULL if undefined */
183 const char *cmdvalue; /* value set on command line, or NULL */
184 void *used; /* buffer pointer, or NULL */
185 struct _defines *next; /* list link */
186};
187
188/* This is a linked list of the variable names and types. */
189struct variable
190{
191 char *name;
192 struct ECPGtype *type;
194 struct variable *next;
195};
196
198{
202};
203
204struct descriptor
205{
206 char *name;
208 struct descriptor *next;
209};
210
212{
213 char *variable;
216};
217
219{
222
224{
225 const char *str;
226 const char *name;
227};
228
230{
231 int input;
232 const char *stmt_name;
233};
234
235#endif /* _ECPG_PREPROC_TYPE_H */
ECPGttype
Definition: ecpgtype.h:42
ECPGdtype
Definition: ecpgtype.h:72
return str start
static pg_noinline void Size size
Definition: slab.c:607
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:71
struct ECPGtype * type
Definition: type.h:70
Definition: type.h:18
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
union ECPGtype::@165 u
int counter
Definition: type.h:32
Definition: type.h:180
struct _defines * next
Definition: type.h:185
char * value
Definition: type.h:182
char * name
Definition: type.h:181
void * used
Definition: type.h:184
const char * cmdvalue
Definition: type.h:183
struct _include_path * next
Definition: type.h:134
char * path
Definition: type.h:133
struct variable * indicator
Definition: type.h:200
struct arguments * next
Definition: type.h:201
struct variable * variable
Definition: type.h:199
char * variable
Definition: type.h:213
enum ECPGdtype value
Definition: type.h:214
struct assignment * next
Definition: type.h:215
Definition: type.h:138
char * function
Definition: type.h:140
bool opened
Definition: type.h:143
char * command
Definition: type.h:141
struct arguments * argsinsert_oos
Definition: type.h:145
struct arguments * argsinsert
Definition: type.h:144
char * name
Definition: type.h:139
char * connection
Definition: type.h:142
struct arguments * argsresult_oos
Definition: type.h:147
struct cursor * next
Definition: type.h:148
struct arguments * argsresult
Definition: type.h:146
struct declared_list * next
Definition: type.h:155
char * connection
Definition: type.h:154
char * name
Definition: type.h:153
Definition: type.h:230
const char * stmt_name
Definition: type.h:232
int input
Definition: type.h:231
char * connection
Definition: type.h:207
struct descriptor * next
Definition: type.h:116
const char * name
Definition: type.h:117
const char * type
Definition: type.h:118
const char * str
Definition: type.h:225
const char * name
Definition: type.h:226
Definition: type.h:96
const char * index2
Definition: type.h:98
const char * index1
Definition: type.h:97
const char * str
Definition: type.h:99
Definition: type.h:109
const char * name
Definition: type.h:110
const char * stmt
Definition: type.h:111
const char * type
Definition: type.h:112
const char * su
Definition: type.h:104
const char * symbol
Definition: type.h:105
char * type_index
Definition: type.h:127
char * type_dimension
Definition: type.h:126
char * type_sizeof
Definition: type.h:128
char * type_str
Definition: type.h:125
char * type_storage
Definition: type.h:123
enum ECPGttype type_enum
Definition: type.h:124
Definition: type.h:159
int brace_level
Definition: type.h:163
char * name
Definition: type.h:160
struct ECPGstruct_member * struct_member_list
Definition: type.h:162
struct typedefs * next
Definition: type.h:164
struct this_type * type
Definition: type.h:161
char * name
Definition: type.h:191
struct ECPGtype * type
Definition: type.h:192
struct variable * next
int brace_level
Definition: type.h:193
Definition: type.h:89
char * str
Definition: type.h:92
char * command
Definition: type.h:91
enum WHEN_TYPE code
Definition: type.h:90
errortype
Definition: type.h:219
@ ET_WARNING
Definition: type.h:220
@ ET_ERROR
Definition: type.h:220
void ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
Definition: type.c:53
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype type, const char *size, int counter)
Definition: type.c:72
const char * ecpg_type_name(enum ECPGttype type)
Definition: typename.c:17
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:218
void ECPGfree_struct_member(struct ECPGstruct_member *rm)
Definition: type.c:618
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *rm)
Definition: type.c:13
void ECPGfree_type(struct ECPGtype *type)
Definition: type.c:632
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *type, const char *size)
Definition: type.c:87
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *rm, enum ECPGttype type, const char *type_name, const char *struct_sizeof)
Definition: type.c:97
WHEN_TYPE
Definition: type.h:78
@ W_STOP
Definition: type.h:85
@ W_GOTO
Definition: type.h:83
@ W_SQLPRINT
Definition: type.h:82
@ W_BREAK
Definition: type.h:81
@ W_CONTINUE
Definition: type.h:80
@ W_DO
Definition: type.h:84
@ W_NOTHING
Definition: type.h:79
const char * type
const char * name