Sat Nov 1 06:28:49 2008

Asterisk developer's documentation


ast_expr2.c File Reference

#include "asterisk.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <regex.h>
#include <limits.h>
#include "asterisk/ast_expr.h"
#include "asterisk/logger.h"

Include dependency graph for ast_expr2.c:

Go to the source code of this file.

Data Structures

struct  parse_io
struct  val
union  yyalloc
struct  yyltype
union  YYSTYPE

Defines

#define ast_yyerror(x)   ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio)
#define ast_yyerror(x)   ast_yyerror(x,&yyloc,parseio)
#define DESTROY(x)   {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);}
#define QUAD_MAX   (0x7fffffffffffffffLL)
#define QUAD_MIN   (-0x7fffffffffffffffLL-1)
#define TOK_AND   261
#define TOK_COLON   275
#define TOK_COLONCOLON   258
#define TOK_COMPL   273
#define TOK_COND   259
#define TOK_DIV   271
#define TOK_EQ   267
#define TOK_EQTILDE   274
#define TOK_GE   264
#define TOK_GT   266
#define TOK_LE   263
#define TOK_LP   276
#define TOK_LT   265
#define TOK_MINUS   268
#define TOK_MOD   270
#define TOK_MULT   272
#define TOK_NE   262
#define TOK_OR   260
#define TOK_PLUS   269
#define TOK_RP   277
#define TOKEN   278
#define YY_(msgid)   msgid
#define YY_LOCATION_PRINT(File, Loc)
#define YY_REDUCE_PRINT(Rule)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#define YYABORT   goto yyabortlab
#define YYACCEPT   goto yyacceptlab
#define YYBACKUP(Token, Value)
#define YYBISON   1
#define YYBISON_VERSION   "2.1a"
#define yychar   ast_yychar
#define yyclearin   (yychar = YYEMPTY)
#define YYCOPY(To, From, Count)
#define YYDEBUG   0
#define yydebug   ast_yydebug
#define YYDPRINTF(Args)
#define YYEMPTY   (-2)
#define YYEOF   0
#define YYERRCODE   256
#define yyerrok   (yyerrstatus = 0)
#define YYERROR   goto yyerrorlab
#define yyerror   ast_yyerror
#define YYERROR_VERBOSE   1
#define YYERROR_VERBOSE   1
#define YYFAIL   goto yyerrlab
#define YYFINAL   10
#define YYFREE   free
#define YYID(n)   (n)
#define YYINITDEPTH   200
#define YYLAST   140
#define YYLEX   yylex (&yylval, &yylloc, YYLEX_PARAM)
#define yylex   ast_yylex
#define YYLEX_PARAM   ((struct parse_io *)parseio)->scanner
#define yylloc   ast_yylloc
#define YYLLOC_DEFAULT(Current, Rhs, N)
#define YYLSP_NEEDED   1
#define YYLTYPE   yyltype
#define YYLTYPE_IS_TRIVIAL   1
#define yylval   ast_yylval
#define YYMALLOC   malloc
#define YYMAXDEPTH   10000
#define YYMAXUTOK   278
#define yynerrs   ast_yynerrs
#define YYNNTS   3
#define YYNRULES   23
#define YYNSTATES   46
#define YYNTOKENS   24
#define YYPACT_NINF   -13
#define yyparse   ast_yyparse
#define YYPARSE_PARAM   parseio
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
#define YYPURE   1
#define YYRECOVERING()   (!!yyerrstatus)
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
#define YYSIZE_T   unsigned int
#define YYSKELETON_NAME   "yacc.c"
#define YYSTACK_ALLOC   YYMALLOC
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
#define YYSTACK_BYTES(N)
#define YYSTACK_FREE   YYFREE
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_RELOCATE(Stack)
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYTABLE_NINF   -1
#define YYTERROR   1
#define YYTOKEN_TABLE   0
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYUNDEFTOK   2
#define YYUSE(e)   ((void) (e))

Typedefs

typedef void * yyscan_t
typedef short int yytype_int16
typedef short int yytype_int8
typedef unsigned short int yytype_uint16
typedef unsigned char yytype_uint8

Enumerations

