Sat Feb 11 06:34:09 2012

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 <math.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 "asterisk/pbx.h"

Include dependency graph for ast_expr2.c:

Go to the source code of this file.

Data Structures

struct  expr_node
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 FP___PRINTF   "%.16g"
#define FP___TYPE   double
#define QUAD_MAX   (0x7fffffffffffffffLL)
#define QUAD_MIN   (-0x7fffffffffffffffLL-1)
#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.4.1"
#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 YYENABLE_NLS   0
#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   11
#define YYFREE   free
#define YYID(n)   (n)
#define YYINITDEPTH   200
#define YYLAST   159
#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   280
#define yynerrs   ast_yynerrs
#define YYNNTS   4
#define YYNRULES   28
#define YYNSTATES   54
#define YYNTOKENS   26
#define YYPACT_NINF   -18
#define yyparse   ast_yyparse
#define YYPARSE_PARAM   parseio
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
#define YYPULL   1
#define YYPURE   1
#define YYPUSH   0
#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_alloc, 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  node_type { AST_EXPR_NODE_COMMA, AST_EXPR_NODE_STRING, AST_EXPR_NODE_VAL }
enum  valtype {
  AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string, AST_EXPR_number,
  AST_EXPR_numeric_string, AST_EXPR_string
}
enum  yytokentype {
  TOK_COMMA = 258, TOK_COLONCOLON = 259, TOK_COND = 260, TOK_OR = 261,
  TOK_AND = 262, TOK_NE = 263, TOK_LE = 264, TOK_GE = 265,
  TOK_LT = 266, TOK_GT = 267, TOK_EQ = 268, TOK_MINUS = 269,
  TOK_PLUS = 270, TOK_MOD = 271, TOK_DIV = 272, TOK_MULT = 273,
  TOK_COMPL = 274, TOK_TILDETILDE = 275, TOK_EQTILDE = 276, TOK_COLON = 277,
  TOK_LP = 278, TOK_RP = 279, TOKEN = 280, TOK_COMMA = 258,
  TOK_COLONCOLON = 259, TOK_COND = 260, TOK_OR = 261, TOK_AND = 262,
  TOK_NE = 263, TOK_LE = 264, TOK_GE = 265, TOK_LT = 266,
  TOK_GT = 267, TOK_EQ = 268, TOK_MINUS = 269, TOK_PLUS = 270,
  TOK_MOD = 271, TOK_DIV = 272, TOK_MULT = 273, TOK_COMPL = 274,
  TOK_TILDETILDE = 275, TOK_EQTILDE = 276, TOK_COLON = 277, TOK_LP = 278,
  TOK_RP = 279, TOKEN = 280, KW_CONTEXT = 258, LC = 259,
  RC = 260, LP = 261, RP = 262, SEMI = 263,
  EQ = 264, COMMA = 265, COLON = 266, AMPER = 267,
  BAR = 268, AT = 269, KW_MACRO = 270, KW_GLOBALS = 271,
  KW_IGNOREPAT = 272, KW_SWITCH = 273, KW_IF = 274, KW_IFTIME = 275,
  KW_ELSE = 276, KW_RANDOM = 277, KW_ABSTRACT = 278, KW_EXTEND = 279,
  EXTENMARK = 280, KW_GOTO = 281, KW_JUMP = 282, KW_RETURN = 283,
  KW_BREAK = 284, KW_CONTINUE = 285, KW_REGEXTEN = 286, KW_HINT = 287,
  KW_FOR = 288, KW_WHILE = 289, KW_CASE = 290, KW_PATTERN = 291,
  KW_DEFAULT = 292, KW_CATCH = 293, KW_SWITCHES = 294, KW_ESWITCHES = 295,
  KW_INCLUDES = 296, KW_LOCAL = 297, word = 298, KW_CONTEXT = 258,
  LC = 259, RC = 260, LP = 261, RP = 262,
  SEMI = 263, EQ = 264, COMMA = 265, COLON = 266,
  AMPER = 267, BAR = 268, AT = 269, KW_MACRO = 270,
  KW_GLOBALS = 271, KW_IGNOREPAT = 272, KW_SWITCH = 273, KW_IF = 274,
  KW_IFTIME = 275, KW_ELSE = 276, KW_RANDOM = 277, KW_ABSTRACT = 278,
  KW_EXTEND = 279, EXTENMARK = 280, KW_GOTO = 281, KW_JUMP = 282,
  KW_RETURN = 283, KW_BREAK = 284, KW_CONTINUE = 285, KW_REGEXTEN = 286,
  KW_HINT = 287, KW_FOR = 288, KW_WHILE = 289, KW_CASE = 290,
  KW_PATTERN = 291, KW_DEFAULT = 292, KW_CATCH = 293, KW_SWITCHES = 294,
  KW_ESWITCHES = 295, KW_INCLUDES = 296, KW_LOCAL = 297, word = 298
}

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_number __P ((FP___TYPE))
static void free_value __P ((struct val *))
static int chk_minus __P ((FP___TYPE, FP___TYPE, FP___TYPE))
static int chk_div __P ((FP___TYPE, FP___TYPE))
static struct expr_nodealloc_expr_node (enum node_type)
int ast_yyerror (const char *, YYLTYPE *, struct parse_io *)
static int chk_div (FP___TYPE a, FP___TYPE b)
static int chk_minus (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static int chk_plus (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static int chk_times (FP___TYPE a, FP___TYPE b, FP___TYPE r)
static char * compose_func_args (struct expr_node *arglist)
static void destroy_arglist (struct expr_node *arglist)
static void free_value (struct val *vp)
static int is_really_num (char *str)
static int is_zero_or_null (struct val *vp)
static int isstring (struct val *vp)
static struct valmake_number (FP___TYPE 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_func (struct val *funcname, struct expr_node *arglist, struct ast_channel *chan)
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_tildetilde (struct val *a, struct val *b)
static struct valop_times (struct val *a, struct val *b)
static void strip_quotes (struct val *vp)
static int to_number (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_int16 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 2724 of file ast_expr2.c.

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

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

Referenced by yyparse().

#define FP___PRINTF   "%.16g"

Definition at line 112 of file ast_expr2.c.

Referenced by ast_expr(), ast_str_expr(), compose_func_args(), and to_string().

#define FP___TYPE   double

Definition at line 113 of file ast_expr2.c.

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

#define QUAD_MAX   (0x7fffffffffffffffLL)

Definition at line 310 of file ast_expr2.c.

#define QUAD_MIN   (-0x7fffffffffffffffLL-1)

Note:
Oddly enough, some platforms have some ISO C99 functions, but not others, so we define the missing functions in terms of their mathematical identities.

Definition at line 307 of file ast_expr2.c.

#define YY_ ( msgid   )     msgid

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

#define YY_REDUCE_PRINT ( Rule   ) 

Definition at line 1211 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT ( Bottom,
Top   ) 

Definition at line 1210 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 1209 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 961 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 960 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP ( Token,
Value   ) 

Definition at line 973 of file ast_expr2.c.

#define YYBISON   1

Definition at line 46 of file ast_expr2.c.

#define YYBISON_VERSION   "2.4.1"

Definition at line 49 of file ast_expr2.c.

#define yychar   ast_yychar

Definition at line 71 of file ast_expr2.c.

Referenced by yyparse().

#define yyclearin   (yychar = YYEMPTY)

Definition at line 956 of file ast_expr2.c.

#define YYCOPY ( To,
From,
Count   ) 

Definition at line 701 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 422 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 72 of file ast_expr2.c.

#define YYDPRINTF ( Args   ) 

Definition at line 1208 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 957 of file ast_expr2.c.

Referenced by yyparse().

#define YYENABLE_NLS   0

Definition at line 312 of file ast_expr2.c.

#define YYEOF   0

Definition at line 958 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 992 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 955 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

Definition at line 962 of file ast_expr2.c.

#define yyerror   ast_yyerror

Definition at line 69 of file ast_expr2.c.

Referenced by yyparse().

#define YYERROR_VERBOSE   1

Definition at line 428 of file ast_expr2.c.

#define YYERROR_VERBOSE   1

Definition at line 428 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 969 of file ast_expr2.c.

#define YYFINAL   11

Definition at line 731 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 662 of file ast_expr2.c.

#define YYID (  )     (n)

Definition at line 586 of file ast_expr2.c.

Referenced by yyparse().

#define YYINITDEPTH   200

Definition at line 1217 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   159

Definition at line 733 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

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

Definition at line 1040 of file ast_expr2.c.

Referenced by yyparse().

#define yylex   ast_yylex

Definition at line 68 of file ast_expr2.c.

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

Definition at line 314 of file ast_expr2.c.

#define yylloc   ast_yylloc

Definition at line 74 of file ast_expr2.c.

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

#define YYLLOC_DEFAULT ( Current,
Rhs,
 ) 

Definition at line 1001 of file ast_expr2.c.

Referenced by yyparse().

#define YYLSP_NEEDED   1

Definition at line 64 of file ast_expr2.c.

#define YYLTYPE   yyltype

Definition at line 402 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

Definition at line 403 of file ast_expr2.c.

#define yylval   ast_yylval

Definition at line 70 of file ast_expr2.c.

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

#define YYMALLOC   malloc

Definition at line 655 of file ast_expr2.c.

#define YYMAXDEPTH   10000

Definition at line 1228 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   280

Definition at line 746 of file ast_expr2.c.

#define yynerrs   ast_yynerrs

Definition at line 73 of file ast_expr2.c.

Referenced by yyparse().

#define YYNNTS   4

Definition at line 738 of file ast_expr2.c.

#define YYNRULES   28

Definition at line 740 of file ast_expr2.c.

#define YYNSTATES   54

Definition at line 742 of file ast_expr2.c.

#define YYNTOKENS   26

Definition at line 736 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -18

Definition at line 881 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define yyparse   ast_yyparse

Definition at line 67 of file ast_expr2.c.

#define YYPARSE_PARAM   parseio

Definition at line 313 of file ast_expr2.c.

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

Referenced by yyparse().

#define YYPULL   1

Definition at line 61 of file ast_expr2.c.

#define YYPURE   1

Definition at line 55 of file ast_expr2.c.

#define YYPUSH   0

Definition at line 58 of file ast_expr2.c.

 
#define YYRECOVERING (  )     (!!yyerrstatus)

Definition at line 971 of file ast_expr2.c.

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

Definition at line 999 of file ast_expr2.c.

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

Definition at line 563 of file ast_expr2.c.

Referenced by yysyntax_error().

#define YYSIZE_T   unsigned int

Definition at line 559 of file ast_expr2.c.

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

#define YYSKELETON_NAME   "yacc.c"

Definition at line 52 of file ast_expr2.c.

#define YYSTACK_ALLOC   YYMALLOC

Definition at line 641 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

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

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 642 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 686 of file ast_expr2.c.

#define YYSTACK_RELOCATE ( Stack_alloc,
Stack   ) 

Definition at line 717 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 489 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 490 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 488 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 902 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 991 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0

Definition at line 435 of file ast_expr2.c.

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

Definition at line 748 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYUNDEFTOK   2

Definition at line 745 of file ast_expr2.c.

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

Definition at line 579 of file ast_expr2.c.

Referenced by yydestruct().


Typedef Documentation

typedef void* yyscan_t

Definition at line 348 of file ast_expr2.c.

typedef short int yytype_int16

Definition at line 546 of file ast_expr2.c.

typedef short int yytype_int8

Definition at line 534 of file ast_expr2.c.

typedef unsigned short int yytype_uint16

Definition at line 540 of file ast_expr2.c.

typedef unsigned char yytype_uint8

Definition at line 525 of file ast_expr2.c.


Enumeration Type Documentation

enum node_type

Enumerator:
AST_EXPR_NODE_COMMA 
AST_EXPR_NODE_STRING 
AST_EXPR_NODE_VAL 

Definition at line 335 of file ast_expr2.c.

enum valtype

Enumerator:
AST_EXPR_number 
AST_EXPR_numeric_string 
AST_EXPR_string 
AST_EXPR_number 
AST_EXPR_numeric_string 
AST_EXPR_string 

Definition at line 319 of file ast_expr2.c.

Enumerator:
TOK_COMMA 
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_TILDETILDE 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
TOK_COMMA 
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_TILDETILDE 
TOK_EQTILDE 
TOK_COLON 
TOK_LP 
TOK_RP 
TOKEN 
KW_CONTEXT 
LC 
RC 
LP 
RP 
SEMI 
EQ 
COMMA 
COLON 
AMPER 
BAR 
AT 
KW_MACRO 
KW_GLOBALS 
KW_IGNOREPAT 
KW_SWITCH 
KW_IF 
KW_IFTIME 
KW_ELSE 
KW_RANDOM 
KW_ABSTRACT 
KW_EXTEND 
EXTENMARK 
KW_GOTO 
KW_JUMP 
KW_RETURN 
KW_BREAK 
KW_CONTINUE 
KW_REGEXTEN 
KW_HINT 
KW_FOR 
KW_WHILE 
KW_CASE 
KW_PATTERN 
KW_DEFAULT 
KW_CATCH 
KW_SWITCHES 
KW_ESWITCHES 
KW_INCLUDES 
KW_LOCAL 
word 
KW_CONTEXT 
LC 
RC 
LP 
RP 
SEMI 
EQ 
COMMA 
COLON 
AMPER 
BAR 
AT 
KW_MACRO 
KW_GLOBALS 
KW_IGNOREPAT 
KW_SWITCH 
KW_IF 
KW_IFTIME 
KW_ELSE 
KW_RANDOM 
KW_ABSTRACT 
KW_EXTEND 
EXTENMARK 
KW_GOTO 
KW_JUMP 
KW_RETURN 
KW_BREAK 
KW_CONTINUE 
KW_REGEXTEN 
KW_HINT 
KW_FOR 
KW_WHILE 
KW_CASE 
KW_PATTERN 
KW_DEFAULT 
KW_CATCH 
KW_SWITCHES 
KW_ESWITCHES 
KW_INCLUDES 
KW_LOCAL 
word 

Definition at line 444 of file ast_expr2.c.

00444                     {
00445      TOK_COMMA = 258,
00446      TOK_COLONCOLON = 259,
00447      TOK_COND = 260,
00448      TOK_OR = 261,
00449      TOK_AND = 262,
00450      TOK_NE = 263,
00451      TOK_LE = 264,
00452      TOK_GE = 265,
00453      TOK_LT = 266,
00454      TOK_GT = 267,
00455      TOK_EQ = 268,
00456      TOK_MINUS = 269,
00457      TOK_PLUS = 270,
00458      TOK_MOD = 271,
00459      TOK_DIV = 272,
00460      TOK_MULT = 273,
00461      TOK_COMPL = 274,
00462      TOK_TILDETILDE = 275,
00463      TOK_EQTILDE = 276,
00464      TOK_COLON = 277,
00465      TOK_LP = 278,
00466      TOK_RP = 279,
00467      TOKEN = 280
00468    };


Function Documentation

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

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

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

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

static struct val* make_number __P ( (FP___TYPE)   )  [static, read]

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

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

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

static struct expr_node * alloc_expr_node ( enum node_type  nt  )  [static, read]

Definition at line 2504 of file ast_expr2.c.

References ast_log(), calloc, LOG_ERROR, and expr_node::type.

Referenced by yyparse().

02505 {
02506    struct expr_node *x = calloc(1,sizeof(struct expr_node));
02507    if (!x) {
02508       ast_log(LOG_ERROR, "Allocation for expr_node FAILED!!\n");
02509       return 0;
02510    }
02511    x->type = nt;
02512    return x;
02513 }

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

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

Definition at line 3482 of file ast_expr2.c.

References QUAD_MIN.

Referenced by op_div().

03483 {
03484    /* div by zero has been taken care of before */
03485    /* only QUAD_MIN / -1 causes overflow */
03486    if (a == QUAD_MIN && b == -1)
03487       return 1;
03488    /* everything else is OK */
03489    return 0;
03490 }

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

Definition at line 3326 of file ast_expr2.c.

References chk_plus(), and QUAD_MIN.

Referenced by op_minus(), and op_negate().

03327 {
03328    /* special case subtraction of QUAD_MIN */
03329    if (b == QUAD_MIN) {
03330       if (a >= 0)
03331          return 1;
03332       else
03333          return 0;
03334    }
03335    /* this is allowed for b != QUAD_MIN */
03336    return chk_plus (a, -b, r);
03337 }

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

Definition at line 3283 of file ast_expr2.c.

Referenced by chk_minus(), and op_plus().

03284 {
03285    /* sum of two positive numbers must be positive */
03286    if (a > 0 && b > 0 && r <= 0)
03287       return 1;
03288    /* sum of two negative numbers must be negative */
03289    if (a < 0 && b < 0 && r >= 0)
03290       return 1;
03291    /* all other cases are OK */
03292    return 0;
03293 }

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

Definition at line 3448 of file ast_expr2.c.

Referenced by op_times().

03449 {
03450    /* special case: first operand is 0, no overflow possible */
03451    if (a == 0)
03452       return 0;
03453    /* cerify that result of division matches second operand */
03454    if (r / a != b)
03455       return 1;
03456    return 0;
03457 }

static char* compose_func_args ( struct expr_node arglist  )  [static]

Definition at line 2748 of file ast_expr2.c.

References AST_EXPR_number, ast_log(), FP___PRINTF, val::i, LOG_NOTICE, malloc, expr_node::right, val::s, val::type, val::u, and expr_node::val.

Referenced by op_func().

02749 {
02750    struct expr_node *t = arglist;
02751    char *argbuf;
02752    int total_len = 0;
02753    
02754    while (t) {
02755       if (t != arglist)
02756          total_len += 1; /* for the sep */
02757       if (t->val) {
02758          if (t->val->type == AST_EXPR_number)
02759             total_len += 25; /* worst case */
02760          else
02761             total_len += strlen(t->val->u.s);
02762       }
02763       
02764       t = t->right;
02765    }
02766    total_len++; /* for the null */
02767    ast_log(LOG_NOTICE,"argbuf allocated %d bytes;\n", total_len);
02768    argbuf = malloc(total_len);
02769    argbuf[0] = 0;
02770    t = arglist;
02771    while (t) {
02772       char numbuf[30];
02773       
02774       if (t != arglist)
02775          strcat(argbuf,",");
02776       
02777       if (t->val) {
02778          if (t->val->type == AST_EXPR_number) {
02779             sprintf(numbuf,FP___PRINTF,t->val->u.i);
02780             strcat(argbuf,numbuf);
02781          } else
02782             strcat(argbuf,t->val->u.s);
02783       }
02784       t = t->right;
02785    }
02786    ast_log(LOG_NOTICE,"argbuf uses %d bytes;\n", (int) strlen(argbuf));
02787    return argbuf;
02788 }

static void destroy_arglist ( struct expr_node arglist  )  [static]

Definition at line 2731 of file ast_expr2.c.

References free, free_value(), expr_node::right, and expr_node::val.

Referenced by yyparse().

02732 {
02733    struct expr_node *arglist_next;
02734    
02735    while (arglist)
02736    {
02737       arglist_next = arglist->right;
02738       if (arglist->val)
02739          free_value(arglist->val);
02740       arglist->val = 0;
02741       arglist->right = 0;
02742       free(arglist);
02743       arglist = arglist_next;
02744    }
02745 }

static void free_value ( struct val vp  )  [static]

Definition at line 2563 of file ast_expr2.c.

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

Referenced by destroy_arglist(), 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_tildetilde(), op_times(), and yydestruct().

02564 {  
02565    if (vp==NULL) {
02566       return;
02567    }
02568    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
02569       free (vp->u.s);   
02570    free(vp);
02571 }

static int is_really_num ( char *  str  )  [static]

Definition at line 2790 of file ast_expr2.c.

Referenced by op_func().

02791 {
02792    if ( strspn(str,"-0123456789.    ") == strlen(str))
02793       return 1;
02794    else
02795       return 0;
02796 }

static int is_zero_or_null ( struct val vp  )  [static]

Definition at line 2657 of file ast_expr2.c.

References AST_EXPR_number, val::i, val::s, to_number(), val::type, and val::u.

Referenced by op_and(), and op_or().

02658 {
02659    if (vp->type == AST_EXPR_number) {
02660       return (vp->u.i == 0);
02661    } else {
02662       return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0));
02663    }
02664    /* NOTREACHED */
02665 }

