1/* src/interfaces/ecpg/preproc/preproc_extern.h */
2
3#ifndef _ECPG_PREPROC_EXTERN_H
4#define _ECPG_PREPROC_EXTERN_H
5
6#include "type.h"
7
8#include "common/keywords.h"
9
10#ifndef CHAR_BIT
11#include <limits.h>
12#endif
13
14/* defines */
15
16#define STRUCT_DEPTH 128
17#define EMPTY mm_strdup("")
18
19/* variables */
20
21extern bool autocommit,
22 auto_create_c,
23 system_includes,
24 force_indicator,
25 questionmarks,
26 regression_mode,
27 auto_prepare;
28extern int braces_open,
29 ret_value,
30 struct_level,
31 ecpg_internal_var;
32extern char *current_function;
33extern char *descriptor_index;
34extern char *descriptor_name;
35extern char *connection;
36extern char *input_filename;
37extern char *base_yytext,
38 *token_start;
39
40#ifdef YYDEBUG
41extern int base_yydebug;
42#endif
43extern int base_yylineno;
44extern FILE *base_yyin,
45 *base_yyout;
46extern char *output_filename;
47
48extern struct _include_path *include_paths;
49extern struct cursor *cur;
50extern struct typedefs *types;
51extern struct _defines *defines;
52extern struct ECPGtype ecpg_no_indicator;
53extern struct variable no_indicator;
54extern struct arguments *argsinsert;
55extern struct arguments *argsresult;
56extern struct when when_error,
57 when_nf,
58 when_warn;
59extern struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH];
60
61/* Globals from keywords.c */
62extern const uint16 SQLScanKeywordTokens[];
63
64/* functions */
65
66extern const char *get_dtype(enum ECPGdtype);
67extern void lex_init(void);
68extern void output_line_number(void);
69extern void output_statement(char *, int, enum ECPG_statement_type);
70extern void output_prepare_statement(char *, char *);
71extern void output_deallocate_prepare_statement(char *);
72extern void output_simple_statement(char *, int);
73extern char *hashline_number(void);
74extern int base_yyparse(void);
75extern int base_yylex(void);
76extern void base_yyerror(const char *);
77extern void *mm_alloc(size_t);
78extern char *mm_strdup(const char *);
79extern void mmerror(int errorcode, enum errortype type, const char *error,...) pg_attribute_printf(3, 4);
80extern void mmfatal(int errorcode, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn();
81extern void output_get_descr_header(char *);
82extern void output_get_descr(char *, char *);
83extern void output_set_descr_header(char *);
84extern void output_set_descr(char *, char *);
85extern void push_assignment(char *, enum ECPGdtype);
86extern struct variable *find_variable(char *);
87extern void whenever_action(int);
88extern void add_descriptor(char *, char *);
89extern void drop_descriptor(char *, char *);
90extern struct descriptor *lookup_descriptor(char *, char *);
91extern struct variable *descriptor_variable(const char *name, int input);
92extern struct variable *sqlda_variable(const char *name);
93extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *);
94extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *);
95extern void remove_variable_from_list(struct arguments **list, struct variable *var);
96extern void dump_variables(struct arguments *, int);
97extern struct typedefs *get_typedef(char *);
98extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool);
99extern void reset_variables(void);
100extern void check_indicator(struct ECPGtype *);
101extern void remove_typedefs(int);
102extern void remove_variables(int);
103extern struct variable *new_variable(const char *, struct ECPGtype *, int);
104extern int ScanCKeywordLookup(const char *text);
105extern int ScanECPGKeywordLookup(const char *text);
106extern void parser_init(void);
107extern int filtered_base_yylex(void);
108
109/* return codes */
110
111#define ILLEGAL_OPTION 1
112#define NO_INCLUDE_FILE 2
113#define PARSE_ERROR 3
114#define INDICATOR_NOT_ARRAY 4
115#define OUT_OF_MEMORY 5
116#define INDICATOR_NOT_STRUCT 6
117#define INDICATOR_NOT_SIMPLE 7
118
119enum COMPAT_MODE
120{
121 ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE, ECPG_COMPAT_ORACLE
122};
123extern enum COMPAT_MODE compat;
124
125#define INFORMIX_MODE (compat == ECPG_COMPAT_INFORMIX || compat == ECPG_COMPAT_INFORMIX_SE)
126#define ORACLE_MODE (compat == ECPG_COMPAT_ORACLE)
127
128
129#endif /* _ECPG_PREPROC_EXTERN_H */
130