enum  valtype {
  AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string, AST_EXPR_integer,
  AST_EXPR_numeric_string, AST_EXPR_string
}
enum  yytokentype {
  TOK_COLONCOLON = 258, TOK_COND = 259, TOK_OR = 260, TOK_AND = 261,
  TOK_NE = 262, TOK_LE = 263, TOK_GE = 264, TOK_LT = 265,
  TOK_GT = 266, TOK_EQ = 267, TOK_MINUS = 268, TOK_PLUS = 269,
  TOK_MOD = 270, TOK_DIV = 271, TOK_MULT = 272, TOK_COMPL = 273,
  TOK_EQTILDE = 274, TOK_COLON = 275, TOK_LP = 276, TOK_RP = 277,
  TOKEN = 278, TOK_COLONCOLON = 258, TOK_COND = 259, TOK_OR = 260,
  TOK_AND = 261, TOK_NE = 262, TOK_LE = 263, TOK_GE = 264,
  TOK_LT = 265, TOK_GT = 266, TOK_EQ = 267, TOK_MINUS = 268,
  TOK_PLUS = 269, TOK_MOD = 270, TOK_DIV = 271, TOK_MULT = 272,
  TOK_COMPL = 273, TOK_EQTILDE = 274, TOK_COLON = 275, TOK_LP = 276,
  TOK_RP = 277, TOKEN = 278
}

Functions

int ast_yylex __P ((YYSTYPE *, YYLTYPE *, yyscan_t))
static struct val *op_cond __P ((struct val *, struct val *, struct val *))
static struct val *op_and __P ((struct val *, struct val *))
static struct val *make_str __P ((const char *))
static struct val *make_integer __P ((quad_t))
static void free_value __P ((struct val *))
static int chk_minus __P ((quad_t, quad_t, quad_t))
static int chk_div __P ((quad_t, quad_t))
int ast_yyerror (const char *, YYLTYPE *, struct parse_io *)
static int chk_div (quad_t a, quad_t b)
static int chk_minus (quad_t a, quad_t b, quad_t r)
static int chk_plus (quad_t a, quad_t b, quad_t r)
static int chk_times (quad_t a, quad_t b, quad_t r)
static void free_value (struct val *vp)
static int is_zero_or_null (struct val *vp)
static int isstring (struct val *vp)
static struct valmake_integer (quad_t i)
static struct valmake_str (const char *s)
static struct valop_and (struct val *a, struct val *b)
static struct valop_colon (struct val *a, struct val *b)
static struct valop_compl (struct val *a)
static struct valop_cond (struct val *a, struct val *b, struct val *c)
static struct valop_div (struct val *a, struct val *b)
static struct valop_eq (struct val *a, struct val *b)
static struct valop_eqtilde (struct val *a, struct val *b)
static struct valop_ge (struct val *a, struct val *b)
static struct valop_gt (struct val *a, struct val *b)
static struct valop_le (struct val *a, struct val *b)
static struct valop_lt (struct val *a, struct val *b)
static struct valop_minus (struct val *a, struct val *b)
static struct valop_ne (struct val *a, struct val *b)
static struct valop_negate (struct val *a)
static struct valop_or (struct val *a, struct val *b)
static struct valop_plus (struct val *a, struct val *b)
static struct valop_rem (struct val *a, struct val *b)
static struct valop_times (struct val *a, struct val *b)
static void strip_quotes (struct val *vp)
static quad_t to_integer (struct val *vp)
static void to_string (struct val *vp)
static void yydestruct (char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) const
int yyparse (void *YYPARSE_PARAM)
int yyparse ()
static char * yystpcpy (char *yydest, const char *yysrc)
static YYSIZE_T yystrlen (char *yystr) const
static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar)
static YYSIZE_T yytnamerr (char *yyres, const char *yystr)

Variables

char extra_error_message [4095]
int extra_error_message_supplied
static const yytype_int8 yycheck []
static const yytype_uint8 yydefact []
static const yytype_int8 yydefgoto []
static const yytype_int8 yypact []
static const yytype_int8 yypgoto []
static const yytype_uint8 yyr1 []
static const yytype_uint8 yyr2 []
static const yytype_uint8 yystos []
static const yytype_uint8 yytable []
static const char *const yytname []
static const yytype_uint8 yytranslate []


Define Documentation

#define ast_yyerror (  )     ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio)

Definition at line 2292 of file ast_expr2.c.

#define ast_yyerror (  )     ast_yyerror(x,&yyloc,parseio)