static int isstring ( struct val vp  )  [static]

Definition at line 2649 of file ast_expr2.c.

References AST_EXPR_string, and val::type.

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

02650 {
02651    /* only TRUE if this string is not a valid number */
02652    return (vp->type == AST_EXPR_string);
02653 }

static struct val* make_number ( FP___TYPE  i  )  [static, read]

Definition at line 2518 of file ast_expr2.c.

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

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

02519 {
02520    struct val *vp;
02521 
02522    vp = (struct val *) malloc (sizeof (*vp));
02523    if (vp == NULL) {
02524       ast_log(LOG_WARNING, "malloc() failed\n");
02525       return(NULL);
02526    }
02527 
02528    vp->type = AST_EXPR_number;
02529    vp->u.i  = i;
02530    return vp; 
02531 }

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

Definition at line 2534 of file ast_expr2.c.

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

Referenced by op_colon(), op_eqtilde(), op_func(), op_tildetilde(), and yyparse().

02535 {
02536    struct val *vp;
02537    size_t i;
02538    int isint; /* this started out being a test for an integer, but then ended up being a test for a float */
02539 
02540    vp = (struct val *) malloc (sizeof (*vp));
02541    if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
02542       ast_log(LOG_WARNING,"malloc() failed\n");
02543       return(NULL);
02544    }
02545 
02546    for (i = 0, isint = (isdigit(s[0]) || s[0] == '-' || s[0]=='.'); isint && i < strlen(s); i++)
02547    {
02548       if (!isdigit(s[i]) && s[i] != '.') {
02549          isint = 0;
02550          break;
02551       }
02552    }
02553    if (isint)
02554       vp->type = AST_EXPR_numeric_string;
02555    else  
02556       vp->type = AST_EXPR_string;
02557 
02558    return vp;
02559 }

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

Definition at line 3104 of file ast_expr2.c.

References FP___TYPE, free_value(), is_zero_or_null(), and make_number().

Referenced by yyparse().

03105 {
03106    if (is_zero_or_null (a) || is_zero_or_null (b)) {
03107       free_value (a);
03108       free_value (b);
03109       return (make_number ((FP___TYPE)0.0));
03110    } else {
03111       free_value (b);
03112       return (a);
03113    }
03114 }

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

Definition at line 3555 of file ast_expr2.c.

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

Referenced by yyparse().

