00001 #ifndef _ASTERISK_AEL_STRUCTS_H
00002 #define _ASTERISK_AEL_STRUCTS_H
00003
00004 #if !defined(SOLARIS) && !defined(__CYGWIN__)
00005
00006 #else
00007 #define quad_t int64_t
00008 #endif
00009
00010 #if defined(LONG_LONG_MIN) && !defined(QUAD_MIN)
00011 #define QUAD_MIN LONG_LONG_MIN
00012 #endif
00013 #if defined(LONG_LONG_MAX) && !defined(QUAD_MAX)
00014 #define QUAD_MAX LONG_LONG_MAX
00015 #endif
00016
00017 # if ! defined(QUAD_MIN)
00018 # define QUAD_MIN (-0x7fffffffffffffffLL-1)
00019 # endif
00020 # if ! defined(QUAD_MAX)
00021 # define QUAD_MAX (0x7fffffffffffffffLL)
00022 # endif
00023
00024
00025 typedef enum
00026 {
00027 PV_WORD,
00028 PV_MACRO,
00029 PV_CONTEXT,
00030 PV_MACRO_CALL,
00031 PV_APPLICATION_CALL,
00032 PV_CASE,
00033 PV_PATTERN,
00034 PV_DEFAULT,
00035 PV_CATCH,
00036 PV_SWITCHES,
00037 PV_ESWITCHES,
00038 PV_INCLUDES,
00039 PV_STATEMENTBLOCK,
00040 PV_VARDEC,
00041 PV_GOTO,
00042 PV_LABEL,
00043 PV_FOR,
00044 PV_WHILE,
00045 PV_BREAK,
00046 PV_RETURN,
00047 PV_CONTINUE,
00048 PV_IF,
00049 PV_IFTIME,
00050 PV_RANDOM,
00051 PV_SWITCH,
00052 PV_EXTENSION,
00053 PV_IGNOREPAT,
00054 PV_GLOBALS,
00055
00056 } pvaltype;
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 struct pval
00068 {
00069 pvaltype type;
00070 int startline;
00071 int endline;
00072 int startcol;
00073 int endcol;
00074 char *filename;
00075
00076 union
00077 {
00078 char *str;
00079 struct pval *list;
00080 struct pval *statements;
00081 char *for_init;
00082 } u1;
00083 struct pval *u1_last;
00084
00085 union
00086 {
00087 struct pval *arglist;
00088 struct pval *statements;
00089 char *val;
00090 char *for_test;
00091 int label_in_case;
00092 struct pval *goto_target;
00093 } u2;
00094
00095 union
00096 {
00097 char *for_inc;
00098 struct pval *else_statements;
00099 struct pval *macro_statements;
00100 int abstract;
00101 char *hints;
00102 int goto_target_in_case;
00103 struct ael_extension *compiled_label;
00104 struct pval *extend;
00105 } u3;
00106
00107 union
00108 {
00109 struct pval *for_statements;
00110 int regexten;
00111 } u4;
00112
00113 struct pval *next;
00114
00115
00116 struct pval *dad;
00117 struct pval *prev;
00118 } ;
00119
00120
00121 typedef struct pval pval;
00122
00123 #if 0
00124 pval *npval(pvaltype type, int first_line, int last_line, int first_column, int last_column);
00125 void linku1(pval *head, pval *tail);
00126 void print_pval_list(FILE *f, pval *item, int depth);
00127 void print_pval(FILE *f, pval *item, int depth);
00128 void ael2_semantic_check(pval *item, int *errs, int *warns, int *notes);
00129 struct pval *find_label_in_current_context(char *exten, char *label);
00130 struct pval *find_label_in_current_extension(char *label);
00131 int count_labels_in_current_context(char *label);
00132 struct pval *find_label_in_current_db(char *context, char *exten, char *label);
00133 void ael2_print(char *fname, pval *tree);
00134 #endif
00135 struct pval *ael2_parse(char *fname, int *errs);
00136 void destroy_pval(pval *item);
00137
00138 extern char *prev_word;
00139
00140 #ifndef YY_TYPEDEF_YY_SCANNER_T
00141 #define YY_TYPEDEF_YY_SCANNER_T
00142 typedef void* yyscan_t;
00143 #endif
00144
00145
00146 struct parse_io
00147 {
00148 struct pval *pval;
00149 yyscan_t scanner;
00150 int syntax_error_count;
00151 };
00152
00153
00154
00155 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;
00156
00157
00158 struct ael_priority
00159 {
00160 int priority_num;
00161 ael_priority_type type;
00162
00163 char *app;
00164 char *appargs;
00165
00166 struct pval *origin;
00167 struct ael_extension *exten;
00168
00169 struct ael_priority *goto_true;
00170 struct ael_priority *goto_false;
00171 struct ael_priority *next;
00172 };
00173
00174 struct ael_extension
00175 {
00176 char *name;
00177 char *cidmatch;
00178 char *hints;
00179 int regexten;
00180 int is_switch;
00181 int has_switch;
00182 int checked_switch;
00183
00184 struct ast_context *context;
00185
00186 struct ael_priority *plist;
00187 struct ael_priority *plist_last;
00188 struct ael_extension *next_exten;
00189
00190 struct ael_priority *loop_break;
00191 struct ael_priority *loop_continue;
00192 struct ael_priority *return_target;
00193 int return_needed;
00194 };
00195
00196 #endif