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 struct pval *goto_target;
00092 } u2;
00093
00094 union
00095 {
00096 char *for_inc;
00097 struct pval *else_statements;
00098 struct pval *macro_statements;
00099 int abstract;
00100 char *hints;
00101 int goto_target_in_case;
00102 struct ael_extension *compiled_label;
00103 struct pval *extend;
00104 } u3;
00105
00106 union
00107 {
00108 struct pval *for_statements;
00109 int regexten;
00110 } u4;
00111
00112 struct pval *next;
00113
00114
00115 struct pval *dad;
00116 struct pval *prev;
00117 } ;
00118
00119
00120 typedef struct pval pval;
00121
00122 #if 0
00123 pval *npval(pvaltype type, int first_line, int last_line, int first_column, int last_column);
00124 void linku1(pval *head, pval *tail);
00125 void print_pval_list(FILE *f, pval *item, int depth);
00126 void print_pval(FILE *f, pval *item, int depth);
00127 void ael2_semantic_check(pval *item, int *errs, int *warns, int *notes);
00128 struct pval *find_label_in_current_context(char *exten, char *label);
00129 struct pval *find_label_in_current_extension(char *label);
00130 int count_labels_in_current_context(char *label);
00131 struct pval *find_label_in_current_db(char *context, char *exten, char *label);
00132 void ael2_print(char *fname, pval *tree);
00133 #endif
00134 struct pval *ael2_parse(char *fname, int *errs);
00135 void destroy_pval(pval *item);
00136
00137 extern char *prev_word;
00138
00139 #ifndef YY_TYPEDEF_YY_SCANNER_T
00140 #define YY_TYPEDEF_YY_SCANNER_T
00141 typedef void* yyscan_t;
00142 #endif
00143
00144
00145 struct parse_io
00146 {
00147 struct pval *pval;
00148 yyscan_t scanner;
00149 int syntax_error_count;
00150 };
00151
00152
00153
00154 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;
00155
00156
00157 struct ael_priority
00158 {
00159 int priority_num;
00160 ael_priority_type type;
00161
00162 char *app;
00163 char *appargs;
00164
00165 struct pval *origin;
00166 struct ael_extension *exten;
00167
00168 struct ael_priority *goto_true;
00169 struct ael_priority *goto_false;
00170 struct ael_priority *next;
00171 };
00172
00173 struct ael_extension
00174 {
00175 char *name;
00176 char *cidmatch;
00177 char *hints;
00178 int regexten;
00179 int is_switch;
00180 int has_switch;
00181 int checked_switch;
00182
00183 struct ast_context *context;
00184
00185 struct ael_priority *plist;
00186 struct ael_priority *plist_last;
00187 struct ael_extension *next_exten;
00188
00189 struct ael_priority *loop_break;
00190 struct ael_priority *loop_continue;
00191 struct ael_priority *return_target;
00192 int return_needed;
00193 };
00194
00195 #endif