03556 {
03557    regex_t rp;
03558    regmatch_t rm[2];
03559    char errbuf[256];
03560    int eval;
03561    struct val *v;
03562 
03563    /* coerce to both arguments to strings */
03564    to_string(a);
03565    to_string(b);
03566    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
03567    strip_quotes(a);
03568    strip_quotes(b);
03569    /* compile regular expression */
03570    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
03571       regerror (eval, &rp, errbuf, sizeof(errbuf));
03572       ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
03573       free_value(a);
03574       free_value(b);
03575       return make_str("");    
03576    }
03577 
03578    /* compare string against pattern */
03579    /* remember that patterns are anchored to the beginning of the line */
03580    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 && rm[0].rm_so == 0) {
03581       if (rm[1].rm_so >= 0) {
03582          *(a->u.s + rm[1].rm_eo) = '\0';
03583          v = make_str (a->u.s + rm[1].rm_so);
03584 
03585       } else {
03586          v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
03587       }
03588    } else {
03589       if (rp.re_nsub == 0) {
03590          v = make_number ((FP___TYPE)0);
03591       } else {
03592          v = make_str ("");
03593       }
03594    }
03595 
03596    /* free arguments and pattern buffer */
03597    free_value (a);
03598    free_value (b);
03599    regfree (&rp);
03600 
03601    return v;
03602 }

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

Definition at line 3394 of file ast_expr2.c.

References AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string, free_value(), val::i, make_number(), val::s, val::type, and val::u.

Referenced by yyparse().

03395 {
03396    int v1 = 1;
03397    struct val *r;
03398    
03399    if( !a )
03400    {
03401       v1 = 0;
03402    }
03403    else
03404    {
03405       switch( a->type )
03406       {
03407       case AST_EXPR_number:
03408          if( a->u.i == 0 )
03409             v1 = 0;
03410          break;
03411          
03412       case AST_EXPR_string:
03413          if( a->u.s == 0 )
03414             v1 = 0;
03415          else
03416          {
03417             if( a->u.s[0] == 0 )
03418                v1 = 0;
03419             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
03420                v1 = 0;
03421             else
03422                v1 = atoi(a->u.s);
03423          }
03424          break;
03425          
03426       case AST_EXPR_numeric_string:
03427          if( a->u.s == 0 )
03428             v1 = 0;
03429          else
03430          {
03431             if( a->u.s[0] == 0 )
03432                v1 = 0;
03433             else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' )
03434                v1 = 0;
03435             else
03436                v1 = atoi(a->u.s);
03437          }
03438          break;
03439       }
03440    }
03441    
03442    r = make_number (!v1);
03443    free_value (a);
03444    return r;
03445 }

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

Definition at line 3224 of file ast_expr2.c.

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

Referenced by yyparse().

03225 {
03226    struct val *r;
03227 
03228    if( isstring(a) )
03229    {
03230       if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 )
03231       {
03232          free_value(a);
03233          free_value(c);
03234          r = b;
03235       }
03236       else
03237       {
03238          free_value(a);
03239          free_value(b);
03240          r = c;
03241       }
03242    }
03243    else
03244    {
03245       (void)to_number(a);
03246       if( a->u.i )
03247       {
03248          free_value(a);
03249          free_value(c);
03250          r = b;
03251       }
03252       else
03253       {
03254          free_value(a);
03255          free_value(b);
03256          r = c;
03257       }
03258    }
03259    return r;
03260 }

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

Definition at line 3493 of file ast_expr2.c.

References ast_log(), chk_div(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03494 {
03495    struct val *r;
03496 
03497    if (!to_number (a)) {
03498       free_value(a);
03499       free_value(b);
03500       if( !extra_error_message_supplied )
03501          ast_log(LOG_WARNING, "non-numeric argument\n");
03502       return make_number(0);
03503    } else if (!to_number (b)) {
03504       free_value(a);
03505       free_value(b);
03506       if( !extra_error_message_supplied )
03507          ast_log(LOG_WARNING, "non-numeric argument\n");
03508       return make_number(INT_MAX);
03509    }
03510 
03511    if (b->u.i == 0) {
03512       ast_log(LOG_WARNING, "division by zero\n");     
03513       free_value(a);
03514       free_value(b);
03515       return make_number(INT_MAX);
03516    }
03517 
03518    r = make_number (a->u.i / b->u.i);
03519    if (chk_div (a->u.i, b->u.i)) {
03520       ast_log(LOG_WARNING, "overflow\n");
03521    }
03522    free_value (a);
03523    free_value (b);
03524    return r;
03525 }

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

Definition at line 3117 of file ast_expr2.c.

References ast_log(), FP___TYPE, free_value(), val::i, isstring(), LOG_WARNING, make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03118 {
03119    struct val *r; 
03120 
03121    if (isstring (a) || isstring (b)) {
03122       to_string (a);
03123       to_string (b); 
03124       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0));
03125    } else {
03126 #ifdef DEBUG_FOR_CONVERSIONS
03127       char buffer[2000];
03128       sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
03129 #endif
03130       (void)to_number(a);
03131       (void)to_number(b);
03132 #ifdef DEBUG_FOR_CONVERSIONS
03133       ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
03134 #endif
03135       r = make_number ((FP___TYPE)(a->u.i == b->u.i));
03136    }
03137 
03138    free_value (a);
03139    free_value (b);
03140    return r;
03141 }

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

Definition at line 3606 of file ast_expr2.c.

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

Referenced by yyparse().

03607 {
03608    regex_t rp;
03609    regmatch_t rm[2];
03610    char errbuf[256];
03611    int eval;
03612    struct val *v;
03613 
03614    /* coerce to both arguments to strings */
03615    to_string(a);
03616    to_string(b);
03617    /* strip double quotes from both -- they'll screw up the pattern, and the search string starting at ^ */
03618    strip_quotes(a);
03619    strip_quotes(b);
03620    /* compile regular expression */
03621    if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
03622       regerror (eval, &rp, errbuf, sizeof(errbuf));
03623       ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
03624       free_value(a);
03625       free_value(b);
03626       return make_str("");    
03627    }
03628 
03629    /* compare string against pattern */
03630    /* remember that patterns are anchored to the beginning of the line */
03631    if (regexec(&rp, a->u.s, (size_t)2, rm, 0) == 0 ) {
03632       if (rm[1].rm_so >= 0) {
03633          *(a->u.s + rm[1].rm_eo) = '\0';
03634          v = make_str (a->u.s + rm[1].rm_so);
03635 
03636       } else {
03637          v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so));
03638       }
03639    } else {
03640       if (rp.re_nsub == 0) {
03641          v = make_number ((FP___TYPE)0.0);
03642       } else {
03643          v = make_str ("");
03644       }
03645    }
03646 
03647    /* free arguments and pattern buffer */
03648    free_value (a);
03649    free_value (b);
03650    regfree (&rp);
03651 
03652    return v;
03653 }

static struct val * op_func ( struct val funcname,
struct expr_node arglist,
struct ast_channel chan 
) [static, read]

Definition at line 2799 of file ast_expr2.c.

References ast_custom_function_find(), ast_log(), compose_func_args(), f, FP___TYPE, free, val::i, is_really_num(), LOG_ERROR, LOG_WARNING, make_number(), make_str(), ast_custom_function::read, expr_node::right, val::s, to_number(), val::u, and expr_node::val.

Referenced by yyparse().

