mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
This commit is contained in:
203
main/ast_expr2.c
203
main/ast_expr2.c
@@ -2,20 +2,20 @@
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
||||
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
@@ -78,14 +78,14 @@
|
||||
/* Line 189 of yacc.c */
|
||||
#line 1 "ast_expr2.y"
|
||||
|
||||
/* Written by Pace Willisson (pace@blitz.com)
|
||||
/* Written by Pace Willisson (pace@blitz.com)
|
||||
* and placed in the public domain.
|
||||
*
|
||||
* Largely rewritten by J.T. Conklin (jtc@wimsey.com)
|
||||
*
|
||||
* And then overhauled twice by Steve Murphy (murf@digium.com)
|
||||
* to add double-quoted strings, allow mult. spaces, improve
|
||||
* error messages, and then to fold in a flex scanner for the
|
||||
* error messages, and then to fold in a flex scanner for the
|
||||
* yylex operation.
|
||||
*
|
||||
* $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $
|
||||
@@ -98,7 +98,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(STANDALONE) && !defined(STANDALONE2) \
|
||||
|
||||
|
||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#else
|
||||
#ifndef __USE_ISOC99
|
||||
@@ -337,7 +337,7 @@ enum node_type {
|
||||
AST_EXPR_NODE_COMMA, AST_EXPR_NODE_STRING, AST_EXPR_NODE_VAL
|
||||
} ;
|
||||
|
||||
struct expr_node
|
||||
struct expr_node
|
||||
{
|
||||
enum node_type type;
|
||||
struct val *val;
|
||||
@@ -355,7 +355,7 @@ struct parse_io
|
||||
yyscan_t scanner;
|
||||
struct ast_channel *chan;
|
||||
};
|
||||
|
||||
|
||||
static int chk_div __P((FP___TYPE, FP___TYPE));
|
||||
static int chk_minus __P((FP___TYPE, FP___TYPE, FP___TYPE));
|
||||
static int chk_plus __P((FP___TYPE, FP___TYPE, FP___TYPE));
|
||||
@@ -407,7 +407,7 @@ typedef struct yyltype
|
||||
define it here, we have no definition yet for YYSTYPE. */
|
||||
|
||||
int ast_yyerror(const char *,YYLTYPE *, struct parse_io *);
|
||||
|
||||
|
||||
/* I wanted to add args to the yyerror routine, so I could print out
|
||||
some useful info about the error. Not as easy as it looks, but it
|
||||
is possible. */
|
||||
@@ -1229,7 +1229,7 @@ int yydebug;
|
||||
# define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if YYERROR_VERBOSE
|
||||
|
||||
@@ -1440,7 +1440,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
||||
}
|
||||
}
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------.
|
||||
| Release the memory associated to this symbol. |
|
||||
@@ -2011,7 +2011,7 @@ yyreduce:
|
||||
if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
|
||||
((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
|
||||
else
|
||||
((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s;
|
||||
((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s;
|
||||
free((yyvsp[(1) - (1)].val));
|
||||
;}
|
||||
break;
|
||||
@@ -2022,7 +2022,7 @@ yyreduce:
|
||||
#line 382 "ast_expr2.y"
|
||||
{/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
|
||||
((struct parse_io *)parseio)->val->type = AST_EXPR_string;
|
||||
((struct parse_io *)parseio)->val->u.s = strdup("");
|
||||
((struct parse_io *)parseio)->val->u.s = strdup("");
|
||||
;}
|
||||
break;
|
||||
|
||||
@@ -2081,7 +2081,7 @@ yyreduce:
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 412 "ast_expr2.y"
|
||||
{ (yyval.val) = (yyvsp[(2) - (3)].val);
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;
|
||||
DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
|
||||
break;
|
||||
@@ -2091,8 +2091,8 @@ yyreduce:
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 416 "ast_expr2.y"
|
||||
{ (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2100,9 +2100,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 420 "ast_expr2.y"
|
||||
{ (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2111,7 +2111,7 @@ yyreduce:
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 424 "ast_expr2.y"
|
||||
{ (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
@@ -2121,7 +2121,7 @@ yyreduce:
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 428 "ast_expr2.y"
|
||||
{ (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
@@ -2130,9 +2130,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 432 "ast_expr2.y"
|
||||
{ (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2140,9 +2140,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 436 "ast_expr2.y"
|
||||
{ (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2150,9 +2150,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 440 "ast_expr2.y"
|
||||
{ (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2160,9 +2160,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 444 "ast_expr2.y"
|
||||
{ (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2170,9 +2170,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 448 "ast_expr2.y"
|
||||
{ (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2180,9 +2180,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 452 "ast_expr2.y"
|
||||
{ (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2190,9 +2190,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 456 "ast_expr2.y"
|
||||
{ (yyval.val) = op_negate ((yyvsp[(2) - (2)].val));
|
||||
DESTROY((yyvsp[(1) - (2)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
|
||||
{ (yyval.val) = op_negate ((yyvsp[(2) - (2)].val));
|
||||
DESTROY((yyvsp[(1) - (2)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2200,9 +2200,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 460 "ast_expr2.y"
|
||||
{ (yyval.val) = op_compl ((yyvsp[(2) - (2)].val));
|
||||
DESTROY((yyvsp[(1) - (2)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
|
||||
{ (yyval.val) = op_compl ((yyvsp[(2) - (2)].val));
|
||||
DESTROY((yyvsp[(1) - (2)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2210,9 +2210,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 464 "ast_expr2.y"
|
||||
{ (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2220,9 +2220,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 468 "ast_expr2.y"
|
||||
{ (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2230,9 +2230,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 472 "ast_expr2.y"
|
||||
{ (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2240,9 +2240,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 476 "ast_expr2.y"
|
||||
{ (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2250,9 +2250,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 480 "ast_expr2.y"
|
||||
{ (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2260,10 +2260,10 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 484 "ast_expr2.y"
|
||||
{ (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val));
|
||||
DESTROY((yyvsp[(2) - (5)].val));
|
||||
DESTROY((yyvsp[(4) - (5)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column;
|
||||
{ (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val));
|
||||
DESTROY((yyvsp[(2) - (5)].val));
|
||||
DESTROY((yyvsp[(4) - (5)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (5)]).first_column; (yyloc).last_column = (yylsp[(3) - (5)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2271,9 +2271,9 @@ yyreduce:
|
||||
|
||||
/* Line 1455 of yacc.c */
|
||||
#line 489 "ast_expr2.y"
|
||||
{ (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
{ (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
|
||||
DESTROY((yyvsp[(2) - (3)].val));
|
||||
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
|
||||
(yyloc).first_line=0; (yyloc).last_line=0;;}
|
||||
break;
|
||||
|
||||
@@ -2528,7 +2528,7 @@ make_number (FP___TYPE i)
|
||||
|
||||
vp->type = AST_EXPR_number;
|
||||
vp->u.i = i;
|
||||
return vp;
|
||||
return vp;
|
||||
}
|
||||
|
||||
static struct val *
|
||||
@@ -2556,7 +2556,7 @@ make_str (const char *s)
|
||||
}
|
||||
if (isint)
|
||||
vp->type = AST_EXPR_numeric_string;
|
||||
else
|
||||
else
|
||||
vp->type = AST_EXPR_string;
|
||||
|
||||
return vp;
|
||||
@@ -2565,12 +2565,12 @@ make_str (const char *s)
|
||||
|
||||
static void
|
||||
free_value (struct val *vp)
|
||||
{
|
||||
{
|
||||
if (vp==NULL) {
|
||||
return;
|
||||
}
|
||||
if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
|
||||
free (vp->u.s);
|
||||
free (vp->u.s);
|
||||
free(vp);
|
||||
}
|
||||
|
||||
@@ -2579,7 +2579,7 @@ static int
|
||||
to_number (struct val *vp)
|
||||
{
|
||||
FP___TYPE i;
|
||||
|
||||
|
||||
if (vp == NULL) {
|
||||
ast_log(LOG_WARNING,"vp==NULL in to_number()\n");
|
||||
return(0);
|
||||
@@ -2611,13 +2611,13 @@ strip_quotes(struct val *vp)
|
||||
{
|
||||
if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string)
|
||||
return;
|
||||
|
||||
|
||||
if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' )
|
||||
{
|
||||
char *f, *t;
|
||||
f = vp->u.s;
|
||||
t = vp->u.s;
|
||||
|
||||
|
||||
while( *f )
|
||||
{
|
||||
if( *f && *f != '"' )
|
||||
@@ -2672,7 +2672,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
||||
{
|
||||
va_list vars;
|
||||
va_start(vars,fmt);
|
||||
|
||||
|
||||
printf("LOG: lev:%d file:%s line:%d func: %s ",
|
||||
level, file, line, function);
|
||||
vprintf(fmt, vars);
|
||||
@@ -2685,14 +2685,14 @@ int main(int argc,char **argv) {
|
||||
char s[4096];
|
||||
char out[4096];
|
||||
FILE *infile;
|
||||
|
||||
|
||||
if( !argv[1] )
|
||||
exit(20);
|
||||
|
||||
|
||||
if( access(argv[1],F_OK)== 0 )
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
infile = fopen(argv[1],"r");
|
||||
if( !infile )
|
||||
{
|
||||
@@ -2703,7 +2703,7 @@ int main(int argc,char **argv) {
|
||||
{
|
||||
if( s[strlen(s)-1] == '\n' )
|
||||
s[strlen(s)-1] = 0;
|
||||
|
||||
|
||||
ret = ast_expr(s, out, sizeof(out), NULL);
|
||||
printf("Expression: %s Result: [%d] '%s'\n",
|
||||
s, ret, out);
|
||||
@@ -2733,7 +2733,7 @@ int main(int argc,char **argv) {
|
||||
static void destroy_arglist(struct expr_node *arglist)
|
||||
{
|
||||
struct expr_node *arglist_next;
|
||||
|
||||
|
||||
while (arglist)
|
||||
{
|
||||
arglist_next = arglist->right;
|
||||
@@ -2752,7 +2752,7 @@ static char *compose_func_args(struct expr_node *arglist)
|
||||
struct expr_node *t = arglist;
|
||||
char *argbuf;
|
||||
int total_len = 0;
|
||||
|
||||
|
||||
while (t) {
|
||||
if (t != arglist)
|
||||
total_len += 1; /* for the sep */
|
||||
@@ -2762,7 +2762,7 @@ static char *compose_func_args(struct expr_node *arglist)
|
||||
else
|
||||
total_len += strlen(t->val->u.s);
|
||||
}
|
||||
|
||||
|
||||
t = t->right;
|
||||
}
|
||||
total_len++; /* for the null */
|
||||
@@ -2772,10 +2772,10 @@ static char *compose_func_args(struct expr_node *arglist)
|
||||
t = arglist;
|
||||
while (t) {
|
||||
char numbuf[30];
|
||||
|
||||
|
||||
if (t != arglist)
|
||||
strcat(argbuf,",");
|
||||
|
||||
|
||||
if (t->val) {
|
||||
if (t->val->type == AST_EXPR_number) {
|
||||
sprintf(numbuf,FP___PRINTF,t->val->u.i);
|
||||
@@ -3055,7 +3055,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
|
||||
ast_log(LOG_WARNING,"Hey! chan is NULL.\n");
|
||||
if (!f)
|
||||
ast_log(LOG_WARNING,"Hey! could not find func %s.\n", funcname->u.s);
|
||||
|
||||
|
||||
if (f && chan) {
|
||||
if (f->read) {
|
||||
char workspace[512];
|
||||
@@ -3070,7 +3070,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
|
||||
ast_log(LOG_ERROR,"Error! Function '%s' cannot be read!\n", funcname->u.s);
|
||||
return (make_number ((FP___TYPE)0.0));
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Error! '%s' doesn't appear to be an available function!\n", funcname->u.s);
|
||||
return (make_number ((FP___TYPE)0.0));
|
||||
@@ -3101,7 +3101,7 @@ op_or (struct val *a, struct val *b)
|
||||
return (a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct val *
|
||||
op_and (struct val *a, struct val *b)
|
||||
{
|
||||
@@ -3118,11 +3118,11 @@ op_and (struct val *a, struct val *b)
|
||||
static struct val *
|
||||
op_eq (struct val *a, struct val *b)
|
||||
{
|
||||
struct val *r;
|
||||
struct val *r;
|
||||
|
||||
if (isstring (a) || isstring (b)) {
|
||||
to_string (a);
|
||||
to_string (b);
|
||||
to_string (b);
|
||||
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0));
|
||||
} else {
|
||||
#ifdef DEBUG_FOR_CONVERSIONS
|
||||
@@ -3397,7 +3397,7 @@ op_compl (struct val *a)
|
||||
{
|
||||
int v1 = 1;
|
||||
struct val *r;
|
||||
|
||||
|
||||
if( !a )
|
||||
{
|
||||
v1 = 0;
|
||||
@@ -3410,7 +3410,7 @@ op_compl (struct val *a)
|
||||
if( a->u.i == 0 )
|
||||
v1 = 0;
|
||||
break;
|
||||
|
||||
|
||||
case AST_EXPR_string:
|
||||
if( a->u.s == 0 )
|
||||
v1 = 0;
|
||||
@@ -3424,7 +3424,7 @@ op_compl (struct val *a)
|
||||
v1 = atoi(a->u.s);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AST_EXPR_numeric_string:
|
||||
if( a->u.s == 0 )
|
||||
v1 = 0;
|
||||
@@ -3440,7 +3440,7 @@ op_compl (struct val *a)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
r = make_number (!v1);
|
||||
free_value (a);
|
||||
return r;
|
||||
@@ -3511,7 +3511,7 @@ op_div (struct val *a, struct val *b)
|
||||
}
|
||||
|
||||
if (b->u.i == 0) {
|
||||
ast_log(LOG_WARNING, "division by zero\n");
|
||||
ast_log(LOG_WARNING, "division by zero\n");
|
||||
free_value(a);
|
||||
free_value(b);
|
||||
return make_number(INT_MAX);
|
||||
@@ -3525,7 +3525,7 @@ op_div (struct val *a, struct val *b)
|
||||
free_value (b);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static struct val *
|
||||
op_rem (struct val *a, struct val *b)
|
||||
{
|
||||
@@ -3551,7 +3551,7 @@ op_rem (struct val *a, struct val *b)
|
||||
free_value (b);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct val *
|
||||
op_colon (struct val *a, struct val *b)
|
||||
@@ -3574,7 +3574,7 @@ op_colon (struct val *a, struct val *b)
|
||||
ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
|
||||
free_value(a);
|
||||
free_value(b);
|
||||
return make_str("");
|
||||
return make_str("");
|
||||
}
|
||||
|
||||
/* compare string against pattern */
|
||||
@@ -3602,7 +3602,7 @@ op_colon (struct val *a, struct val *b)
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct val *
|
||||
op_eqtilde (struct val *a, struct val *b)
|
||||
@@ -3625,7 +3625,7 @@ op_eqtilde (struct val *a, struct val *b)
|
||||
ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf);
|
||||
free_value(a);
|
||||
free_value(b);
|
||||
return make_str("");
|
||||
return make_str("");
|
||||
}
|
||||
|
||||
/* compare string against pattern */
|
||||
@@ -3688,4 +3688,3 @@ op_tildetilde (struct val *a, struct val *b)
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user