]> granicus.if.org Git - postgresql/blob - src/interfaces/ecpg/preproc/type.h
OK, folks, here is the pgindent output.
[postgresql] / src / interfaces / ecpg / preproc / type.h
1 #include <ecpgtype.h>
2
3 struct ECPGtype;
4 struct ECPGstruct_member
5 {
6         char       *name;
7         struct ECPGtype *typ;
8         struct ECPGstruct_member *next;
9 };
10
11 struct ECPGtype
12 {
13         enum ECPGttype typ;
14         long            size;                   /* For array it is the number of elements.
15                                                                  * For varchar it is the maxsize of the
16                                                                  * area. */
17         union
18         {
19                 struct ECPGtype *element;               /* For an array this is the type
20                                                                                  * of the element */
21
22                 struct ECPGstruct_member *members;
23                 /* A pointer to a list of members. */
24         }                       u;
25 };
26
27 /* Everything is malloced. */
28 void            ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **);
29 struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, long);
30 struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
31 struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, long);
32 struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *);
33
34 /* Frees a type. */
35 void            ECPGfree_struct_member(struct ECPGstruct_member *);
36 void            ECPGfree_type(struct ECPGtype *);
37
38 /* Dump a type.
39    The type is dumped as:
40    type-tag <comma> reference-to-variable <comma> arrsize <comma> size <comma>
41    Where:
42    type-tag is one of the simple types or varchar.
43    reference-to-variable can be a reference to a struct element.
44    arrsize is the size of the array in case of array fetches. Otherwise 0.
45    size is the maxsize in case it is a varchar. Otherwise it is the size of
46            the variable (required to do array fetches of structs).
47  */
48 void            ECPGdump_a_type(FILE *, const char *, struct ECPGtype *, const char *, struct ECPGtype *, const char *, const char *);
49
50 /* A simple struct to keep a variable and its type. */
51 struct ECPGtemp_type
52 {
53         struct ECPGtype *typ;
54         const char *name;
55 };
56
57 extern const char *ECPGtype_name(enum ECPGttype typ);
58
59 /* some stuff for whenever statements */
60 enum WHEN
61 {
62         W_NOTHING,
63         W_CONTINUE,
64         W_BREAK,
65         W_SQLPRINT,
66         W_GOTO,
67         W_DO,
68         W_STOP
69 };
70
71 struct when
72 {
73         enum WHEN       code;
74         char       *command;
75         char       *str;
76 };
77
78 struct index
79 {
80         int                     index1;
81         int                     index2;
82         char       *str;
83 };
84
85 struct this_type
86 {
87         enum ECPGttype type_enum;
88         char       *type_str;
89 };