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