Mon May 14 04:44:56 2007

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.3"
#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 2304 of file ast_expr2.c.

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

Definition at line 2304 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 264 of file ast_expr2.c.

Referenced by yyparse().

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 178 of file ast_expr2.c.

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Definition at line 175 of file ast_expr2.c.

Referenced by chk_div(), and chk_minus().

#define TOK_AND   261

Definition at line 104 of file ast_expr2.c.

#define TOK_COLON   275

Definition at line 118 of file ast_expr2.c.

#define TOK_COLONCOLON   258

Definition at line 101 of file ast_expr2.c.

#define TOK_COMPL   273

Definition at line 116 of file ast_expr2.c.

#define TOK_COND   259

Definition at line 102 of file ast_expr2.c.

#define TOK_DIV   271

Definition at line 114 of file ast_expr2.c.

#define TOK_EQ   267

Definition at line 110 of file ast_expr2.c.

#define TOK_EQTILDE   274

Definition at line 117 of file ast_expr2.c.

#define TOK_GE   264

Definition at line 107 of file ast_expr2.c.

#define TOK_GT   266

Definition at line 109 of file ast_expr2.c.

#define TOK_LE   263

Definition at line 106 of file ast_expr2.c.

#define TOK_LP   276

Definition at line 119 of file ast_expr2.c.

#define TOK_LT   265

Definition at line 108 of file ast_expr2.c.

#define TOK_MINUS   268

Definition at line 111 of file ast_expr2.c.

#define TOK_MOD   270

Definition at line 113 of file ast_expr2.c.

#define TOK_MULT   272

Definition at line 115 of file ast_expr2.c.

#define TOK_NE   262

Definition at line 105 of file ast_expr2.c.

#define TOK_OR   260

Definition at line 103 of file ast_expr2.c.

#define TOK_PLUS   269

Definition at line 112 of file ast_expr2.c.

#define TOK_RP   277

Definition at line 120 of file ast_expr2.c.

#define TOKEN   278

Definition at line 121 of file ast_expr2.c.

#define YY_ ( msgid   )     msgid

Definition at line 377 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 823 of file ast_expr2.c.

#define YY_REDUCE_PRINT ( Rule   ) 

Definition at line 1004 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT ( Bottom,
Top   ) 

Definition at line 1003 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 1002 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 757 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 756 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP ( Token,
Value   ) 

Definition at line 769 of file ast_expr2.c.

#define YYBISON   1

Definition at line 47 of file ast_expr2.c.

#define YYBISON_VERSION   "2.3"

Definition at line 50 of file ast_expr2.c.

#define yychar   ast_yychar

Definition at line 66 of file ast_expr2.c.

Referenced by yyparse().

#define yyclearin   (yychar = YYEMPTY)

Definition at line 752 of file ast_expr2.c.

#define YYCOPY ( To,
From,
Count   ) 

Definition at line 505 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 269 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 67 of file ast_expr2.c.

#define YYDPRINTF ( Args   ) 

Definition at line 1001 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 753 of file ast_expr2.c.

Referenced by yyparse().

#define YYEOF   0

Definition at line 754 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 788 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 751 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

Definition at line 758 of file ast_expr2.c.

#define yyerror   ast_yyerror

Definition at line 64 of file ast_expr2.c.

Referenced by yyparse().

#define YYERROR_VERBOSE   1

Definition at line 275 of file ast_expr2.c.

#define YYERROR_VERBOSE   1

Definition at line 275 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 765 of file ast_expr2.c.

#define YYFINAL   10

Definition at line 535 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 466 of file ast_expr2.c.

#define YYID (  )     (n)

Definition at line 390 of file ast_expr2.c.

Referenced by yyparse().

#define YYINITDEPTH   200

Definition at line 1010 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   140

Definition at line 537 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

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

Definition at line 836 of file ast_expr2.c.

Referenced by yyparse().

#define yylex   ast_yylex

Definition at line 63 of file ast_expr2.c.

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

Definition at line 182 of file ast_expr2.c.

#define yylloc   ast_yylloc

Definition at line 69 of file ast_expr2.c.

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

#define YYLLOC_DEFAULT ( Current,
Rhs,
 ) 

Definition at line 797 of file ast_expr2.c.

Referenced by yyparse().

#define YYLSP_NEEDED   1

Definition at line 59 of file ast_expr2.c.

#define YYLTYPE   yyltype

Definition at line 252 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

Definition at line 253 of file ast_expr2.c.

#define yylval   ast_yylval

Definition at line 65 of file ast_expr2.c.

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

#define YYMALLOC   malloc

Definition at line 459 of file ast_expr2.c.

#define YYMAXDEPTH   10000

Definition at line 1021 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   278

Definition at line 550 of file ast_expr2.c.

#define yynerrs   ast_yynerrs

Definition at line 68 of file ast_expr2.c.

Referenced by yyparse().

#define YYNNTS   3

Definition at line 542 of file ast_expr2.c.

#define YYNRULES   23

Definition at line 544 of file ast_expr2.c.

#define YYNSTATES   46

Definition at line 546 of file ast_expr2.c.

#define YYNTOKENS   24

Definition at line 540 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -13

Definition at line 681 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define yyparse   ast_yyparse

Definition at line 62 of file ast_expr2.c.

#define YYPARSE_PARAM   parseio

Definition at line 181 of file ast_expr2.c.

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

Referenced by yyparse().

#define YYPURE   1

Definition at line 56 of file ast_expr2.c.

 
#define YYRECOVERING (  )     (!!yyerrstatus)

Definition at line 767 of file ast_expr2.c.

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

Definition at line 795 of file ast_expr2.c.

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

Definition at line 367 of file ast_expr2.c.

Referenced by yysyntax_error().

#define YYSIZE_T   unsigned int

Definition at line 363 of file ast_expr2.c.

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

#define YYSKELETON_NAME   "yacc.c"

Definition at line 53 of file ast_expr2.c.

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 445 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 448 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 494 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 446 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 490 of file ast_expr2.c.

#define YYSTACK_RELOCATE ( Stack   ) 

Definition at line 521 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 294 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 295 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 296 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 701 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 787 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0

Definition at line 282 of file ast_expr2.c.

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

Definition at line 552 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYUNDEFTOK   2

Definition at line 549 of file ast_expr2.c.

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

Definition at line 383 of file ast_expr2.c.

Referenced by yydestruct().


Typedef Documentation

typedef void* yyscan_t

Definition at line 203 of file ast_expr2.c.

typedef short int yytype_int16

Definition at line 350 of file ast_expr2.c.

typedef short int yytype_int8

Definition at line 338 of file ast_expr2.c.

typedef unsigned short int yytype_uint16

Definition at line 344 of file ast_expr2.c.

typedef unsigned char yytype_uint8

Definition at line 329 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 187 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 
TOK_EQ 
TOK_MINUS 
TOK_PLUS 
TOK_MOD 
TOK_DIV 
TOK_MULT 
TOK_COMPL 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
TOK_COLONCOLON 
TOK_COND 
TOK_OR 
TOK_AND 
TOK_NE 
TOK_LE 
TOK_GE 
TOK_LT 
TOK_GT 
TOK_EQ 
TOK_MINUS 
TOK_PLUS 
TOK_MOD 
TOK_DIV 
TOK_MULT 
TOK_COMPL 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 

Definition at line 76 of file ast_expr2.c.

00076                     {
00077      TOK_COLONCOLON = 258,
00078      TOK_COND = 259,
00079      TOK_OR = 260,
00080      TOK_AND = 261,
00081      TOK_NE = 262,
00082      TOK_LE = 263,
00083      TOK_GE = 264,
00084      TOK_LT = 265,
00085      TOK_GT = 266,
00086      TOK_EQ = 267,
00087      TOK_MINUS = 268,
00088      TOK_PLUS = 269,
00089      TOK_MOD = 270,
00090      TOK_DIV = 271,
00091      TOK_MULT = 272,
00092      TOK_COMPL = 273,
00093      TOK_EQTILDE = 274,
00094      TOK_COLON = 275,
00095      TOK_LP = 276,
00096      TOK_RP = 277,
00097      TOKEN = 278
00098    };


Function Documentation