Definition at line 2292 of file ast_expr2.c.

#define DESTROY (  )     {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);}

Definition at line 254 of file ast_expr2.c.

Referenced by yyparse().

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 168 of file ast_expr2.c.

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Definition at line 165 of file ast_expr2.c.

Referenced by chk_div(), and chk_minus().

#define TOK_AND   261

Definition at line 94 of file ast_expr2.c.

#define TOK_COLON   275

Definition at line 108 of file ast_expr2.c.

#define TOK_COLONCOLON   258

Definition at line 91 of file ast_expr2.c.

#define TOK_COMPL   273

Definition at line 106 of file ast_expr2.c.

#define TOK_COND   259

Definition at line 92 of file ast_expr2.c.

#define TOK_DIV   271

Definition at line 104 of file ast_expr2.c.

#define TOK_EQ   267

Definition at line 100 of file ast_expr2.c.

#define TOK_EQTILDE   274

Definition at line 107 of file ast_expr2.c.

#define TOK_GE   264

Definition at line 97 of file ast_expr2.c.

#define TOK_GT   266

Definition at line 99 of file ast_expr2.c.

#define TOK_LE   263

Definition at line 96 of file ast_expr2.c.

#define TOK_LP   276

Definition at line 109 of file ast_expr2.c.

#define TOK_LT   265

Definition at line 98 of file ast_expr2.c.

#define TOK_MINUS   268

Definition at line 101 of file ast_expr2.c.

#define TOK_MOD   270

Definition at line 103 of file ast_expr2.c.

#define TOK_MULT   272

Definition at line 105 of file ast_expr2.c.

#define TOK_NE   262

Definition at line 95 of file ast_expr2.c.

#define TOK_OR   260

Definition at line 93 of file ast_expr2.c.

#define TOK_PLUS   269

Definition at line 102 of file ast_expr2.c.

#define TOK_RP   277

Definition at line 110 of file ast_expr2.c.

#define TOKEN   278

Definition at line 111 of file ast_expr2.c.

#define YY_ ( msgid   )     msgid

Definition at line 367 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YY_LOCATION_PRINT ( File,
Loc   ) 

Value:

fprintf (File, "%d.%d-%d.%d",       \
         (Loc).first_line, (Loc).first_column,  \
         (Loc).last_line,  (Loc).last_column)

Definition at line 811 of file ast_expr2.c.

#define YY_REDUCE_PRINT ( Rule   ) 

Definition at line 993 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT ( Bottom,
Top   ) 

Definition at line 992 of file ast_expr2.c.

Referenced by yyparse().

#define YY_SYMBOL_PRINT ( Title,
Type,
Value,
Location   ) 

Definition at line 991 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 745 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 744 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP ( Token,
Value   ) 

Definition at line 757 of file ast_expr2.c.

#define YYBISON   1

Definition at line 37 of file ast_expr2.c.

#define YYBISON_VERSION   "2.1a"

Definition at line 40 of file ast_expr2.c.

#define yychar   ast_yychar

Definition at line 56 of file ast_expr2.c.

Referenced by yyparse().

#define yyclearin   (yychar = YYEMPTY)

Definition at line 740 of file ast_expr2.c.

#define YYCOPY ( To,
From,
Count   ) 

Definition at line 493 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 259 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 57 of file ast_expr2.c.

#define YYDPRINTF ( Args   ) 

Definition at line 990 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 741 of file ast_expr2.c.

Referenced by yyparse().

#define YYEOF   0

Definition at line 742 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 776 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 739 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

Definition at line 746 of file ast_expr2.c.

#define yyerror   ast_yyerror

Definition at line 54 of file ast_expr2.c.

Referenced by yyparse().

#define YYERROR_VERBOSE   1

Definition at line 265 of file ast_expr2.c.

#define YYERROR_VERBOSE   1

Definition at line 265 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 753 of file ast_expr2.c.

#define YYFINAL   10

Definition at line 523 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 451 of file ast_expr2.c.

#define YYID (  )     (n)

Definition at line 380 of file ast_expr2.c.

#define YYINITDEPTH   200

Definition at line 999 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   140

Definition at line 525 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYLEX   yylex (&yylval, &yylloc, YYLEX_PARAM)

Definition at line 824 of file ast_expr2.c.