02800 {
02801    if (strspn(funcname->u.s,"ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789") == strlen(funcname->u.s))
02802    {
02803       struct val *result;
02804       if (0) {
02805 #ifdef FUNC_COS
02806       } else if (strcmp(funcname->u.s,"COS") == 0) {
02807          if (arglist && !arglist->right && arglist->val){
02808             to_number(arglist->val);
02809             result = make_number(FUNC_COS(arglist->val->u.i));
02810             return result;
02811          } else {
02812             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02813             return make_number(0.0);
02814          }
02815 #endif
02816 #ifdef FUNC_SIN
02817       } else if (strcmp(funcname->u.s,"SIN") == 0) {
02818          if (arglist && !arglist->right && arglist->val){
02819             to_number(arglist->val);
02820             result = make_number(FUNC_SIN(arglist->val->u.i));
02821             return result;
02822          } else {
02823             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02824             return make_number(0.0);
02825          }
02826 #endif
02827 #ifdef FUNC_TAN
02828       } else if (strcmp(funcname->u.s,"TAN") == 0) {
02829          if (arglist && !arglist->right && arglist->val){
02830             to_number(arglist->val);
02831             result = make_number(FUNC_TAN(arglist->val->u.i));
02832             return result;
02833          } else {
02834             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02835             return make_number(0.0);
02836          }
02837 #endif
02838 #ifdef FUNC_ACOS
02839       } else if (strcmp(funcname->u.s,"ACOS") == 0) {
02840          if (arglist && !arglist->right && arglist->val){
02841             to_number(arglist->val);
02842             result = make_number(FUNC_ACOS(arglist->val->u.i));
02843             return result;
02844          } else {
02845             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02846             return make_number(0.0);
02847          }
02848 #endif
02849 #ifdef FUNC_ASIN
02850       } else if (strcmp(funcname->u.s,"ASIN") == 0) {
02851          if (arglist && !arglist->right && arglist->val){
02852             to_number(arglist->val);
02853             result = make_number(FUNC_ASIN(arglist->val->u.i));
02854             return result;
02855          } else {
02856             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02857             return make_number(0.0);
02858          }
02859 #endif
02860 #ifdef FUNC_ATAN
02861       } else if (strcmp(funcname->u.s,"ATAN") == 0) {
02862          if (arglist && !arglist->right && arglist->val){
02863             to_number(arglist->val);
02864             result = make_number(FUNC_ATAN(arglist->val->u.i));
02865             return result;
02866          } else {
02867             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02868             return make_number(0.0);
02869          }
02870 #endif
02871 #ifdef FUNC_ATAN2
02872       } else if (strcmp(funcname->u.s,"ATAN2") == 0) {
02873          if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
02874             to_number(arglist->val);
02875             to_number(arglist->right->val);
02876             result = make_number(FUNC_ATAN2(arglist->val->u.i, arglist->right->val->u.i));
02877             return result;
02878          } else {
02879             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02880             return make_number(0.0);
02881          }
02882 #endif
02883 #ifdef FUNC_POW
02884       } else if (strcmp(funcname->u.s,"POW") == 0) {
02885          if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
02886             to_number(arglist->val);
02887             to_number(arglist->right->val);
02888             result = make_number(FUNC_POW(arglist->val->u.i, arglist->right->val->u.i));
02889             return result;
02890          } else {
02891             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02892             return make_number(0.0);
02893          }
02894 #endif
02895 #ifdef FUNC_SQRT
02896       } else if (strcmp(funcname->u.s,"SQRT") == 0) {
02897          if (arglist && !arglist->right && arglist->val){
02898             to_number(arglist->val);
02899             result = make_number(FUNC_SQRT(arglist->val->u.i));
02900             return result;
02901          } else {
02902             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02903             return make_number(0.0);
02904          }
02905 #endif
02906 #ifdef FUNC_FLOOR
02907       } else if (strcmp(funcname->u.s,"FLOOR") == 0) {
02908          if (arglist && !arglist->right && arglist->val){
02909             to_number(arglist->val);
02910             result = make_number(FUNC_FLOOR(arglist->val->u.i));
02911             return result;
02912          } else {
02913             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02914             return make_number(0.0);
02915          }
02916 #endif
02917 #ifdef FUNC_CEIL
02918       } else if (strcmp(funcname->u.s,"CEIL") == 0) {
02919          if (arglist && !arglist->right && arglist->val){
02920             to_number(arglist->val);
02921             result = make_number(FUNC_CEIL(arglist->val->u.i));
02922             return result;
02923          } else {
02924             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02925             return make_number(0.0);
02926          }
02927 #endif
02928 #ifdef FUNC_ROUND
02929       } else if (strcmp(funcname->u.s,"ROUND") == 0) {
02930          if (arglist && !arglist->right && arglist->val){
02931             to_number(arglist->val);
02932             result = make_number(FUNC_ROUND(arglist->val->u.i));
02933             return result;
02934          } else {
02935             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02936             return make_number(0.0);
02937          }
02938 #endif /* defined(FUNC_ROUND) */
02939 #ifdef FUNC_RINT
02940       } else if (strcmp(funcname->u.s,"RINT") == 0) {
02941          if (arglist && !arglist->right && arglist->val){
02942             to_number(arglist->val);
02943             result = make_number(FUNC_RINT(arglist->val->u.i));
02944             return result;
02945          } else {
02946             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02947             return make_number(0.0);
02948          }
02949 #endif
02950 #ifdef FUNC_TRUNC
02951       } else if (strcmp(funcname->u.s,"TRUNC") == 0) {
02952          if (arglist && !arglist->right && arglist->val){
02953             to_number(arglist->val);
02954             result = make_number(FUNC_TRUNC(arglist->val->u.i));
02955             return result;
02956          } else {
02957             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02958             return make_number(0.0);
02959          }
02960 #endif /* defined(FUNC_TRUNC) */
02961 #ifdef FUNC_EXP
02962       } else if (strcmp(funcname->u.s,"EXP") == 0) {
02963          if (arglist && !arglist->right && arglist->val){
02964             to_number(arglist->val);
02965             result = make_number(FUNC_EXP(arglist->val->u.i));
02966             return result;
02967          } else {
02968             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02969             return make_number(0.0);
02970          }
02971 #endif
02972 #ifdef FUNC_EXP2
02973       } else if (strcmp(funcname->u.s,"EXP2") == 0) {
02974          if (arglist && !arglist->right && arglist->val){
02975             to_number(arglist->val);
02976             result = make_number(FUNC_EXP2(arglist->val->u.i));
02977             return result;
02978          } else {
02979             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02980             return make_number(0.0);
02981          }
02982 #endif
02983 #ifdef FUNC_EXP10
02984       } else if (strcmp(funcname->u.s,"EXP10") == 0) {
02985          if (arglist && !arglist->right && arglist->val){
02986             to_number(arglist->val);
02987             result = make_number(FUNC_EXP10(arglist->val->u.i));
02988             return result;
02989          } else {
02990             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
02991             return make_number(0.0);
02992          }
02993 #endif
02994 #ifdef FUNC_LOG
02995       } else if (strcmp(funcname->u.s,"LOG") == 0) {
02996          if (arglist && !arglist->right && arglist->val){
02997             to_number(arglist->val);
02998             result = make_number(FUNC_LOG(arglist->val->u.i));
02999             return result;
03000          } else {
03001             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
03002             return make_number(0.0);
03003          }
03004 #endif
03005 #ifdef FUNC_LOG2
03006       } else if (strcmp(funcname->u.s,"LOG2") == 0) {
03007          if (arglist && !arglist->right && arglist->val){
03008             to_number(arglist->val);
03009             result = make_number(FUNC_LOG2(arglist->val->u.i));
03010             return result;
03011          } else {
03012             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
03013             return make_number(0.0);
03014          }
03015 #endif
03016 #ifdef FUNC_LOG10
03017       } else if (strcmp(funcname->u.s,"LOG10") == 0) {
03018          if (arglist && !arglist->right && arglist->val){
03019             to_number(arglist->val);
03020             result = make_number(FUNC_LOG10(arglist->val->u.i));
03021             return result;
03022          } else {
03023             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
03024             return make_number(0.0);
03025          }
03026 #endif
03027 #ifdef FUNC_REMAINDER
03028       } else if (strcmp(funcname->u.s,"REMAINDER") == 0) {
03029          if (arglist && arglist->right && !arglist->right->right && arglist->val && arglist->right->val){
03030             to_number(arglist->val);
03031             to_number(arglist->right->val);
03032             result = make_number(FUNC_REMAINDER(arglist->val->u.i, arglist->right->val->u.i));
03033             return result;
03034          } else {
03035             ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
03036             return make_number(0.0);
03037          }
03038 #endif
03039       } else if (strcmp(funcname->u.s, "ABS") == 0) {
03040          if (arglist && !arglist->right && arglist->val) {
03041             to_number(arglist->val);
03042             result = make_number(arglist->val->u.i < 0 ? arglist->val->u.i * -1 : arglist->val->u.i);
03043             return result;
03044          } else {
03045             ast_log(LOG_WARNING, "Wrong args to %s() function\n", funcname->u.s);
03046             return make_number(0.0);
03047          }
03048       } else {
03049          /* is this a custom function we should execute and collect the results of? */
03050 #if !defined(STANDALONE) && !defined(STANDALONE2)
03051          struct ast_custom_function *f = ast_custom_function_find(funcname->u.s);
03052          if (!chan)
03053             ast_log(LOG_WARNING,"Hey! chan is NULL.\n");
03054          if (!f)
03055             ast_log(LOG_WARNING,"Hey! could not find func %s.\n", funcname->u.s);
03056          
03057          if (f && chan) {
03058             if (f->read) {
03059                char workspace[512];
03060                char *argbuf = compose_func_args(arglist);
03061                f->read(chan, funcname->u.s, argbuf, workspace, sizeof(workspace));
03062                free(argbuf);
03063                if (is_really_num(workspace))
03064                   return make_number(FUNC_STRTOD(workspace,(char **)NULL));
03065                else
03066                   return make_str(workspace);
03067             } else {
03068                ast_log(LOG_ERROR,"Error! Function '%s' cannot be read!\n", funcname->u.s);
03069                return (make_number ((FP___TYPE)0.0));
03070             }
03071             
03072          } else {
03073             ast_log(LOG_ERROR, "Error! '%s' doesn't appear to be an available function!\n", funcname->u.s);
03074             return (make_number ((FP___TYPE)0.0));
03075          }
03076 #else
03077          ast_log(LOG_ERROR, "Error! '%s' is not available in the standalone version!\n", funcname->u.s);
03078          return (make_number ((FP___TYPE)0.0));
03079 #endif
03080       }
03081    }
03082    else
03083    {
03084       ast_log(LOG_ERROR, "Error! '%s' is not possibly a function name!\n", funcname->u.s);
03085       return (make_number ((FP___TYPE)0.0));
03086    }
03087    return (make_number ((FP___TYPE)0.0));
03088 }

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

Definition at line 3184 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03185 {
03186    struct val *r;
03187 
03188    if (isstring (a) || isstring (b)) {
03189       to_string (a);
03190       to_string (b);
03191       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) >= 0));
03192    } else {
03193       (void)to_number(a);
03194       (void)to_number(b);
03195       r = make_number ((FP___TYPE)(a->u.i >= b->u.i));
03196    }
03197 
03198    free_value (a);
03199    free_value (b);
03200    return r;
03201 }

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

Definition at line 3144 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03145 {
03146    struct val *r;
03147 
03148    if (isstring (a) || isstring (b)) {
03149       to_string (a);
03150       to_string (b);
03151       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) > 0));
03152    } else {
03153       (void)to_number(a);
03154       (void)to_number(b);
03155       r = make_number ((FP___TYPE)(a->u.i > b->u.i));
03156    }
03157 
03158    free_value (a);
03159    free_value (b);
03160    return r;
03161 }

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

Definition at line 3204 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03205 {
03206    struct val *r;
03207 
03208    if (isstring (a) || isstring (b)) {
03209       to_string (a);
03210       to_string (b);
03211       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) <= 0));
03212    } else {
03213       (void)to_number(a);
03214       (void)to_number(b);
03215       r = make_number ((FP___TYPE)(a->u.i <= b->u.i));
03216    }
03217 
03218    free_value (a);
03219    free_value (b);
03220    return r;
03221 }

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

Definition at line 3164 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03165 {
03166    struct val *r;
03167 
03168    if (isstring (a) || isstring (b)) {
03169       to_string (a);
03170       to_string (b);
03171       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) < 0));
03172    } else {
03173       (void)to_number(a);
03174       (void)to_number(b);
03175       r = make_number ((FP___TYPE)(a->u.i < b->u.i));
03176    }
03177 
03178    free_value (a);
03179    free_value (b);
03180    return r;
03181 }

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

Definition at line 3340 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03341 {
03342    struct val *r;
03343 
03344    if (!to_number (a)) {
03345       if( !extra_error_message_supplied )
03346          ast_log(LOG_WARNING, "non-numeric argument\n");
03347       if (!to_number (b)) {
03348          free_value(a);
03349          free_value(b);
03350          return make_number(0);
03351       } else {
03352          r = make_number(0 - b->u.i);
03353          free_value(a);
03354          free_value(b);
03355          return (r);
03356       }
03357    } else if (!to_number(b)) {
03358       if( !extra_error_message_supplied )
03359          ast_log(LOG_WARNING, "non-numeric argument\n");
03360       free_value(b);
03361       return (a);
03362    }
03363 
03364    r = make_number (a->u.i - b->u.i);
03365    if (chk_minus (a->u.i, b->u.i, r->u.i)) {
03366       ast_log(LOG_WARNING, "overflow\n");
03367    }
03368    free_value (a);
03369    free_value (b);
03370    return r;
03371 }

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

Definition at line 3263 of file ast_expr2.c.

References FP___TYPE, free_value(), val::i, isstring(), make_number(), val::s, to_number(), to_string(), and val::u.

Referenced by yyparse().

03264 {
03265    struct val *r;
03266 
03267    if (isstring (a) || isstring (b)) {
03268       to_string (a);
03269       to_string (b);
03270       r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) != 0));
03271    } else {
03272       (void)to_number(a);
03273       (void)to_number(b);
03274       r = make_number ((FP___TYPE)(a->u.i != b->u.i));
03275    }
03276 
03277    free_value (a);
03278    free_value (b);
03279    return r;
03280 }

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

Definition at line 3374 of file ast_expr2.c.

References ast_log(), chk_minus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03375 {
03376    struct val *r;
03377 
03378    if (!to_number (a) ) {
03379       free_value(a);
03380       if( !extra_error_message_supplied )
03381          ast_log(LOG_WARNING, "non-numeric argument\n");
03382       return make_number(0);
03383    }
03384 
03385    r = make_number (- a->u.i);
03386    if (chk_minus (0, a->u.i, r->u.i)) {
03387       ast_log(LOG_WARNING, "overflow\n");
03388    }
03389    free_value (a);
03390    return r;
03391 }

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

Definition at line 3092 of file ast_expr2.c.

References free_value(), and is_zero_or_null().

Referenced by yyparse().

03093 {
03094    if (is_zero_or_null (a)) {
03095       free_value (a);
03096       return (b);
03097    } else {
03098       free_value (b);
03099       return (a);
03100    }
03101 }

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

Definition at line 3296 of file ast_expr2.c.