int ast_yylex __P ( (YYSTYPE *, YYLTYPE *, yyscan_t  ) 

static struct val* op_cond __P ( (struct val *, struct val *, struct val *)   )  [static]

static struct val *op_times __P ( (struct val *, struct val *)   )  [static]

static struct val* make_str __P ( (const char *)   )  [static]

static struct val* make_integer __P ( (quad_t)   )  [static]

static void to_string __P ( (struct val *)   )  [static]

static int chk_times __P ( (quad_t, quad_t, quad_t)   )  [static]

static int chk_div __P ( (quad_t, quad_t)   )  [static]

int ast_yyerror ( const char *  ,
YYLTYPE ,
struct parse_io  
)

static int chk_div ( quad_t  a,
quad_t  b 
) [static]

Definition at line 2699 of file ast_expr2.c.

References QUAD_MIN.

Referenced by op_div().

02700 {
02701    /* div by zero has been taken care of before */
02702    /* only QUAD_MIN / -1 causes overflow */
02703    if (a == QUAD_MIN && b == -1)
02704       return 1;
02705    /* everything else is OK */
02706    return 0;
02707 }

static int chk_minus ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2547 of file ast_expr2.c.

References chk_plus(), and QUAD_MIN.

Referenced by op_minus(), and op_negate().

02548 {
02549    /* special case subtraction of QUAD_MIN */
02550    if (b == QUAD_MIN) {
02551       if (a >= 0)
02552          return 1;
02553       else
02554          return 0;
02555    }
02556    /* this is allowed for b != QUAD_MIN */
02557    return chk_plus (a, -b, r);
02558 }

static int chk_plus ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2504 of file ast_expr2.c.

Referenced by chk_minus(), and op_plus().

02505 {
02506    /* sum of two positive numbers must be positive */
02507    if (a > 0 && b > 0 && r <= 0)
02508       return 1;
02509    /* sum of two negative numbers must be negative */
02510    if (a < 0 && b < 0 && r >= 0)
02511       return 1;
02512    /* all other cases are OK */
02513    return 0;
02514 }

static int chk_times ( quad_t  a,
quad_t  b,
quad_t  r 
) [static]

Definition at line 2665 of file ast_expr2.c.

Referenced by op_times().

02666 {
02667    /* special case: first operand is 0, no overflow possible */
02668    if (a == 0)
02669       return 0;
02670    /* cerify that result of division matches second operand */
02671    if (r / a != b)
02672       return 1;
02673    return 0;
02674 }

static void free_value ( struct val vp  )  [static]

Definition at line 2144 of file ast_expr2.c.

References AST_EXPR_numeric_string, free, val::s, val::type, and val::u.

Referenced by op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_times(), and yydestruct().

02145 {  
02146    if (vp==NULL) {
02147       return;
02148    }
02149    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
02150       free (vp->u.s);   
02151    free(vp);
02152 }

static int is_zero_or_null ( struct val vp  )  [static]

Definition at line 2238 of file ast_expr2.c.

References AST_EXPR_integer, val::i, val::s, to_integer(), val::type, and val::u.

Referenced by op_and(), and op_or().

02239 {
02240    if (vp->type == AST_EXPR_integer) {
02241       return (vp->u.i == 0);
02242    } else {
02243       return (*vp->u.s == 0 || (to_integer (vp) && vp->u.i == 0));
02244    }
02245    /* NOTREACHED */
02246 }

static int isstring ( struct val vp  )  [static]

Definition at line 2230 of file ast_expr2.c.

References val::type.

Referenced by op_cond(), op_eq(), op_ge(), op_gt(), op_le(), op_lt(), and op_ne().

02231 {
02232    /* only TRUE if this string is not a valid integer */
02233    return (vp->type == AST_EXPR_string);
02234 }

static struct val* make_integer ( quad_t  i  )  [static]

Definition at line 2098 of file ast_expr2.c.

References AST_EXPR_integer, ast_log(), LOG_WARNING, and malloc.

Referenced by op_and(), op_colon(), op_compl(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

02099 {
02100    struct val *vp;
02101 
02102    vp = (struct val *) malloc (sizeof (*vp));
02103    if (vp == NULL) {
02104       ast_log(LOG_WARNING, "malloc() failed\n");
02105       return(NULL);
02106    }
02107 
02108    vp->type = AST_EXPR_integer;
02109    vp->u.i  = i;
02110    return vp; 
02111 }

static struct val* make_str ( const char *  s  )  [static]

Definition at line 2114 of file ast_expr2.c.

References AST_EXPR_numeric_string, ast_log(), LOG_WARNING, malloc, and strdup.

Referenced by op_colon(), and op_eqtilde().

02115 {
02116    struct val *vp;
02117    size_t i;
02118    int isint;
02119 
02120    vp = (struct val *) malloc (sizeof (*vp));
02121    if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
02122       ast_log(LOG_WARNING,"malloc() failed\n");
02123       return(NULL);
02124    }
02125 
02126    for(i = 1, isint = isdigit(s[0]) || s[0] == '-';
02127        isint && i < strlen(s);
02128        i++)
02129    {
02130       if(!isdigit(s[i]))
02131           isint = 0;
02132    }
02133 
02134    if (isint)
02135       vp->type = AST_EXPR_numeric_string;
02136    else  
02137       vp->type = AST_EXPR_string;
02138 
02139    return vp;
02140 }

static struct val* op_and ( struct val a,
struct val b 
) [static]

Definition at line 2325 of file ast_expr2.c.

References free_value(), is_zero_or_null(), and make_integer().

Referenced by yyparse().

02326 {
02327    if (is_zero_or_null (a) || is_zero_or_null (b)) {
02328       free_value (a);
02329       free_value (b);
02330       return (make_integer ((quad_t)0));
02331    } else {
02332       free_value (b);
02333       return (a);
02334    }
02335 }

static struct val* op_colon ( struct val a,
struct val b 
) [static]

Definition at line 2772 of file ast_expr2.c.

References ast_log(), free_value(), LOG_WARNING, make_integer(), make_str(), val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

02773 {
02774    regex_t rp;
02775    regmatch_t rm[2];
02776    char errbuf[256];
02777    int eval;
02778    struct val *v;
02779 
02780    /* coerce to both arguments to strings */
02781    to_string(a);
02782    to_string(b);
02783    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
02784    strip_quotes(a);
02785    strip_quotes(b);
02786    /* compile regular expression */
02787    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
02788       regerror (eval, &rp, errbuf, sizeof(errbuf));
02789       ast_log(LOG_WARNING,"regcomp() error : %s",errbuf);
02790       free_value(a);
02791       free_value(b);
02792       return make_str("");    
02793    }
02794 
02795    /* compare string against pattern */
02796    /* remember that patterns are anchored to the beginning of the line */
02797    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 && rm[0].rm_so == 0) {
02798       if (rm[1].rm_so >= 0) {
02799          *(a->u.s + rm[1].rm_eo) = '\0';
02800          v = make_str (a->u.s + rm[1].rm_so);
02801 
02802       } else {
02803          v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
02804       }
02805    } else {
02806       if (rp.re_nsub == 0) {
02807          v = make_integer ((quad_t)0);
02808       } else {
02809          v = make_str ("");
02810       }
02811    }
02812 
02813    /* free arguments and pattern buffer */
02814    free_value (a);
02815    free_value (b);
02816    regfree (&rp);
02817 
02818    return v;
02819 }

static struct val* op_compl ( struct val a  )  [static]

Definition at line 2615 of file ast_expr2.c.

References AST_EXPR_integer, AST_EXPR_numeric_string, free_value(), val::i, make_integer(), val::s, val::type, and val::u.

Referenced by yyparse().

02616 {
02617    int v1 = 1;
02618    struct val *r;
02619    
02620    if( !a )
02621    {
02622       v1 = 0;
02623    }
02624    else
02625    {
02626       switch( a->type )
02627       {
02628       case AST_EXPR_integer:
02629          if( a->u.i == 0 )
02630             v1 = 0;
02631          break;
02632          
02633       case AST_EXPR_string:
02634          if( a->u.s == 0 )
02635             v1 = 0;
02636          else
02637          {
02638             if( a->u.s[0] == 0 )
02639                v1 = 0;
02640             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
02641                v1 = 0;
02642          }
02643          break;
02644          
02645       case AST_EXPR_numeric_string:
02646          if( a->u.s == 0 )
02647             v1 = 0;
02648          else
02649          {
02650             if( a->u.s[0] == 0 )
02651                v1 = 0;
02652             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
02653                v1 = 0;
02654          }
02655          break;
02656       }
02657    }
02658    
02659    r = make_integer (!v1);
02660    free_value (a);
02661    return r;
02662 }