Referenced by yyparse().

#define yylex   ast_yylex

Definition at line 53 of file ast_expr2.c.

#define YYLEX_PARAM   ((struct parse_io *)parseio)->scanner

Definition at line 172 of file ast_expr2.c.

#define yylloc   ast_yylloc

Definition at line 59 of file ast_expr2.c.

Referenced by ast_yyget_lloc(), ast_yyset_lloc(), and yyparse().

#define YYLLOC_DEFAULT ( Current,
Rhs,
 ) 

Definition at line 785 of file ast_expr2.c.

Referenced by yyparse().

#define YYLSP_NEEDED   1

Definition at line 49 of file ast_expr2.c.

#define YYLTYPE   yyltype

Definition at line 242 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

Definition at line 243 of file ast_expr2.c.

#define yylval   ast_yylval

Definition at line 55 of file ast_expr2.c.

Referenced by ast_yyget_lval(), ast_yyset_lval(), and yyparse().

#define YYMALLOC   malloc

Definition at line 444 of file ast_expr2.c.

#define YYMAXDEPTH   10000

Definition at line 1010 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   278

Definition at line 538 of file ast_expr2.c.

#define yynerrs   ast_yynerrs

Definition at line 58 of file ast_expr2.c.

Referenced by yyparse().

#define YYNNTS   3

Definition at line 530 of file ast_expr2.c.

#define YYNRULES   23

Definition at line 532 of file ast_expr2.c.

#define YYNSTATES   46

Definition at line 534 of file ast_expr2.c.

#define YYNTOKENS   24

Definition at line 528 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -13

Definition at line 669 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define yyparse   ast_yyparse

Definition at line 52 of file ast_expr2.c.

#define YYPARSE_PARAM   parseio

Definition at line 171 of file ast_expr2.c.

#define YYPOPSTACK (  )     (yyvsp -= (N), yyssp -= (N), yylsp -= (N))

Referenced by yyparse().

#define YYPURE   1

Definition at line 46 of file ast_expr2.c.

 
#define YYRECOVERING (  )     (!!yyerrstatus)

Definition at line 755 of file ast_expr2.c.

#define YYRHSLOC ( Rhs,
 )     ((Rhs)[K])

Definition at line 783 of file ast_expr2.c.

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

Definition at line 357 of file ast_expr2.c.

Referenced by yysyntax_error().

#define YYSIZE_T   unsigned int

Definition at line 353 of file ast_expr2.c.

Referenced by yyparse(), yystrlen(), and yysyntax_error().

#define YYSKELETON_NAME   "yacc.c"

Definition at line 43 of file ast_expr2.c.

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 435 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 438 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_BYTES (  ) 

Value:

((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
      + 2 * YYSTACK_GAP_MAXIMUM)

Definition at line 482 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 436 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)

Definition at line 478 of file ast_expr2.c.

#define YYSTACK_RELOCATE ( Stack   ) 

Definition at line 509 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 284 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 285 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 286 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 689 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 775 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0

Definition at line 272 of file ast_expr2.c.

#define YYTRANSLATE ( YYX   )     ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

Definition at line 540 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYUNDEFTOK   2

Definition at line 537 of file ast_expr2.c.

#define YYUSE (  )     ((void) (e))

Definition at line 373 of file ast_expr2.c.

Referenced by yydestruct().


Typedef Documentation

typedef void* yyscan_t

Definition at line 193 of file ast_expr2.c.

typedef short int yytype_int16

Definition at line 340 of file ast_expr2.c.

typedef short int yytype_int8

Definition at line 328 of file ast_expr2.c.

typedef unsigned short int yytype_uint16

Definition at line 334 of file ast_expr2.c.

typedef unsigned char yytype_uint8

Definition at line 319 of file ast_expr2.c.


Enumeration Type Documentation

enum valtype

Enumerator:
AST_EXPR_integer 
AST_EXPR_numeric_string 
AST_EXPR_string 
AST_EXPR_integer 
AST_EXPR_numeric_string 
AST_EXPR_string 

Definition at line 177 of file ast_expr2.c.

enum yytokentype

Enumerator:
TOK_COLONCOLON 
TOK_COND 
TOK_OR 
TOK_AND 
TOK_NE 
TOK_LE 
TOK_GE 
TOK_LT 
TOK_GT