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