static struct val* op_cond ( struct val a,
struct val b,
struct val c 
) [static]

Definition at line 2445 of file ast_expr2.c.

References free_value(), val::i, isstring(), val::s, to_integer(), and val::u.

Referenced by yyparse().

02446 {
02447    struct val *r;
02448 
02449    if( isstring(a) )
02450    {
02451       if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 )
02452       {
02453          free_value(a);
02454          free_value(c);
02455          r = b;
02456       }
02457       else
02458       {
02459          free_value(a);
02460          free_value(b);
02461          r = c;
02462       }
02463    }
02464    else
02465    {
02466       (void)to_integer(a);
02467       if( a->u.i )
02468       {
02469          free_value(a);
02470          free_value(c);
02471          r = b;
02472       }
02473       else
02474       {
02475          free_value(a);
02476          free_value(b);
02477          r = c;
02478       }
02479    }
02480    return r;
02481 }

static struct val* op_div ( struct val a,
struct val b 
) [static]

Definition at line 2710 of file ast_expr2.c.

References ast_log(), chk_div(), free_value(), LOG_WARNING, make_integer(), and to_integer().

Referenced by yyparse().

02711 {
02712    struct val *r;
02713 
02714    if (!to_integer (a)) {
02715       free_value(a);
02716       free_value(b);
02717       if( !extra_error_message_supplied )
02718          ast_log(LOG_WARNING, "non-numeric argument\n");
02719       return make_integer(0);
02720    } else if (!to_integer (b)) {
02721       free_value(a);
02722       free_value(b);
02723       if( !extra_error_message_supplied )
02724          ast_log(LOG_WARNING, "non-numeric argument\n");
02725       return make_integer(INT_MAX);
02726    }
02727 
02728    if (b->u.i == 0) {
02729       ast_log(LOG_WARNING, "division by zero\n");     
02730       free_value(a);
02731       free_value(b);
02732       return make_integer(INT_MAX);
02733    }
02734 
02735    r = make_integer (/*(quad_t)*/(a->u.i / b->u.i));
02736    if (chk_div (a->u.i, b->u.i)) {
02737       ast_log(LOG_WARNING, "overflow\n");
02738    }
02739    free_value (a);
02740    free_value (b);
02741    return r;
02742 }

static struct val* op_eq ( struct val a,
struct val b 
) [static]

Definition at line 2338 of file ast_expr2.c.

References ast_log(), free_value(), isstring(), LOG_WARNING, make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02339 {
02340    struct val *r; 
02341 
02342    if (isstring (a) || isstring (b)) {
02343       to_string (a);
02344       to_string (b); 
02345       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) == 0));
02346    } else {
02347 #ifdef DEBUG_FOR_CONVERSIONS
02348       char buffer[2000];
02349       sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
02350 #endif
02351       (void)to_integer(a);
02352       (void)to_integer(b);
02353 #ifdef DEBUG_FOR_CONVERSIONS
02354       ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
02355 #endif
02356       r = make_integer ((quad_t)(a->u.i == b->u.i));
02357    }
02358 
02359    free_value (a);
02360    free_value (b);
02361    return r;
02362 }

static struct val* op_eqtilde ( struct val a,
struct val b 
) [static]

Definition at line 2823 of file ast_expr2.c.

References ast_log(), free_value(), LOG_WARNING, make_integer(), make_str(), val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

02824 {
02825    regex_t rp;
02826    regmatch_t rm[2];
02827    char errbuf[256];
02828    int eval;
02829    struct val *v;
02830 
02831    /* coerce to both arguments to strings */
02832    to_string(a);
02833    to_string(b);
02834    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
02835    strip_quotes(a);
02836    strip_quotes(b);
02837    /* compile regular expression */
02838    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
02839       regerror (eval, &rp, errbuf, sizeof(errbuf));
02840       ast_log(LOG_WARNING,"regcomp() error : %s",errbuf);
02841       free_value(a);
02842       free_value(b);
02843       return make_str("");    
02844    }
02845 
02846    /* compare string against pattern */
02847    /* remember that patterns are anchored to the beginning of the line */
02848    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 ) {
02849       if (rm[1].rm_so >= 0) {
02850          *(a->u.s + rm[1].rm_eo) = '\0';
02851          v = make_str (a->u.s + rm[1].rm_so);
02852 
02853       } else {
02854          v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
02855       }
02856    } else {
02857       if (rp.re_nsub == 0) {
02858          v = make_integer ((quad_t)0);
02859       } else {
02860          v = make_str ("");
02861       }
02862    }
02863 
02864    /* free arguments and pattern buffer */
02865    free_value (a);
02866    free_value (b);
02867    regfree (&rp);
02868 
02869    return v;
02870 }

static struct val* op_ge ( struct val a,
struct val b 
) [static]

Definition at line 2405 of file ast_expr2.c.

References free_value(), isstring(), make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02406 {
02407    struct val *r;
02408 
02409    if (isstring (a) || isstring (b)) {
02410       to_string (a);
02411       to_string (b);
02412       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) >= 0));
02413    } else {
02414       (void)to_integer(a);
02415       (void)to_integer(b);
02416       r = make_integer ((quad_t)(a->u.i >= b->u.i));
02417    }
02418 
02419    free_value (a);
02420    free_value (b);
02421    return r;
02422 }

static struct val* op_gt ( struct val a,
struct val b 
) [static]

Definition at line 2365 of file ast_expr2.c.

References free_value(), isstring(), make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02366 {
02367    struct val *r;
02368 
02369    if (isstring (a) || isstring (b)) {
02370       to_string (a);
02371       to_string (b);
02372       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) > 0));
02373    } else {
02374       (void)to_integer(a);
02375       (void)to_integer(b);
02376       r = make_integer ((quad_t)(a->u.i > b->u.i));
02377    }
02378 
02379    free_value (a);
02380    free_value (b);
02381    return r;
02382 }

static struct val* op_le ( struct val a,
struct val b 
) [static]

Definition at line 2425 of file ast_expr2.c.

References free_value(), isstring(), make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02426 {
02427    struct val *r;
02428 
02429    if (isstring (a) || isstring (b)) {
02430       to_string (a);
02431       to_string (b);
02432       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) <= 0));
02433    } else {
02434       (void)to_integer(a);
02435       (void)to_integer(b);
02436       r = make_integer ((quad_t)(a->u.i <= b->u.i));
02437    }
02438 
02439    free_value (a);
02440    free_value (b);
02441    return r;
02442 }

static struct val* op_lt ( struct val a,
struct val b 
) [static]

Definition at line 2385 of file ast_expr2.c.

References free_value(), isstring(), make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02386 {
02387    struct val *r;
02388 
02389    if (isstring (a) || isstring (b)) {
02390       to_string (a);
02391       to_string (b);
02392       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) < 0));
02393    } else {
02394       (void)to_integer(a);
02395       (void)to_integer(b);
02396       r = make_integer ((quad_t)(a->u.i < b->u.i));
02397    }
02398 
02399    free_value (a);
02400    free_value (b);
02401    return r;
02402 }

static struct val* op_minus ( struct val a,
struct val b 
) [static]

Definition at line 2561 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02562 {
02563    struct val *r;
02564 
02565    if (!to_integer (a)) {
02566       if( !extra_error_message_supplied )
02567          ast_log(LOG_WARNING, "non-numeric argument\n");
02568       if (!to_integer (b)) {
02569          free_value(a);
02570          free_value(b);
02571          return make_integer(0);
02572       } else {
02573          r = make_integer(0 - b->u.i);
02574          free_value(a);
02575          free_value(b);
02576          return (r);
02577       }
02578    } else if (!to_integer(b)) {
02579       if( !extra_error_message_supplied )
02580          ast_log(LOG_WARNING, "non-numeric argument\n");
02581       free_value(b);
02582       return (a);
02583    }
02584 
02585    r = make_integer (/*(quad_t)*/(a->u.i - b->u.i));
02586    if (chk_minus (a->u.i, b->u.i, r->u.i)) {
02587       ast_log(LOG_WARNING, "overflow\n");
02588    }
02589    free_value (a);
02590    free_value (b);
02591    return r;
02592 }

