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 WRAP_LIBC_MALLOC
#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 2728 of file ast_expr2.c.

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

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

Referenced by yyparse().

#define FP___PRINTF   "%.16g"

Definition at line 113 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 114 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 311 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 308 of file ast_expr2.c.

#define WRAP_LIBC_MALLOC

Definition at line 94 of file ast_expr2.c.

#define YY_ ( msgid   )     msgid

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

#define YY_REDUCE_PRINT ( Rule   ) 

Definition at line 1212 of file ast_expr2.c.

Referenced by yyparse().

#define YY_STACK_PRINT ( Bottom,
Top   ) 

Definition at line 1211 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 1210 of file ast_expr2.c.

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Definition at line 962 of file ast_expr2.c.

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Definition at line 961 of file ast_expr2.c.

Referenced by yyparse().

#define YYBACKUP ( Token,
Value   ) 

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

#define YYCOPY ( To,
From,
Count   ) 

Definition at line 702 of file ast_expr2.c.

#define YYDEBUG   0

Definition at line 423 of file ast_expr2.c.

#define yydebug   ast_yydebug

Definition at line 72 of file ast_expr2.c.

#define YYDPRINTF ( Args   ) 

Definition at line 1209 of file ast_expr2.c.

Referenced by yyparse().

#define YYEMPTY   (-2)

Definition at line 958 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYENABLE_NLS   0

Definition at line 313 of file ast_expr2.c.

#define YYEOF   0

Definition at line 959 of file ast_expr2.c.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 993 of file ast_expr2.c.

#define yyerrok   (yyerrstatus = 0)

Definition at line 956 of file ast_expr2.c.

#define YYERROR   goto yyerrorlab

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

#define YYERROR_VERBOSE   1

Definition at line 429 of file ast_expr2.c.

#define YYFAIL   goto yyerrlab

Definition at line 970 of file ast_expr2.c.

#define YYFINAL   11

Definition at line 732 of file ast_expr2.c.

Referenced by yyparse().

#define YYFREE   free

Definition at line 663 of file ast_expr2.c.

#define YYID (  )     (n)

Definition at line 587 of file ast_expr2.c.

Referenced by yyparse().

#define YYINITDEPTH   200

Definition at line 1218 of file ast_expr2.c.

Referenced by yyparse().

#define YYLAST   159

Definition at line 734 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

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

Definition at line 1041 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 315 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 1002 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 403 of file ast_expr2.c.

#define YYLTYPE_IS_TRIVIAL   1

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

#define YYMAXDEPTH   10000

Definition at line 1229 of file ast_expr2.c.

Referenced by yyparse().

#define YYMAXUTOK   280

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

#define YYNRULES   28

Definition at line 741 of file ast_expr2.c.

#define YYNSTATES   54

Definition at line 743 of file ast_expr2.c.

#define YYNTOKENS   26

Definition at line 737 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -18

Definition at line 882 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 314 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 972 of file ast_expr2.c.

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

Definition at line 1000 of file ast_expr2.c.

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

Definition at line 564 of file ast_expr2.c.

Referenced by yysyntax_error().

#define YYSIZE_T   unsigned int

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

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Definition at line 645 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYSTACK_BYTES (  ) 

Value:

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

Definition at line 691 of file ast_expr2.c.

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Definition at line 643 of file ast_expr2.c.

Referenced by yyparse().

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

Definition at line 687 of file ast_expr2.c.

#define YYSTACK_RELOCATE ( Stack_alloc,
Stack   ) 

Definition at line 718 of file ast_expr2.c.

Referenced by yyparse().

#define yystype   YYSTYPE

Definition at line 490 of file ast_expr2.c.

#define YYSTYPE_IS_DECLARED   1

Definition at line 491 of file ast_expr2.c.

#define YYSTYPE_IS_TRIVIAL   1

Definition at line 489 of file ast_expr2.c.

#define YYTABLE_NINF   -1

Definition at line 903 of file ast_expr2.c.

Referenced by yyparse().

#define YYTERROR   1

Definition at line 992 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0

Definition at line 436 of file ast_expr2.c.

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

Definition at line 749 of file ast_expr2.c.

Referenced by yyparse(), and yysyntax_error().

#define YYUNDEFTOK   2

Definition at line 746 of file ast_expr2.c.

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

Definition at line 580 of file ast_expr2.c.

Referenced by yydestruct().


Typedef Documentation

typedef void* yyscan_t

Definition at line 349 of file ast_expr2.c.

typedef short int yytype_int16

Definition at line 547 of file ast_expr2.c.

typedef short int yytype_int8

Definition at line 535 of file ast_expr2.c.

typedef unsigned short int yytype_uint16

Definition at line 541 of file ast_expr2.c.

typedef unsigned char yytype_uint8

Definition at line 526 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 336 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 320 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 445 of file ast_expr2.c.

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


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 2505 of file ast_expr2.c.

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

Referenced by yyparse().

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

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

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

Definition at line 3486 of file ast_expr2.c.

References QUAD_MIN.

Referenced by op_div().

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

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

Definition at line 3330 of file ast_expr2.c.

References chk_plus(), and QUAD_MIN.

Referenced by op_minus(), and op_negate().

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

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

Definition at line 3287 of file ast_expr2.c.

Referenced by chk_minus(), and op_plus().

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

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

Definition at line 3452 of file ast_expr2.c.

Referenced by op_times().

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

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

Definition at line 2752 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().

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

static void destroy_arglist ( struct expr_node arglist  )  [static]

Definition at line 2735 of file ast_expr2.c.

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

Referenced by yyparse().

