1 #ifndef _ASTERISK_AEL_STRUCTS_H
2 #define _ASTERISK_AEL_STRUCTS_H
4 #if !defined(SOLARIS) && !defined(__CYGWIN__)
10 #if defined(LONG_LONG_MIN) && !defined(QUAD_MIN)
11 #define QUAD_MIN LONG_LONG_MIN
13 #if defined(LONG_LONG_MAX) && !defined(QUAD_MAX)
14 #define QUAD_MAX LONG_LONG_MAX
17 # if ! defined(QUAD_MIN)
18 # define QUAD_MIN (-0x7fffffffffffffffLL-1)
20 # if ! defined(QUAD_MAX)
21 # define QUAD_MAX (0x7fffffffffffffffLL)
27 PV_WORD
, /* an ident, string, name, label, etc. A user-supplied string. */ /* 0 */
30 PV_MACRO_CALL
, /* 3 */
31 PV_APPLICATION_CALL
, /* 4 */
37 PV_ESWITCHES
, /* 10 */
39 PV_STATEMENTBLOCK
, /* 12 */
40 PV_VARDEC
, /* you know, var=val; */ /* 13 */
52 PV_EXTENSION
, /* 25 */
53 PV_IGNOREPAT
, /* 26 */
58 /* why this horrible mess? It's always been a tradeoff-- tons of structs,
59 each storing it's specific lists of goodies, or a 'simple' single struct,
60 with lots of fields, that catches all uses at once. Either you have a long
61 list of struct names and subnames, or you have a long list of field names,
62 and where/how they are used. I'm going with a single struct, using unions
63 to reduce storage. Some simple generalizations, and a long list of types,
64 and a book about what is used with what types.... Sorry!
78 char *str
; /* wow, used almost everywhere! */
79 struct pval
*list
; /* used in SWITCHES, ESWITCHES, INCLUDES, STATEMENTBLOCK, GOTO */
80 struct pval
*statements
;/* used in EXTENSION */
81 char *for_init
; /* used in FOR */
83 struct pval
*u1_last
; /* to build in-order lists -- looks like we only need one */
87 struct pval
*arglist
; /* used in macro_call, application_call, MACRO def, also attached to PWORD, the 4 timevals for includes */
88 struct pval
*statements
; /* used in case, default, catch, while's statement, CONTEXT elements, GLOBALS */
89 char *val
; /* used in VARDEC */
90 char *for_test
; /* used in FOR */
91 int label_in_case
; /* a boolean for LABELs */
92 struct pval
*goto_target
; /* used in GOTO */
97 char *for_inc
; /* used in FOR */
98 struct pval
*else_statements
; /* used in IF */
99 struct pval
*macro_statements
; /* used in MACRO */
100 int abstract
; /* used for context 1=abstract; 2=extend; 3=both */
101 char *hints
; /* used in EXTENSION */
102 int goto_target_in_case
; /* used in GOTO */
103 struct ael_extension
*compiled_label
;
104 struct pval
*extend
; /* to link extended contexts to the 'original' */
109 struct pval
*for_statements
; /* used in PV_FOR */
110 int regexten
; /* used in EXTENSION */
113 struct pval
*next
; /* the pval at the end of this ptr will ALWAYS be of the same type as this one!
114 EXCEPT for objects of the different types, that are in the same list, like contexts & macros, etc */
116 struct pval
*dad
; /* the 'container' of this struct instance */
117 struct pval
*prev
; /* the opposite of the 'next' pointer */
121 typedef struct pval pval
;
124 pval
*npval(pvaltype type
, int first_line
, int last_line
, int first_column
, int last_column
);
125 void linku1(pval
*head
, pval
*tail
);
126 void print_pval_list(FILE *f
, pval
*item
, int depth
);
127 void print_pval(FILE *f
, pval
*item
, int depth
);
128 void ael2_semantic_check(pval
*item
, int *errs
, int *warns
, int *notes
);
129 struct pval
*find_label_in_current_context(char *exten
, char *label
);
130 struct pval
*find_label_in_current_extension(char *label
);
131 int count_labels_in_current_context(char *label
);
132 struct pval
*find_label_in_current_db(char *context
, char *exten
, char *label
);
133 void ael2_print(char *fname
, pval
*tree
);
135 struct pval
*ael2_parse(char *fname
, int *errs
); /* in ael.flex */
136 void destroy_pval(pval
*item
);
138 extern char *prev_word
; /* in ael.flex */
140 #ifndef YY_TYPEDEF_YY_SCANNER_T
141 #define YY_TYPEDEF_YY_SCANNER_T
142 typedef void* yyscan_t
;
145 /* for passing info into and out of yyparse */
148 struct pval
*pval
; /* yyparse will set this to point to the parse tree */
149 yyscan_t scanner
; /* yylex needs a scanner. Set it up, and pass it in */
150 int syntax_error_count
; /* the count of syntax errors encountered */
153 /* for CODE GENERATION */
155 typedef enum { AEL_APPCALL
, AEL_CONTROL1
, AEL_FOR_CONTROL
, AEL_IF_CONTROL
, AEL_IFTIME_CONTROL
, AEL_RAND_CONTROL
, AEL_LABEL
, AEL_RETURN
} ael_priority_type
;
161 ael_priority_type type
;
167 struct ael_extension
*exten
;
169 struct ael_priority
*goto_true
;
170 struct ael_priority
*goto_false
;
171 struct ael_priority
*next
;
183 struct ast_context
*context
;
185 struct ael_priority
*plist
;
186 struct ael_priority
*plist_last
;
187 struct ael_extension
*next_exten
;
189 struct ael_priority
*loop_break
; /* set by latest loop for breaks */
190 struct ael_priority
*loop_continue
; /* set by lastest loop for continuing */
191 struct ael_priority
*return_target
;
195 #endif /* _ASTERISK_AEL_STRUCTS_H */