static struct val* op_ne ( struct val a,
struct val b 
) [static]

Definition at line 2484 of file ast_expr2.c.

References free_value(), isstring(), make_integer(), to_integer(), and to_string().

Referenced by yyparse().

02485 {
02486    struct val *r;
02487 
02488    if (isstring (a) || isstring (b)) {
02489       to_string (a);
02490       to_string (b);
02491       r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) != 0));
02492    } else {
02493       (void)to_integer(a);
02494       (void)to_integer(b);
02495       r = make_integer ((quad_t)(a->u.i != b->u.i));
02496    }
02497 
02498    free_value (a);
02499    free_value (b);
02500    return r;
02501 }

static struct val* op_negate ( struct val a  )  [static]

Definition at line 2595 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02596 {
02597    struct val *r;
02598 
02599    if (!to_integer (a) ) {
02600       free_value(a);
02601       if( !extra_error_message_supplied )
02602          ast_log(LOG_WARNING, "non-numeric argument\n");
02603       return make_integer(0);
02604    }
02605 
02606    r = make_integer (/*(quad_t)*/(- a->u.i));
02607    if (chk_minus (0, a->u.i, r->u.i)) {
02608       ast_log(LOG_WARNING, "overflow\n");
02609    }
02610    free_value (a);
02611    return r;
02612 }

static struct val* op_or ( struct val a,
struct val b 
) [static]

Definition at line 2313 of file ast_expr2.c.

References free_value(), and is_zero_or_null().

Referenced by yyparse().

02314 {
02315    if (is_zero_or_null (a)) {
02316       free_value (a);
02317       return (b);
02318    } else {
02319       free_value (b);
02320       return (a);
02321    }
02322 }

static struct val* op_plus ( struct val a,
struct val b 
) [static]

Definition at line 2517 of file ast_expr2.c.