02736 {
02737    struct expr_node *arglist_next;
02738    
02739    while (arglist)
02740    {
02741       arglist_next = arglist->right;
02742       if (arglist->val)
02743          free_value(arglist->val);
02744       arglist->val = 0;
02745       arglist->right = 0;
02746       free(arglist);
02747       arglist = arglist_next;
02748    }
02749 }

static void free_value ( struct val vp  )  [static]

Definition at line 2567 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, free, NULL, 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().

02568 {  
02569    if (vp==NULL) {
02570       return;
02571    }
02572    if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
02573       free (vp->u.s);   
02574    free(vp);
02575 }

static int is_really_num ( char *  str  )  [static]

Definition at line 2794 of file ast_expr2.c.

Referenced by op_func().

02795 {
02796    if ( strspn(str,"-0123456789.    ") == strlen(str))
02797       return 1;
02798    else
02799       return 0;
02800 }

static int is_zero_or_null ( struct val vp  )  [static]

Definition at line 2661 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().

02662 {
02663    if (vp->type == AST_EXPR_number) {
02664       return (vp->u.i == 0);
02665    } else {
02666       return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0));
02667    }
02668    /* NOTREACHED */
02669 }

static int isstring ( struct val vp  )  [static]

Definition at line 2653 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().

02654 {
02655    /* only TRUE if this string is not a valid number */
02656    return (vp->type == AST_EXPR_string);
02657 }

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

Definition at line 2519 of file ast_expr2.c.

References AST_EXPR_number, ast_log, val::i, LOG_WARNING, malloc, NULL, 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().

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

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

Definition at line 2535 of file ast_expr2.c.

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

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

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

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

Definition at line 3108 of file ast_expr2.c.

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

Referenced by yyparse().

03109 {
03110    if (is_zero_or_null (a) || is_zero_or_null (b)) {
03111       free_value (a);
03112       free_value (b);
03113       return (make_number ((FP___TYPE)0.0));
03114    } else {
03115       free_value (b);
03116       return (a);
03117    }
03118 }

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

Definition at line 3559 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().

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

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

Definition at line 3398 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().

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

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

Definition at line 3228 of file ast_expr2.c.

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

Referenced by yyparse().

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

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

Definition at line 3497 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().

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

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

Definition at line 3121 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().

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

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

Definition at line 3610 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().

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

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

Definition at line 2803 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(), NULL, ast_custom_function::read, result, expr_node::right, val::s, to_number(), val::u, and expr_node::val.

Referenced by yyparse().

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

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

Definition at line 3188 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().

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

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

Definition at line 3148 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().

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

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

Definition at line 3208 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().

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

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

Definition at line 3168 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().

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

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

Definition at line 3344 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().

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

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

Definition at line 3267 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().

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

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

Definition at line 3378 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().

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

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

Definition at line 3096 of file ast_expr2.c.

References free_value(), and is_zero_or_null().

Referenced by yyparse().

03097 {
03098    if (is_zero_or_null (a)) {
03099       free_value (a);
03100       return (b);
03101    } else {
03102       free_value (b);
03103       return (a);
03104    }
03105 }

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

Definition at line 3300 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().

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

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

Definition at line 3532 of file ast_expr2.c.

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

Referenced by yyparse().

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

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

Definition at line 3660 of file ast_expr2.c.

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

Referenced by yyparse().

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

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

Definition at line 3464 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().

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

static void strip_quotes ( struct val vp  )  [static]

Definition at line 2610 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().

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

static int to_number ( struct val vp  )  [static]

Definition at line 2579 of file ast_expr2.c.

References AST_EXPR_number, AST_EXPR_string, ast_log, errno, FP___TYPE, free, val::i, LOG_WARNING, NULL, 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().

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

static void to_string ( struct val vp  )  [static]

Definition at line 2633 of file ast_expr2.c.

References AST_EXPR_numeric_string, AST_EXPR_string, ast_log, FP___PRINTF, val::i, LOG_WARNING, malloc, NULL, val::s, tmp(), 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().

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

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

Definition at line 1456 of file ast_expr2.c.

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

Referenced by yyparse().

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

int yyparse ( void *  YYPARSE_PARAM  ) 

Definition at line 1715 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.

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

int yyparse (  ) 

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

Definition at line 1271 of file ast_expr2.c.

Referenced by yysyntax_error(), and yytnamerr().

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

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

Definition at line 1247 of file ast_expr2.c.

References YYSIZE_T.

Referenced by yysyntax_error(), and yytnamerr().

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

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

Definition at line 1343 of file ast_expr2.c.

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

Referenced by yyparse().

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

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

Definition at line 1296 of file ast_expr2.c.

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

Referenced by yysyntax_error().

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


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 924 of file ast_expr2.c.

const yytype_uint8 yydefact[] [static]

Definition at line 864 of file ast_expr2.c.

const yytype_int8 yydefgoto[] [static]

Initial value:

{
      -1,     5,    30,     6
}

Definition at line 875 of file ast_expr2.c.

const yytype_int16 yypact[] [static]

Definition at line 883 of file ast_expr2.c.

const yytype_int8 yypgoto[] [static]

Initial value:

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

Definition at line 894 of file ast_expr2.c.

const yytype_uint8 yyr1[] [static]

Definition at line 846 of file ast_expr2.c.

const yytype_uint8 yyr2[] [static]

Definition at line 854 of file ast_expr2.c.

const yytype_uint8 yystos[] [static]

Definition at line 946 of file ast_expr2.c.

const yytype_uint8 yytable[] [static]

Definition at line 904 of file ast_expr2.c.

const char* const yytname[] [static]

Definition at line 824 of file ast_expr2.c.

const yytype_uint8 yytranslate[] [static]

Definition at line 753 of file ast_expr2.c.


Generated on Thu Apr 16 06:28:55 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6