00001 #ifndef _ASTERISK_PVAL_H
00002 #define _ASTERISK_PVAL_H
00003
00004
00005
00006 typedef enum
00007 {
00008 PV_WORD,
00009 PV_MACRO,
00010 PV_CONTEXT,
00011 PV_MACRO_CALL,
00012 PV_APPLICATION_CALL,
00013 PV_CASE,
00014 PV_PATTERN,
00015 PV_DEFAULT,
00016 PV_CATCH,
00017 PV_SWITCHES,
00018 PV_ESWITCHES,
00019 PV_INCLUDES,
00020 PV_STATEMENTBLOCK,
00021 PV_VARDEC,
00022 PV_GOTO,
00023 PV_LABEL,
00024 PV_FOR,
00025 PV_WHILE,
00026 PV_BREAK,
00027 PV_RETURN,
00028 PV_CONTINUE,
00029 PV_IF,
00030 PV_IFTIME,
00031 PV_RANDOM,
00032 PV_SWITCH,
00033 PV_EXTENSION,
00034 PV_IGNOREPAT,
00035 PV_GLOBALS,
00036 PV_LOCALVARDEC,
00037 } pvaltype;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 struct pval
00049 {
00050 pvaltype type;
00051 int startline;
00052 int endline;
00053 int startcol;
00054 int endcol;
00055 char *filename;
00056
00057 union
00058 {
00059 char *str;
00060 struct pval *list;
00061 struct pval *statements;
00062 char *for_init;
00063 } u1;
00064 struct pval *u1_last;
00065
00066 union
00067 {
00068 struct pval *arglist;
00069 struct pval *statements;
00070 char *val;
00071 char *for_test;
00072 struct pval *goto_target;
00073 } u2;
00074
00075 union
00076 {
00077 char *for_inc;
00078 struct pval *else_statements;
00079 struct pval *macro_statements;
00080 int abstract;
00081 char *hints;
00082 int goto_target_in_case;
00083 struct ael_extension *compiled_label;
00084 struct pval *extend;
00085 } u3;
00086
00087 union
00088 {
00089 struct pval *for_statements;
00090 int regexten;
00091 } u4;
00092
00093 struct pval *next;
00094
00095
00096 struct pval *dad;
00097 struct pval *prev;
00098 } ;
00099
00100
00101 typedef struct pval pval;
00102
00103 #ifndef AAL_ARGCHECK
00104
00105
00106
00107
00108
00109
00110 struct argapp
00111 {
00112 struct argapp *next;
00113 };
00114
00115 #endif
00116
00117 struct ast_context;
00118
00119 #ifdef AAL_ARGCHECK
00120 int option_matches_j( struct argdesc *should, pval *is, struct argapp *app);
00121 int option_matches( struct argdesc *should, pval *is, struct argapp *app);
00122 int ael_is_funcname(char *name);
00123 #endif
00124
00125 int do_pbx_load_module(void);
00126 int count_labels_in_current_context(char *label);
00127 int check_app_args(pval *appcall, pval *arglist, struct argapp *app);
00128 void check_pval(pval *item, struct argapp *apps, int in_globals);
00129 void check_pval_item(pval *item, struct argapp *apps, int in_globals);
00130 void check_switch_expr(pval *item, struct argapp *apps);
00131 void ast_expr_register_extra_error_info(char *errmsg);
00132 void ast_expr_clear_extra_error_info(void);
00133 int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan);
00134 struct pval *find_macro(char *name);
00135 struct pval *find_context(char *name);
00136 struct pval *find_context(char *name);
00137 struct pval *find_macro(char *name);
00138 struct ael_priority *new_prio(void);
00139 struct ael_extension *new_exten(void);
00140 void linkprio(struct ael_extension *exten, struct ael_priority *prio, struct ael_extension *mother_exten);
00141 void destroy_extensions(struct ael_extension *exten);
00142
00143
00144 void set_priorities(struct ael_extension *exten);
00145 void add_extensions(struct ael_extension *exten);
00146 int ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root);
00147 void destroy_pval(pval *item);
00148 void destroy_pval_item(pval *item);
00149 int is_float(char *arg );
00150 int is_int(char *arg );
00151 int is_empty(char *arg);
00152
00153
00154
00155
00156 pval *pvalCreateNode( pvaltype type );
00157 pvaltype pvalObjectGetType( pval *p );
00158
00159 void pvalWordSetString( pval *p, char *str);
00160 char *pvalWordGetString( pval *p );
00161
00162 void pvalMacroSetName( pval *p, char *name);
00163 char *pvalMacroGetName( pval *p );
00164 void pvalMacroSetArglist( pval *p, pval *arglist );
00165 void pvalMacroAddArg( pval *p, pval *arg );
00166 pval *pvalMacroWalkArgs( pval *p, pval **arg );
00167 void pvalMacroAddStatement( pval *p, pval *statement );
00168 pval *pvalMacroWalkStatements( pval *p, pval **next_statement );
00169
00170 void pvalContextSetName( pval *p, char *name);
00171 char *pvalContextGetName( pval *p );
00172 void pvalContextSetAbstract( pval *p );
00173 void pvalContextUnsetAbstract( pval *p );
00174 int pvalContextGetAbstract( pval *p );
00175 void pvalContextAddStatement( pval *p, pval *statement);
00176 pval *pvalContextWalkStatements( pval *p, pval **statements );
00177
00178 void pvalMacroCallSetMacroName( pval *p, char *name );
00179 char* pvalMacroCallGetMacroName( pval *p );
00180 void pvalMacroCallSetArglist( pval *p, pval *arglist );
00181 void pvalMacroCallAddArg( pval *p, pval *arg );
00182 pval *pvalMacroCallWalkArgs( pval *p, pval **args );
00183
00184 void pvalAppCallSetAppName( pval *p, char *name );
00185 char* pvalAppCallGetAppName( pval *p );
00186 void pvalAppCallSetArglist( pval *p, pval *arglist );
00187 void pvalAppCallAddArg( pval *p, pval *arg );
00188 pval *pvalAppCallWalkArgs( pval *p, pval **args );
00189
00190 void pvalCasePatSetVal( pval *p, char *val );
00191 char* pvalCasePatGetVal( pval *p );
00192 void pvalCasePatDefAddStatement( pval *p, pval *statement );
00193 pval *pvalCasePatDefWalkStatements( pval *p, pval **statement );
00194
00195 void pvalCatchSetExtName( pval *p, char *name );
00196 char* pvalCatchGetExtName( pval *p );
00197 void pvalCatchSetStatement( pval *p, pval *statement );
00198 pval *pvalCatchGetStatement( pval *p );
00199
00200 void pvalSwitchesAddSwitch( pval *p, char *name );
00201 char* pvalSwitchesWalkNames( pval *p, pval **next_item );
00202 void pvalESwitchesAddSwitch( pval *p, char *name );
00203 char* pvalESwitchesWalkNames( pval *p, pval **next_item );
00204
00205 void pvalIncludesAddInclude( pval *p, const char *include );
00206
00207 void pvalIncludesAddIncludeWithTimeConstraints( pval *p, const char *include, char *hour_range, char *dom_range, char *dow_range, char *month_range );
00208 void pvalIncludeGetTimeConstraints( pval *p, char **hour_range, char **dom_range, char **dow_range, char **month_range );
00209 char* pvalIncludesWalk( pval *p, pval **next_item );
00210
00211 void pvalStatementBlockAddStatement( pval *p, pval *statement);
00212 pval *pvalStatementBlockWalkStatements( pval *p, pval **next_statement);
00213
00214 void pvalVarDecSetVarname( pval *p, char *name );
00215 void pvalVarDecSetValue( pval *p, char *value );
00216 char* pvalVarDecGetVarname( pval *p );
00217 char* pvalVarDecGetValue( pval *p );
00218
00219 void pvalGotoSetTarget( pval *p, char *context, char *exten, char *label );
00220 void pvalGotoGetTarget( pval *p, char **context, char **exten, char **label );
00221
00222 void pvalLabelSetName( pval *p, char *name );
00223 char* pvalLabelGetName( pval *p );
00224
00225 void pvalForSetInit( pval *p, char *init );
00226 void pvalForSetTest( pval *p, char *test );
00227 void pvalForSetInc( pval *p, char *inc );
00228 void pvalForSetStatement( pval *p, pval *statement );
00229 char* pvalForGetInit( pval *p );
00230 char* pvalForGetTest( pval *p );
00231 char* pvalForGetInc( pval *p );
00232 pval* pvalForGetStatement( pval *p );
00233
00234
00235 void pvalIfSetCondition( pval *p, char *expr );
00236 char* pvalIfGetCondition( pval *p );
00237 void pvalIfTimeSetCondition( pval *p, char *hour_range, char *dow_range, char *dom_range, char *mon_range );
00238 void pvalIfTimeGetCondition( pval *p, char **hour_range, char **dow_range, char **dom_range, char **month_range );
00239 void pvalRandomSetCondition( pval *p, char *percent );
00240 char* pvalRandomGetCondition( pval *p );
00241 void pvalConditionalSetThenStatement( pval *p, pval *statement );
00242 void pvalConditionalSetElseStatement( pval *p, pval *statement );
00243 pval* pvalConditionalGetThenStatement( pval *p );
00244 pval* pvalConditionalGetElseStatement( pval *p );
00245
00246 void pvalSwitchSetTestexpr( pval *p, char *expr );
00247 char* pvalSwitchGetTestexpr( pval *p );
00248 void pvalSwitchAddCase( pval *p, pval *Case );
00249 pval* pvalSwitchWalkCases( pval *p, pval **next_case );
00250
00251 void pvalExtenSetName( pval *p, char *name );
00252 char *pvalExtenGetName( pval *p );
00253 void pvalExtenSetRegexten( pval *p );
00254 void pvalExtenUnSetRegexten( pval *p );
00255 int pvalExtenGetRegexten( pval *p );
00256 void pvalExtenSetHints( pval *p, char *hints );
00257 char* pvalExtenGetHints( pval *p );
00258 void pvalExtenSetStatement( pval *p, pval *statement );
00259 pval* pvalExtenGetStatement( pval *p );
00260
00261 void pvalIgnorePatSetPattern( pval *p, char *pat );
00262 char* pvalIgnorePatGetPattern( pval *p );
00263
00264 void pvalGlobalsAddStatement( pval *p, pval *statement );
00265 pval* pvalGlobalsWalkStatements( pval *p, pval **next_statement );
00266
00267 void pvalTopLevAddObject( pval *p, pval *contextOrObj );
00268 pval* pvalTopLevWalkObjects( pval *p, pval **next_obj );
00269
00270 int pvalCheckType( pval *p, char *funcname, pvaltype type );
00271
00272
00273 #endif