References ast_log(), chk_plus(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03297 {
03298    struct val *r;
03299 
03300    if (!to_number (a)) {
03301       if( !extra_error_message_supplied )
03302          ast_log(LOG_WARNING,"non-numeric argument\n");
03303       if (!to_number (b)) {
03304          free_value(a);
03305          free_value(b);
03306          return make_number(0);
03307       } else {
03308          free_value(a);
03309          return (b);
03310       }
03311    } else if (!to_number(b)) {
03312       free_value(b);
03313       return (a);
03314    }
03315 
03316    r = make_number (a->u.i + b->u.i);
03317    if (chk_plus (a->u.i, b->u.i, r->u.i)) {
03318       ast_log(LOG_WARNING,"overflow\n");
03319    }
03320    free_value (a);
03321    free_value (b);
03322    return r;
03323 }

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

Definition at line 3528 of file ast_expr2.c.

References ast_log(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03529 {
03530    struct val *r;
03531 
03532    if (!to_number (a) || !to_number (b)) {
03533       if( !extra_error_message_supplied )
03534          ast_log(LOG_WARNING, "non-numeric argument\n");
03535       free_value(a);
03536       free_value(b);
03537       return make_number(0);
03538    }
03539 
03540    if (b->u.i == 0) {
03541       ast_log(LOG_WARNING, "div by zero\n");
03542       free_value(a);
03543       return(b);
03544    }
03545 
03546    r = make_number (FUNC_FMOD(a->u.i, b->u.i)); /* either fmod or fmodl if FP___TYPE is available */
03547    /* chk_rem necessary ??? */
03548    free_value (a);
03549    free_value (b);
03550    return r;
03551 }

static struct val* op_tildetilde ( struct val a,
struct val b 
) [static, read]

Definition at line 3656 of file ast_expr2.c.

References free_value(), make_str(), malloc, val::s, strip_quotes(), to_string(), and val::u.

Referenced by yyparse().

03657 {
03658    struct val *v;
03659    char *vs;
03660 
03661    /* coerce to both arguments to strings */
03662    to_string(a);
03663    to_string(b);
03664    /* strip double quotes from both -- */
03665    strip_quotes(a);
03666    strip_quotes(b);
03667    
03668    vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
03669    strcpy(vs,a->u.s);
03670    strcat(vs,b->u.s);
03671 
03672    v = make_str(vs);
03673 
03674    /* free arguments */
03675    free_value(a);
03676    free_value(b);
03677 
03678    return v;
03679 }

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

Definition at line 3460 of file ast_expr2.c.

References ast_log(), chk_times(), free_value(), val::i, LOG_WARNING, make_number(), to_number(), and val::u.

Referenced by yyparse().

03461 {
03462    struct val *r;
03463 
03464    if (!to_number (a) || !to_number (b)) {
03465       free_value(a);
03466       free_value(b);
03467       if( !extra_error_message_supplied )
03468          ast_log(LOG_WARNING, "non-numeric argument\n");
03469       return(make_number(0));
03470    }
03471 
03472    r = make_number (a->u.i * b->u.i);
03473    if (chk_times (a->u.i, b->u.i, r->u.i)) {
03474       ast_log(LOG_WARNING, "overflow\n");
03475    }
03476    free_value (a);
03477    free_value (b);
03478    return (r);
03479 }

static void strip_quotes ( struct val vp  )  [static]

Definition at line 2606 of file ast_expr2.c.

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

Referenced by op_colon(), op_eqtilde(), and op_tildetilde().

02607 {
02608    if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
02609       return;
02610    
02611    if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
02612    {
02613       char *f, *t;
02614       f = vp->u.s;
02615       t = vp->u.s;
02616       
02617       while( *f )
02618       {
02619          if( *f  && *f != '"' )
02620             *t++ = *f++;
02621          else
02622             f++;
02623       }
02624       *t = *f;
02625    }
02626 }

static int to_number ( struct val vp  )  [static]

Definition at line 2575 of file ast_expr2.c.

References AST_EXPR_number, AST_EXPR_string, ast_log(), errno, FP___TYPE, 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_func(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_plus(), op_rem(), and op_times().

02576 {
02577    FP___TYPE i;
02578    
02579    if (vp == NULL) {
02580       ast_log(LOG_WARNING,"vp==NULL in to_number()\n");
02581       return(0);
02582    }
02583 
02584    if (vp->type == AST_EXPR_number)
02585       return 1;
02586 
02587    if (vp->type == AST_EXPR_string)
02588       return 0;
02589 
02590    /* vp->type == AST_EXPR_numeric_string, make it numeric */
02591    errno = 0;
02592    i  = FUNC_STRTOD(vp->u.s, (char**)0); /* either strtod, or strtold on a good day */
02593    if (errno != 0) {
02594       ast_log(LOG_WARNING,"Conversion of %s to number under/overflowed!\n", vp->u.s);
02595       free(vp->u.s);
02596       vp->u.s = 0;
02597       return(0);
02598    }
02599    free (vp->u.s);
02600    vp->u.i = i;
02601    vp->type = AST_EXPR_number;
02602    return 1;
02603 }

static void to_string ( struct val vp  )  [static]

Definition at line 2629 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, ast_log(), FP___PRINTF, 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(), op_ne(), and op_tildetilde().

02630 {
02631    char *tmp;
02632 
02633    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
02634       return;
02635 
02636    tmp = malloc ((size_t)25);
02637    if (tmp == NULL) {
02638       ast_log(LOG_WARNING,"malloc() failed\n");
02639       return;
02640    }
02641 
02642    sprintf(tmp, FP___PRINTF, vp->u.i);
02643    vp->type = AST_EXPR_string;
02644    vp->u.s  = tmp;
02645 }

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

Definition at line 1455 of file ast_expr2.c.

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

Referenced by yyparse().

01461 {
01462   YYUSE (yyvaluep);
01463   YYUSE (yylocationp);
01464 
01465   if (!yymsg)
01466     yymsg = "Deleting";
01467   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01468 
01469   switch (yytype)
01470     {
01471       case 4: /* "TOK_COLONCOLON" */
01472 
01473 /* Line 1000 of yacc.c  */
01474 #line 368 "ast_expr2.y"
01475    {  free_value((yyvaluep->val)); };
01476 
01477 /* Line 1000 of yacc.c  */
01478 #line 1479 "ast_expr2.c"
01479    break;
01480       case 5: /* "TOK_COND" */
01481 
01482 /* Line 1000 of yacc.c  */
01483 #line 368 "ast_expr2.y"
01484    {  free_value((yyvaluep->val)); };
01485 
01486 /* Line 1000 of yacc.c  */
01487 #line 1488 "ast_expr2.c"
01488    break;
01489       case 6: /* "TOK_OR" */
01490 
01491 /* Line 1000 of yacc.c  */
01492 #line 368 "ast_expr2.y"
01493    {  free_value((yyvaluep->val)); };
01494 
01495 /* Line 1000 of yacc.c  */
01496 #line 1497 "ast_expr2.c"
01497    break;
01498       case 7: /* "TOK_AND" */
01499 
01500 /* Line 1000 of yacc.c  */
01501 #line 368 "ast_expr2.y"
01502    {  free_value((yyvaluep->val)); };
01503 
01504 /* Line 1000 of yacc.c  */
01505 #line 1506 "ast_expr2.c"
01506    break;
01507       case 8: /* "TOK_NE" */
01508 
01509 /* Line 1000 of yacc.c  */
01510 #line 368 "ast_expr2.y"
01511    {  free_value((yyvaluep->val)); };
01512 
01513 /* Line 1000 of yacc.c  */
01514 #line 1515 "ast_expr2.c"
01515    break;
01516       case 9: /* "TOK_LE" */
01517 
01518 /* Line 1000 of yacc.c  */
01519 #line 368 "ast_expr2.y"
01520    {  free_value((yyvaluep->val)); };
01521 
01522 /* Line 1000 of yacc.c  */
01523 #line 1524 "ast_expr2.c"
01524    break;
01525       case 10: /* "TOK_GE" */
01526 
01527 /* Line 1000 of yacc.c  */
01528 #line 368 "ast_expr2.y"
01529    {  free_value((yyvaluep->val)); };
01530 
01531 /* Line 1000 of yacc.c  */
01532 #line 1533 "ast_expr2.c"
01533    break;
01534       case 11: /* "TOK_LT" */
01535 
01536 /* Line 1000 of yacc.c  */
01537 #line 368 "ast_expr2.y"
01538    {  free_value((yyvaluep->val)); };
01539 
01540 /* Line 1000 of yacc.c  */
01541 #line 1542 "ast_expr2.c"
01542    break;
01543       case 12: /* "TOK_GT" */
01544 
01545 /* Line 1000 of yacc.c  */
01546 #line 368 "ast_expr2.y"
01547    {  free_value((yyvaluep->val)); };
01548 
01549 /* Line 1000 of yacc.c  */
01550 #line 1551 "ast_expr2.c"
01551    break;
01552       case 13: /* "TOK_EQ" */
01553 
01554 /* Line 1000 of yacc.c  */
01555 #line 368 "ast_expr2.y"
01556    {  free_value((yyvaluep->val)); };
01557 
01558 /* Line 1000 of yacc.c  */
01559 #line 1560 "ast_expr2.c"
01560    break;
01561       case 14: /* "TOK_MINUS" */
01562 
01563 /* Line 1000 of yacc.c  */
01564 #line 368 "ast_expr2.y"
01565    {  free_value((yyvaluep->val)); };
01566 
01567 /* Line 1000 of yacc.c  */
01568 #line 1569 "ast_expr2.c"
01569    break;
01570       case 15: /* "TOK_PLUS" */
01571 
01572 /* Line 1000 of yacc.c  */
01573 #line 368 "ast_expr2.y"
01574    {  free_value((yyvaluep->val)); };
01575 
01576 /* Line 1000 of yacc.c  */
01577 #line 1578 "ast_expr2.c"
01578    break;
01579       case 16: /* "TOK_MOD" */
01580 
01581 /* Line 1000 of yacc.c  */
01582 #line 368 "ast_expr2.y"
01583    {  free_value((yyvaluep->val)); };
01584 
01585 /* Line 1000 of yacc.c  */
01586 #line 1587 "ast_expr2.c"
01587    break;
01588       case 17: /* "TOK_DIV" */
01589 
01590 /* Line 1000 of yacc.c  */
01591 #line 368 "ast_expr2.y"
01592    {  free_value((yyvaluep->val)); };
01593 
01594 /* Line 1000 of yacc.c  */
01595 #line 1596 "ast_expr2.c"
01596    break;
01597       case 18: /* "TOK_MULT" */
01598 
01599 /* Line 1000 of yacc.c  */
01600 #line 368 "ast_expr2.y"
01601    {  free_value((yyvaluep->val)); };
01602 
01603 /* Line 1000 of yacc.c  */
01604 #line 1605 "ast_expr2.c"
01605    break;
01606       case 19: /* "TOK_COMPL" */
01607 
01608 /* Line 1000 of yacc.c  */
01609 #line 368 "ast_expr2.y"
01610    {  free_value((yyvaluep->val)); };
01611 
01612 /* Line 1000 of yacc.c  */
01613 #line 1614 "ast_expr2.c"
01614    break;
01615       case 20: /* "TOK_TILDETILDE" */
01616 
01617 /* Line 1000 of yacc.c  */
01618 #line 368 "ast_expr2.y"
01619    {  free_value((yyvaluep->val)); };
01620 
01621 /* Line 1000 of yacc.c  */
01622 #line 1623 "ast_expr2.c"
01623    break;
01624       case 21: /* "TOK_EQTILDE" */
01625 
01626 /* Line 1000 of yacc.c  */
01627 #line 368 "ast_expr2.y"
01628    {  free_value((yyvaluep->val)); };
01629 
01630 /* Line 1000 of yacc.c  */
01631 #line 1632 "ast_expr2.c"
01632    break;
01633       case 22: /* "TOK_COLON" */
01634 
01635 /* Line 1000 of yacc.c  */
01636 #line 368 "ast_expr2.y"
01637    {  free_value((yyvaluep->val)); };
01638 
01639 /* Line 1000 of yacc.c  */
01640 #line 1641 "ast_expr2.c"
01641    break;
01642       case 23: /* "TOK_LP" */
01643 
01644 /* Line 1000 of yacc.c  */
01645 #line 368 "ast_expr2.y"
01646    {  free_value((yyvaluep->val)); };
01647 
01648 /* Line 1000 of yacc.c  */
01649 #line 1650 "ast_expr2.c"
01650    break;
01651       case 24: /* "TOK_RP" */
01652 
01653 /* Line 1000 of yacc.c  */
01654 #line 368 "ast_expr2.y"
01655    {  free_value((yyvaluep->val)); };
01656 
01657 /* Line 1000 of yacc.c  */
01658 #line 1659 "ast_expr2.c"
01659    break;
01660       case 25: /* "TOKEN" */
01661 
01662 /* Line 1000 of yacc.c  */
01663 #line 368 "ast_expr2.y"
01664    {  free_value((yyvaluep->val)); };
01665 
01666 /* Line 1000 of yacc.c  */
01667 #line 1668 "ast_expr2.c"
01668    break;
01669       case 29: /* "expr" */
01670 
01671 /* Line 1000 of yacc.c  */
01672 #line 368 "ast_expr2.y"
01673    {  free_value((yyvaluep->val)); };
01674 
01675 /* Line 1000 of yacc.c  */
01676 #line 1677 "ast_expr2.c"
01677    break;
01678 
01679       default:
01680    break;
01681     }
01682 }

int yyparse ( void *  YYPARSE_PARAM  ) 

Definition at line 1714 of file ast_expr2.c.

References alloc_expr_node(), YYSTYPE::arglist, AST_EXPR_NODE_VAL, AST_EXPR_number, AST_EXPR_string, calloc, DESTROY, destroy_arglist(), YYLTYPE::first_column, YYLTYPE::first_line, free, YYLTYPE::last_column, YYLTYPE::last_line, make_str(), op_and(), op_colon(), op_compl(), op_cond(), op_div(), op_eq(), op_eqtilde(), op_func(), op_ge(), op_gt(), op_le(), op_lt(), op_minus(), op_ne(), op_negate(), op_or(), op_plus(), op_rem(), op_tildetilde(), op_times(), expr_node::right, strdup, type, expr_node::val, 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_alloc, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_ALLOC_MAXIMUM, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, yysyntax_error(), YYTABLE_NINF, YYTERROR, YYTRANSLATE, and yyalloc::yyvs_alloc.

01728 {
01729 /* The lookahead symbol.  */
01730 int yychar;
01731 
01732 /* The semantic value of the lookahead symbol.  */
01733 YYSTYPE yylval;
01734 
01735 /* Location data for the lookahead symbol.  */
01736 YYLTYPE yylloc;
01737 
01738     /* Number of syntax errors so far.  */
01739     int yynerrs;
01740 
01741     int yystate;
01742     /* Number of tokens to shift before error messages enabled.  */
01743     int yyerrstatus;
01744 
01745     /* The stacks and their tools:
01746        `yyss': related to states.
01747        `yyvs': related to semantic values.
01748        `yyls': related to locations.
01749 
01750        Refer to the stacks thru separate pointers, to allow yyoverflow
01751        to reallocate them elsewhere.  */
01752 
01753     /* The state stack.  */
01754     yytype_int16 yyssa[YYINITDEPTH];
01755     yytype_int16 *yyss;
01756     yytype_int16 *yyssp;
01757 
01758     /* The semantic value stack.  */
01759     YYSTYPE yyvsa[YYINITDEPTH];
01760     YYSTYPE *yyvs;
01761     YYSTYPE *yyvsp;
01762 
01763     /* The location stack.  */
01764     YYLTYPE yylsa[YYINITDEPTH];
01765     YYLTYPE *yyls;
01766     YYLTYPE *yylsp;
01767 
01768     /* The locations where the error started and ended.  */
01769     YYLTYPE yyerror_range[2];
01770 
01771     YYSIZE_T yystacksize;
01772 
01773   int yyn;
01774   int yyresult;
01775   /* Lookahead token as an internal (translated) token number.  */
01776   int yytoken;
01777   /* The variables used to return semantic value and location from the
01778      action routines.  */
01779   YYSTYPE yyval;
01780   YYLTYPE yyloc;
01781 
01782 #if YYERROR_VERBOSE
01783   /* Buffer for error messages, and its allocated size.  */
01784   char yymsgbuf[128];
01785   char *yymsg = yymsgbuf;
01786   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01787 #endif
01788 
01789 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
01790 
01791   /* The number of symbols on the RHS of the reduced rule.
01792      Keep to zero when no symbol should be popped.  */
01793   int yylen = 0;
01794 
01795   yytoken = 0;
01796   yyss = yyssa;
01797   yyvs = yyvsa;
01798   yyls = yylsa;
01799   yystacksize = YYINITDEPTH;
01800 
01801   YYDPRINTF ((stderr, "Starting parse\n"));
01802 
01803   yystate = 0;
01804   yyerrstatus = 0;
01805   yynerrs = 0;
01806   yychar = YYEMPTY; /* Cause a token to be read.  */
01807 
01808   /* Initialize stack pointers.
01809      Waste one element of value and location stack
01810      so that they stay on the same level as the state stack.
01811      The wasted elements are never initialized.  */
01812   yyssp = yyss;
01813   yyvsp = yyvs;
01814   yylsp = yyls;
01815 
01816 #if YYLTYPE_IS_TRIVIAL
01817   /* Initialize the default location before parsing starts.  */
01818   yylloc.first_line   = yylloc.last_line   = 1;
01819   yylloc.first_column = yylloc.last_column = 1;
01820 #endif
01821 
01822   goto yysetstate;
01823 
01824 /*------------------------------------------------------------.
01825 | yynewstate -- Push a new state, which is found in yystate.  |
01826 `------------------------------------------------------------*/
01827  yynewstate:
01828   /* In all cases, when you get here, the value and location stacks
01829      have just been pushed.  So pushing a state here evens the stacks.  */
01830   yyssp++;
01831 
01832  yysetstate:
01833   *yyssp = yystate;
01834 
01835   if (yyss + yystacksize - 1 <= yyssp)
01836     {
01837       /* Get the current used size of the three stacks, in elements.  */
01838       YYSIZE_T yysize = yyssp - yyss + 1;
01839 
01840 #ifdef yyoverflow
01841       {
01842    /* Give user a chance to reallocate the stack.  Use copies of
01843       these so that the &'s don't force the real ones into
01844       memory.  */
01845    YYSTYPE *yyvs1 = yyvs;
01846    yytype_int16 *yyss1 = yyss;
01847    YYLTYPE *yyls1 = yyls;
01848 
01849    /* Each stack pointer address is followed by the size of the
01850       data in use in that stack, in bytes.  This used to be a
01851       conditional around just the two extra args, but that might
01852       be undefined if yyoverflow is a macro.  */
01853    yyoverflow (YY_("memory exhausted"),
01854           &yyss1, yysize * sizeof (*yyssp),
01855           &yyvs1, yysize * sizeof (*yyvsp),
01856           &yyls1, yysize * sizeof (*yylsp),
01857           &yystacksize);
01858 
01859    yyls = yyls1;
01860    yyss = yyss1;
01861    yyvs = yyvs1;
01862       }
01863 #else /* no yyoverflow */
01864 # ifndef YYSTACK_RELOCATE
01865       goto yyexhaustedlab;
01866 # else
01867       /* Extend the stack our own way.  */
01868       if (YYMAXDEPTH <= yystacksize)
01869    goto yyexhaustedlab;
01870       yystacksize *= 2;
01871       if (YYMAXDEPTH < yystacksize)
01872    yystacksize = YYMAXDEPTH;
01873 
01874       {
01875    yytype_int16 *yyss1 = yyss;
01876    union yyalloc *yyptr =
01877      (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01878    if (! yyptr)
01879      goto yyexhaustedlab;
01880    YYSTACK_RELOCATE (yyss_alloc, yyss);
01881    YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01882    YYSTACK_RELOCATE (yyls_alloc, yyls);
01883 #  undef YYSTACK_RELOCATE
01884    if (yyss1 != yyssa)
01885      YYSTACK_FREE (yyss1);
01886       }
01887 # endif
01888 #endif /* no yyoverflow */
01889 
01890       yyssp = yyss + yysize - 1;
01891       yyvsp = yyvs + yysize - 1;
01892       yylsp = yyls + yysize - 1;
01893 
01894       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01895         (unsigned long int) yystacksize));
01896 
01897       if (yyss + yystacksize - 1 <= yyssp)
01898    YYABORT;
01899     }
01900 
01901   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01902 
01903   if (yystate == YYFINAL)
01904     YYACCEPT;
01905 
01906   goto yybackup;
01907 
01908 /*-----------.
01909 | yybackup.  |
01910 `-----------*/
01911 yybackup:
01912 
01913   /* Do appropriate processing given the current state.  Read a
01914      lookahead token if we need one and don't already have one.  */
01915 
01916   /* First try to decide what to do without reference to lookahead token.  */
01917   yyn = yypact[yystate];
01918   if (yyn == YYPACT_NINF)
01919     goto yydefault;
01920 
01921   /* Not known => get a lookahead token if don't already have one.  */
01922 
01923   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01924   if (yychar == YYEMPTY)
01925     {
01926       YYDPRINTF ((stderr, "Reading a token: "));
01927       yychar = YYLEX;
01928     }
01929 
01930   if (yychar <= YYEOF)
01931     {
01932       yychar = yytoken = YYEOF;
01933       YYDPRINTF ((stderr, "Now at end of input.\n"));
01934     }
01935   else
01936     {
01937       yytoken = YYTRANSLATE (yychar);
01938       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01939     }
01940 
01941   /* If the proper action on seeing token YYTOKEN is to reduce or to
01942      detect an error, take that action.  */
01943   yyn += yytoken;
01944   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01945     goto yydefault;
01946   yyn = yytable[yyn];
01947   if (yyn <= 0)
01948     {
01949       if (yyn == 0 || yyn == YYTABLE_NINF)
01950    goto yyerrlab;
01951       yyn = -yyn;
01952       goto yyreduce;
01953     }
01954 
01955   /* Count tokens shifted since error; after three, turn off error
01956      status.  */
01957   if (yyerrstatus)
01958     yyerrstatus--;
01959 
01960   /* Shift the lookahead token.  */
01961   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01962 
01963   /* Discard the shifted token.  */
01964   yychar = YYEMPTY;
01965 
01966   yystate = yyn;
01967   *++yyvsp = yylval;
01968   *++yylsp = yylloc;
01969   goto yynewstate;
01970 
01971 
01972 /*-----------------------------------------------------------.
01973 | yydefault -- do the default action for the current state.  |
01974 `-----------------------------------------------------------*/
01975 yydefault:
01976   yyn = yydefact[yystate];
01977   if (yyn == 0)
01978     goto yyerrlab;
01979   goto yyreduce;
01980 
01981 
01982 /*-----------------------------.
01983 | yyreduce -- Do a reduction.  |
01984 `-----------------------------*/
01985 yyreduce:
01986   /* yyn is the number of a rule to reduce with.  */
01987   yylen = yyr2[yyn];
01988 
01989   /* If YYLEN is nonzero, implement the default value of the action:
01990      `$$ = $1'.
01991 
01992      Otherwise, the following line sets YYVAL to garbage.
01993      This behavior is undocumented and Bison
01994      users should not rely upon it.  Assigning to YYVAL
01995      unconditionally makes the parser a bit smaller, and it avoids a
01996      GCC warning that YYVAL may be used uninitialized.  */
01997   yyval = yyvsp[1-yylen];
01998 
01999   /* Default location.  */
02000   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
02001   YY_REDUCE_PRINT (yyn);
02002   switch (yyn)
02003     {
02004         case 2:
02005 
02006 /* Line 1455 of yacc.c  */
02007 #line 374 "ast_expr2.y"
02008     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
02009               ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
02010               if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
02011               ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
02012               else
02013               ((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s; 
02014            free((yyvsp[(1) - (1)].val));
02015          ;}
02016     break;
02017 
02018   case 3:
02019 
02020 /* Line 1455 of yacc.c  */
02021 #line 382 "ast_expr2.y"
02022     {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
02023               ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
02024            ((struct parse_io *)parseio)->val->u.s = strdup(""); 
02025          ;}
02026     break;
02027 
02028   case 4:
02029 
02030 /* Line 1455 of yacc.c  */
02031 #line 389 "ast_expr2.y"
02032     { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
02033     break;
02034 
02035   case 5:
02036 
02037 /* Line 1455 of yacc.c  */
02038 #line 390 "ast_expr2.y"
02039     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
02040                                  struct expr_node *t;
02041                          DESTROY((yyvsp[(2) - (3)].val));
02042                                  for (t=(yyvsp[(1) - (3)].arglist);t->right;t=t->right)
02043                                 ;
02044                                  (yyval.arglist) = (yyvsp[(1) - (3)].arglist); t->right = x; x->val = (yyvsp[(3) - (3)].val);;}
02045     break;
02046 
02047   case 6:
02048 
02049 /* Line 1455 of yacc.c  */
02050 #line 396 "ast_expr2.y"
02051     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
02052                                  struct expr_node *t;  /* NULL args should OK */
02053                          DESTROY((yyvsp[(2) - (2)].val));
02054                                  for (t=(yyvsp[(1) - (2)].arglist);t->right;t=t->right)
02055                                 ;
02056                                  (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");;}
02057     break;
02058 
02059   case 7:
02060 
02061 /* Line 1455 of yacc.c  */
02062 #line 405 "ast_expr2.y"
02063     { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
02064                                   DESTROY((yyvsp[(2) - (4)].val));
02065                            DESTROY((yyvsp[(4) - (4)].val));
02066                            DESTROY((yyvsp[(1) - (4)].val));
02067                            destroy_arglist((yyvsp[(3) - (4)].arglist));
02068                                   ;}
02069     break;
02070 
02071   case 8:
02072 
02073 /* Line 1455 of yacc.c  */
02074 #line 411 "ast_expr2.y"
02075     {(yyval.val) = (yyvsp[(1) - (1)].val);;}
02076     break;
02077 
02078   case 9:
02079 
02080 /* Line 1455 of yacc.c  */
02081 #line 412 "ast_expr2.y"
02082     { (yyval.val) = (yyvsp[(2) - (3)].val);
02083                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02084                      (yyloc).first_line=0; (yyloc).last_line=0;
02085                      DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
02086     break;
02087 
02088   case 10:
02089 
02090 /* Line 1455 of yacc.c  */
02091 #line 416 "ast_expr2.y"
02092     { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
02093                   DESTROY((yyvsp[(2) - (3)].val)); 
02094                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02095                    (yyloc).first_line=0; (yyloc).last_line=0;;}
02096     break;
02097 
02098   case 11:
02099 
02100 /* Line 1455 of yacc.c  */
02101 #line 420 "ast_expr2.y"
02102     { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02103                   DESTROY((yyvsp[(2) - (3)].val)); 
02104                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02105                           (yyloc).first_line=0; (yyloc).last_line=0;;}
02106     break;
02107 
02108   case 12:
02109 
02110 /* Line 1455 of yacc.c  */
02111 #line 424 "ast_expr2.y"
02112     { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
02113                   DESTROY((yyvsp[(2) - (3)].val)); 
02114                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
02115                    (yyloc).first_line=0; (yyloc).last_line=0;;}
02116     break;
02117 
02118   case 13:
02119 
02120 /* Line 1455 of yacc.c  */
02121 #line 428 "ast_expr2.y"
02122     { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
02123                   DESTROY((yyvsp[(2) - (3)].val)); 
02124                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
02125                    (yyloc).first_line=0; (yyloc).last_line=0;;}
02126     break;
02127 
02128   case 14:
02129 
02130 /* Line 1455 of yacc.c  */
02131 #line 432 "ast_expr2.y"
02132     { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02133                   DESTROY((yyvsp[(2) - (3)].val)); 
02134                         (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02135                    (yyloc).first_line=0; (yyloc).last_line=0;;}
02136     break;
02137 
02138   case 15:
02139 
02140 /* Line 1455 of yacc.c  */
02141 #line 436 "ast_expr2.y"
02142     { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02143                   DESTROY((yyvsp[(2) - (3)].val)); 
02144                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02145                     (yyloc).first_line=0; (yyloc).last_line=0;;}
02146     break;
02147 
02148   case 16:
02149 
02150 /* Line 1455 of yacc.c  */
02151 #line 440 "ast_expr2.y"
02152     { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02153                   DESTROY((yyvsp[(2) - (3)].val)); 
02154                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02155                     (yyloc).first_line=0; (yyloc).last_line=0;;}
02156     break;
02157 
02158   case 17:
02159 
02160 /* Line 1455 of yacc.c  */
02161 #line 444 "ast_expr2.y"
02162     { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02163                   DESTROY((yyvsp[(2) - (3)].val)); 
02164                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02165                     (yyloc).first_line=0; (yyloc).last_line=0;;}
02166     break;
02167 
02168   case 18:
02169 
02170 /* Line 1455 of yacc.c  */
02171 #line 448 "ast_expr2.y"
02172     { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02173                   DESTROY((yyvsp[(2) - (3)].val)); 
02174                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02175                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02176     break;
02177 
02178   case 19:
02179 
02180 /* Line 1455 of yacc.c  */
02181 #line 452 "ast_expr2.y"
02182     { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02183                   DESTROY((yyvsp[(2) - (3)].val)); 
02184                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02185                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02186     break;
02187 
02188   case 20:
02189 
02190 /* Line 1455 of yacc.c  */
02191 #line 456 "ast_expr2.y"
02192     { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); 
02193                   DESTROY((yyvsp[(1) - (2)].val)); 
02194                            (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
02195                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02196     break;
02197 
02198   case 21:
02199 
02200 /* Line 1455 of yacc.c  */
02201 #line 460 "ast_expr2.y"
02202     { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); 
02203                   DESTROY((yyvsp[(1) - (2)].val)); 
02204                            (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
02205                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02206     break;
02207 
02208   case 22:
02209 
02210 /* Line 1455 of yacc.c  */
02211 #line 464 "ast_expr2.y"
02212     { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02213                   DESTROY((yyvsp[(2) - (3)].val)); 
02214                           (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02215                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02216     break;
02217 
02218   case 23:
02219 
02220 /* Line 1455 of yacc.c  */
02221 #line 468 "ast_expr2.y"
02222     { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02223                   DESTROY((yyvsp[(2) - (3)].val)); 
02224                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02225                     (yyloc).first_line=0; (yyloc).last_line=0;;}
02226     break;
02227 
02228   case 24:
02229 
02230 /* Line 1455 of yacc.c  */
02231 #line 472 "ast_expr2.y"
02232     { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02233                   DESTROY((yyvsp[(2) - (3)].val)); 
02234                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02235                     (yyloc).first_line=0; (yyloc).last_line=0;;}
02236     break;
02237 
02238   case 25:
02239 
02240 /* Line 1455 of yacc.c  */
02241 #line 476 "ast_expr2.y"
02242     { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02243                   DESTROY((yyvsp[(2) - (3)].val)); 
02244                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02245                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02246     break;
02247 
02248   case 26:
02249 
02250 /* Line 1455 of yacc.c  */
02251 #line 480 "ast_expr2.y"
02252     { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02253                   DESTROY((yyvsp[(2) - (3)].val)); 
02254                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02255                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02256     break;
02257 
02258   case 27:
02259 
02260 /* Line 1455 of yacc.c  */
02261 #line 484 "ast_expr2.y"
02262     { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); 
02263                   DESTROY((yyvsp[(2) - (5)].val)); 
02264                   DESTROY((yyvsp[(4) - (5)].val)); 
02265                            (yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column; 
02266                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02267     break;
02268 
02269   case 28:
02270 
02271 /* Line 1455 of yacc.c  */
02272 #line 489 "ast_expr2.y"
02273     { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
02274                   DESTROY((yyvsp[(2) - (3)].val)); 
02275                            (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
02276                      (yyloc).first_line=0; (yyloc).last_line=0;;}
02277     break;
02278 
02279 
02280 
02281 /* Line 1455 of yacc.c  */
02282 #line 2283 "ast_expr2.c"
02283       default: break;
02284     }
02285   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02286 
02287   YYPOPSTACK (yylen);
02288   yylen = 0;
02289   YY_STACK_PRINT (yyss, yyssp);
02290 
02291   *++yyvsp = yyval;
02292   *++yylsp = yyloc;
02293 
02294   /* Now `shift' the result of the reduction.  Determine what state
02295      that goes to, based on the state we popped back to and the rule
02296      number reduced by.  */
02297 
02298   yyn = yyr1[yyn];
02299 
02300   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02301   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02302     yystate = yytable[yystate];
02303   else
02304     yystate = yydefgoto[yyn - YYNTOKENS];
02305 
02306   goto yynewstate;
02307 
02308 
02309 /*------------------------------------.
02310 | yyerrlab -- here on detecting error |
02311 `------------------------------------*/
02312 yyerrlab:
02313   /* If not already recovering from an error, report this error.  */
02314   if (!yyerrstatus)
02315     {
02316       ++yynerrs;
02317 #if ! YYERROR_VERBOSE
02318       yyerror (YY_("syntax error"));
02319 #else
02320       {
02321    YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
02322    if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02323      {
02324        YYSIZE_T yyalloc = 2 * yysize;
02325        if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
02326          yyalloc = YYSTACK_ALLOC_MAXIMUM;
02327        if (yymsg != yymsgbuf)
02328          YYSTACK_FREE (yymsg);
02329        yymsg = (char *) YYSTACK_ALLOC (yyalloc);
02330        if (yymsg)
02331          yymsg_alloc = yyalloc;
02332        else
02333          {
02334       yymsg = yymsgbuf;
02335       yymsg_alloc = sizeof yymsgbuf;
02336          }
02337      }
02338 
02339    if (0 < yysize && yysize <= yymsg_alloc)
02340      {
02341        (void) yysyntax_error (yymsg, yystate, yychar);
02342        yyerror (yymsg);
02343      }
02344    else
02345      {
02346        yyerror (YY_("syntax error"));
02347        if (yysize != 0)
02348          goto yyexhaustedlab;
02349      }
02350       }
02351 #endif
02352     }
02353 
02354   yyerror_range[0] = yylloc;
02355 
02356   if (yyerrstatus == 3)
02357     {
02358       /* If just tried and failed to reuse lookahead token after an
02359     error, discard it.  */
02360 
02361       if (yychar <= YYEOF)
02362    {
02363      /* Return failure if at end of input.  */
02364      if (yychar == YYEOF)
02365        YYABORT;
02366    }
02367       else
02368    {
02369      yydestruct ("Error: discarding",
02370             yytoken, &yylval, &yylloc);
02371      yychar = YYEMPTY;
02372    }
02373     }
02374 
02375   /* Else will try to reuse lookahead token after shifting the error
02376      token.  */
02377   goto yyerrlab1;
02378 
02379 
02380 /*---------------------------------------------------.
02381 | yyerrorlab -- error raised explicitly by YYERROR.  |
02382 `---------------------------------------------------*/
02383 yyerrorlab:
02384 
02385   /* Pacify compilers like GCC when the user code never invokes
02386      YYERROR and the label yyerrorlab therefore never appears in user
02387      code.  */
02388   if (/*CONSTCOND*/ 0)
02389      goto yyerrorlab;
02390 
02391   yyerror_range[0] = yylsp[1-yylen];
02392   /* Do not reclaim the symbols of the rule which action triggered
02393      this YYERROR.  */
02394   YYPOPSTACK (yylen);
02395   yylen = 0;
02396   YY_STACK_PRINT (yyss, yyssp);
02397   yystate = *yyssp;
02398   goto yyerrlab1;
02399 
02400 
02401 /*-------------------------------------------------------------.
02402 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
02403 `-------------------------------------------------------------*/
02404 yyerrlab1:
02405   yyerrstatus = 3;   /* Each real token shifted decrements this.  */
02406 
02407   for (;;)
02408     {
02409       yyn = yypact[yystate];
02410       if (yyn != YYPACT_NINF)
02411    {
02412      yyn += YYTERROR;
02413      if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02414        {
02415          yyn = yytable[yyn];
02416          if (0 < yyn)
02417       break;
02418        }
02419    }
02420 
02421       /* Pop the current state because it cannot handle the error token.  */
02422       if (yyssp == yyss)
02423    YYABORT;
02424 
02425       yyerror_range[0] = *yylsp;
02426       yydestruct ("Error: popping",
02427         yystos[yystate], yyvsp, yylsp);
02428       YYPOPSTACK (1);
02429       yystate = *yyssp;
02430       YY_STACK_PRINT (yyss, yyssp);
02431     }
02432 
02433   *++yyvsp = yylval;
02434 
02435   yyerror_range[1] = yylloc;
02436   /* Using YYLLOC is tempting, but would change the location of
02437      the lookahead.  YYLOC is available though.  */
02438   YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
02439   *++yylsp = yyloc;
02440 
02441   /* Shift the error token.  */
02442   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02443 
02444   yystate = yyn;
02445   goto yynewstate;
02446 
02447 
02448 /*-------------------------------------.
02449 | yyacceptlab -- YYACCEPT comes here.  |
02450 `-------------------------------------*/
02451 yyacceptlab:
02452   yyresult = 0;
02453   goto yyreturn;
02454 
02455 /*-----------------------------------.
02456 | yyabortlab -- YYABORT comes here.  |
02457 `-----------------------------------*/
02458 yyabortlab:
02459   yyresult = 1;
02460   goto yyreturn;
02461 
02462 #if !defined(yyoverflow) || YYERROR_VERBOSE
02463 /*-------------------------------------------------.
02464 | yyexhaustedlab -- memory exhaustion comes here.  |
02465 `-------------------------------------------------*/
02466 yyexhaustedlab:
02467   yyerror (YY_("memory exhausted"));
02468   yyresult = 2;
02469   /* Fall through.  */
02470 #endif
02471 
02472 yyreturn:
02473   if (yychar != YYEMPTY)
02474      yydestruct ("Cleanup: discarding lookahead",
02475        yytoken, &yylval, &yylloc);
02476   /* Do not reclaim the symbols of the rule which action triggered
02477      this YYABORT or YYACCEPT.  */
02478   YYPOPSTACK (yylen);
02479   YY_STACK_PRINT (yyss, yyssp);
02480   while (yyssp != yyss)
02481     {
02482       yydestruct ("Cleanup: popping",
02483         yystos[*yyssp], yyvsp, yylsp);
02484       YYPOPSTACK (1);
02485     }
02486 #ifndef yyoverflow
02487   if (yyss != yyssa)
02488     YYSTACK_FREE (yyss);
02489 #endif
02490 #if YYERROR_VERBOSE
02491   if (yymsg != yymsgbuf)
02492     YYSTACK_FREE (yymsg);
02493 #endif
02494   /* Make sure YYID is used.  */
02495   return YYID (yyresult);
02496 }

int yyparse (  ) 

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

Definition at line 1270 of file ast_expr2.c.

Referenced by yysyntax_error(), and yytnamerr().

01274 {
01275   char *yyd = yydest;
01276   const char *yys = yysrc;
01277 
01278   while ((*yyd++ = *yys++) != '\0')
01279     continue;
01280 
01281   return yyd - 1;
01282 }

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

Definition at line 1246 of file ast_expr2.c.

References YYSIZE_T.

Referenced by yysyntax_error(), and yytnamerr().

01249 {
01250   YYSIZE_T yylen;
01251   for (yylen = 0; yystr[yylen]; yylen++)
01252     continue;
01253   return yylen;
01254 }

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

Definition at line 1342 of file ast_expr2.c.

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

Referenced by yyparse().

01343 {
01344   int yyn = yypact[yystate];
01345 
01346   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01347     return 0;
01348   else
01349     {
01350       int yytype = YYTRANSLATE (yychar);
01351       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01352       YYSIZE_T yysize = yysize0;
01353       YYSIZE_T yysize1;
01354       int yysize_overflow = 0;
01355       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01356       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01357       int yyx;
01358 
01359 # if 0
01360       /* This is so xgettext sees the translatable formats that are
01361     constructed on the fly.  */
01362       YY_("syntax error, unexpected %s");
01363       YY_("syntax error, unexpected %s, expecting %s");
01364       YY_("syntax error, unexpected %s, expecting %s or %s");
01365       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01366       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01367 # endif
01368       char *yyfmt;
01369       char const *yyf;
01370       static char const yyunexpected[] = "syntax error, unexpected %s";
01371       static char const yyexpecting[] = ", expecting %s";
01372       static char const yyor[] = " or %s";
01373       char yyformat[sizeof yyunexpected
01374           + sizeof yyexpecting - 1
01375           + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01376              * (sizeof yyor - 1))];
01377       char const *yyprefix = yyexpecting;
01378 
01379       /* Start YYX at -YYN if negative to avoid negative indexes in
01380     YYCHECK.  */
01381       int yyxbegin = yyn < 0 ? -yyn : 0;
01382 
01383       /* Stay within bounds of both yycheck and yytname.  */
01384       int yychecklim = YYLAST - yyn + 1;
01385       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01386       int yycount = 1;
01387 
01388       yyarg[0] = yytname[yytype];
01389       yyfmt = yystpcpy (yyformat, yyunexpected);
01390 
01391       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01392    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01393      {
01394        if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01395          {
01396       yycount = 1;
01397       yysize = yysize0;
01398       yyformat[sizeof yyunexpected - 1] = '\0';
01399       break;
01400          }
01401        yyarg[yycount++] = yytname[yyx];
01402        yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01403        yysize_overflow |= (yysize1 < yysize);
01404        yysize = yysize1;
01405        yyfmt = yystpcpy (yyfmt, yyprefix);
01406        yyprefix = yyor;
01407      }
01408 
01409       yyf = YY_(yyformat);
01410       yysize1 = yysize + yystrlen (yyf);
01411       yysize_overflow |= (yysize1 < yysize);
01412       yysize = yysize1;
01413 
01414       if (yysize_overflow)
01415    return YYSIZE_MAXIMUM;
01416 
01417       if (yyresult)
01418    {
01419      /* Avoid sprintf, as that infringes on the user's name space.
01420         Don't have undefined behavior even if the translation
01421         produced a string with the wrong number of "%s"s.  */
01422      char *yyp = yyresult;
01423      int yyi = 0;
01424      while ((*yyp = *yyf) != '\0')
01425        {
01426          if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01427       {
01428         yyp += yytnamerr (yyp, yyarg[yyi++]);
01429         yyf += 2;
01430       }
01431          else
01432       {
01433         yyp++;
01434         yyf++;
01435       }
01436        }
01437    }
01438       return yysize;
01439     }
01440 }

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

Definition at line 1295 of file ast_expr2.c.

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

Referenced by yysyntax_error().

01296 {
01297   if (*yystr == '"')
01298     {
01299       YYSIZE_T yyn = 0;
01300       char const *yyp = yystr;
01301 
01302       for (;;)
01303    switch (*++yyp)
01304      {
01305      case '\'':
01306      case ',':
01307        goto do_not_strip_quotes;
01308 
01309      case '\\':
01310        if (*++yyp != '\\')
01311          goto do_not_strip_quotes;
01312        /* Fall through.  */
01313      default:
01314        if (yyres)
01315          yyres[yyn] = *yyp;
01316        yyn++;
01317        break;
01318 
01319      case '"':
01320        if (yyres)
01321          yyres[yyn] = '\0';
01322        return yyn;
01323      }
01324     do_not_strip_quotes: ;
01325     }
01326 
01327   if (! yyres)
01328     return yystrlen (yystr);
01329 
01330   return yystpcpy (yyres, yystr) - yyres;
01331 }


Variable Documentation

char extra_error_message[4095]

Definition at line 2474 of file ast_expr2f.c.

Definition at line 2475 of file ast_expr2f.c.

const yytype_int8 yycheck[] [static]

Definition at line 923 of file ast_expr2.c.

const yytype_uint8 yydefact[] [static]

Definition at line 863 of file ast_expr2.c.

const yytype_int8 yydefgoto[] [static]

Initial value:

{
      -1,     5,    30,     6
}

Definition at line 874 of file ast_expr2.c.

const yytype_int16 yypact[] [static]

Definition at line 882 of file ast_expr2.c.

const yytype_int8 yypgoto[] [static]

Initial value:

{
     -18,   -18,   -18,    -1
}

Definition at line 893 of file ast_expr2.c.

const yytype_uint8 yyr1[] [static]

Definition at line 845 of file ast_expr2.c.

const yytype_uint8 yyr2[] [static]

Definition at line 853 of file ast_expr2.c.

const yytype_uint8 yystos[] [static]

Definition at line 945 of file ast_expr2.c.

const yytype_uint8 yytable[] [static]

Definition at line 903 of file ast_expr2.c.

const char* const yytname[] [static]

Definition at line 823 of file ast_expr2.c.

const yytype_uint8 yytranslate[] [static]

Definition at line 752 of file ast_expr2.c.


Generated on Sat Feb 11 06:34:10 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6