References ast_log(), chk_plus(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02518 {
02519    struct val *r;
02520 
02521    if (!to_integer (a)) {
02522       if( !extra_error_message_supplied )
02523          ast_log(LOG_WARNING,"non-numeric argument\n");
02524       if (!to_integer (b)) {
02525          free_value(a);
02526          free_value(b);
02527          return make_integer(0);
02528       } else {
02529          free_value(a);
02530          return (b);
02531       }
02532    } else if (!to_integer(b)) {
02533       free_value(b);
02534       return (a);
02535    }
02536 
02537    r = make_integer (/*(quad_t)*/(a->u.i + b->u.i));
02538    if (chk_plus (a->u.i, b->u.i, r->u.i)) {
02539       ast_log(LOG_WARNING,"overflow\n");
02540    }
02541    free_value (a);
02542    free_value (b);
02543    return r;
02544 }

static struct val* op_rem ( struct val a,
struct val b 
) [static]

Definition at line 2745 of file ast_expr2.c.

References ast_log(), free_value(), LOG_WARNING, make_integer(), and to_integer().

Referenced by yyparse().

02746 {
02747    struct val *r;
02748 
02749    if (!to_integer (a) || !to_integer (b)) {
02750       if( !extra_error_message_supplied )
02751          ast_log(LOG_WARNING, "non-numeric argument\n");
02752       free_value(a);
02753       free_value(b);
02754       return make_integer(0);
02755    }
02756 
02757    if (b->u.i == 0) {
02758       ast_log(LOG_WARNING, "div by zero\n");
02759       free_value(a);
02760       return(b);
02761    }
02762 
02763    r = make_integer (/*(quad_t)*/(a->u.i % b->u.i));
02764    /* chk_rem necessary ??? */
02765    free_value (a);
02766    free_value (b);
02767    return r;
02768 }

static struct val* op_times ( struct val a,
struct val b 
) [static]

Definition at line 2677 of file ast_expr2.c.

References ast_log(), chk_times(), free_value(), val::i, LOG_WARNING, make_integer(), to_integer(), and val::u.

Referenced by yyparse().

02678 {
02679    struct val *r;
02680 
02681    if (!to_integer (a) || !to_integer (b)) {
02682       free_value(a);
02683       free_value(b);
02684       if( !extra_error_message_supplied )
02685          ast_log(LOG_WARNING, "non-numeric argument\n");
02686       return(make_integer(0));
02687    }
02688 
02689    r = make_integer (/*(quad_t)*/(a->u.i * b->u.i));
02690    if (chk_times (a->u.i, b->u.i, r->u.i)) {
02691       ast_log(LOG_WARNING, "overflow\n");
02692    }
02693    free_value (a);
02694    free_value (b);
02695    return (r);
02696 }

static void strip_quotes ( struct val vp  )  [static]

Definition at line 2187 of file ast_expr2.c.

References AST_EXPR_numeric_string, f, val::s, t, val::type, and val::u.

Referenced by op_colon(), and op_eqtilde().

02188 {
02189    if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
02190       return;
02191    
02192    if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
02193    {
02194       char *f, *t;
02195       f = vp->u.s;
02196       t = vp->u.s;
02197       
02198       while( *f )
02199       {
02200          if( *f  && *f != '"' )
02201             *t++ = *f++;
02202          else
02203             f++;
02204       }
02205       *t = *f;
02206    }
02207 }

static quad_t to_integer ( struct val vp  )  [static]

Definition at line 2156 of file ast_expr2.c.

References AST_EXPR_integer, ast_log(), free, val::i, LOG_WARNING, val::s, val::type, and val::u.

Referenced by is_zero_or_null(), op_cond(), op_div(), op_eq(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

02157 {
02158    quad_t i;
02159    
02160    if (vp == NULL) {
02161       ast_log(LOG_WARNING,"vp==NULL in to_integer()\n");
02162       return(0);
02163    }
02164 
02165    if (vp->type == AST_EXPR_integer)
02166       return 1;
02167 
02168    if (vp->type == AST_EXPR_string)
02169       return 0;
02170 
02171    /* vp->type == AST_EXPR_numeric_string, make it numeric */
02172    errno = 0;
02173    i  = strtoll(vp->u.s, (char**)NULL, 10);
02174    if (errno != 0) {
02175       ast_log(LOG_WARNING,"Conversion of %s to integer under/overflowed!\n", vp->u.s);
02176       free(vp->u.s);
02177       vp->u.s = 0;
02178       return(0);
02179    }
02180    free (vp->u.s);
02181    vp->u.i = i;
02182    vp->type = AST_EXPR_integer;
02183    return 1;
02184 }

static void to_string ( struct val vp  )  [static]

Definition at line 2210 of file ast_expr2.c.

References AST_EXPR_numeric_string, ast_log(), val::i, LOG_WARNING, malloc, val::s, val::type, and val::u.

Referenced by op_colon(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), and op_ne().

02211 {
02212    char *tmp;
02213 
02214    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
02215       return;
02216 
02217    tmp = malloc ((size_t)25);
02218    if (tmp == NULL) {
02219       ast_log(LOG_WARNING,"malloc() failed\n");
02220       return;
02221    }
02222 
02223    sprintf(tmp, "%ld", (long int) vp->u.i);
02224    vp->type = AST_EXPR_string;
02225    vp->u.s  = tmp;
02226 }

static void yydestruct ( char *  yymsg,
int  yytype,
YYSTYPE yyvaluep,
YYLTYPE yylocationp 
) const [static]

Definition at line 1248 of file ast_expr2.c.

References free_value(), YYSTYPE::val, YY_SYMBOL_PRINT, and YYUSE.

Referenced by yyparse().

01254 {
01255   YYUSE (yyvaluep);
01256   YYUSE (yylocationp);
01257 
01258   if (!yymsg)
01259     yymsg = "Deleting";
01260   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01261 
01262   switch (yytype)
01263     {
01264       case 3: /* "TOK_COLONCOLON" */
01265 #line 169 "ast_expr2.y"
01266    {  free_value((yyvaluep->val)); };
01267 #line 1268 "ast_expr2.c"
01268    break;
01269       case 4: /* "TOK_COND" */
01270 #line 169 "ast_expr2.y"
01271    {  free_value((yyvaluep->val)); };
01272 #line 1273 "ast_expr2.c"
01273    break;
01274       case 5: /* "TOK_OR" */
01275 #line 169 "ast_expr2.y"
01276    {  free_value((yyvaluep->val)); };
01277 #line 1278 "ast_expr2.c"
01278    break;
01279       case 6: /* "TOK_AND" */
01280 #line 169 "ast_expr2.y"
01281    {  free_value((yyvaluep->val)); };
01282 #line 1283 "ast_expr2.c"
01283    break;
01284       case 7: /* "TOK_NE" */
01285 #line 169 "ast_expr2.y"
01286    {  free_value((yyvaluep->val)); };
01287 #line 1288 "ast_expr2.c"
01288    break;
01289       case 8: /* "TOK_LE" */
01290 #line 169 "ast_expr2.y"
01291    {  free_value((yyvaluep->val)); };
01292 #line 1293 "ast_expr2.c"
01293    break;
01294       case 9: /* "TOK_GE" */
01295 #line 169 "ast_expr2.y"
01296    {  free_value((yyvaluep->val)); };
01297 #line 1298 "ast_expr2.c"
01298    break;
01299       case 10: /* "TOK_LT" */
01300 #line 169 "ast_expr2.y"
01301    {  free_value((yyvaluep->val)); };
01302 #line 1303 "ast_expr2.c"
01303    break;
01304       case 11: /* "TOK_GT" */
01305 #line 169 "ast_expr2.y"
01306    {  free_value((yyvaluep->val)); };
01307 #line 1308 "ast_expr2.c"
01308    break;
01309       case 12: /* "TOK_EQ" */
01310 #line 169 "ast_expr2.y"
01311    {  free_value((yyvaluep->val)); };
01312 #line 1313 "ast_expr2.c"
01313    break;
01314       case 13: /* "TOK_MINUS" */
01315 #line 169 "ast_expr2.y"
01316    {  free_value((yyvaluep->val)); };
01317 #line 1318 "ast_expr2.c"
01318    break;
01319       case 14: /* "TOK_PLUS" */
01320 #line 169 "ast_expr2.y"
01321    {  free_value((yyvaluep->val)); };
01322 #line 1323 "ast_expr2.c"
01323    break;
01324       case 15: /* "TOK_MOD" */
01325 #line 169 "ast_expr2.y"
01326    {  free_value((yyvaluep->val)); };
01327 #line 1328 "ast_expr2.c"
01328    break;
01329       case 16: /* "TOK_DIV" */
01330 #line 169 "ast_expr2.y"
01331    {  free_value((yyvaluep->val)); };
01332 #line 1333 "ast_expr2.c"
01333    break;
01334       case 17: /* "TOK_MULT" */
01335 #line 169 "ast_expr2.y"
01336    {  free_value((yyvaluep->val)); };
01337 #line 1338 "ast_expr2.c"
01338    break;
01339       case 18: /* "TOK_COMPL" */
01340 #line 169 "ast_expr2.y"
01341    {  free_value((yyvaluep->val)); };
01342 #line 1343 "ast_expr2.c"
01343    break;
01344       case 19: /* "TOK_EQTILDE" */
01345 #line 169 "ast_expr2.y"
01346    {  free_value((yyvaluep->val)); };
01347 #line 1348 "ast_expr2.c"
01348    break;
01349       case 20: /* "TOK_COLON" */
01350 #line 169 "ast_expr2.y"
01351    {  free_value((yyvaluep->val)); };
01352 #line 1353 "ast_expr2.c"
01353    break;
01354       case 21: /* "TOK_LP" */
01355 #line 169 "ast_expr2.y"
01356    {  free_value((yyvaluep->val)); };
01357 #line 1358 "ast_expr2.c"
01358    break;
01359       case 22: /* "TOK_RP" */
01360 #line 169 "ast_expr2.y"
01361    {  free_value((yyvaluep->val)); };
01362 #line 1363 "ast_expr2.c"
01363    break;
01364       case 23: /* "TOKEN" */
01365 #line 169 "ast_expr2.y"
01366    {  free_value((yyvaluep->val)); };
01367 #line 1368 "ast_expr2.c"
01368    break;
01369       case 26: /* "expr" */
01370 #line 169 "ast_expr2.y"
01371    {  free_value((yyvaluep->val)); };
01372 #line 1373 "ast_expr2.c"
01373    break;
01374 
01375       default:
01376    break;
01377     }
01378 }

int yyparse ( void *  YYPARSE_PARAM  ) 

Definition at line 1413 of file ast_expr2.c.

References AST_EXPR_integer, calloc, DESTROY, free, op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_times(), strdup, type, YYSTYPE::val, YY_, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yychar, yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, yyerror, YYFINAL, YYID, YYINITDEPTH, YYLAST, YYLEX, yylloc, YYLLOC_DEFAULT, yyalloc::yyls, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, YYSTACK_ALLOC, YYSTACK_ALLOC_MAXIMUM, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yysyntax_error(), YYTABLE_NINF, YYTERROR, YYTRANSLATE, and yyalloc::yyvs.

01427 {
01428   /* The look-ahead symbol.  */
01429 int yychar;
01430 
01431 /* The semantic value of the look-ahead symbol.  */
01432 YYSTYPE yylval;
01433 
01434 /* Number of syntax errors so far.  */
01435 int yynerrs;
01436 /* Location data for the look-ahead symbol.  */
01437 YYLTYPE yylloc;
01438 
01439   int yystate;
01440   int yyn;
01441   int yyresult;
01442   /* Number of tokens to shift before error messages enabled.  */
01443   int yyerrstatus;
01444   /* Look-ahead token as an internal (translated) token number.  */
01445   int yytoken = 0;
01446 #if YYERROR_VERBOSE
01447   /* Buffer for error messages, and its allocated size.  */
01448   char yymsgbuf[128];
01449   char *yymsg = yymsgbuf;
01450   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01451 #endif
01452 
01453   /* Three stacks and their tools:
01454      `yyss': related to states,
01455      `yyvs': related to semantic values,
01456      `yyls': related to locations.
01457 
01458      Refer to the stacks thru separate pointers, to allow yyoverflow
01459      to reallocate them elsewhere.  */
01460 
01461   /* The state stack.  */
01462   yytype_int16 yyssa[YYINITDEPTH];
01463   yytype_int16 *yyss = yyssa;
01464   yytype_int16 *yyssp;
01465 
01466   /* The semantic value stack.  */
01467   YYSTYPE yyvsa[YYINITDEPTH];
01468   YYSTYPE *yyvs = yyvsa;
01469   YYSTYPE *yyvsp;
01470 
01471   /* The location stack.  */
01472   YYLTYPE yylsa[YYINITDEPTH];
01473   YYLTYPE *yyls = yylsa;
01474   YYLTYPE *yylsp;
01475   /* The locations where the error started and ended.  */
01476   YYLTYPE yyerror_range[2];
01477 
01478 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
01479 
01480   YYSIZE_T yystacksize = YYINITDEPTH;
01481 
01482   /* The variables used to return semantic value and location from the
01483      action routines.  */
01484   YYSTYPE yyval;
01485   YYLTYPE yyloc;
01486 
01487   /* The number of symbols on the RHS of the reduced rule.
01488      Keep to zero when no symbol should be popped.  */
01489   int yylen = 0;
01490 
01491   YYDPRINTF ((stderr, "Starting parse\n"));
01492 
01493   yystate = 0;
01494   yyerrstatus = 0;
01495   yynerrs = 0;
01496   yychar = YYEMPTY;     /* Cause a token to be read.  */
01497 
01498   /* Initialize stack pointers.
01499      Waste one element of value and location stack
01500      so that they stay on the same level as the state stack.
01501      The wasted elements are never initialized.  */
01502 
01503   yyssp = yyss;
01504   yyvsp = yyvs;
01505   yylsp = yyls;
01506 #if YYLTYPE_IS_TRIVIAL
01507   /* Initialize the default location before parsing starts.  */
01508   yylloc.first_line   = yylloc.last_line   = 1;
01509   yylloc.first_column = yylloc.last_column = 0;
01510 #endif
01511 
01512   goto yysetstate;
01513 
01514 /*------------------------------------------------------------.
01515 | yynewstate -- Push a new state, which is found in yystate.  |
01516 `------------------------------------------------------------*/
01517  yynewstate:
01518   /* In all cases, when you get here, the value and location stacks
01519      have just been pushed.  So pushing a state here evens the stacks.  */
01520   yyssp++;
01521 
01522  yysetstate:
01523   *yyssp = yystate;
01524 
01525   if (yyss + yystacksize - 1 <= yyssp)
01526     {
01527       /* Get the current used size of the three stacks, in elements.  */
01528       YYSIZE_T yysize = yyssp - yyss + 1;
01529 
01530 #ifdef yyoverflow
01531       {
01532    /* Give user a chance to reallocate the stack.  Use copies of
01533       these so that the &'s don't force the real ones into
01534       memory.  */
01535    YYSTYPE *yyvs1 = yyvs;
01536    yytype_int16 *yyss1 = yyss;
01537    YYLTYPE *yyls1 = yyls;
01538 
01539    /* Each stack pointer address is followed by the size of the
01540       data in use in that stack, in bytes.  This used to be a
01541       conditional around just the two extra args, but that might
01542       be undefined if yyoverflow is a macro.  */
01543    yyoverflow (YY_("memory exhausted"),
01544           &yyss1, yysize * sizeof (*yyssp),
01545           &yyvs1, yysize * sizeof (*yyvsp),
01546           &yyls1, yysize * sizeof (*yylsp),
01547           &yystacksize);
01548    yyls = yyls1;
01549    yyss = yyss1;
01550    yyvs = yyvs1;
01551       }
01552 #else /* no yyoverflow */
01553 # ifndef YYSTACK_RELOCATE
01554       goto yyexhaustedlab;
01555 # else
01556       /* Extend the stack our own way.  */
01557       if (YYMAXDEPTH <= yystacksize)
01558    goto yyexhaustedlab;
01559       yystacksize *= 2;
01560       if (YYMAXDEPTH < yystacksize)
01561    yystacksize = YYMAXDEPTH;
01562 
01563       {
01564    yytype_int16 *yyss1 = yyss;
01565    union yyalloc *yyptr =
01566      (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01567    if (! yyptr)
01568      goto yyexhaustedlab;
01569    YYSTACK_RELOCATE (yyss);
01570    YYSTACK_RELOCATE (yyvs);
01571    YYSTACK_RELOCATE (yyls);
01572 #  undef YYSTACK_RELOCATE
01573    if (yyss1 != yyssa)
01574      YYSTACK_FREE (yyss1);
01575       }
01576 # endif
01577 #endif /* no yyoverflow */
01578 
01579       yyssp = yyss + yysize - 1;
01580       yyvsp = yyvs + yysize - 1;
01581       yylsp = yyls + yysize - 1;
01582 
01583       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01584         (unsigned long int) yystacksize));
01585 
01586       if (yyss + yystacksize - 1 <= yyssp)
01587    YYABORT;
01588     }
01589 
01590   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01591 
01592   goto yybackup;
01593 
01594 /*-----------.
01595 | yybackup.  |
01596 `-----------*/
01597 yybackup:
01598 
01599   /* Do appropriate processing given the current state.  Read a
01600      look-ahead token if we need one and don't already have one.  */
01601 
01602   /* First try to decide what to do without reference to look-ahead token.  */
01603   yyn = yypact[yystate];
01604   if (yyn == YYPACT_NINF)
01605     goto yydefault;
01606 
01607   /* Not known => get a look-ahead token if don't already have one.  */
01608 
01609   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
01610   if (yychar == YYEMPTY)
01611     {
01612       YYDPRINTF ((stderr, "Reading a token: "));
01613       yychar = YYLEX;
01614     }
01615 
01616   if (yychar <= YYEOF)
01617     {
01618       yychar = yytoken = YYEOF;
01619       YYDPRINTF ((stderr, "Now at end of input.\n"));
01620     }
01621   else
01622     {
01623       yytoken = YYTRANSLATE (yychar);
01624       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01625     }
01626 
01627   /* If the proper action on seeing token YYTOKEN is to reduce or to
01628      detect an error, take that action.  */
01629   yyn += yytoken;
01630   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01631     goto yydefault;
01632   yyn = yytable[yyn];
01633   if (yyn <= 0)
01634     {
01635       if (yyn == 0 || yyn == YYTABLE_NINF)
01636    goto yyerrlab;
01637       yyn = -yyn;
01638       goto yyreduce;
01639     }
01640 
01641   if (yyn == YYFINAL)
01642     YYACCEPT;
01643 
01644   /* Count tokens shifted since error; after three, turn off error
01645      status.  */
01646   if (yyerrstatus)
01647     yyerrstatus--;
01648 
01649   /* Shift the look-ahead token.  */
01650   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01651 
01652   /* Discard the shifted token unless it is eof.  */
01653   if (yychar != YYEOF)
01654     yychar = YYEMPTY;
01655 
01656   yystate = yyn;
01657   *++yyvsp = yylval;
01658   *++yylsp = yylloc;
01659   goto yynewstate;
01660 
01661 
01662 /*-----------------------------------------------------------.
01663 | yydefault -- do the default action for the current state.  |
01664 `-----------------------------------------------------------*/
01665 yydefault:
01666   yyn = yydefact[yystate];
01667   if (yyn == 0)
01668     goto yyerrlab;
01669   goto yyreduce;
01670 
01671 
01672 /*-----------------------------.
01673 | yyreduce -- Do a reduction.  |
01674 `-----------------------------*/
01675 yyreduce:
01676   /* yyn is the number of a rule to reduce with.  */
01677   yylen = yyr2[yyn];
01678 
01679   /* If YYLEN is nonzero, implement the default value of the action:
01680      `$$ = $1'.
01681 
01682      Otherwise, the following line sets YYVAL to garbage.
01683      This behavior is undocumented and Bison
01684      users should not rely upon it.  Assigning to YYVAL
01685      unconditionally makes the parser a bit smaller, and it avoids a
01686      GCC warning that YYVAL may be used uninitialized.  */
01687   yyval = yyvsp[1-yylen];
01688 
01689   /* Default location.  */
01690   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
01691   YY_REDUCE_PRINT (yyn);
01692   switch (yyn)
01693     {
01694         case 2:
01695 #line 175 "ast_expr2.y"
01696     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
01697               ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
01698               if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_integer )
01699               ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
01700               else
01701               ((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s; 
01702            free((yyvsp[(1) - (1)].val));
01703          ;}
01704     break;
01705 
01706   case 3:
01707 #line 183 "ast_expr2.y"
01708     {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
01709               ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
01710            ((struct parse_io *)parseio)->val->u.s = strdup(""); 
01711          ;}
01712     break;
01713 
01714   case 4:
01715 #line 190 "ast_expr2.y"
01716     { (yyval.val)= (yyvsp[(1) - (1)].val);;}
01717     break;
01718 
01719   case 5:
01720 #line 191 "ast_expr2.y"
01721     { (yyval.val) = (yyvsp[(2) - (3)].val); 
01722                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01723                      (yyloc).first_line=0; (yyloc).last_line=0;
01724                      DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
01725     break;
01726 
01727   case 6:
01728 #line 195 "ast_expr2.y"
01729     { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
01730                   DESTROY((yyvsp[(2) - (3)].val)); 
01731                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01732                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01733     break;
01734 
01735   case 7:
01736 #line 199 "ast_expr2.y"
01737     { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01738                   DESTROY((yyvsp[(2) - (3)].val)); 
01739                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01740                           (yyloc).first_line=0; (yyloc).last_line=0;;}
01741     break;
01742 
01743   case 8:
01744 #line 203 "ast_expr2.y"
01745     { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
01746                   DESTROY((yyvsp[(2) - (3)].val)); 
01747                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
01748                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01749     break;
01750 
01751   case 9:
01752 #line 207 "ast_expr2.y"
01753     { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
01754                   DESTROY((yyvsp[(2) - (3)].val)); 
01755                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
01756                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01757     break;
01758 
01759   case 10:
01760 #line 211 "ast_expr2.y"
01761     { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01762                   DESTROY((yyvsp[(2) - (3)].val)); 
01763                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01764                    (yyloc).first_line=0; (yyloc).last_line=0;;}
01765     break;
01766 
01767   case 11:
01768 #line 215 "ast_expr2.y"
01769     { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01770                   DESTROY((yyvsp[(2) - (3)].val)); 
01771                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01772                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01773     break;
01774 
01775   case 12:
01776 #line 219 "ast_expr2.y"
01777     { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01778                   DESTROY((yyvsp[(2) - (3)].val)); 
01779                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01780                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01781     break;
01782 
01783   case 13:
01784 #line 223 "ast_expr2.y"
01785     { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01786                   DESTROY((yyvsp[(2) - (3)].val)); 
01787                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01788                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01789     break;
01790 
01791   case 14:
01792 #line 227 "ast_expr2.y"
01793     { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01794                   DESTROY((yyvsp[(2) - (3)].val)); 
01795                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01796                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01797     break;
01798 
01799   case 15:
01800 #line 231 "ast_expr2.y"
01801     { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01802                   DESTROY((yyvsp[(2) - (3)].val)); 
01803                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01804                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01805     break;
01806 
01807   case 16:
01808 #line 235 "ast_expr2.y"
01809     { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); 
01810                   DESTROY((yyvsp[(1) - (2)].val)); 
01811                            (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
01812                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01813     break;
01814 
01815   case 17:
01816 #line 239 "ast_expr2.y"
01817     { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); 
01818                   DESTROY((yyvsp[(1) - (2)].val)); 
01819                            (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
01820                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01821     break;
01822 
01823   case 18:
01824 #line 243 "ast_expr2.y"
01825     { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01826                   DESTROY((yyvsp[(2) - (3)].val)); 
01827                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01828                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01829     break;
01830 
01831   case 19:
01832 #line 247 "ast_expr2.y"
01833     { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01834                   DESTROY((yyvsp[(2) - (3)].val)); 
01835                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01836                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01837     break;
01838 
01839   case 20:
01840 #line 251 "ast_expr2.y"
01841     { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01842                   DESTROY((yyvsp[(2) - (3)].val)); 
01843                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01844                     (yyloc).first_line=0; (yyloc).last_line=0;;}
01845     break;
01846 
01847   case 21:
01848 #line 255 "ast_expr2.y"
01849     { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01850                   DESTROY((yyvsp[(2) - (3)].val)); 
01851                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01852                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01853     break;
01854 
01855   case 22:
01856 #line 259 "ast_expr2.y"
01857     { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
01858                   DESTROY((yyvsp[(2) - (3)].val)); 
01859                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
01860                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01861     break;
01862 
01863   case 23:
01864 #line 263 "ast_expr2.y"
01865     { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); 
01866                   DESTROY((yyvsp[(2) - (5)].val)); 
01867                   DESTROY((yyvsp[(4) - (5)].val)); 
01868                            (yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column; 
01869                      (yyloc).first_line=0; (yyloc).last_line=0;;}
01870     break;
01871 
01872 
01873 /* Line 1267 of yacc.c.  */
01874 #line 1875 "ast_expr2.c"
01875       default: break;
01876     }
01877   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01878 
01879   YYPOPSTACK (yylen);
01880   yylen = 0;
01881   YY_STACK_PRINT (yyss, yyssp);
01882 
01883   *++yyvsp = yyval;
01884   *++yylsp = yyloc;
01885 
01886   /* Now `shift' the result of the reduction.  Determine what state
01887      that goes to, based on the state we popped back to and the rule
01888      number reduced by.  */
01889 
01890   yyn = yyr1[yyn];
01891 
01892   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01893   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01894     yystate = yytable[yystate];
01895   else
01896     yystate = yydefgoto[yyn - YYNTOKENS];
01897 
01898   goto yynewstate;
01899 
01900 
01901 /*------------------------------------.
01902 | yyerrlab -- here on detecting error |
01903 `------------------------------------*/
01904 yyerrlab:
01905   /* If not already recovering from an error, report this error.  */
01906   if (!yyerrstatus)
01907     {
01908       ++yynerrs;
01909 #if ! YYERROR_VERBOSE
01910       yyerror (YY_("syntax error"));
01911 #else
01912       {
01913    YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01914    if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01915      {
01916        YYSIZE_T yyalloc = 2 * yysize;
01917        if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01918          yyalloc = YYSTACK_ALLOC_MAXIMUM;
01919        if (yymsg != yymsgbuf)
01920          YYSTACK_FREE (yymsg);
01921        yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01922        if (yymsg)
01923          yymsg_alloc = yyalloc;
01924        else
01925          {
01926       yymsg = yymsgbuf;
01927       yymsg_alloc = sizeof yymsgbuf;
01928          }
01929      }
01930 
01931    if (0 < yysize && yysize <= yymsg_alloc)
01932      {
01933        (void) yysyntax_error (yymsg, yystate, yychar);
01934        yyerror (yymsg);
01935      }
01936    else
01937      {
01938        yyerror (YY_("syntax error"));
01939        if (yysize != 0)
01940          goto yyexhaustedlab;
01941      }
01942       }
01943 #endif
01944     }
01945 
01946   yyerror_range[0] = yylloc;
01947 
01948   if (yyerrstatus == 3)
01949     {
01950       /* If just tried and failed to reuse look-ahead token after an
01951     error, discard it.  */
01952 
01953       if (yychar <= YYEOF)
01954    {
01955      /* Return failure if at end of input.  */
01956      if (yychar == YYEOF)
01957        YYABORT;
01958    }
01959       else
01960    {
01961      yydestruct ("Error: discarding",
01962             yytoken, &yylval, &yylloc);
01963      yychar = YYEMPTY;
01964    }
01965     }
01966 
01967   /* Else will try to reuse look-ahead token after shifting the error
01968      token.  */
01969   goto yyerrlab1;
01970 
01971 
01972 /*---------------------------------------------------.
01973 | yyerrorlab -- error raised explicitly by YYERROR.  |
01974 `---------------------------------------------------*/
01975 yyerrorlab:
01976 
01977   /* Pacify compilers like GCC when the user code never invokes
01978      YYERROR and the label yyerrorlab therefore never appears in user
01979      code.  */
01980   if (/*CONSTCOND*/ 0)
01981      goto yyerrorlab;
01982 
01983   yyerror_range[0] = yylsp[1-yylen];
01984   /* Do not reclaim the symbols of the rule which action triggered
01985      this YYERROR.  */
01986   YYPOPSTACK (yylen);
01987   yylen = 0;
01988   YY_STACK_PRINT (yyss, yyssp);
01989   yystate = *yyssp;
01990   goto yyerrlab1;
01991 
01992 
01993 /*-------------------------------------------------------------.
01994 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
01995 `-------------------------------------------------------------*/
01996 yyerrlab1:
01997   yyerrstatus = 3;   /* Each real token shifted decrements this.  */
01998 
01999   for (;;)
02000     {
02001       yyn = yypact[yystate];
02002       if (yyn != YYPACT_NINF)
02003    {
02004      yyn += YYTERROR;
02005      if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02006        {
02007          yyn = yytable[yyn];
02008          if (0 < yyn)
02009       break;
02010        }
02011    }
02012 
02013       /* Pop the current state because it cannot handle the error token.  */
02014       if (yyssp == yyss)
02015    YYABORT;
02016 
02017       yyerror_range[0] = *yylsp;
02018       yydestruct ("Error: popping",
02019         yystos[yystate], yyvsp, yylsp);
02020       YYPOPSTACK (1);
02021       yystate = *yyssp;
02022       YY_STACK_PRINT (yyss, yyssp);
02023     }
02024 
02025   if (yyn == YYFINAL)
02026     YYACCEPT;
02027 
02028   *++yyvsp = yylval;
02029 
02030   yyerror_range[1] = yylloc;
02031   /* Using YYLLOC is tempting, but would change the location of
02032      the look-ahead.  YYLOC is available though.  */
02033   YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
02034   *++yylsp = yyloc;
02035 
02036   /* Shift the error token.  */
02037   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02038 
02039   yystate = yyn;
02040   goto yynewstate;
02041 
02042 
02043 /*-------------------------------------.
02044 | yyacceptlab -- YYACCEPT comes here.  |
02045 `-------------------------------------*/
02046 yyacceptlab:
02047   yyresult = 0;
02048   goto yyreturn;
02049 
02050 /*-----------------------------------.
02051 | yyabortlab -- YYABORT comes here.  |
02052 `-----------------------------------*/
02053 yyabortlab:
02054   yyresult = 1;
02055   goto yyreturn;
02056 
02057 #ifndef yyoverflow
02058 /*-------------------------------------------------.
02059 | yyexhaustedlab -- memory exhaustion comes here.  |
02060 `-------------------------------------------------*/
02061 yyexhaustedlab:
02062   yyerror (YY_("memory exhausted"));
02063   yyresult = 2;
02064   /* Fall through.  */
02065 #endif
02066 
02067 yyreturn:
02068   if (yychar != YYEOF && yychar != YYEMPTY)
02069      yydestruct ("Cleanup: discarding lookahead",
02070        yytoken, &yylval, &yylloc);
02071   /* Do not reclaim the symbols of the rule which action triggered
02072      this YYABORT or YYACCEPT.  */
02073   YYPOPSTACK (yylen);
02074   YY_STACK_PRINT (yyss, yyssp);
02075   while (yyssp != yyss)
02076     {
02077       yydestruct ("Cleanup: popping",
02078         yystos[*yyssp], yyvsp, yylsp);
02079       YYPOPSTACK (1);
02080     }
02081 #ifndef yyoverflow
02082   if (yyss != yyssa)
02083     YYSTACK_FREE (yyss);
02084 #endif
02085 #if YYERROR_VERBOSE
02086   if (yymsg != yymsgbuf)
02087     YYSTACK_FREE (yymsg);
02088 #endif
02089   /* Make sure YYID is used.  */
02090   return YYID (yyresult);
02091 }

int yyparse (  ) 

static char* yystpcpy ( char *  yydest,
const char *  yysrc 
) [static]

Definition at line 1063 of file ast_expr2.c.

Referenced by yysyntax_error(), and yytnamerr().

01067 {
01068   char *yyd = yydest;
01069   const char *yys = yysrc;
01070 
01071   while ((*yyd++ = *yys++) != '\0')
01072     continue;
01073 
01074   return yyd - 1;
01075 }

static YYSIZE_T yystrlen ( char *  yystr  )  const [static]

Definition at line 1039 of file ast_expr2.c.

References YYSIZE_T.

Referenced by yysyntax_error(), and yytnamerr().

01042 {
01043   YYSIZE_T yylen;
01044   for (yylen = 0; yystr[yylen]; yylen++)
01045     continue;
01046   return yylen;
01047 }

static YYSIZE_T yysyntax_error ( char *  yyresult,
int  yystate,
int  yychar 
) [static]

Definition at line 1135 of file ast_expr2.c.

References YY_, YYLAST, YYNTOKENS, YYPACT_NINF, YYSIZE_MAXIMUM, YYSIZE_T, yystpcpy(), yystrlen(), YYTERROR, yytnamerr(), and YYTRANSLATE.

Referenced by yyparse().

01136 {
01137   int yyn = yypact[yystate];
01138 
01139   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01140     return 0;
01141   else
01142     {
01143       int yytype = YYTRANSLATE (yychar);
01144       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01145       YYSIZE_T yysize = yysize0;
01146       YYSIZE_T yysize1;
01147       int yysize_overflow = 0;
01148       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01149       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01150       int yyx;
01151 
01152 # if 0
01153       /* This is so xgettext sees the translatable formats that are
01154     constructed on the fly.  */
01155       YY_("syntax error, unexpected %s");
01156       YY_("syntax error, unexpected %s, expecting %s");
01157       YY_("syntax error, unexpected %s, expecting %s or %s");
01158       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01159       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01160 # endif
01161       char *yyfmt;
01162       char const *yyf;
01163       static char const yyunexpected[] = "syntax error, unexpected %s";
01164       static char const yyexpecting[] = ", expecting %s";
01165       static char const yyor[] = " or %s";
01166       char yyformat[sizeof yyunexpected
01167           + sizeof yyexpecting - 1
01168           + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01169              * (sizeof yyor - 1))];
01170       char const *yyprefix = yyexpecting;
01171 
01172       /* Start YYX at -YYN if negative to avoid negative indexes in
01173     YYCHECK.  */
01174       int yyxbegin = yyn < 0 ? -yyn : 0;
01175 
01176       /* Stay within bounds of both yycheck and yytname.  */
01177       int yychecklim = YYLAST - yyn + 1;
01178       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01179       int yycount = 1;
01180 
01181       yyarg[0] = yytname[yytype];
01182       yyfmt = yystpcpy (yyformat, yyunexpected);
01183 
01184       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01185    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01186      {
01187        if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01188          {
01189       yycount = 1;
01190       yysize = yysize0;
01191       yyformat[sizeof yyunexpected - 1] = '\0';
01192       break;
01193          }
01194        yyarg[yycount++] = yytname[yyx];
01195        yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01196        yysize_overflow |= (yysize1 < yysize);
01197        yysize = yysize1;
01198        yyfmt = yystpcpy (yyfmt, yyprefix);
01199        yyprefix = yyor;
01200      }
01201 
01202       yyf = YY_(yyformat);
01203       yysize1 = yysize + yystrlen (yyf);
01204       yysize_overflow |= (yysize1 < yysize);
01205       yysize = yysize1;
01206 
01207       if (yysize_overflow)
01208    return YYSIZE_MAXIMUM;
01209 
01210       if (yyresult)
01211    {
01212      /* Avoid sprintf, as that infringes on the user's name space.
01213         Don't have undefined behavior even if the translation
01214         produced a string with the wrong number of "%s"s.  */
01215      char *yyp = yyresult;
01216      int yyi = 0;
01217      while ((*yyp = *yyf) != '\0')
01218        {
01219          if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01220       {
01221         yyp += yytnamerr (yyp, yyarg[yyi++]);
01222         yyf += 2;
01223       }
01224          else
01225       {
01226         yyp++;
01227         yyf++;
01228       }
01229        }
01230    }
01231       return yysize;
01232     }
01233 }

static YYSIZE_T yytnamerr ( char *  yyres,
const char *  yystr 
) [static]

Definition at line 1088 of file ast_expr2.c.

References YYSIZE_T, yystpcpy(), and yystrlen().

Referenced by yysyntax_error().

01089 {
01090   if (*yystr == '"')
01091     {
01092       YYSIZE_T yyn = 0;
01093       char const *yyp = yystr;
01094 
01095       for (;;)
01096    switch (*++yyp)
01097      {
01098      case '\'':
01099      case ',':
01100        goto do_not_strip_quotes;
01101 
01102      case '\\':
01103        if (*++yyp != '\\')
01104          goto do_not_strip_quotes;
01105        /* Fall through.  */
01106      default:
01107        if (yyres)
01108          yyres[yyn] = *yyp;
01109        yyn++;
01110        break;
01111 
01112      case '"':
01113        if (yyres)
01114          yyres[yyn] = '\0';
01115        return yyn;
01116      }
01117     do_not_strip_quotes: ;
01118     }
01119 
01120   if (! yyres)
01121     return yystrlen (yystr);
01122 
01123   return yystpcpy (yyres, yystr) - yyres;
01124 }


Variable Documentation

char extra_error_message[4095]

Definition at line 3139 of file ast_expr2f.c.

int extra_error_message_supplied

Definition at line 3140 of file ast_expr2f.c.

const yytype_int8 yycheck[] [static]

Definition at line 721 of file ast_expr2.c.

const yytype_uint8 yydefact[] [static]

Definition at line 664 of file ast_expr2.c.

const yytype_int8 yydefgoto[] [static]

Initial value:

{
      -1,     5,     6
}

Definition at line 674 of file ast_expr2.c.

const yytype_int8 yypact[] [static]

Definition at line 682 of file ast_expr2.c.

const yytype_int8 yypgoto[] [static]

Initial value:

{
     -13,   -13,    -1
}

Definition at line 692 of file ast_expr2.c.

const yytype_uint8 yyr1[] [static]

Definition at line 646 of file ast_expr2.c.

const yytype_uint8 yyr2[] [static]

Definition at line 654 of file ast_expr2.c.

const yytype_uint8 yystos[] [static]

Definition at line 742 of file ast_expr2.c.

const yytype_uint8 yytable[] [static]

Definition at line 702 of file ast_expr2.c.

const char* const yytname[] [static]

Definition at line 624 of file ast_expr2.c.

const yytype_uint8 yytranslate[] [static]

Definition at line 556 of file ast_expr2.c.


Generated on Mon May 14 04:44:57 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1