PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 {
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(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 {
80 };
81 
82 struct when
83 {
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 this_type
110 {
112  char *type_str;
114  char *type_index;
115  char *type_sizeof;
116 };
117 
119 {
120  char *path;
122 };
123 
124 struct cursor
125 {
126  char *name;
127  char *function;
128  char *command;
129  char *connection;
130  bool opened;
135  struct cursor *next;
136 };
137 
138 struct typedefs
139 {
140  char *name;
141  struct this_type *type;
144  struct typedefs *next;
145 };
146 
147 struct _defines
148 {
149  char *old;
150  char *new;
152  void *used;
153  struct _defines *next;
154 };
155 
156 /* This is a linked list of the variable names and types. */
157 struct variable
158 {
159  char *name;
160  struct ECPGtype *type;
162  struct variable *next;
163 };
164 
165 struct arguments
166 {
168  struct variable *indicator;
169  struct arguments *next;
170 };
171 
172 struct descriptor
173 {
174  char *name;
175  char *connection;
176  struct descriptor *next;
177 };
178 
180 {
181  char *variable;
183  struct assignment *next;
184 };
185 
187 {
189 };
190 
192 {
193  char *str;
194  char *name;
195 };
196 
197 #endif /* _ECPG_PREPROC_TYPE_H */
char * stmt
Definition: type.h:105
errortype
Definition: type.h:186
int brace_level
Definition: type.h:161
const char * ecpg_type_name(enum ECPGttype type)
Definition: typename.c:17
char * type_index
Definition: type.h:114
Definition: type.h:73
void ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **)
Definition: type.c:77
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *, char *)
Definition: type.c:111
char * connection
Definition: type.h:175
struct ECPGstruct_member * members
Definition: type.h:30
struct arguments * argsinsert_oos
Definition: type.h:132
char * name
Definition: type.h:12
Definition: type.h:188
struct cursor * next
Definition: type.h:135
Definition: type.h:102
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *)
Definition: type.c:37
void * used
Definition: type.h:152
struct variable * indicator
Definition: type.h:168
struct ECPGtype * type
Definition: type.h:64
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *)
Definition: type.c:121
char * old
Definition: type.h:149
Definition: type.h:147
struct variable * next
Definition: extern.h:125
char * index1
Definition: type.h:91
char * name
Definition: type.h:126
Definition: type.h:138
struct typedefs * next
Definition: type.h:144
Definition: type.h:96
enum WHEN_TYPE code
Definition: type.h:84
Definition: type.h:17
char * type_str
Definition: type.h:112
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype, char *, int)
Definition: type.c:96
Definition: type.h:89
void ECPGfree_type(struct ECPGtype *)
Definition: type.c:634
struct arguments * next
Definition: type.h:169
struct descriptor * next
Definition: extern.h:94
struct arguments * argsinsert
Definition: type.h:131
struct ECPGtype * element
Definition: type.h:28
struct this_type * type
Definition: type.h:141
char * size
Definition: type.h:22
char * name
Definition: type.h:194
union ECPGtype::@125 u
char * name
Definition: type.h:140
int counter
Definition: type.h:32
int brace_level
Definition: type.h:143
Definition: type.h:124
char * command
Definition: type.h:85
Definition: type.h:82
struct assignment * next
Definition: type.h:183
char * variable
Definition: type.h:181
char * connection
Definition: type.h:129
struct ECPGtype * type
Definition: type.h:13
char * str
Definition: type.h:93
char * name
Definition: type.h:104
char * index2
Definition: type.h:92
struct _defines * next
Definition: type.h:153
WHEN_TYPE
Definition: type.h:71
Definition: type.h:79
const char * name
Definition: type.h:65
int pertinent
Definition: type.h:151
ECPGdtype
Definition: ecpgtype.h:70
char * type_sizeof
Definition: type.h:115
Definition: type.h:78
struct arguments * argsresult
Definition: type.h:133
struct arguments * argsresult_oos
Definition: type.h:134
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:239
Definition: type.h:75
char * type
Definition: type.h:106
char * type_name
Definition: type.h:20
enum ECPGttype type
Definition: type.h:19
bool opened
Definition: type.h:130
enum ECPGttype type_enum
Definition: type.h:111
char * struct_sizeof
Definition: type.h:24
char * path
Definition: type.h:120
struct variable * variable
Definition: type.h:167
Definition: type.h:77
char * name
Definition: extern.h:92
void ECPGfree_struct_member(struct ECPGstruct_member *)
Definition: type.c:620
struct ECPGstruct_member * struct_member_list
Definition: type.h:142
char * su
Definition: type.h:98
char * type_dimension
Definition: type.h:113
enum ECPGdtype value
Definition: type.h:182
struct ECPGtype * type
Definition: type.h:160
char * symbol
Definition: type.h:99
char * str
Definition: type.h:193
char * str
Definition: type.h:86
char * name
Definition: type.h:159
struct ECPGstruct_member * next
Definition: type.h:14
char * command
Definition: type.h:128
struct _include_path * next
Definition: type.h:121
ECPGttype
Definition: ecpgtype.h:41