Wed Oct 28 11:45:28 2009

Asterisk developer's documentation


ast_expr2f.c

Go to the documentation of this file.
00001 #include "asterisk.h"
00002 
00003 #line 2 "ast_expr2f.c"
00004 
00005 #line 4 "ast_expr2f.c"
00006 
00007 #define  YY_INT_ALIGNED short int
00008 
00009 /* A lexical scanner generated by flex */
00010 
00011 #define FLEX_SCANNER
00012 #define YY_FLEX_MAJOR_VERSION 2
00013 #define YY_FLEX_MINOR_VERSION 5
00014 #define YY_FLEX_SUBMINOR_VERSION 35
00015 #if YY_FLEX_SUBMINOR_VERSION > 0
00016 #define FLEX_BETA
00017 #endif
00018 
00019 /* First, we deal with  platform-specific or compiler-specific issues. */
00020 
00021 /* begin standard C headers. */
00022 #include <stdio.h>
00023 #include <string.h>
00024 #include <errno.h>
00025 #include <stdlib.h>
00026 
00027 /* end standard C headers. */
00028 
00029 /* flex integer type definitions */
00030 
00031 #ifndef FLEXINT_H
00032 #define FLEXINT_H
00033 
00034 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00035 
00036 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00037 
00038 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00039  * if you want the limit (max/min) macros for int types. 
00040  */
00041 #ifndef __STDC_LIMIT_MACROS
00042 #define __STDC_LIMIT_MACROS 1
00043 #endif
00044 
00045 #include <inttypes.h>
00046 typedef int8_t flex_int8_t;
00047 typedef uint8_t flex_uint8_t;
00048 typedef int16_t flex_int16_t;
00049 typedef uint16_t flex_uint16_t;
00050 typedef int32_t flex_int32_t;
00051 typedef uint32_t flex_uint32_t;
00052 #else
00053 typedef signed char flex_int8_t;
00054 typedef short int flex_int16_t;
00055 typedef int flex_int32_t;
00056 typedef unsigned char flex_uint8_t; 
00057 typedef unsigned short int flex_uint16_t;
00058 typedef unsigned int flex_uint32_t;
00059 
00060 /* Limits of integral types. */
00061 #ifndef INT8_MIN
00062 #define INT8_MIN               (-128)
00063 #endif
00064 #ifndef INT16_MIN
00065 #define INT16_MIN              (-32767-1)
00066 #endif
00067 #ifndef INT32_MIN
00068 #define INT32_MIN              (-2147483647-1)
00069 #endif
00070 #ifndef INT8_MAX
00071 #define INT8_MAX               (127)
00072 #endif
00073 #ifndef INT16_MAX
00074 #define INT16_MAX              (32767)
00075 #endif
00076 #ifndef INT32_MAX
00077 #define INT32_MAX              (2147483647)
00078 #endif
00079 #ifndef UINT8_MAX
00080 #define UINT8_MAX              (255U)
00081 #endif
00082 #ifndef UINT16_MAX
00083 #define UINT16_MAX             (65535U)
00084 #endif
00085 #ifndef UINT32_MAX
00086 #define UINT32_MAX             (4294967295U)
00087 #endif
00088 
00089 #endif /* ! C99 */
00090 
00091 #endif /* ! FLEXINT_H */
00092 
00093 #ifdef __cplusplus
00094 
00095 /* The "const" storage-class-modifier is valid. */
00096 #define YY_USE_CONST
00097 
00098 #else /* ! __cplusplus */
00099 
00100 /* C99 requires __STDC__ to be defined as 1. */
00101 #if defined (__STDC__)
00102 
00103 #define YY_USE_CONST
00104 
00105 #endif   /* defined (__STDC__) */
00106 #endif   /* ! __cplusplus */
00107 
00108 #ifdef YY_USE_CONST
00109 #define yyconst const
00110 #else
00111 #define yyconst
00112 #endif
00113 
00114 /* Returned upon end-of-file. */
00115 #define YY_NULL 0
00116 
00117 /* Promotes a possibly negative, possibly signed char to an unsigned
00118  * integer for use as an array index.  If the signed char is negative,
00119  * we want to instead treat it as an 8-bit unsigned char, hence the
00120  * double cast.
00121  */
00122 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00123 
00124 /* An opaque pointer. */
00125 #ifndef YY_TYPEDEF_YY_SCANNER_T
00126 #define YY_TYPEDEF_YY_SCANNER_T
00127 typedef void* yyscan_t;
00128 #endif
00129 
00130 /* For convenience, these vars (plus the bison vars far below)
00131    are macros in the reentrant scanner. */
00132 #define yyin yyg->yyin_r
00133 #define yyout yyg->yyout_r
00134 #define yyextra yyg->yyextra_r
00135 #define yyleng yyg->yyleng_r
00136 #define yytext yyg->yytext_r
00137 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
00138 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
00139 #define yy_flex_debug yyg->yy_flex_debug_r
00140 
00141 /* Enter a start condition.  This macro really ought to take a parameter,
00142  * but we do it the disgusting crufty way forced on us by the ()-less
00143  * definition of BEGIN.
00144  */
00145 #define BEGIN yyg->yy_start = 1 + 2 *
00146 
00147 /* Translate the current start state into a value that can be later handed
00148  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00149  * compatibility.
00150  */
00151 #define YY_START ((yyg->yy_start - 1) / 2)
00152 #define YYSTATE YY_START
00153 
00154 /* Action number for EOF rule of a given start state. */
00155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00156 
00157 /* Special action meaning "start processing a new file". */
00158 #define YY_NEW_FILE ast_yyrestart(yyin ,yyscanner )
00159 
00160 #define YY_END_OF_BUFFER_CHAR 0
00161 
00162 /* Size of default input buffer. */
00163 #ifndef YY_BUF_SIZE
00164 #define YY_BUF_SIZE 16384
00165 #endif
00166 
00167 /* The state buf must be large enough to hold one state per character in the main buffer.
00168  */
00169 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00170 
00171 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00172 #define YY_TYPEDEF_YY_BUFFER_STATE
00173 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00174 #endif
00175 
00176 #define EOB_ACT_CONTINUE_SCAN 0
00177 #define EOB_ACT_END_OF_FILE 1
00178 #define EOB_ACT_LAST_MATCH 2
00179 
00180     #define YY_LESS_LINENO(n)
00181     
00182 /* Return all but the first "n" matched characters back to the input stream. */
00183 #define yyless(n) \
00184    do \
00185       { \
00186       /* Undo effects of setting up yytext. */ \
00187         int yyless_macro_arg = (n); \
00188         YY_LESS_LINENO(yyless_macro_arg);\
00189       *yy_cp = yyg->yy_hold_char; \
00190       YY_RESTORE_YY_MORE_OFFSET \
00191       yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00192       YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00193       } \
00194    while ( 0 )
00195 
00196 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
00197 
00198 #ifndef YY_TYPEDEF_YY_SIZE_T
00199 #define YY_TYPEDEF_YY_SIZE_T
00200 typedef size_t yy_size_t;
00201 #endif
00202 
00203 #ifndef YY_STRUCT_YY_BUFFER_STATE
00204 #define YY_STRUCT_YY_BUFFER_STATE
00205 struct yy_buffer_state
00206    {
00207    FILE *yy_input_file;
00208 
00209    char *yy_ch_buf;     /* input buffer */
00210    char *yy_buf_pos;    /* current position in input buffer */
00211 
00212    /* Size of input buffer in bytes, not including room for EOB
00213     * characters.
00214     */
00215    yy_size_t yy_buf_size;
00216 
00217    /* Number of characters read into yy_ch_buf, not including EOB
00218     * characters.
00219     */
00220    int yy_n_chars;
00221 
00222    /* Whether we "own" the buffer - i.e., we know we created it,
00223     * and can realloc() it to grow it, and should free() it to
00224     * delete it.
00225     */
00226    int yy_is_our_buffer;
00227 
00228    /* Whether this is an "interactive" input source; if so, and
00229     * if we're using stdio for input, then we want to use getc()
00230     * instead of fread(), to make sure we stop fetching input after
00231     * each newline.
00232     */
00233    int yy_is_interactive;
00234 
00235    /* Whether we're considered to be at the beginning of a line.
00236     * If so, '^' rules will be active on the next match, otherwise
00237     * not.
00238     */
00239    int yy_at_bol;
00240 
00241     int yy_bs_lineno; /**< The line count. */
00242     int yy_bs_column; /**< The column count. */
00243     
00244    /* Whether to try to fill the input buffer when we reach the
00245     * end of it.
00246     */
00247    int yy_fill_buffer;
00248 
00249    int yy_buffer_status;
00250 
00251 #define YY_BUFFER_NEW 0
00252 #define YY_BUFFER_NORMAL 1
00253    /* When an EOF's been seen but there's still some text to process
00254     * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00255     * shouldn't try reading from the input source any more.  We might
00256     * still have a bunch of tokens to match, though, because of
00257     * possible backing-up.
00258     *
00259     * When we actually see the EOF, we change the status to "new"
00260     * (via ast_yyrestart()), so that the user can continue scanning by
00261     * just pointing yyin at a new input file.
00262     */
00263 #define YY_BUFFER_EOF_PENDING 2
00264 
00265    };
00266 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00267 
00268 /* We provide macros for accessing buffer states in case in the
00269  * future we want to put the buffer states in a more general
00270  * "scanner state".
00271  *
00272  * Returns the top of the stack, or NULL.
00273  */
00274 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
00275                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
00276                           : NULL)
00277 
00278 /* Same as previous macro, but useful when we know that the buffer stack is not
00279  * NULL or when we need an lvalue. For internal use only.
00280  */
00281 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
00282 
00283 void ast_yyrestart (FILE *input_file ,yyscan_t yyscanner );
00284 void ast_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00285 YY_BUFFER_STATE ast_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
00286 void ast_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00287 void ast_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00288 void ast_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00289 void ast_yypop_buffer_state (yyscan_t yyscanner );
00290 
00291 static void ast_yyensure_buffer_stack (yyscan_t yyscanner );
00292 static void ast_yy_load_buffer_state (yyscan_t yyscanner );
00293 static void ast_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
00294 
00295 #define YY_FLUSH_BUFFER ast_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
00296 
00297 YY_BUFFER_STATE ast_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
00298 YY_BUFFER_STATE ast_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
00299 YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
00300 
00301 void *ast_yyalloc (yy_size_t ,yyscan_t yyscanner );
00302 void *ast_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
00303 void ast_yyfree (void * ,yyscan_t yyscanner );
00304 
00305 #define yy_new_buffer ast_yy_create_buffer
00306 
00307 #define yy_set_interactive(is_interactive) \
00308    { \
00309    if ( ! YY_CURRENT_BUFFER ){ \
00310         ast_yyensure_buffer_stack (yyscanner); \
00311       YY_CURRENT_BUFFER_LVALUE =    \
00312             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00313    } \
00314    YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00315    }
00316 
00317 #define yy_set_bol(at_bol) \
00318    { \
00319    if ( ! YY_CURRENT_BUFFER ){\
00320         ast_yyensure_buffer_stack (yyscanner); \
00321       YY_CURRENT_BUFFER_LVALUE =    \
00322             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00323    } \
00324    YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00325    }
00326 
00327 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00328 
00329 /* Begin user sect3 */
00330 
00331 #define ast_yywrap(n) 1
00332 #define YY_SKIP_YYWRAP
00333 
00334 typedef unsigned char YY_CHAR;
00335 
00336 typedef int yy_state_type;
00337 
00338 #define yytext_ptr yytext_r
00339 
00340 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
00341 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
00342 static int yy_get_next_buffer (yyscan_t yyscanner );
00343 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
00344 
00345 /* Done after the current pattern has been matched and before the
00346  * corresponding action - sets up yytext.
00347  */
00348 #define YY_DO_BEFORE_ACTION \
00349    yyg->yytext_ptr = yy_bp; \
00350    yyg->yytext_ptr -= yyg->yy_more_len; \
00351    yyleng = (size_t) (yy_cp - yyg->yytext_ptr); \
00352    yyg->yy_hold_char = *yy_cp; \
00353    *yy_cp = '\0'; \
00354    yyg->yy_c_buf_p = yy_cp;
00355 
00356 #define YY_NUM_RULES 37
00357 #define YY_END_OF_BUFFER 38
00358 /* This struct is not used in this scanner,
00359    but its presence is necessary. */
00360 struct yy_trans_info
00361    {
00362    flex_int32_t yy_verify;
00363    flex_int32_t yy_nxt;
00364    };
00365 static yyconst flex_int16_t yy_accept[61] =
00366     {   0,
00367         0,    0,    0,    0,   34,   34,   38,   37,   26,   28,
00368        20,   37,   30,   37,   18,    2,   23,   24,   16,   13,
00369        14,   15,   17,   29,   21,    9,    3,    8,   19,    1,
00370        37,   33,   32,   34,   36,   36,   12,    0,   27,   30,
00371         0,   25,    5,   30,   29,   22,   11,    6,    7,   10,
00372         4,    0,   33,   32,   34,    0,   35,   31,   29,    0
00373     } ;
00374 
00375 static yyconst flex_int32_t yy_ec[256] =
00376     {   0,
00377         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00378         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00379         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00380         1,    2,    4,    5,    6,    7,    8,    9,    6,   10,
00381        11,   12,   13,   14,   15,   16,   17,   18,   18,   18,
00382        18,   18,   18,   18,   18,   18,   18,   19,    6,   20,
00383        21,   22,   23,    6,    6,    6,    6,    6,    6,    6,
00384         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00385         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00386         1,    6,    1,    6,    6,    1,    6,    6,    6,    6,
00387 
00388         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00389         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
00390         6,    6,   24,   25,   26,   27,    1,   28,   28,   28,
00391        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00392        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00393        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00394        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00395        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00396        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00397        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00398 
00399        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00400        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00401        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00402        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00403        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
00404        28,   28,   28,   28,   28
00405     } ;
00406 
00407 static yyconst flex_int32_t yy_meta[29] =
00408     {   0,
00409         1,    2,    2,    2,    1,    3,    3,    2,    2,    2,
00410         2,    2,    2,    1,    2,    3,    2,    3,    2,    2,
00411         2,    2,    2,    1,    2,    1,    1,    3
00412     } ;
00413 
00414 static yyconst flex_int16_t yy_base[68] =
00415     {   0,
00416         0,    0,    5,    6,   32,   60,   72,  130,  130,  130,
00417        50,   65,   62,   44,  130,   55,  130,  130,  130,  130,
00418       130,  130,  130,   83,   44,   41,   13,   36,  130,   30,
00419        17,  130,  130,   47,  130,   29,  130,   47,  130,   44,
00420        25,  130,  130,   29,    0,  130,  130,  130,  130,  130,
00421       130,   18,  130,  130,   38,   12,  130,  130,    0,  130,
00422       111,  114,  117,   32,  120,  123,  126
00423     } ;
00424 
00425 static yyconst flex_int16_t yy_def[68] =
00426     {   0,
00427        60,    1,   61,   61,   62,   62,   60,   60,   60,   60,
00428        60,   63,   64,   65,   60,   60,   60,   60,   60,   60,
00429        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00430        66,   60,   60,   67,   60,   60,   60,   63,   60,   64,
00431        65,   60,   60,   40,   24,   60,   60,   60,   60,   60,
00432        60,   66,   60,   60,   67,   60,   60,   60,   44,    0,
00433        60,   60,   60,   60,   60,   60,   60
00434     } ;
00435 
00436 static yyconst flex_int16_t yy_nxt[159] =
00437     {   0,
00438         8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
00439        18,   19,   20,   21,   22,   13,   23,   24,   25,   26,
00440        27,   28,   29,    8,   30,    8,    8,   13,   32,   32,
00441        33,   33,   34,   48,   40,   57,   34,   34,   36,   49,
00442        53,   53,   54,   54,   56,   34,   59,   34,   58,   34,
00443        41,   39,   57,   56,   51,   34,   50,   34,   34,   34,
00444        34,   47,   46,   43,   34,   34,   36,   42,   41,   39,
00445        37,   60,   60,   34,   60,   34,   60,   34,   60,   60,
00446        60,   60,   60,   34,   60,   34,   34,   34,   40,   41,
00447        60,   60,   60,   60,   60,   60,   60,   60,   44,   60,
00448 
00449        45,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00450        40,   31,   31,   31,   35,   35,   35,   38,   38,   38,
00451        40,   40,   40,   52,   52,   52,   55,   60,   55,    7,
00452        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00453        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00454        60,   60,   60,   60,   60,   60,   60,   60
00455     } ;
00456 
00457 static yyconst flex_int16_t yy_chk[159] =
00458     {   0,
00459         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00460         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00461         1,    1,    1,    1,    1,    1,    1,    1,    3,    4,
00462         3,    4,    5,   27,   64,   56,    5,    5,    5,   27,
00463        31,   52,   31,   52,   55,    5,   44,    5,   41,    5,
00464        40,   38,   36,   34,   30,    5,   28,    5,    5,    5,
00465         6,   26,   25,   16,    6,    6,    6,   14,   13,   12,
00466        11,    7,    0,    6,    0,    6,    0,    6,    0,    0,
00467         0,    0,    0,    6,    0,    6,    6,    6,   24,   24,
00468         0,    0,    0,    0,    0,    0,    0,    0,   24,    0,
00469 
00470        24,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00471        24,   61,   61,   61,   62,   62,   62,   63,   63,   63,
00472        65,   65,   65,   66,   66,   66,   67,    0,   67,   60,
00473        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00474        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
00475        60,   60,   60,   60,   60,   60,   60,   60
00476     } ;
00477 
00478 /* The intent behind this definition is that it'll catch
00479  * any uses of REJECT which flex missed.
00480  */
00481 #define REJECT reject_used_but_not_detected
00482 #define yymore() (yyg->yy_more_flag = 1)
00483 #define YY_MORE_ADJ yyg->yy_more_len
00484 #define YY_RESTORE_YY_MORE_OFFSET
00485 #line 1 "ast_expr2.fl"
00486 #line 2 "ast_expr2.fl"
00487 /*
00488  * Asterisk -- An open source telephony toolkit.
00489  *
00490  * Copyright (C) 1999 - 2006, Digium, Inc.
00491  *
00492  * Mark Spencer <markster@digium.com>
00493  *
00494  * See http://www.asterisk.org for more information about
00495  * the Asterisk project. Please do not directly contact
00496  * any of the maintainers of this project for assistance;
00497  * the project provides a web site, mailing lists and IRC
00498  * channels for your use.
00499  *
00500  * This program is free software, distributed under the terms of
00501  * the GNU General Public License Version 2. See the LICENSE file
00502  * at the top of the source tree.
00503  */
00504 
00505 /*! \file
00506  *
00507  * \brief Dialplan Expression Lexical Scanner
00508  */
00509 
00510 #include <sys/types.h>
00511 #include <stdio.h>
00512 
00513 #if !defined(STANDALONE)
00514 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 201682 $")
00515 #else
00516 #ifndef __USE_ISOC99
00517 #define __USE_ISOC99 1
00518 #endif
00519 #endif
00520 
00521 #ifdef __USE_ISOC99
00522 #define FP___PRINTF "%.18Lg"
00523 #define FP___FMOD   fmodl
00524 #define FP___STRTOD  strtold
00525 #define FP___TYPE    long double
00526 #else
00527 #define FP___PRINTF "%.16g"
00528 #define FP___FMOD   fmod
00529 #define FP___STRTOD  strtod
00530 #define FP___TYPE    double
00531 #endif
00532 
00533 #include <stdlib.h>
00534 #include <string.h>
00535 #include <locale.h>
00536 #include <ctype.h>
00537 #if !defined(SOLARIS) && !defined(__CYGWIN__)
00538 /* #include <err.h> */
00539 #else
00540 #define quad_t int64_t
00541 #endif
00542 #include <errno.h>
00543 #include <regex.h>
00544 #include <limits.h>
00545 
00546 #include "asterisk/ast_expr.h"
00547 #include "asterisk/logger.h"
00548 #ifndef STANDALONE
00549 #include "asterisk/strings.h"
00550 #include "asterisk/channel.h"
00551 #endif
00552 
00553 enum valtype {
00554    AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string
00555 } ;
00556 
00557 struct val {
00558    enum valtype type;
00559    union {
00560       char *s;
00561       FP___TYPE i; /* long double or just double if it's a bad day */
00562    } u;
00563 } ;
00564 
00565 #include "ast_expr2.h" /* the o/p of the bison on ast_expr2.y */
00566 
00567 #define SET_COLUMNS  do {     \
00568    yylloc_param->first_column = (int)(yyg->yytext_r - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); \
00569    yylloc_param->last_column += yyleng - 1; \
00570    yylloc_param->first_line = yylloc_param->last_line = 1; \
00571    } while (0)
00572 
00573 #define SET_STRING   do {     \
00574    yylval_param->val = calloc(1, sizeof(struct val)); \
00575    yylval_param->val->type = AST_EXPR_string;      \
00576    yylval_param->val->u.s = strdup(yytext);     \
00577    } while (0)
00578 
00579 #define SET_NUMERIC_STRING do {  \
00580    yylval_param->val = calloc(1, sizeof(struct val)); \
00581    yylval_param->val->type = AST_EXPR_numeric_string; \
00582    yylval_param->val->u.s = strdup(yytext);  \
00583    } while (0)
00584 
00585 struct parse_io
00586 {
00587    char *string;
00588    struct val *val;
00589    yyscan_t scanner;
00590    struct ast_channel *chan;
00591 };
00592  
00593 void ast_yyset_column(int column_no, yyscan_t yyscanner);
00594 int ast_yyget_column(yyscan_t yyscanner);
00595 static int curlycount = 0;
00596 static char *expr2_token_subst(const char *mess);
00597 
00598 #line 597 "ast_expr2f.c"
00599 
00600 #define INITIAL 0
00601 #define var 1
00602 #define trail 2
00603 
00604 #ifndef YY_NO_UNISTD_H
00605 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00606  * down here because we want the user's section 1 to have been scanned first.
00607  * The user has a chance to override it with an option.
00608  */
00609 #include <unistd.h>
00610 #endif
00611 
00612 #ifndef YY_EXTRA_TYPE
00613 #define YY_EXTRA_TYPE void *
00614 #endif
00615 
00616 /* Holds the entire state of the reentrant scanner. */
00617 struct yyguts_t
00618     {
00619 
00620     /* User-defined. Not touched by flex. */
00621     YY_EXTRA_TYPE yyextra_r;
00622 
00623     /* The rest are the same as the globals declared in the non-reentrant scanner. */
00624     FILE *yyin_r, *yyout_r;
00625     size_t yy_buffer_stack_top; /**< index of top of stack. */
00626     size_t yy_buffer_stack_max; /**< capacity of stack. */
00627     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
00628     char yy_hold_char;
00629     int yy_n_chars;
00630     int yyleng_r;
00631     char *yy_c_buf_p;
00632     int yy_init;
00633     int yy_start;
00634     int yy_did_buffer_switch_on_eof;
00635     int yy_start_stack_ptr;
00636     int yy_start_stack_depth;
00637     int *yy_start_stack;
00638     yy_state_type yy_last_accepting_state;
00639     char* yy_last_accepting_cpos;
00640 
00641     int yylineno_r;
00642     int yy_flex_debug_r;
00643 
00644     char *yytext_r;
00645     int yy_more_flag;
00646     int yy_more_len;
00647 
00648     YYSTYPE * yylval_r;
00649 
00650     YYLTYPE * yylloc_r;
00651 
00652     }; /* end struct yyguts_t */
00653 
00654 static int yy_init_globals (yyscan_t yyscanner );
00655 
00656     /* This must go here because YYSTYPE and YYLTYPE are included
00657      * from bison output in section 1.*/
00658     #    define yylval yyg->yylval_r
00659     
00660     #    define yylloc yyg->yylloc_r
00661     
00662 int ast_yylex_init (yyscan_t* scanner);
00663 
00664 int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
00665 
00666 /* Accessor methods to globals.
00667    These are made visible to non-reentrant scanners for convenience. */
00668 
00669 int ast_yylex_destroy (yyscan_t yyscanner );
00670 
00671 int ast_yyget_debug (yyscan_t yyscanner );
00672 
00673 void ast_yyset_debug (int debug_flag ,yyscan_t yyscanner );
00674 
00675 YY_EXTRA_TYPE ast_yyget_extra (yyscan_t yyscanner );
00676 
00677 void ast_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
00678 
00679 FILE *ast_yyget_in (yyscan_t yyscanner );
00680 
00681 void ast_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
00682 
00683 FILE *ast_yyget_out (yyscan_t yyscanner );
00684 
00685 void ast_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
00686 
00687 int ast_yyget_leng (yyscan_t yyscanner );
00688 
00689 char *ast_yyget_text (yyscan_t yyscanner );
00690 
00691 int ast_yyget_lineno (yyscan_t yyscanner );
00692 
00693 void ast_yyset_lineno (int line_number ,yyscan_t yyscanner );
00694 
00695 YYSTYPE * ast_yyget_lval (yyscan_t yyscanner );
00696 
00697 void ast_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
00698 
00699        YYLTYPE *ast_yyget_lloc (yyscan_t yyscanner );
00700     
00701         void ast_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
00702     
00703 /* Macros after this point can all be overridden by user definitions in
00704  * section 1.
00705  */
00706 
00707 #ifndef YY_SKIP_YYWRAP
00708 #ifdef __cplusplus
00709 extern "C" int ast_yywrap (yyscan_t yyscanner );
00710 #else
00711 extern int ast_yywrap (yyscan_t yyscanner );
00712 #endif
00713 #endif
00714 
00715     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
00716     
00717 #ifndef yytext_ptr
00718 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
00719 #endif
00720 
00721 #ifdef YY_NEED_STRLEN
00722 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
00723 #endif
00724 
00725 #ifndef YY_NO_INPUT
00726 
00727 #ifdef __cplusplus
00728 static int yyinput (yyscan_t yyscanner );
00729 #else
00730 static int input (yyscan_t yyscanner );
00731 #endif
00732 
00733 #endif
00734 
00735 /* Amount of stuff to slurp up with each read. */
00736 #ifndef YY_READ_BUF_SIZE
00737 #define YY_READ_BUF_SIZE 8192
00738 #endif
00739 
00740 /* Copy whatever the last rule matched to the standard output. */
00741 #ifndef ECHO
00742 /* This used to be an fputs(), but since the string might contain NUL's,
00743  * we now use fwrite().
00744  */
00745 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00746 #endif
00747 
00748 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00749  * is returned in "result".
00750  */
00751 #ifndef YY_INPUT
00752 #define YY_INPUT(buf,result,max_size) \
00753    if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00754       { \
00755       int c = '*'; \
00756       size_t n; \
00757       for ( n = 0; n < max_size && \
00758               (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00759          buf[n] = (char) c; \
00760       if ( c == '\n' ) \
00761          buf[n++] = (char) c; \
00762       if ( c == EOF && ferror( yyin ) ) \
00763          YY_FATAL_ERROR( "input in flex scanner failed" ); \
00764       result = n; \
00765       } \
00766    else \
00767       { \
00768       errno=0; \
00769       while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00770          { \
00771          if( errno != EINTR) \
00772             { \
00773             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00774             break; \
00775             } \
00776          errno=0; \
00777          clearerr(yyin); \
00778          } \
00779       }\
00780 \
00781 
00782 #endif
00783 
00784 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00785  * we don't want an extra ';' after the "return" because that will cause
00786  * some compilers to complain about unreachable statements.
00787  */
00788 #ifndef yyterminate
00789 #define yyterminate() return YY_NULL
00790 #endif
00791 
00792 /* Number of entries by which start-condition stack grows. */
00793 #ifndef YY_START_STACK_INCR
00794 #define YY_START_STACK_INCR 25
00795 #endif
00796 
00797 /* Report a fatal error. */
00798 #ifndef YY_FATAL_ERROR
00799 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
00800 #endif
00801 
00802 /* end tables serialization structures and prototypes */
00803 
00804 /* Default declaration of generated scanner - a define so the user can
00805  * easily add parameters.
00806  */
00807 #ifndef YY_DECL
00808 #define YY_DECL_IS_OURS 1
00809 
00810 extern int ast_yylex \
00811                (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
00812 
00813 #define YY_DECL int ast_yylex \
00814                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
00815 #endif /* !YY_DECL */
00816 
00817 /* Code executed at the beginning of each rule, after yytext and yyleng
00818  * have been set up.
00819  */
00820 #ifndef YY_USER_ACTION
00821 #define YY_USER_ACTION
00822 #endif
00823 
00824 /* Code executed at the end of each rule. */
00825 #ifndef YY_BREAK
00826 #define YY_BREAK break;
00827 #endif
00828 
00829 #define YY_RULE_SETUP \
00830    YY_USER_ACTION
00831 
00832 /** The main scanner function which does all the work.
00833  */
00834 YY_DECL
00835 {
00836    register yy_state_type yy_current_state;
00837    register char *yy_cp, *yy_bp;
00838    register int yy_act;
00839     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
00840 
00841 #line 125 "ast_expr2.fl"
00842 
00843 
00844 #line 843 "ast_expr2f.c"
00845 
00846     yylval = yylval_param;
00847 
00848     yylloc = yylloc_param;
00849 
00850    if ( !yyg->yy_init )
00851       {
00852       yyg->yy_init = 1;
00853 
00854 #ifdef YY_USER_INIT
00855       YY_USER_INIT;
00856 #endif
00857 
00858       if ( ! yyg->yy_start )
00859          yyg->yy_start = 1;   /* first start state */
00860 
00861       if ( ! yyin )
00862          yyin = stdin;
00863 
00864       if ( ! yyout )
00865          yyout = stdout;
00866 
00867       if ( ! YY_CURRENT_BUFFER ) {
00868          ast_yyensure_buffer_stack (yyscanner);
00869          YY_CURRENT_BUFFER_LVALUE =
00870             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
00871       }
00872 
00873       ast_yy_load_buffer_state(yyscanner );
00874       }
00875 
00876    while ( 1 )    /* loops until end-of-file is reached */
00877       {
00878       yyg->yy_more_len = 0;
00879       if ( yyg->yy_more_flag )
00880          {
00881          yyg->yy_more_len = yyg->yy_c_buf_p - yyg->yytext_ptr;
00882          yyg->yy_more_flag = 0;
00883          }
00884       yy_cp = yyg->yy_c_buf_p;
00885 
00886       /* Support of yytext. */
00887       *yy_cp = yyg->yy_hold_char;
00888 
00889       /* yy_bp points to the position in yy_ch_buf of the start of
00890        * the current run.
00891        */
00892       yy_bp = yy_cp;
00893 
00894       yy_current_state = yyg->yy_start;
00895 yy_match:
00896       do
00897          {
00898          register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00899          if ( yy_accept[yy_current_state] )
00900             {
00901             yyg->yy_last_accepting_state = yy_current_state;
00902             yyg->yy_last_accepting_cpos = yy_cp;
00903             }
00904          while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00905             {
00906             yy_current_state = (int) yy_def[yy_current_state];
00907             if ( yy_current_state >= 61 )
00908                yy_c = yy_meta[(unsigned int) yy_c];
00909             }
00910          yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00911          ++yy_cp;
00912          }
00913       while ( yy_current_state != 60 );
00914       yy_cp = yyg->yy_last_accepting_cpos;
00915       yy_current_state = yyg->yy_last_accepting_state;
00916 
00917 yy_find_action:
00918       yy_act = yy_accept[yy_current_state];
00919 
00920       YY_DO_BEFORE_ACTION;
00921 
00922 do_action:  /* This label is used only to access EOF actions. */
00923 
00924       switch ( yy_act )
00925    { /* beginning of action switch */
00926          case 0: /* must back up */
00927          /* undo the effects of YY_DO_BEFORE_ACTION */
00928          *yy_cp = yyg->yy_hold_char;
00929          yy_cp = yyg->yy_last_accepting_cpos;
00930          yy_current_state = yyg->yy_last_accepting_state;
00931          goto yy_find_action;
00932 
00933 case 1:
00934 YY_RULE_SETUP
00935 #line 127 "ast_expr2.fl"
00936 { SET_COLUMNS; SET_STRING; return TOK_OR;}
00937    YY_BREAK
00938 case 2:
00939 YY_RULE_SETUP
00940 #line 128 "ast_expr2.fl"
00941 { SET_COLUMNS; SET_STRING; return TOK_AND;}
00942    YY_BREAK
00943 case 3:
00944 YY_RULE_SETUP
00945 #line 129 "ast_expr2.fl"
00946 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
00947    YY_BREAK
00948 case 4:
00949 YY_RULE_SETUP
00950 #line 130 "ast_expr2.fl"
00951 { SET_COLUMNS; SET_STRING; return TOK_OR;}
00952    YY_BREAK
00953 case 5:
00954 YY_RULE_SETUP
00955 #line 131 "ast_expr2.fl"
00956 { SET_COLUMNS; SET_STRING; return TOK_AND;}
00957    YY_BREAK
00958 case 6:
00959 YY_RULE_SETUP
00960 #line 132 "ast_expr2.fl"
00961 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
00962    YY_BREAK
00963 case 7:
00964 YY_RULE_SETUP
00965 #line 133 "ast_expr2.fl"
00966 { SET_COLUMNS; SET_STRING; return TOK_EQTILDE;}
00967    YY_BREAK
00968 case 8:
00969 YY_RULE_SETUP
00970 #line 134 "ast_expr2.fl"
00971 { SET_COLUMNS; SET_STRING; return TOK_GT;}
00972    YY_BREAK
00973 case 9:
00974 YY_RULE_SETUP
00975 #line 135 "ast_expr2.fl"
00976 { SET_COLUMNS; SET_STRING; return TOK_LT;}
00977    YY_BREAK
00978 case 10:
00979 YY_RULE_SETUP
00980 #line 136 "ast_expr2.fl"
00981 { SET_COLUMNS; SET_STRING; return TOK_GE;}
00982    YY_BREAK
00983 case 11:
00984 YY_RULE_SETUP
00985 #line 137 "ast_expr2.fl"
00986 { SET_COLUMNS; SET_STRING; return TOK_LE;}
00987    YY_BREAK
00988 case 12:
00989 YY_RULE_SETUP
00990 #line 138 "ast_expr2.fl"
00991 { SET_COLUMNS; SET_STRING; return TOK_NE;}
00992    YY_BREAK
00993 case 13:
00994 YY_RULE_SETUP
00995 #line 139 "ast_expr2.fl"
00996 { SET_COLUMNS; SET_STRING; return TOK_PLUS;}
00997    YY_BREAK
00998 case 14:
00999 YY_RULE_SETUP
01000 #line 140 "ast_expr2.fl"
01001 { SET_COLUMNS; SET_STRING; return TOK_COMMA;}
01002    YY_BREAK
01003 case 15:
01004 YY_RULE_SETUP
01005 #line 141 "ast_expr2.fl"
01006 { SET_COLUMNS; SET_STRING; return TOK_MINUS;}
01007    YY_BREAK
01008 case 16:
01009 YY_RULE_SETUP
01010 #line 142 "ast_expr2.fl"
01011 { SET_COLUMNS; SET_STRING; return TOK_MULT;}
01012    YY_BREAK
01013 case 17:
01014 YY_RULE_SETUP
01015 #line 143 "ast_expr2.fl"
01016 { SET_COLUMNS; SET_STRING; return TOK_DIV;}
01017    YY_BREAK
01018 case 18:
01019 YY_RULE_SETUP
01020 #line 144 "ast_expr2.fl"
01021 { SET_COLUMNS; SET_STRING; return TOK_MOD;}
01022    YY_BREAK
01023 case 19:
01024 YY_RULE_SETUP
01025 #line 145 "ast_expr2.fl"
01026 { SET_COLUMNS; SET_STRING; return TOK_COND;}
01027    YY_BREAK
01028 case 20:
01029 YY_RULE_SETUP
01030 #line 146 "ast_expr2.fl"
01031 { SET_COLUMNS; SET_STRING; return TOK_COMPL;}
01032    YY_BREAK
01033 case 21:
01034 YY_RULE_SETUP
01035 #line 147 "ast_expr2.fl"
01036 { SET_COLUMNS; SET_STRING; return TOK_COLON;}
01037    YY_BREAK
01038 case 22:
01039 YY_RULE_SETUP
01040 #line 148 "ast_expr2.fl"
01041 { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
01042    YY_BREAK
01043 case 23:
01044 YY_RULE_SETUP
01045 #line 149 "ast_expr2.fl"
01046 { SET_COLUMNS; SET_STRING; return TOK_LP;}
01047    YY_BREAK
01048 case 24:
01049 YY_RULE_SETUP
01050 #line 150 "ast_expr2.fl"
01051 { SET_COLUMNS; SET_STRING; return TOK_RP;}
01052    YY_BREAK
01053 case 25:
01054 YY_RULE_SETUP
01055 #line 151 "ast_expr2.fl"
01056 {
01057       /* gather the contents of ${} expressions, with trailing stuff,
01058        * into a single TOKEN.
01059        * They are much more complex now than they used to be
01060        */
01061       curlycount = 0;
01062       BEGIN(var);
01063       yymore();
01064    }
01065    YY_BREAK
01066 case 26:
01067 YY_RULE_SETUP
01068 #line 161 "ast_expr2.fl"
01069 {}
01070    YY_BREAK
01071 case 27:
01072 /* rule 27 can match eol */
01073 YY_RULE_SETUP
01074 #line 162 "ast_expr2.fl"
01075 {SET_COLUMNS; SET_STRING; return TOKEN;}
01076    YY_BREAK
01077 case 28:
01078 /* rule 28 can match eol */
01079 YY_RULE_SETUP
01080 #line 164 "ast_expr2.fl"
01081 {/* what to do with eol */}
01082    YY_BREAK
01083 case 29:
01084 YY_RULE_SETUP
01085 #line 165 "ast_expr2.fl"
01086 {
01087       SET_COLUMNS;
01088       /* the original behavior of the expression parser was
01089        * to bring in numbers as a numeric string
01090        */
01091       SET_NUMERIC_STRING;
01092       return TOKEN;
01093    }
01094    YY_BREAK
01095 case 30:
01096 /* rule 30 can match eol */
01097 YY_RULE_SETUP
01098 #line 174 "ast_expr2.fl"
01099 {
01100       SET_COLUMNS;
01101       SET_STRING;
01102       return TOKEN;
01103    }
01104    YY_BREAK
01105 case 31:
01106 /* rule 31 can match eol */
01107 YY_RULE_SETUP
01108 #line 180 "ast_expr2.fl"
01109 {
01110       curlycount = 0;
01111       BEGIN(var);
01112       yymore();
01113    }
01114    YY_BREAK
01115 case 32:
01116 /* rule 32 can match eol */
01117 YY_RULE_SETUP
01118 #line 186 "ast_expr2.fl"
01119 {
01120       curlycount--;
01121       if (curlycount < 0) {
01122          BEGIN(trail);
01123          yymore();
01124       } else {
01125          yymore();
01126       }
01127    }
01128    YY_BREAK
01129 case 33:
01130 /* rule 33 can match eol */
01131 YY_RULE_SETUP
01132 #line 196 "ast_expr2.fl"
01133 {
01134       curlycount++;
01135       yymore();
01136    }
01137    YY_BREAK
01138 case 34:
01139 YY_RULE_SETUP
01140 #line 202 "ast_expr2.fl"
01141 {
01142       BEGIN(0);
01143       SET_COLUMNS;
01144       SET_STRING;
01145       return TOKEN;
01146    }
01147    YY_BREAK
01148 case 35:
01149 YY_RULE_SETUP
01150 #line 209 "ast_expr2.fl"
01151 {
01152       curlycount = 0;
01153       BEGIN(var);
01154       yymore();
01155    }
01156    YY_BREAK
01157 case 36:
01158 /* rule 36 can match eol */
01159 YY_RULE_SETUP
01160 #line 215 "ast_expr2.fl"
01161 {
01162       char c = yytext[yyleng-1];
01163       BEGIN(0);
01164       unput(c);
01165       SET_COLUMNS;
01166       SET_STRING;
01167       return TOKEN;
01168    }
01169    YY_BREAK
01170 case YY_STATE_EOF(trail):
01171 #line 224 "ast_expr2.fl"
01172 {
01173       BEGIN(0);
01174       SET_COLUMNS;
01175       SET_STRING;
01176       return TOKEN;
01177       /*actually, if an expr is only a variable ref, this could happen a LOT */
01178    }
01179    YY_BREAK
01180 case 37:
01181 YY_RULE_SETUP
01182 #line 232 "ast_expr2.fl"
01183 ECHO;
01184    YY_BREAK
01185 #line 1184 "ast_expr2f.c"
01186 case YY_STATE_EOF(INITIAL):
01187 case YY_STATE_EOF(var):
01188    yyterminate();
01189 
01190    case YY_END_OF_BUFFER:
01191       {
01192       /* Amount of text matched not including the EOB char. */
01193       int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
01194 
01195       /* Undo the effects of YY_DO_BEFORE_ACTION. */
01196       *yy_cp = yyg->yy_hold_char;
01197       YY_RESTORE_YY_MORE_OFFSET
01198 
01199       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01200          {
01201          /* We're scanning a new file or input source.  It's
01202           * possible that this happened because the user
01203           * just pointed yyin at a new source and called
01204           * ast_yylex().  If so, then we have to assure
01205           * consistency between YY_CURRENT_BUFFER and our
01206           * globals.  Here is the right place to do so, because
01207           * this is the first action (other than possibly a
01208           * back-up) that will match for the new input source.
01209           */
01210          yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01211          YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01212          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01213          }
01214 
01215       /* Note that here we test for yy_c_buf_p "<=" to the position
01216        * of the first EOB in the buffer, since yy_c_buf_p will
01217        * already have been incremented past the NUL character
01218        * (since all states make transitions on EOB to the
01219        * end-of-buffer state).  Contrast this with the test
01220        * in input().
01221        */
01222       if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01223          { /* This was really a NUL. */
01224          yy_state_type yy_next_state;
01225 
01226          yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
01227 
01228          yy_current_state = yy_get_previous_state( yyscanner );
01229 
01230          /* Okay, we're now positioned to make the NUL
01231           * transition.  We couldn't have
01232           * yy_get_previous_state() go ahead and do it
01233           * for us because it doesn't know how to deal
01234           * with the possibility of jamming (and we don't
01235           * want to build jamming into it because then it
01236           * will run more slowly).
01237           */
01238 
01239          yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
01240 
01241          yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01242 
01243          if ( yy_next_state )
01244             {
01245             /* Consume the NUL. */
01246             yy_cp = ++yyg->yy_c_buf_p;
01247             yy_current_state = yy_next_state;
01248             goto yy_match;
01249             }
01250 
01251          else
01252             {
01253             yy_cp = yyg->yy_last_accepting_cpos;
01254             yy_current_state = yyg->yy_last_accepting_state;
01255             goto yy_find_action;
01256             }
01257          }
01258 
01259       else switch ( yy_get_next_buffer( yyscanner ) )
01260          {
01261          case EOB_ACT_END_OF_FILE:
01262             {
01263             yyg->yy_did_buffer_switch_on_eof = 0;
01264 
01265             if ( ast_yywrap(yyscanner ) )
01266                {
01267                /* Note: because we've taken care in
01268                 * yy_get_next_buffer() to have set up
01269                 * yytext, we can now set up
01270                 * yy_c_buf_p so that if some total
01271                 * hoser (like flex itself) wants to
01272                 * call the scanner after we return the
01273                 * YY_NULL, it'll still work - another
01274                 * YY_NULL will get returned.
01275                 */
01276                yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
01277 
01278                yy_act = YY_STATE_EOF(YY_START);
01279                goto do_action;
01280                }
01281 
01282             else
01283                {
01284                if ( ! yyg->yy_did_buffer_switch_on_eof )
01285                   YY_NEW_FILE;
01286                }
01287             break;
01288             }
01289 
01290          case EOB_ACT_CONTINUE_SCAN:
01291             yyg->yy_c_buf_p =
01292                yyg->yytext_ptr + yy_amount_of_matched_text;
01293 
01294             yy_current_state = yy_get_previous_state( yyscanner );
01295 
01296             yy_cp = yyg->yy_c_buf_p;
01297             yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01298             goto yy_match;
01299 
01300          case EOB_ACT_LAST_MATCH:
01301             yyg->yy_c_buf_p =
01302             &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
01303 
01304             yy_current_state = yy_get_previous_state( yyscanner );
01305 
01306             yy_cp = yyg->yy_c_buf_p;
01307             yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01308             goto yy_find_action;
01309          }
01310       break;
01311       }
01312 
01313    default:
01314       YY_FATAL_ERROR(
01315          "fatal flex scanner internal error--no action found" );
01316    } /* end of action switch */
01317       } /* end of scanning one token */
01318 } /* end of ast_yylex */
01319 
01320 /* yy_get_next_buffer - try to read in a new buffer
01321  *
01322  * Returns a code representing an action:
01323  * EOB_ACT_LAST_MATCH -
01324  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01325  * EOB_ACT_END_OF_FILE - end of file
01326  */
01327 static int yy_get_next_buffer (yyscan_t yyscanner)
01328 {
01329     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01330    register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01331    register char *source = yyg->yytext_ptr;
01332    register int number_to_move, i;
01333    int ret_val;
01334 
01335    if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
01336       YY_FATAL_ERROR(
01337       "fatal flex scanner internal error--end of buffer missed" );
01338 
01339    if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01340       { /* Don't try to fill the buffer, so this is an EOF. */
01341       if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
01342          {
01343          /* We matched a single character, the EOB, so
01344           * treat this as a final EOF.
01345           */
01346          return EOB_ACT_END_OF_FILE;
01347          }
01348 
01349       else
01350          {
01351          /* We matched some text prior to the EOB, first
01352           * process it.
01353           */
01354          return EOB_ACT_LAST_MATCH;
01355          }
01356       }
01357 
01358    /* Try to read more data. */
01359 
01360    /* First move last chars to start of buffer. */
01361    number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
01362 
01363    for ( i = 0; i < number_to_move; ++i )
01364       *(dest++) = *(source++);
01365 
01366    if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01367       /* don't do the read, it's not guaranteed to return an EOF,
01368        * just force an EOF
01369        */
01370       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
01371 
01372    else
01373       {
01374          int num_to_read =
01375          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01376 
01377       while ( num_to_read <= 0 )
01378          { /* Not enough room in the buffer - grow it. */
01379 
01380          /* just a shorter name for the current buffer */
01381          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01382 
01383          int yy_c_buf_p_offset =
01384             (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
01385 
01386          if ( b->yy_is_our_buffer )
01387             {
01388             int new_size = b->yy_buf_size * 2;
01389 
01390             if ( new_size <= 0 )
01391                b->yy_buf_size += b->yy_buf_size / 8;
01392             else
01393                b->yy_buf_size *= 2;
01394 
01395             b->yy_ch_buf = (char *)
01396                /* Include room in for 2 EOB chars. */
01397                ast_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
01398             }
01399          else
01400             /* Can't grow it, we don't own it. */
01401             b->yy_ch_buf = 0;
01402 
01403          if ( ! b->yy_ch_buf )
01404             YY_FATAL_ERROR(
01405             "fatal error - scanner input buffer overflow" );
01406 
01407          yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01408 
01409          num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01410                   number_to_move - 1;
01411 
01412          }
01413 
01414       if ( num_to_read > YY_READ_BUF_SIZE )
01415          num_to_read = YY_READ_BUF_SIZE;
01416 
01417       /* Read in more data. */
01418       YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01419          yyg->yy_n_chars, (size_t) num_to_read );
01420 
01421       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01422       }
01423 
01424    if ( yyg->yy_n_chars == 0 )
01425       {
01426       if ( number_to_move == YY_MORE_ADJ )
01427          {
01428          ret_val = EOB_ACT_END_OF_FILE;
01429          ast_yyrestart(yyin  ,yyscanner);
01430          }
01431 
01432       else
01433          {
01434          ret_val = EOB_ACT_LAST_MATCH;
01435          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01436             YY_BUFFER_EOF_PENDING;
01437          }
01438       }
01439 
01440    else
01441       ret_val = EOB_ACT_CONTINUE_SCAN;
01442 
01443    if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01444       /* Extend the array by 50%, plus the number we really need. */
01445       yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
01446       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ast_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
01447       if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01448          YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01449    }
01450 
01451    yyg->yy_n_chars += number_to_move;
01452    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01453    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01454 
01455    yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01456 
01457    return ret_val;
01458 }
01459 
01460 /* yy_get_previous_state - get the state just before the EOB char was reached */
01461 
01462     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
01463 {
01464    register yy_state_type yy_current_state;
01465    register char *yy_cp;
01466     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01467 
01468    yy_current_state = yyg->yy_start;
01469 
01470    for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
01471       {
01472       register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01473       if ( yy_accept[yy_current_state] )
01474          {
01475          yyg->yy_last_accepting_state = yy_current_state;
01476          yyg->yy_last_accepting_cpos = yy_cp;
01477          }
01478       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01479          {
01480          yy_current_state = (int) yy_def[yy_current_state];
01481          if ( yy_current_state >= 61 )
01482             yy_c = yy_meta[(unsigned int) yy_c];
01483          }
01484       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01485       }
01486 
01487    return yy_current_state;
01488 }
01489 
01490 /* yy_try_NUL_trans - try to make a transition on the NUL character
01491  *
01492  * synopsis
01493  * next_state = yy_try_NUL_trans( current_state );
01494  */
01495     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
01496 {
01497    register int yy_is_jam;
01498     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
01499    register char *yy_cp = yyg->yy_c_buf_p;
01500 
01501    register YY_CHAR yy_c = 1;
01502    if ( yy_accept[yy_current_state] )
01503       {
01504       yyg->yy_last_accepting_state = yy_current_state;
01505       yyg->yy_last_accepting_cpos = yy_cp;
01506       }
01507    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01508       {
01509       yy_current_state = (int) yy_def[yy_current_state];
01510       if ( yy_current_state >= 61 )
01511          yy_c = yy_meta[(unsigned int) yy_c];
01512       }
01513    yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01514    yy_is_jam = (yy_current_state == 60);
01515 
01516    return yy_is_jam ? 0 : yy_current_state;
01517 }
01518 
01519     static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
01520 {
01521    register char *yy_cp;
01522     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01523 
01524     yy_cp = yyg->yy_c_buf_p;
01525 
01526    /* undo effects of setting up yytext */
01527    *yy_cp = yyg->yy_hold_char;
01528 
01529    if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01530       { /* need to shift things up to make room */
01531       /* +2 for EOB chars. */
01532       register int number_to_move = yyg->yy_n_chars + 2;
01533       register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01534                YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01535       register char *source =
01536             &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01537 
01538       while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01539          *--dest = *--source;
01540 
01541       yy_cp += (int) (dest - source);
01542       yy_bp += (int) (dest - source);
01543       YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01544          yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01545 
01546       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01547          YY_FATAL_ERROR( "flex scanner push-back overflow" );
01548       }
01549 
01550    *--yy_cp = (char) c;
01551 
01552    yyg->yytext_ptr = yy_bp;
01553    yyg->yy_hold_char = *yy_cp;
01554    yyg->yy_c_buf_p = yy_cp;
01555 }
01556 
01557 #ifndef YY_NO_INPUT
01558 #ifdef __cplusplus
01559     static int yyinput (yyscan_t yyscanner)
01560 #else
01561     static int input  (yyscan_t yyscanner)
01562 #endif
01563 
01564 {
01565    int c;
01566     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01567 
01568    *yyg->yy_c_buf_p = yyg->yy_hold_char;
01569 
01570    if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01571       {
01572       /* yy_c_buf_p now points to the character we want to return.
01573        * If this occurs *before* the EOB characters, then it's a
01574        * valid NUL; if not, then we've hit the end of the buffer.
01575        */
01576       if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01577          /* This was really a NUL. */
01578          *yyg->yy_c_buf_p = '\0';
01579 
01580       else
01581          { /* need more input */
01582          int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
01583          ++yyg->yy_c_buf_p;
01584 
01585          switch ( yy_get_next_buffer( yyscanner ) )
01586             {
01587             case EOB_ACT_LAST_MATCH:
01588                /* This happens because yy_g_n_b()
01589                 * sees that we've accumulated a
01590                 * token and flags that we need to
01591                 * try matching the token before
01592                 * proceeding.  But for input(),
01593                 * there's no matching to consider.
01594                 * So convert the EOB_ACT_LAST_MATCH
01595                 * to EOB_ACT_END_OF_FILE.
01596                 */
01597 
01598                /* Reset buffer status. */
01599                ast_yyrestart(yyin ,yyscanner);
01600 
01601                /*FALLTHROUGH*/
01602 
01603             case EOB_ACT_END_OF_FILE:
01604                {
01605                if ( ast_yywrap(yyscanner ) )
01606                   return EOF;
01607 
01608                if ( ! yyg->yy_did_buffer_switch_on_eof )
01609                   YY_NEW_FILE;
01610 #ifdef __cplusplus
01611                return yyinput(yyscanner);
01612 #else
01613                return input(yyscanner);
01614 #endif
01615                }
01616 
01617             case EOB_ACT_CONTINUE_SCAN:
01618                yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
01619                break;
01620             }
01621          }
01622       }
01623 
01624    c = *(unsigned char *) yyg->yy_c_buf_p;   /* cast for 8-bit char's */
01625    *yyg->yy_c_buf_p = '\0';   /* preserve yytext */
01626    yyg->yy_hold_char = *++yyg->yy_c_buf_p;
01627 
01628    return c;
01629 }
01630 #endif   /* ifndef YY_NO_INPUT */
01631 
01632 /** Immediately switch to a different input stream.
01633  * @param input_file A readable stream.
01634  * @param yyscanner The scanner object.
01635  * @note This function does not reset the start condition to @c INITIAL .
01636  */
01637     void ast_yyrestart  (FILE * input_file , yyscan_t yyscanner)
01638 {
01639     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01640 
01641    if ( ! YY_CURRENT_BUFFER ){
01642         ast_yyensure_buffer_stack (yyscanner);
01643       YY_CURRENT_BUFFER_LVALUE =
01644             ast_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
01645    }
01646 
01647    ast_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
01648    ast_yy_load_buffer_state(yyscanner );
01649 }
01650 
01651 /** Switch to a different input buffer.
01652  * @param new_buffer The new input buffer.
01653  * @param yyscanner The scanner object.
01654  */
01655     void ast_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
01656 {
01657     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01658 
01659    /* TODO. We should be able to replace this entire function body
01660     * with
01661     *    ast_yypop_buffer_state();
01662     *    ast_yypush_buffer_state(new_buffer);
01663      */
01664    ast_yyensure_buffer_stack (yyscanner);
01665    if ( YY_CURRENT_BUFFER == new_buffer )
01666       return;
01667 
01668    if ( YY_CURRENT_BUFFER )
01669       {
01670       /* Flush out information for old buffer. */
01671       *yyg->yy_c_buf_p = yyg->yy_hold_char;
01672       YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01673       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01674       }
01675 
01676    YY_CURRENT_BUFFER_LVALUE = new_buffer;
01677    ast_yy_load_buffer_state(yyscanner );
01678 
01679    /* We don't actually know whether we did this switch during
01680     * EOF (ast_yywrap()) processing, but the only time this flag
01681     * is looked at is after ast_yywrap() is called, so it's safe
01682     * to go ahead and always set it.
01683     */
01684    yyg->yy_did_buffer_switch_on_eof = 1;
01685 }
01686 
01687 static void ast_yy_load_buffer_state  (yyscan_t yyscanner)
01688 {
01689     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01690    yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01691    yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01692    yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01693    yyg->yy_hold_char = *yyg->yy_c_buf_p;
01694 }
01695 
01696 /** Allocate and initialize an input buffer state.
01697  * @param file A readable stream.
01698  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
01699  * @param yyscanner The scanner object.
01700  * @return the allocated buffer state.
01701  */
01702     YY_BUFFER_STATE ast_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
01703 {
01704    YY_BUFFER_STATE b;
01705     
01706    b = (YY_BUFFER_STATE) ast_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01707    if ( ! b )
01708       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_create_buffer()" );
01709 
01710    b->yy_buf_size = size;
01711 
01712    /* yy_ch_buf has to be 2 characters longer than the size given because
01713     * we need to put in 2 end-of-buffer characters.
01714     */
01715    b->yy_ch_buf = (char *) ast_yyalloc(b->yy_buf_size + 2 ,yyscanner );
01716    if ( ! b->yy_ch_buf )
01717       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_create_buffer()" );
01718 
01719    b->yy_is_our_buffer = 1;
01720 
01721    ast_yy_init_buffer(b,file ,yyscanner);
01722 
01723    return b;
01724 }
01725 
01726 /** Destroy the buffer.
01727  * @param b a buffer created with ast_yy_create_buffer()
01728  * @param yyscanner The scanner object.
01729  */
01730     void ast_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01731 {
01732     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01733 
01734    if ( ! b )
01735       return;
01736 
01737    if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01738       YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01739 
01740    if ( b->yy_is_our_buffer )
01741       ast_yyfree((void *) b->yy_ch_buf ,yyscanner );
01742 
01743    ast_yyfree((void *) b ,yyscanner );
01744 }
01745 
01746 #ifndef __cplusplus
01747 extern int isatty (int );
01748 #endif /* __cplusplus */
01749     
01750 /* Initializes or reinitializes a buffer.
01751  * This function is sometimes called more than once on the same buffer,
01752  * such as during a ast_yyrestart() or at EOF.
01753  */
01754     static void ast_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
01755 
01756 {
01757    int oerrno = errno;
01758     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01759 
01760    ast_yy_flush_buffer(b ,yyscanner);
01761 
01762    b->yy_input_file = file;
01763    b->yy_fill_buffer = 1;
01764 
01765     /* If b is the current buffer, then ast_yy_init_buffer was _probably_
01766      * called from ast_yyrestart() or through yy_get_next_buffer.
01767      * In that case, we don't want to reset the lineno or column.
01768      */
01769     if (b != YY_CURRENT_BUFFER){
01770         b->yy_bs_lineno = 1;
01771         b->yy_bs_column = 0;
01772     }
01773 
01774         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01775     
01776    errno = oerrno;
01777 }
01778 
01779 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
01780  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
01781  * @param yyscanner The scanner object.
01782  */
01783     void ast_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01784 {
01785     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01786    if ( ! b )
01787       return;
01788 
01789    b->yy_n_chars = 0;
01790 
01791    /* We always need two end-of-buffer characters.  The first causes
01792     * a transition to the end-of-buffer state.  The second causes
01793     * a jam in that state.
01794     */
01795    b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01796    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01797 
01798    b->yy_buf_pos = &b->yy_ch_buf[0];
01799 
01800    b->yy_at_bol = 1;
01801    b->yy_buffer_status = YY_BUFFER_NEW;
01802 
01803    if ( b == YY_CURRENT_BUFFER )
01804       ast_yy_load_buffer_state(yyscanner );
01805 }
01806 
01807 /** Pushes the new state onto the stack. The new state becomes
01808  *  the current state. This function will allocate the stack
01809  *  if necessary.
01810  *  @param new_buffer The new state.
01811  *  @param yyscanner The scanner object.
01812  */
01813 void ast_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
01814 {
01815     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01816    if (new_buffer == NULL)
01817       return;
01818 
01819    ast_yyensure_buffer_stack(yyscanner);
01820 
01821    /* This block is copied from ast_yy_switch_to_buffer. */
01822    if ( YY_CURRENT_BUFFER )
01823       {
01824       /* Flush out information for old buffer. */
01825       *yyg->yy_c_buf_p = yyg->yy_hold_char;
01826       YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01827       YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01828       }
01829 
01830    /* Only push if top exists. Otherwise, replace top. */
01831    if (YY_CURRENT_BUFFER)
01832       yyg->yy_buffer_stack_top++;
01833    YY_CURRENT_BUFFER_LVALUE = new_buffer;
01834 
01835    /* copied from ast_yy_switch_to_buffer. */
01836    ast_yy_load_buffer_state(yyscanner );
01837    yyg->yy_did_buffer_switch_on_eof = 1;
01838 }
01839 
01840 /** Removes and deletes the top of the stack, if present.
01841  *  The next element becomes the new top.
01842  *  @param yyscanner The scanner object.
01843  */
01844 void ast_yypop_buffer_state (yyscan_t yyscanner)
01845 {
01846     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01847    if (!YY_CURRENT_BUFFER)
01848       return;
01849 
01850    ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
01851    YY_CURRENT_BUFFER_LVALUE = NULL;
01852    if (yyg->yy_buffer_stack_top > 0)
01853       --yyg->yy_buffer_stack_top;
01854 
01855    if (YY_CURRENT_BUFFER) {
01856       ast_yy_load_buffer_state(yyscanner );
01857       yyg->yy_did_buffer_switch_on_eof = 1;
01858    }
01859 }
01860 
01861 /* Allocates the stack if it does not exist.
01862  *  Guarantees space for at least one push.
01863  */
01864 static void ast_yyensure_buffer_stack (yyscan_t yyscanner)
01865 {
01866    int num_to_alloc;
01867     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01868 
01869    if (!yyg->yy_buffer_stack) {
01870 
01871       /* First allocation is just for 2 elements, since we don't know if this
01872        * scanner will even need a stack. We use 2 instead of 1 to avoid an
01873        * immediate realloc on the next call.
01874          */
01875       num_to_alloc = 1;
01876       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc
01877                         (num_to_alloc * sizeof(struct yy_buffer_state*)
01878                         , yyscanner);
01879       if ( ! yyg->yy_buffer_stack )
01880          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01881                           
01882       memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01883             
01884       yyg->yy_buffer_stack_max = num_to_alloc;
01885       yyg->yy_buffer_stack_top = 0;
01886       return;
01887    }
01888 
01889    if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
01890 
01891       /* Increase the buffer to prepare for a possible push. */
01892       int grow_size = 8 /* arbitrary grow size */;
01893 
01894       num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
01895       yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyrealloc
01896                         (yyg->yy_buffer_stack,
01897                         num_to_alloc * sizeof(struct yy_buffer_state*)
01898                         , yyscanner);
01899       if ( ! yyg->yy_buffer_stack )
01900          YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
01901 
01902       /* zero only the new slots.*/
01903       memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
01904       yyg->yy_buffer_stack_max = num_to_alloc;
01905    }
01906 }
01907 
01908 /** Setup the input buffer state to scan directly from a user-specified character buffer.
01909  * @param base the character buffer
01910  * @param size the size in bytes of the character buffer
01911  * @param yyscanner The scanner object.
01912  * @return the newly allocated buffer state object. 
01913  */
01914 YY_BUFFER_STATE ast_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
01915 {
01916    YY_BUFFER_STATE b;
01917     
01918    if ( size < 2 ||
01919         base[size-2] != YY_END_OF_BUFFER_CHAR ||
01920         base[size-1] != YY_END_OF_BUFFER_CHAR )
01921       /* They forgot to leave room for the EOB's. */
01922       return 0;
01923 
01924    b = (YY_BUFFER_STATE) ast_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01925    if ( ! b )
01926       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_buffer()" );
01927 
01928    b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
01929    b->yy_buf_pos = b->yy_ch_buf = base;
01930    b->yy_is_our_buffer = 0;
01931    b->yy_input_file = 0;
01932    b->yy_n_chars = b->yy_buf_size;
01933    b->yy_is_interactive = 0;
01934    b->yy_at_bol = 1;
01935    b->yy_fill_buffer = 0;
01936    b->yy_buffer_status = YY_BUFFER_NEW;
01937 
01938    ast_yy_switch_to_buffer(b ,yyscanner );
01939 
01940    return b;
01941 }
01942 
01943 /** Setup the input buffer state to scan a string. The next call to ast_yylex() will
01944  * scan from a @e copy of @a str.
01945  * @param yystr a NUL-terminated string to scan
01946  * @param yyscanner The scanner object.
01947  * @return the newly allocated buffer state object.
01948  * @note If you want to scan bytes that may contain NUL values, then use
01949  *       ast_yy_scan_bytes() instead.
01950  */
01951 YY_BUFFER_STATE ast_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
01952 {
01953     
01954    return ast_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
01955 }
01956 
01957 /** Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will
01958  * scan from a @e copy of @a bytes.
01959  * @param bytes the byte buffer to scan
01960  * @param len the number of bytes in the buffer pointed to by @a bytes.
01961  * @param yyscanner The scanner object.
01962  * @return the newly allocated buffer state object.
01963  */
01964 YY_BUFFER_STATE ast_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
01965 {
01966    YY_BUFFER_STATE b;
01967    char *buf;
01968    yy_size_t n;
01969    int i;
01970     
01971    /* Get memory for full buffer, including space for trailing EOB's. */
01972    n = _yybytes_len + 2;
01973    buf = (char *) ast_yyalloc(n ,yyscanner );
01974    if ( ! buf )
01975       YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_bytes()" );
01976 
01977    for ( i = 0; i < _yybytes_len; ++i )
01978       buf[i] = yybytes[i];
01979 
01980    buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01981 
01982    b = ast_yy_scan_buffer(buf,n ,yyscanner);
01983    if ( ! b )
01984       YY_FATAL_ERROR( "bad buffer in ast_yy_scan_bytes()" );
01985 
01986    /* It's okay to grow etc. this buffer, and we should throw it
01987     * away when we're done.
01988     */
01989    b->yy_is_our_buffer = 1;
01990 
01991    return b;
01992 }
01993 
01994 #ifndef YY_EXIT_FAILURE
01995 #define YY_EXIT_FAILURE 2
01996 #endif
01997 
01998 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
01999 {
02000       (void) fprintf( stderr, "%s\n", msg );
02001    exit( YY_EXIT_FAILURE );
02002 }
02003 
02004 /* Redefine yyless() so it works in section 3 code. */
02005 
02006 #undef yyless
02007 #define yyless(n) \
02008    do \
02009       { \
02010       /* Undo effects of setting up yytext. */ \
02011         int yyless_macro_arg = (n); \
02012         YY_LESS_LINENO(yyless_macro_arg);\
02013       yytext[yyleng] = yyg->yy_hold_char; \
02014       yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
02015       yyg->yy_hold_char = *yyg->yy_c_buf_p; \
02016       *yyg->yy_c_buf_p = '\0'; \
02017       yyleng = yyless_macro_arg; \
02018       } \
02019    while ( 0 )
02020 
02021 /* Accessor  methods (get/set functions) to struct members. */
02022 
02023 /** Get the user-defined data for this scanner.
02024  * @param yyscanner The scanner object.
02025  */
02026 YY_EXTRA_TYPE ast_yyget_extra  (yyscan_t yyscanner)
02027 {
02028     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02029     return yyextra;
02030 }
02031 
02032 /** Get the current line number.
02033  * @param yyscanner The scanner object.
02034  */
02035 int ast_yyget_lineno  (yyscan_t yyscanner)
02036 {
02037     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02038     
02039         if (! YY_CURRENT_BUFFER)
02040             return 0;
02041     
02042     return yylineno;
02043 }
02044 
02045 /** Get the current column number.
02046  * @param yyscanner The scanner object.
02047  */
02048 int ast_yyget_column  (yyscan_t yyscanner)
02049 {
02050     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02051     
02052         if (! YY_CURRENT_BUFFER)
02053             return 0;
02054     
02055     return yycolumn;
02056 }
02057 
02058 /** Get the input stream.
02059  * @param yyscanner The scanner object.
02060  */
02061 FILE *ast_yyget_in  (yyscan_t yyscanner)
02062 {
02063     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02064     return yyin;
02065 }
02066 
02067 /** Get the output stream.
02068  * @param yyscanner The scanner object.
02069  */
02070 FILE *ast_yyget_out  (yyscan_t yyscanner)
02071 {
02072     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02073     return yyout;
02074 }
02075 
02076 /** Get the length of the current token.
02077  * @param yyscanner The scanner object.
02078  */
02079 int ast_yyget_leng  (yyscan_t yyscanner)
02080 {
02081     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02082     return yyleng;
02083 }
02084 
02085 /** Get the current token.
02086  * @param yyscanner The scanner object.
02087  */
02088 
02089 char *ast_yyget_text  (yyscan_t yyscanner)
02090 {
02091     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02092     return yytext;
02093 }
02094 
02095 /** Set the user-defined data. This data is never touched by the scanner.
02096  * @param user_defined The data to be associated with this scanner.
02097  * @param yyscanner The scanner object.
02098  */
02099 void ast_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
02100 {
02101     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02102     yyextra = user_defined ;
02103 }
02104 
02105 /** Set the current line number.
02106  * @param line_number
02107  * @param yyscanner The scanner object.
02108  */
02109 void ast_yyset_lineno (int  line_number , yyscan_t yyscanner)
02110 {
02111     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02112 
02113         /* lineno is only valid if an input buffer exists. */
02114         if (! YY_CURRENT_BUFFER )
02115            yy_fatal_error( "ast_yyset_lineno called with no buffer" , yyscanner); 
02116     
02117     yylineno = line_number;
02118 }
02119 
02120 /** Set the current column.
02121  * @param line_number
02122  * @param yyscanner The scanner object.
02123  */
02124 void ast_yyset_column (int  column_no , yyscan_t yyscanner)
02125 {
02126     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02127 
02128         /* column is only valid if an input buffer exists. */
02129         if (! YY_CURRENT_BUFFER )
02130            yy_fatal_error( "ast_yyset_column called with no buffer" , yyscanner); 
02131     
02132     yycolumn = column_no;
02133 }
02134 
02135 /** Set the input stream. This does not discard the current
02136  * input buffer.
02137  * @param in_str A readable stream.
02138  * @param yyscanner The scanner object.
02139  * @see ast_yy_switch_to_buffer
02140  */
02141 void ast_yyset_in (FILE *  in_str , yyscan_t yyscanner)
02142 {
02143     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02144     yyin = in_str ;
02145 }
02146 
02147 void ast_yyset_out (FILE *  out_str , yyscan_t yyscanner)
02148 {
02149     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02150     yyout = out_str ;
02151 }
02152 
02153 int ast_yyget_debug  (yyscan_t yyscanner)
02154 {
02155     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02156     return yy_flex_debug;
02157 }
02158 
02159 void ast_yyset_debug (int  bdebug , yyscan_t yyscanner)
02160 {
02161     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02162     yy_flex_debug = bdebug ;
02163 }
02164 
02165 /* Accessor methods for yylval and yylloc */
02166 
02167 YYSTYPE * ast_yyget_lval  (yyscan_t yyscanner)
02168 {
02169     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02170     return yylval;
02171 }
02172 
02173 void ast_yyset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
02174 {
02175     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02176     yylval = yylval_param;
02177 }
02178 
02179 YYLTYPE *ast_yyget_lloc  (yyscan_t yyscanner)
02180 {
02181     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02182     return yylloc;
02183 }
02184     
02185 void ast_yyset_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
02186 {
02187     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02188     yylloc = yylloc_param;
02189 }
02190     
02191 /* User-visible API */
02192 
02193 /* ast_yylex_init is special because it creates the scanner itself, so it is
02194  * the ONLY reentrant function that doesn't take the scanner as the last argument.
02195  * That's why we explicitly handle the declaration, instead of using our macros.
02196  */
02197 
02198 int ast_yylex_init(yyscan_t* ptr_yy_globals)
02199 
02200 {
02201     if (ptr_yy_globals == NULL){
02202         errno = EINVAL;
02203         return 1;
02204     }
02205 
02206     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), NULL );
02207 
02208     if (*ptr_yy_globals == NULL){
02209         errno = ENOMEM;
02210         return 1;
02211     }
02212 
02213     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
02214     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02215 
02216     return yy_init_globals ( *ptr_yy_globals );
02217 }
02218 
02219 /* ast_yylex_init_extra has the same functionality as ast_yylex_init, but follows the
02220  * convention of taking the scanner as the last argument. Note however, that
02221  * this is a *pointer* to a scanner, as it will be allocated by this call (and
02222  * is the reason, too, why this function also must handle its own declaration).
02223  * The user defined value in the first argument will be available to ast_yyalloc in
02224  * the yyextra field.
02225  */
02226 
02227 int ast_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
02228 
02229 {
02230     struct yyguts_t dummy_yyguts;
02231 
02232     ast_yyset_extra (yy_user_defined, &dummy_yyguts);
02233 
02234     if (ptr_yy_globals == NULL){
02235         errno = EINVAL;
02236         return 1;
02237     }
02238    
02239     *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
02240    
02241     if (*ptr_yy_globals == NULL){
02242         errno = ENOMEM;
02243         return 1;
02244     }
02245     
02246     /* By setting to 0xAA, we expose bugs in
02247     yy_init_globals. Leave at 0x00 for releases. */
02248     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02249     
02250     ast_yyset_extra (yy_user_defined, *ptr_yy_globals);
02251     
02252     return yy_init_globals ( *ptr_yy_globals );
02253 }
02254 
02255 static int yy_init_globals (yyscan_t yyscanner)
02256 {
02257     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02258     /* Initialization is the same as for the non-reentrant scanner.
02259      * This function is called from ast_yylex_destroy(), so don't allocate here.
02260      */
02261 
02262     yyg->yy_buffer_stack = 0;
02263     yyg->yy_buffer_stack_top = 0;
02264     yyg->yy_buffer_stack_max = 0;
02265     yyg->yy_c_buf_p = (char *) 0;
02266     yyg->yy_init = 0;
02267     yyg->yy_start = 0;
02268 
02269     yyg->yy_start_stack_ptr = 0;
02270     yyg->yy_start_stack_depth = 0;
02271     yyg->yy_start_stack =  NULL;
02272 
02273 /* Defined in main.c */
02274 #ifdef YY_STDINIT
02275     yyin = stdin;
02276     yyout = stdout;
02277 #else
02278     yyin = (FILE *) 0;
02279     yyout = (FILE *) 0;
02280 #endif
02281 
02282     /* For future reference: Set errno on error, since we are called by
02283      * ast_yylex_init()
02284      */
02285     return 0;
02286 }
02287 
02288 /* ast_yylex_destroy is for both reentrant and non-reentrant scanners. */
02289 int ast_yylex_destroy  (yyscan_t yyscanner)
02290 {
02291     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02292 
02293     /* Pop the buffer stack, destroying each element. */
02294    while(YY_CURRENT_BUFFER){
02295       ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
02296       YY_CURRENT_BUFFER_LVALUE = NULL;
02297       ast_yypop_buffer_state(yyscanner);
02298    }
02299 
02300    /* Destroy the stack itself. */
02301    ast_yyfree(yyg->yy_buffer_stack ,yyscanner);
02302    yyg->yy_buffer_stack = NULL;
02303 
02304     /* Destroy the start condition stack. */
02305         ast_yyfree(yyg->yy_start_stack ,yyscanner );
02306         yyg->yy_start_stack = NULL;
02307 
02308     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02309      * ast_yylex() is called, initialization will occur. */
02310     yy_init_globals( yyscanner);
02311 
02312     /* Destroy the main struct (reentrant only). */
02313     ast_yyfree ( yyscanner , yyscanner );
02314     yyscanner = NULL;
02315     return 0;
02316 }
02317 
02318 /*
02319  * Internal utility routines.
02320  */
02321 
02322 #ifndef yytext_ptr
02323 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
02324 {
02325    register int i;
02326    for ( i = 0; i < n; ++i )
02327       s1[i] = s2[i];
02328 }
02329 #endif
02330 
02331 #ifdef YY_NEED_STRLEN
02332 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
02333 {
02334    register int n;
02335    for ( n = 0; s[n]; ++n )
02336       ;
02337 
02338    return n;
02339 }
02340 #endif
02341 
02342 void *ast_yyalloc (yy_size_t  size , yyscan_t yyscanner)
02343 {
02344    return (void *) malloc( size );
02345 }
02346 
02347 void *ast_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
02348 {
02349    /* The cast to (char *) in the following accommodates both
02350     * implementations that use char* generic pointers, and those
02351     * that use void* generic pointers.  It works with the latter
02352     * because both ANSI C and C++ allow castless assignment from
02353     * any pointer type to void*, and deal with argument conversions
02354     * as though doing an assignment.
02355     */
02356    return (void *) realloc( (char *) ptr, size );
02357 }
02358 
02359 #define YYTABLES_NAME "yytables"
02360 
02361 #line 232 "ast_expr2.fl"
02362 
02363 
02364 
02365 /* I'm putting the interface routine to the whole parse here in the flexer input file
02366    mainly because of all the flexer initialization that has to be done. Shouldn't matter
02367    where it is, as long as it's somewhere. I didn't want to define a prototype for the
02368    ast_yy_scan_string in the .y file, because then, I'd have to define YY_BUFFER_STATE there...
02369    UGH! that would be inappropriate. */
02370 
02371 int ast_yyparse(void *); /* need to/should define this prototype for the call to yyparse */
02372 int ast_yyerror(const char *, YYLTYPE *, struct parse_io *); /* likewise */
02373 
02374 void ast_yyfree(void *ptr, yyscan_t yyscanner)
02375 {
02376        /* the normal generated ast_yyfree func just frees its first arg;
02377                     this get complaints on some systems, as sometimes this
02378                     arg is a nil ptr! It's usually not fatal, but is irritating! */
02379               free( (char *) ptr );
02380 }
02381 
02382 int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
02383 {
02384    struct parse_io io;
02385    int return_value = 0;
02386    
02387    memset(&io, 0, sizeof(io));
02388    io.string = expr;  /* to pass to the error routine */
02389    io.chan = chan;
02390    
02391    ast_yylex_init(&io.scanner);
02392    
02393    ast_yy_scan_string(expr, io.scanner);
02394    
02395    ast_yyparse ((void *) &io);
02396 
02397    ast_yylex_destroy(io.scanner);
02398 
02399    if (!io.val) {
02400       if (length > 1) {
02401          strcpy(buf, "0");
02402          return_value = 1;
02403       }
02404    } else {
02405       if (io.val->type == AST_EXPR_number) {
02406          int res_length;
02407 
02408          res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
02409          return_value = (res_length <= length) ? res_length : length;
02410       } else {
02411          if (io.val->u.s)
02412 #if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE)
02413             strncpy(buf, io.val->u.s, length - 1);
02414 #else /* !STANDALONE && !LOW_MEMORY */
02415             ast_copy_string(buf, io.val->u.s, length);
02416 #endif /* STANDALONE || LOW_MEMORY */
02417          else
02418             buf[0] = 0;
02419          return_value = strlen(buf);
02420          free(io.val->u.s);
02421       }
02422       free(io.val);
02423    }
02424    return return_value;
02425 }
02426 
02427 
02428 char extra_error_message[4095];
02429 int extra_error_message_supplied = 0;
02430 void  ast_expr_register_extra_error_info(char *message);
02431 void  ast_expr_clear_extra_error_info(void);
02432 
02433 void  ast_expr_register_extra_error_info(char *message)
02434 {
02435        extra_error_message_supplied=1;
02436        strcpy(extra_error_message, message);
02437 }
02438 
02439 void  ast_expr_clear_extra_error_info(void)
02440 {
02441        extra_error_message_supplied=0;
02442        extra_error_message[0] = 0;
02443 }
02444 
02445 static char *expr2_token_equivs1[] = 
02446 {
02447    "TOKEN",
02448    "TOK_COND",
02449    "TOK_COLONCOLON",
02450    "TOK_OR",
02451    "TOK_AND",
02452    "TOK_EQ",
02453    "TOK_GT",
02454    "TOK_LT",
02455    "TOK_GE",
02456    "TOK_LE",
02457    "TOK_NE",
02458    "TOK_PLUS",
02459    "TOK_MINUS",
02460    "TOK_MULT",
02461    "TOK_DIV",
02462    "TOK_MOD",
02463    "TOK_COMPL",
02464    "TOK_COLON",
02465    "TOK_EQTILDE",
02466    "TOK_COMMA",
02467    "TOK_RP",
02468    "TOK_LP"
02469 };
02470 
02471 static char *expr2_token_equivs2[] = 
02472 {
02473    "<token>",
02474    "?",
02475    "::",
02476    "|",
02477    "&",
02478    "=",
02479    ">",
02480    "<",
02481    ">=",
02482    "<=",
02483    "!=",
02484    "+",
02485    "-",
02486    "*",
02487    "/",
02488    "%",
02489    "!",
02490    ":",
02491    "=~",
02492    ",",
02493    ")",
02494    "("
02495 };
02496 
02497 
02498 static char *expr2_token_subst(const char *mess)
02499 {
02500    /* calc a length, malloc, fill, and return; yyerror had better free it! */
02501    int len=0,i;
02502    const char *p;
02503    char *res, *s,*t;
02504    int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
02505 
02506    for (p=mess; *p; p++) {
02507       for (i=0; i<expr2_token_equivs_entries; i++) {
02508          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 )
02509          {
02510             len+=strlen(expr2_token_equivs2[i])+2;
02511             p += strlen(expr2_token_equivs1[i])-1;
02512             break;
02513          }
02514       }
02515       len++;
02516    }
02517    res = (char*)malloc(len+1);
02518    res[0] = 0;
02519    s = res;
02520    for (p=mess; *p;) {
02521       int found = 0;
02522       for (i=0; i<expr2_token_equivs_entries; i++) {
02523          if ( strncmp(p,expr2_token_equivs1[i],strlen(expr2_token_equivs1[i])) == 0 ) {
02524             *s++ = '\'';
02525             for (t=expr2_token_equivs2[i]; *t;) {
02526                *s++ = *t++;
02527             }
02528             *s++ = '\'';
02529             p += strlen(expr2_token_equivs1[i]);
02530             found = 1;
02531             break;
02532          }
02533       }
02534       if( !found )
02535          *s++ = *p++;
02536    }
02537    *s++ = 0;
02538    return res;
02539 }
02540 
02541 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )
02542 {  
02543    struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
02544    char spacebuf[8000]; /* best safe than sorry */
02545    char spacebuf2[8000]; /* best safe than sorry */
02546    int i=0;
02547    char *s2 = expr2_token_subst(s);
02548    spacebuf[0] = 0;
02549    
02550    for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,
02551                                                                         which is the same thing as... get this:
02552                                        yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
02553                                        I was tempted to just use yy_buf_pos in the STATE, but..., well:
02554                                           a. the yy_buf_pos is the current position in the buffer, which
02555                                              may not relate to the entire string/buffer because of the
02556                                              buffering.
02557                                           b. but, analysis of the situation is that when you use the
02558                                              ast_yy_scan_string func, it creates a single buffer the size of
02559                                              string, so the two would be the same... 
02560                                        so, in the end, the yycolumn macro is available, shorter, therefore easier. */
02561    spacebuf2[i++]='^';
02562    spacebuf2[i]= 0;
02563 
02564 #ifdef STANDALONE3
02565    /* easier to read in the standalone version */
02566    printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
02567          (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
02568 #else
02569    ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
02570          (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
02571 #endif
02572 #ifndef STANDALONE
02573    ast_log(LOG_WARNING,"If you have questions, please refer to doc/tex/channelvariables.tex in the asterisk source.\n");
02574 #endif
02575    free(s2);
02576    return(0);
02577 }
02578 

Generated on Wed Oct 28 11:45:28 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6