Removing expr floating patch from 1.4; too much of a behavior change. If you want this fix, try trunk instead. bug 9508.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@73143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2007-07-03 20:17:31 +00:00
parent 7ba16c9878
commit ad36e954a7
6 changed files with 436 additions and 538 deletions

View File

@@ -110,7 +110,7 @@ ast_expr2f.c:
testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
rm ast_expr2.o ast_expr2f.o rm ast_expr2.o ast_expr2f.o
channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE) channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)

View File

@@ -129,33 +129,16 @@
* $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $ * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $
*/ */
#include "asterisk.h"
#ifndef STANDALONE
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#endif
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#ifdef STANDALONE /* I guess somewhere, the feature is set in the asterisk includes */
#ifndef __USE_ISOC99
#define __USE_ISOC99 1
#endif
#endif
#ifdef __USE_ISOC99
#define FP___PRINTF "%.16Lg"
#define FP___FMOD fmodl
#define FP___STRTOD strtold
#define FP___TYPE long double
#else
#define FP___PRINTF "%.8g"
#define FP___FMOD fmod
#define FP___STRTOD strtod
#define FP___TYPE double
#endif
#include <stdlib.h> #include <stdlib.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <string.h> #include <string.h>
#include <math.h>
#include <locale.h> #include <locale.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@@ -168,7 +151,6 @@
#include <regex.h> #include <regex.h>
#include <limits.h> #include <limits.h>
#include "asterisk.h"
#include "asterisk/ast_expr.h" #include "asterisk/ast_expr.h"
#include "asterisk/logger.h" #include "asterisk/logger.h"
@@ -185,7 +167,7 @@
# if ! defined(QUAD_MAX) # if ! defined(QUAD_MAX)
# define QUAD_MAX (0x7fffffffffffffffLL) # define QUAD_MAX (0x7fffffffffffffffLL)
# endif # endif
#define YYENABLE_NLS 0
#define YYPARSE_PARAM parseio #define YYPARSE_PARAM parseio
#define YYLEX_PARAM ((struct parse_io *)parseio)->scanner #define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
#define YYERROR_VERBOSE 1 #define YYERROR_VERBOSE 1
@@ -193,7 +175,7 @@ extern char extra_error_message[4095];
extern int extra_error_message_supplied; extern int extra_error_message_supplied;
enum valtype { enum valtype {
AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string
} ; } ;
#ifdef STANDALONE #ifdef STANDALONE
@@ -204,7 +186,7 @@ struct val {
enum valtype type; enum valtype type;
union { union {
char *s; char *s;
FP___TYPE i; /* either long double, or just double, on a bad day */ quad_t i;
} u; } u;
} ; } ;
@@ -217,14 +199,14 @@ struct parse_io
yyscan_t scanner; yyscan_t scanner;
}; };
static int chk_div __P((FP___TYPE, FP___TYPE)); static int chk_div __P((quad_t, quad_t));
static int chk_minus __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_minus __P((quad_t, quad_t, quad_t));
static int chk_plus __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_plus __P((quad_t, quad_t, quad_t));
static int chk_times __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_times __P((quad_t, quad_t, quad_t));
static void free_value __P((struct val *)); static void free_value __P((struct val *));
static int is_zero_or_null __P((struct val *)); static int is_zero_or_null __P((struct val *));
static int isstring __P((struct val *)); static int isstring __P((struct val *));
static struct val *make_number __P((FP___TYPE)); static struct val *make_integer __P((quad_t));
static struct val *make_str __P((const char *)); static struct val *make_str __P((const char *));
static struct val *op_and __P((struct val *, struct val *)); static struct val *op_and __P((struct val *, struct val *));
static struct val *op_colon __P((struct val *, struct val *)); static struct val *op_colon __P((struct val *, struct val *));
@@ -244,7 +226,7 @@ static struct val *op_or __P((struct val *, struct val *));
static struct val *op_plus __P((struct val *, struct val *)); static struct val *op_plus __P((struct val *, struct val *));
static struct val *op_rem __P((struct val *, struct val *)); static struct val *op_rem __P((struct val *, struct val *));
static struct val *op_times __P((struct val *, struct val *)); static struct val *op_times __P((struct val *, struct val *));
static int to_number __P((struct val *)); static quad_t to_integer __P((struct val *));
static void to_string __P((struct val *)); static void to_string __P((struct val *));
/* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */ /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */
@@ -292,12 +274,12 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *);
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
#line 165 "ast_expr2.y" #line 147 "ast_expr2.y"
{ {
struct val *val; struct val *val;
} }
/* Line 198 of yacc.c. */ /* Line 198 of yacc.c. */
#line 301 "ast_expr2.c" #line 283 "ast_expr2.c"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
@@ -319,13 +301,13 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
#line 169 "ast_expr2.y" #line 151 "ast_expr2.y"
extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t)); extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
/* Line 221 of yacc.c. */ /* Line 221 of yacc.c. */
#line 329 "ast_expr2.c" #line 311 "ast_expr2.c"
#ifdef short #ifdef short
# undef short # undef short
@@ -618,9 +600,9 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 193, 193, 201, 208, 209, 213, 217, 221, 225, 0, 175, 175, 183, 190, 191, 195, 199, 203, 207,
229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247,
269, 273, 277, 281 251, 255, 259, 263
}; };
#endif #endif
@@ -1269,114 +1251,114 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
switch (yytype) switch (yytype)
{ {
case 3: /* "TOK_COLONCOLON" */ case 3: /* "TOK_COLONCOLON" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1275 "ast_expr2.c" #line 1257 "ast_expr2.c"
break; break;
case 4: /* "TOK_COND" */ case 4: /* "TOK_COND" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1280 "ast_expr2.c" #line 1262 "ast_expr2.c"
break; break;
case 5: /* "TOK_OR" */ case 5: /* "TOK_OR" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1285 "ast_expr2.c" #line 1267 "ast_expr2.c"
break; break;
case 6: /* "TOK_AND" */ case 6: /* "TOK_AND" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1290 "ast_expr2.c" #line 1272 "ast_expr2.c"
break; break;
case 7: /* "TOK_NE" */ case 7: /* "TOK_NE" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1295 "ast_expr2.c" #line 1277 "ast_expr2.c"
break; break;
case 8: /* "TOK_LE" */ case 8: /* "TOK_LE" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1300 "ast_expr2.c" #line 1282 "ast_expr2.c"
break; break;
case 9: /* "TOK_GE" */ case 9: /* "TOK_GE" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1305 "ast_expr2.c" #line 1287 "ast_expr2.c"
break; break;
case 10: /* "TOK_LT" */ case 10: /* "TOK_LT" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1310 "ast_expr2.c" #line 1292 "ast_expr2.c"
break; break;
case 11: /* "TOK_GT" */ case 11: /* "TOK_GT" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1315 "ast_expr2.c" #line 1297 "ast_expr2.c"
break; break;
case 12: /* "TOK_EQ" */ case 12: /* "TOK_EQ" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1320 "ast_expr2.c" #line 1302 "ast_expr2.c"
break; break;
case 13: /* "TOK_MINUS" */ case 13: /* "TOK_MINUS" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1325 "ast_expr2.c" #line 1307 "ast_expr2.c"
break; break;
case 14: /* "TOK_PLUS" */ case 14: /* "TOK_PLUS" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1330 "ast_expr2.c" #line 1312 "ast_expr2.c"
break; break;
case 15: /* "TOK_MOD" */ case 15: /* "TOK_MOD" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1335 "ast_expr2.c" #line 1317 "ast_expr2.c"
break; break;
case 16: /* "TOK_DIV" */ case 16: /* "TOK_DIV" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1340 "ast_expr2.c" #line 1322 "ast_expr2.c"
break; break;
case 17: /* "TOK_MULT" */ case 17: /* "TOK_MULT" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1345 "ast_expr2.c" #line 1327 "ast_expr2.c"
break; break;
case 18: /* "TOK_COMPL" */ case 18: /* "TOK_COMPL" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1350 "ast_expr2.c" #line 1332 "ast_expr2.c"
break; break;
case 19: /* "TOK_EQTILDE" */ case 19: /* "TOK_EQTILDE" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1355 "ast_expr2.c" #line 1337 "ast_expr2.c"
break; break;
case 20: /* "TOK_COLON" */ case 20: /* "TOK_COLON" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1360 "ast_expr2.c" #line 1342 "ast_expr2.c"
break; break;
case 21: /* "TOK_LP" */ case 21: /* "TOK_LP" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1365 "ast_expr2.c" #line 1347 "ast_expr2.c"
break; break;
case 22: /* "TOK_RP" */ case 22: /* "TOK_RP" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1370 "ast_expr2.c" #line 1352 "ast_expr2.c"
break; break;
case 23: /* "TOKEN" */ case 23: /* "TOKEN" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1375 "ast_expr2.c" #line 1357 "ast_expr2.c"
break; break;
case 26: /* "expr" */ case 26: /* "expr" */
#line 187 "ast_expr2.y" #line 169 "ast_expr2.y"
{ free_value((yyvaluep->val)); }; { free_value((yyvaluep->val)); };
#line 1380 "ast_expr2.c" #line 1362 "ast_expr2.c"
break; break;
default: default:
@@ -1699,10 +1681,10 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 2: case 2:
#line 193 "ast_expr2.y" #line 175 "ast_expr2.y"
{ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type; ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number ) if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_integer )
((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i; ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i;
else 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;
@@ -1711,7 +1693,7 @@ yyreduce:
break; break;
case 3: case 3:
#line 201 "ast_expr2.y" #line 183 "ast_expr2.y"
{/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); {/* 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->type = AST_EXPR_string;
((struct parse_io *)parseio)->val->u.s = strdup(""); ((struct parse_io *)parseio)->val->u.s = strdup("");
@@ -1719,12 +1701,12 @@ yyreduce:
break; break;
case 4: case 4:
#line 208 "ast_expr2.y" #line 190 "ast_expr2.y"
{ (yyval.val)= (yyvsp[(1) - (1)].val);;} { (yyval.val)= (yyvsp[(1) - (1)].val);;}
break; break;
case 5: case 5:
#line 209 "ast_expr2.y" #line 191 "ast_expr2.y"
{ (yyval.val) = (yyvsp[(2) - (3)].val); { (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; (yyloc).first_line=0; (yyloc).last_line=0;
@@ -1732,7 +1714,7 @@ yyreduce:
break; break;
case 6: case 6:
#line 213 "ast_expr2.y" #line 195 "ast_expr2.y"
{ (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_or ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1740,7 +1722,7 @@ yyreduce:
break; break;
case 7: case 7:
#line 217 "ast_expr2.y" #line 199 "ast_expr2.y"
{ (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_and ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1748,7 +1730,7 @@ yyreduce:
break; break;
case 8: case 8:
#line 221 "ast_expr2.y" #line 203 "ast_expr2.y"
{ (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1756,7 +1738,7 @@ yyreduce:
break; break;
case 9: case 9:
#line 225 "ast_expr2.y" #line 207 "ast_expr2.y"
{ (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1764,7 +1746,7 @@ yyreduce:
break; break;
case 10: case 10:
#line 229 "ast_expr2.y" #line 211 "ast_expr2.y"
{ (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_lt ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1772,7 +1754,7 @@ yyreduce:
break; break;
case 11: case 11:
#line 233 "ast_expr2.y" #line 215 "ast_expr2.y"
{ (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_ge ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1780,7 +1762,7 @@ yyreduce:
break; break;
case 12: case 12:
#line 237 "ast_expr2.y" #line 219 "ast_expr2.y"
{ (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_le ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1788,7 +1770,7 @@ yyreduce:
break; break;
case 13: case 13:
#line 241 "ast_expr2.y" #line 223 "ast_expr2.y"
{ (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_ne ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1796,7 +1778,7 @@ yyreduce:
break; break;
case 14: case 14:
#line 245 "ast_expr2.y" #line 227 "ast_expr2.y"
{ (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_plus ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1804,7 +1786,7 @@ yyreduce:
break; break;
case 15: case 15:
#line 249 "ast_expr2.y" #line 231 "ast_expr2.y"
{ (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_minus ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1812,7 +1794,7 @@ yyreduce:
break; break;
case 16: case 16:
#line 253 "ast_expr2.y" #line 235 "ast_expr2.y"
{ (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val));
DESTROY((yyvsp[(1) - (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_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
@@ -1820,7 +1802,7 @@ yyreduce:
break; break;
case 17: case 17:
#line 257 "ast_expr2.y" #line 239 "ast_expr2.y"
{ (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val));
DESTROY((yyvsp[(1) - (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_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column;
@@ -1828,7 +1810,7 @@ yyreduce:
break; break;
case 18: case 18:
#line 261 "ast_expr2.y" #line 243 "ast_expr2.y"
{ (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_times ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1836,7 +1818,7 @@ yyreduce:
break; break;
case 19: case 19:
#line 265 "ast_expr2.y" #line 247 "ast_expr2.y"
{ (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_div ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1844,7 +1826,7 @@ yyreduce:
break; break;
case 20: case 20:
#line 269 "ast_expr2.y" #line 251 "ast_expr2.y"
{ (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_rem ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1852,7 +1834,7 @@ yyreduce:
break; break;
case 21: case 21:
#line 273 "ast_expr2.y" #line 255 "ast_expr2.y"
{ (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_colon ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1860,7 +1842,7 @@ yyreduce:
break; break;
case 22: case 22:
#line 277 "ast_expr2.y" #line 259 "ast_expr2.y"
{ (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); { (yyval.val) = op_eqtilde ((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_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -1868,7 +1850,7 @@ yyreduce:
break; break;
case 23: case 23:
#line 281 "ast_expr2.y" #line 263 "ast_expr2.y"
{ (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val));
DESTROY((yyvsp[(2) - (5)].val)); DESTROY((yyvsp[(2) - (5)].val));
DESTROY((yyvsp[(4) - (5)].val)); DESTROY((yyvsp[(4) - (5)].val));
@@ -1878,7 +1860,7 @@ yyreduce:
/* Line 1270 of yacc.c. */ /* Line 1270 of yacc.c. */
#line 1882 "ast_expr2.c" #line 1864 "ast_expr2.c"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2097,11 +2079,11 @@ yyreturn:
} }
#line 288 "ast_expr2.y" #line 270 "ast_expr2.y"
static struct val * static struct val *
make_number (FP___TYPE i) make_integer (quad_t i)
{ {
struct val *vp; struct val *vp;
@@ -2111,7 +2093,7 @@ make_number (FP___TYPE i)
return(NULL); return(NULL);
} }
vp->type = AST_EXPR_number; vp->type = AST_EXPR_integer;
vp->u.i = i; vp->u.i = i;
return vp; return vp;
} }
@@ -2121,7 +2103,7 @@ make_str (const char *s)
{ {
struct val *vp; struct val *vp;
size_t i; size_t i;
int isint; /* this started out being a test for an integer, but then ended up being a test for a float */ int isint;
vp = (struct val *) malloc (sizeof (*vp)); vp = (struct val *) malloc (sizeof (*vp));
if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) { if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
@@ -2129,13 +2111,14 @@ make_str (const char *s)
return(NULL); return(NULL);
} }
for (i = 0, isint = (isdigit(s[0]) || s[0] == '-' || s[0]=='.'); isint && i < strlen(s); i++) for(i = 1, isint = isdigit(s[0]) || s[0] == '-';
isint && i < strlen(s);
i++)
{ {
if (!isdigit(s[i]) && s[i] != '.') { if(!isdigit(s[i]))
isint = 0; isint = 0;
break;
}
} }
if (isint) if (isint)
vp->type = AST_EXPR_numeric_string; vp->type = AST_EXPR_numeric_string;
else else
@@ -2157,17 +2140,17 @@ free_value (struct val *vp)
} }
static int static quad_t
to_number (struct val *vp) to_integer (struct val *vp)
{ {
FP___TYPE i; quad_t i;
if (vp == NULL) { if (vp == NULL) {
ast_log(LOG_WARNING,"vp==NULL in to_number()\n"); ast_log(LOG_WARNING,"vp==NULL in to_integer()\n");
return(0); return(0);
} }
if (vp->type == AST_EXPR_number) if (vp->type == AST_EXPR_integer)
return 1; return 1;
if (vp->type == AST_EXPR_string) if (vp->type == AST_EXPR_string)
@@ -2175,16 +2158,16 @@ to_number (struct val *vp)
/* vp->type == AST_EXPR_numeric_string, make it numeric */ /* vp->type == AST_EXPR_numeric_string, make it numeric */
errno = 0; errno = 0;
i = FP___STRTOD(vp->u.s, (char**)0); /* either strtod, or strtold on a good day */ i = strtoll(vp->u.s, (char**)NULL, 10);
if (errno != 0) { if (errno != 0) {
ast_log(LOG_WARNING,"Conversion of %s to number under/overflowed!\n", vp->u.s); ast_log(LOG_WARNING,"Conversion of %s to integer under/overflowed!\n", vp->u.s);
free(vp->u.s); free(vp->u.s);
vp->u.s = 0; vp->u.s = 0;
return(0); return(0);
} }
free (vp->u.s); free (vp->u.s);
vp->u.i = i; vp->u.i = i;
vp->type = AST_EXPR_number; vp->type = AST_EXPR_integer;
return 1; return 1;
} }
@@ -2225,7 +2208,7 @@ to_string (struct val *vp)
return; return;
} }
sprintf(tmp, FP___PRINTF, vp->u.i); sprintf(tmp, "%ld", (long int) vp->u.i);
vp->type = AST_EXPR_string; vp->type = AST_EXPR_string;
vp->u.s = tmp; vp->u.s = tmp;
} }
@@ -2234,7 +2217,7 @@ to_string (struct val *vp)
static int static int
isstring (struct val *vp) isstring (struct val *vp)
{ {
/* only TRUE if this string is not a valid number */ /* only TRUE if this string is not a valid integer */
return (vp->type == AST_EXPR_string); return (vp->type == AST_EXPR_string);
} }
@@ -2242,10 +2225,10 @@ isstring (struct val *vp)
static int static int
is_zero_or_null (struct val *vp) is_zero_or_null (struct val *vp)
{ {
if (vp->type == AST_EXPR_number) { if (vp->type == AST_EXPR_integer) {
return (vp->u.i == 0); return (vp->u.i == 0);
} else { } else {
return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0)); return (*vp->u.s == 0 || (to_integer (vp) && vp->u.i == 0));
} }
/* NOTREACHED */ /* NOTREACHED */
} }
@@ -2332,7 +2315,7 @@ op_and (struct val *a, struct val *b)
if (is_zero_or_null (a) || is_zero_or_null (b)) { if (is_zero_or_null (a) || is_zero_or_null (b)) {
free_value (a); free_value (a);
free_value (b); free_value (b);
return (make_number ((double)0.0)); return (make_integer ((quad_t)0));
} else { } else {
free_value (b); free_value (b);
return (a); return (a);
@@ -2347,18 +2330,18 @@ op_eq (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) == 0));
} else { } else {
#ifdef DEBUG_FOR_CONVERSIONS #ifdef DEBUG_FOR_CONVERSIONS
char buffer[2000]; char buffer[2000];
sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s); sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
#endif #endif
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
#ifdef DEBUG_FOR_CONVERSIONS #ifdef DEBUG_FOR_CONVERSIONS
ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i); ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
#endif #endif
r = make_number ((FP___TYPE)(a->u.i == b->u.i)); r = make_integer ((quad_t)(a->u.i == b->u.i));
} }
free_value (a); free_value (a);
@@ -2374,11 +2357,11 @@ op_gt (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) > 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) > 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i > b->u.i)); r = make_integer ((quad_t)(a->u.i > b->u.i));
} }
free_value (a); free_value (a);
@@ -2394,11 +2377,11 @@ op_lt (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) < 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) < 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i < b->u.i)); r = make_integer ((quad_t)(a->u.i < b->u.i));
} }
free_value (a); free_value (a);
@@ -2414,11 +2397,11 @@ op_ge (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) >= 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) >= 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i >= b->u.i)); r = make_integer ((quad_t)(a->u.i >= b->u.i));
} }
free_value (a); free_value (a);
@@ -2434,11 +2417,11 @@ op_le (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) <= 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) <= 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i <= b->u.i)); r = make_integer ((quad_t)(a->u.i <= b->u.i));
} }
free_value (a); free_value (a);
@@ -2468,7 +2451,7 @@ op_cond (struct val *a, struct val *b, struct val *c)
} }
else else
{ {
(void)to_number(a); (void)to_integer(a);
if( a->u.i ) if( a->u.i )
{ {
free_value(a); free_value(a);
@@ -2493,11 +2476,11 @@ op_ne (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) != 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) != 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i != b->u.i)); r = make_integer ((quad_t)(a->u.i != b->u.i));
} }
free_value (a); free_value (a);
@@ -2506,7 +2489,7 @@ op_ne (struct val *a, struct val *b)
} }
static int static int
chk_plus (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_plus (quad_t a, quad_t b, quad_t r)
{ {
/* sum of two positive numbers must be positive */ /* sum of two positive numbers must be positive */
if (a > 0 && b > 0 && r <= 0) if (a > 0 && b > 0 && r <= 0)
@@ -2523,23 +2506,23 @@ op_plus (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING,"non-numeric argument\n"); ast_log(LOG_WARNING,"non-numeric argument\n");
if (!to_number (b)) { if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} else { } else {
free_value(a); free_value(a);
return (b); return (b);
} }
} else if (!to_number(b)) { } else if (!to_integer(b)) {
free_value(b); free_value(b);
return (a); return (a);
} }
r = make_number (a->u.i + b->u.i); r = make_integer (/*(quad_t)*/(a->u.i + b->u.i));
if (chk_plus (a->u.i, b->u.i, r->u.i)) { if (chk_plus (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING,"overflow\n"); ast_log(LOG_WARNING,"overflow\n");
} }
@@ -2549,7 +2532,7 @@ op_plus (struct val *a, struct val *b)
} }
static int static int
chk_minus (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_minus (quad_t a, quad_t b, quad_t r)
{ {
/* special case subtraction of QUAD_MIN */ /* special case subtraction of QUAD_MIN */
if (b == QUAD_MIN) { if (b == QUAD_MIN) {
@@ -2567,27 +2550,27 @@ op_minus (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
if (!to_number (b)) { if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} else { } else {
r = make_number(0 - b->u.i); r = make_integer(0 - b->u.i);
free_value(a); free_value(a);
free_value(b); free_value(b);
return (r); return (r);
} }
} else if (!to_number(b)) { } else if (!to_integer(b)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
free_value(b); free_value(b);
return (a); return (a);
} }
r = make_number (a->u.i - b->u.i); r = make_integer (/*(quad_t)*/(a->u.i - b->u.i));
if (chk_minus (a->u.i, b->u.i, r->u.i)) { if (chk_minus (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -2601,14 +2584,14 @@ op_negate (struct val *a)
{ {
struct val *r; struct val *r;
if (!to_number (a) ) { if (!to_integer (a) ) {
free_value(a); free_value(a);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(0); return make_integer(0);
} }
r = make_number (- a->u.i); r = make_integer (/*(quad_t)*/(- a->u.i));
if (chk_minus (0, a->u.i, r->u.i)) { if (chk_minus (0, a->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -2630,7 +2613,7 @@ op_compl (struct val *a)
{ {
switch( a->type ) switch( a->type )
{ {
case AST_EXPR_number: case AST_EXPR_integer:
if( a->u.i == 0 ) if( a->u.i == 0 )
v1 = 0; v1 = 0;
break; break;
@@ -2661,13 +2644,13 @@ op_compl (struct val *a)
} }
} }
r = make_number (!v1); r = make_integer (!v1);
free_value (a); free_value (a);
return r; return r;
} }
static int static int
chk_times (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_times (quad_t a, quad_t b, quad_t r)
{ {
/* special case: first operand is 0, no overflow possible */ /* special case: first operand is 0, no overflow possible */
if (a == 0) if (a == 0)
@@ -2683,15 +2666,15 @@ op_times (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a) || !to_number (b)) { if (!to_integer (a) || !to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return(make_number(0)); return(make_integer(0));
} }
r = make_number (a->u.i * b->u.i); r = make_integer (/*(quad_t)*/(a->u.i * b->u.i));
if (chk_times (a->u.i, b->u.i, r->u.i)) { if (chk_times (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -2701,7 +2684,7 @@ op_times (struct val *a, struct val *b)
} }
static int static int
chk_div (FP___TYPE a, FP___TYPE b) chk_div (quad_t a, quad_t b)
{ {
/* div by zero has been taken care of before */ /* div by zero has been taken care of before */
/* only QUAD_MIN / -1 causes overflow */ /* only QUAD_MIN / -1 causes overflow */
@@ -2716,28 +2699,28 @@ op_div (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(0); return make_integer(0);
} else if (!to_number (b)) { } else if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(INT_MAX); return make_integer(INT_MAX);
} }
if (b->u.i == 0) { 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(a);
free_value(b); free_value(b);
return make_number(INT_MAX); return make_integer(INT_MAX);
} }
r = make_number (a->u.i / b->u.i); r = make_integer (/*(quad_t)*/(a->u.i / b->u.i));
if (chk_div (a->u.i, b->u.i)) { if (chk_div (a->u.i, b->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -2751,12 +2734,12 @@ op_rem (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a) || !to_number (b)) { if (!to_integer (a) || !to_integer (b)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} }
if (b->u.i == 0) { if (b->u.i == 0) {
@@ -2765,7 +2748,7 @@ op_rem (struct val *a, struct val *b)
return(b); return(b);
} }
r = make_number (FP___FMOD(a->u.i, b->u.i)); /* either fmod or fmodl if FP___TYPE is available */ r = make_integer (/*(quad_t)*/(a->u.i % b->u.i));
/* chk_rem necessary ??? */ /* chk_rem necessary ??? */
free_value (a); free_value (a);
free_value (b); free_value (b);
@@ -2805,11 +2788,11 @@ op_colon (struct val *a, struct val *b)
v = make_str (a->u.s + rm[1].rm_so); v = make_str (a->u.s + rm[1].rm_so);
} else { } else {
v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so)); v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
} }
} else { } else {
if (rp.re_nsub == 0) { if (rp.re_nsub == 0) {
v = make_number ((FP___TYPE)0); v = make_integer ((quad_t)0);
} else { } else {
v = make_str (""); v = make_str ("");
} }
@@ -2856,11 +2839,11 @@ op_eqtilde (struct val *a, struct val *b)
v = make_str (a->u.s + rm[1].rm_so); v = make_str (a->u.s + rm[1].rm_so);
} else { } else {
v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so)); v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
} }
} else { } else {
if (rp.re_nsub == 0) { if (rp.re_nsub == 0) {
v = make_number ((FP___TYPE)0.0); v = make_integer ((quad_t)0);
} else { } else {
v = make_str (""); v = make_str ("");
} }

View File

@@ -24,29 +24,12 @@
#include "asterisk.h" #include "asterisk.h"
#include <sys/types.h>
#include <stdio.h>
#ifndef STANDALONE #ifndef STANDALONE
ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#else
#ifndef __USE_ISOC99
#define __USE_ISOC99 1
#endif
#endif
#ifdef __USE_ISOC99
#define FP___PRINTF "%.16Lg"
#define FP___FMOD fmodl
#define FP___STRTOD strtold
#define FP___TYPE long double
#else
#define FP___PRINTF "%.8g"
#define FP___FMOD fmod
#define FP___STRTOD strtod
#define FP___TYPE double
#endif #endif
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
@@ -65,14 +48,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/strings.h" #include "asterisk/strings.h"
enum valtype { enum valtype {
AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string
} ; } ;
struct val { struct val {
enum valtype type; enum valtype type;
union { union {
char *s; char *s;
FP___TYPE i; /* long double or just double if it's a bad day */ quad_t i;
} u; } u;
} ; } ;
@@ -157,7 +140,7 @@ static char *expr2_token_subst(char *mess);
\"[^"]*\" {SET_COLUMNS; SET_STRING; return TOKEN;} \"[^"]*\" {SET_COLUMNS; SET_STRING; return TOKEN;}
[\n] {/* what to do with eol */} [\n] {/* what to do with eol */}
[0-9]+(\.[0-9]+)? { [0-9]+ {
SET_COLUMNS; SET_COLUMNS;
/* the original behavior of the expression parser was /* the original behavior of the expression parser was
* to bring in numbers as a numeric string * to bring in numbers as a numeric string
@@ -252,10 +235,10 @@ int ast_expr(char *expr, char *buf, int length)
return_value = 1; return_value = 1;
} }
} else { } else {
if (io.val->type == AST_EXPR_number) { if (io.val->type == AST_EXPR_integer) {
int res_length; int res_length;
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i); res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
return_value = (res_length <= length) ? res_length : length; return_value = (res_length <= length) ? res_length : length;
} else { } else {
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL) #if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)

View File

@@ -80,7 +80,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
#line 165 "ast_expr2.y" #line 147 "ast_expr2.y"
{ {
struct val *val; struct val *val;
} }

View File

@@ -12,33 +12,16 @@
* $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $ * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $
*/ */
#include "asterisk.h"
#ifndef STANDALONE
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#endif
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#ifdef STANDALONE /* I guess somewhere, the feature is set in the asterisk includes */
#ifndef __USE_ISOC99
#define __USE_ISOC99 1
#endif
#endif
#ifdef __USE_ISOC99
#define FP___PRINTF "%.16Lg"
#define FP___FMOD fmodl
#define FP___STRTOD strtold
#define FP___TYPE long double
#else
#define FP___PRINTF "%.8g"
#define FP___FMOD fmod
#define FP___STRTOD strtod
#define FP___TYPE double
#endif
#include <stdlib.h> #include <stdlib.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <string.h> #include <string.h>
#include <math.h>
#include <locale.h> #include <locale.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@@ -51,7 +34,6 @@
#include <regex.h> #include <regex.h>
#include <limits.h> #include <limits.h>
#include "asterisk.h"
#include "asterisk/ast_expr.h" #include "asterisk/ast_expr.h"
#include "asterisk/logger.h" #include "asterisk/logger.h"
@@ -68,7 +50,7 @@
# if ! defined(QUAD_MAX) # if ! defined(QUAD_MAX)
# define QUAD_MAX (0x7fffffffffffffffLL) # define QUAD_MAX (0x7fffffffffffffffLL)
# endif # endif
#define YYENABLE_NLS 0
#define YYPARSE_PARAM parseio #define YYPARSE_PARAM parseio
#define YYLEX_PARAM ((struct parse_io *)parseio)->scanner #define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
#define YYERROR_VERBOSE 1 #define YYERROR_VERBOSE 1
@@ -76,7 +58,7 @@ extern char extra_error_message[4095];
extern int extra_error_message_supplied; extern int extra_error_message_supplied;
enum valtype { enum valtype {
AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string
} ; } ;
#ifdef STANDALONE #ifdef STANDALONE
@@ -87,7 +69,7 @@ struct val {
enum valtype type; enum valtype type;
union { union {
char *s; char *s;
FP___TYPE i; /* either long double, or just double, on a bad day */ quad_t i;
} u; } u;
} ; } ;
@@ -100,14 +82,14 @@ struct parse_io
yyscan_t scanner; yyscan_t scanner;
}; };
static int chk_div __P((FP___TYPE, FP___TYPE)); static int chk_div __P((quad_t, quad_t));
static int chk_minus __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_minus __P((quad_t, quad_t, quad_t));
static int chk_plus __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_plus __P((quad_t, quad_t, quad_t));
static int chk_times __P((FP___TYPE, FP___TYPE, FP___TYPE)); static int chk_times __P((quad_t, quad_t, quad_t));
static void free_value __P((struct val *)); static void free_value __P((struct val *));
static int is_zero_or_null __P((struct val *)); static int is_zero_or_null __P((struct val *));
static int isstring __P((struct val *)); static int isstring __P((struct val *));
static struct val *make_number __P((FP___TYPE)); static struct val *make_integer __P((quad_t));
static struct val *make_str __P((const char *)); static struct val *make_str __P((const char *));
static struct val *op_and __P((struct val *, struct val *)); static struct val *op_and __P((struct val *, struct val *));
static struct val *op_colon __P((struct val *, struct val *)); static struct val *op_colon __P((struct val *, struct val *));
@@ -127,7 +109,7 @@ static struct val *op_or __P((struct val *, struct val *));
static struct val *op_plus __P((struct val *, struct val *)); static struct val *op_plus __P((struct val *, struct val *));
static struct val *op_rem __P((struct val *, struct val *)); static struct val *op_rem __P((struct val *, struct val *));
static struct val *op_times __P((struct val *, struct val *)); static struct val *op_times __P((struct val *, struct val *));
static int to_number __P((struct val *)); static quad_t to_integer __P((struct val *));
static void to_string __P((struct val *)); static void to_string __P((struct val *));
/* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */ /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */
@@ -192,7 +174,7 @@ extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
start: expr { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); start: expr { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
((struct parse_io *)parseio)->val->type = $1->type; ((struct parse_io *)parseio)->val->type = $1->type;
if( $1->type == AST_EXPR_number ) if( $1->type == AST_EXPR_integer )
((struct parse_io *)parseio)->val->u.i = $1->u.i; ((struct parse_io *)parseio)->val->u.i = $1->u.i;
else else
((struct parse_io *)parseio)->val->u.s = $1->u.s; ((struct parse_io *)parseio)->val->u.s = $1->u.s;
@@ -288,7 +270,7 @@ expr: TOKEN { $$= $1;}
%% %%
static struct val * static struct val *
make_number (FP___TYPE i) make_integer (quad_t i)
{ {
struct val *vp; struct val *vp;
@@ -298,7 +280,7 @@ make_number (FP___TYPE i)
return(NULL); return(NULL);
} }
vp->type = AST_EXPR_number; vp->type = AST_EXPR_integer;
vp->u.i = i; vp->u.i = i;
return vp; return vp;
} }
@@ -308,7 +290,7 @@ make_str (const char *s)
{ {
struct val *vp; struct val *vp;
size_t i; size_t i;
int isint; /* this started out being a test for an integer, but then ended up being a test for a float */ int isint;
vp = (struct val *) malloc (sizeof (*vp)); vp = (struct val *) malloc (sizeof (*vp));
if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) { if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
@@ -316,13 +298,14 @@ make_str (const char *s)
return(NULL); return(NULL);
} }
for (i = 0, isint = (isdigit(s[0]) || s[0] == '-' || s[0]=='.'); isint && i < strlen(s); i++) for(i = 1, isint = isdigit(s[0]) || s[0] == '-';
isint && i < strlen(s);
i++)
{ {
if (!isdigit(s[i]) && s[i] != '.') { if(!isdigit(s[i]))
isint = 0; isint = 0;
break;
}
} }
if (isint) if (isint)
vp->type = AST_EXPR_numeric_string; vp->type = AST_EXPR_numeric_string;
else else
@@ -344,17 +327,17 @@ free_value (struct val *vp)
} }
static int static quad_t
to_number (struct val *vp) to_integer (struct val *vp)
{ {
FP___TYPE i; quad_t i;
if (vp == NULL) { if (vp == NULL) {
ast_log(LOG_WARNING,"vp==NULL in to_number()\n"); ast_log(LOG_WARNING,"vp==NULL in to_integer()\n");
return(0); return(0);
} }
if (vp->type == AST_EXPR_number) if (vp->type == AST_EXPR_integer)
return 1; return 1;
if (vp->type == AST_EXPR_string) if (vp->type == AST_EXPR_string)
@@ -362,16 +345,16 @@ to_number (struct val *vp)
/* vp->type == AST_EXPR_numeric_string, make it numeric */ /* vp->type == AST_EXPR_numeric_string, make it numeric */
errno = 0; errno = 0;
i = FP___STRTOD(vp->u.s, (char**)0); /* either strtod, or strtold on a good day */ i = strtoll(vp->u.s, (char**)NULL, 10);
if (errno != 0) { if (errno != 0) {
ast_log(LOG_WARNING,"Conversion of %s to number under/overflowed!\n", vp->u.s); ast_log(LOG_WARNING,"Conversion of %s to integer under/overflowed!\n", vp->u.s);
free(vp->u.s); free(vp->u.s);
vp->u.s = 0; vp->u.s = 0;
return(0); return(0);
} }
free (vp->u.s); free (vp->u.s);
vp->u.i = i; vp->u.i = i;
vp->type = AST_EXPR_number; vp->type = AST_EXPR_integer;
return 1; return 1;
} }
@@ -412,7 +395,7 @@ to_string (struct val *vp)
return; return;
} }
sprintf(tmp, FP___PRINTF, vp->u.i); sprintf(tmp, "%ld", (long int) vp->u.i);
vp->type = AST_EXPR_string; vp->type = AST_EXPR_string;
vp->u.s = tmp; vp->u.s = tmp;
} }
@@ -421,7 +404,7 @@ to_string (struct val *vp)
static int static int
isstring (struct val *vp) isstring (struct val *vp)
{ {
/* only TRUE if this string is not a valid number */ /* only TRUE if this string is not a valid integer */
return (vp->type == AST_EXPR_string); return (vp->type == AST_EXPR_string);
} }
@@ -429,10 +412,10 @@ isstring (struct val *vp)
static int static int
is_zero_or_null (struct val *vp) is_zero_or_null (struct val *vp)
{ {
if (vp->type == AST_EXPR_number) { if (vp->type == AST_EXPR_integer) {
return (vp->u.i == 0); return (vp->u.i == 0);
} else { } else {
return (*vp->u.s == 0 || (to_number(vp) && vp->u.i == 0)); return (*vp->u.s == 0 || (to_integer (vp) && vp->u.i == 0));
} }
/* NOTREACHED */ /* NOTREACHED */
} }
@@ -519,7 +502,7 @@ op_and (struct val *a, struct val *b)
if (is_zero_or_null (a) || is_zero_or_null (b)) { if (is_zero_or_null (a) || is_zero_or_null (b)) {
free_value (a); free_value (a);
free_value (b); free_value (b);
return (make_number ((double)0.0)); return (make_integer ((quad_t)0));
} else { } else {
free_value (b); free_value (b);
return (a); return (a);
@@ -534,18 +517,18 @@ op_eq (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) == 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) == 0));
} else { } else {
#ifdef DEBUG_FOR_CONVERSIONS #ifdef DEBUG_FOR_CONVERSIONS
char buffer[2000]; char buffer[2000];
sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s); sprintf(buffer,"Converting '%s' and '%s' ", a->u.s, b->u.s);
#endif #endif
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
#ifdef DEBUG_FOR_CONVERSIONS #ifdef DEBUG_FOR_CONVERSIONS
ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i); ast_log(LOG_WARNING,"%s to '%lld' and '%lld'\n", buffer, a->u.i, b->u.i);
#endif #endif
r = make_number ((FP___TYPE)(a->u.i == b->u.i)); r = make_integer ((quad_t)(a->u.i == b->u.i));
} }
free_value (a); free_value (a);
@@ -561,11 +544,11 @@ op_gt (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) > 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) > 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i > b->u.i)); r = make_integer ((quad_t)(a->u.i > b->u.i));
} }
free_value (a); free_value (a);
@@ -581,11 +564,11 @@ op_lt (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) < 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) < 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i < b->u.i)); r = make_integer ((quad_t)(a->u.i < b->u.i));
} }
free_value (a); free_value (a);
@@ -601,11 +584,11 @@ op_ge (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) >= 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) >= 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i >= b->u.i)); r = make_integer ((quad_t)(a->u.i >= b->u.i));
} }
free_value (a); free_value (a);
@@ -621,11 +604,11 @@ op_le (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) <= 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) <= 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i <= b->u.i)); r = make_integer ((quad_t)(a->u.i <= b->u.i));
} }
free_value (a); free_value (a);
@@ -655,7 +638,7 @@ op_cond (struct val *a, struct val *b, struct val *c)
} }
else else
{ {
(void)to_number(a); (void)to_integer(a);
if( a->u.i ) if( a->u.i )
{ {
free_value(a); free_value(a);
@@ -680,11 +663,11 @@ op_ne (struct val *a, struct val *b)
if (isstring (a) || isstring (b)) { if (isstring (a) || isstring (b)) {
to_string (a); to_string (a);
to_string (b); to_string (b);
r = make_number ((FP___TYPE)(strcoll (a->u.s, b->u.s) != 0)); r = make_integer ((quad_t)(strcoll (a->u.s, b->u.s) != 0));
} else { } else {
(void)to_number(a); (void)to_integer(a);
(void)to_number(b); (void)to_integer(b);
r = make_number ((FP___TYPE)(a->u.i != b->u.i)); r = make_integer ((quad_t)(a->u.i != b->u.i));
} }
free_value (a); free_value (a);
@@ -693,7 +676,7 @@ op_ne (struct val *a, struct val *b)
} }
static int static int
chk_plus (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_plus (quad_t a, quad_t b, quad_t r)
{ {
/* sum of two positive numbers must be positive */ /* sum of two positive numbers must be positive */
if (a > 0 && b > 0 && r <= 0) if (a > 0 && b > 0 && r <= 0)
@@ -710,23 +693,23 @@ op_plus (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING,"non-numeric argument\n"); ast_log(LOG_WARNING,"non-numeric argument\n");
if (!to_number (b)) { if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} else { } else {
free_value(a); free_value(a);
return (b); return (b);
} }
} else if (!to_number(b)) { } else if (!to_integer(b)) {
free_value(b); free_value(b);
return (a); return (a);
} }
r = make_number (a->u.i + b->u.i); r = make_integer (/*(quad_t)*/(a->u.i + b->u.i));
if (chk_plus (a->u.i, b->u.i, r->u.i)) { if (chk_plus (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING,"overflow\n"); ast_log(LOG_WARNING,"overflow\n");
} }
@@ -736,7 +719,7 @@ op_plus (struct val *a, struct val *b)
} }
static int static int
chk_minus (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_minus (quad_t a, quad_t b, quad_t r)
{ {
/* special case subtraction of QUAD_MIN */ /* special case subtraction of QUAD_MIN */
if (b == QUAD_MIN) { if (b == QUAD_MIN) {
@@ -754,27 +737,27 @@ op_minus (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
if (!to_number (b)) { if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} else { } else {
r = make_number(0 - b->u.i); r = make_integer(0 - b->u.i);
free_value(a); free_value(a);
free_value(b); free_value(b);
return (r); return (r);
} }
} else if (!to_number(b)) { } else if (!to_integer(b)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
free_value(b); free_value(b);
return (a); return (a);
} }
r = make_number (a->u.i - b->u.i); r = make_integer (/*(quad_t)*/(a->u.i - b->u.i));
if (chk_minus (a->u.i, b->u.i, r->u.i)) { if (chk_minus (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -788,14 +771,14 @@ op_negate (struct val *a)
{ {
struct val *r; struct val *r;
if (!to_number (a) ) { if (!to_integer (a) ) {
free_value(a); free_value(a);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(0); return make_integer(0);
} }
r = make_number (- a->u.i); r = make_integer (/*(quad_t)*/(- a->u.i));
if (chk_minus (0, a->u.i, r->u.i)) { if (chk_minus (0, a->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -817,7 +800,7 @@ op_compl (struct val *a)
{ {
switch( a->type ) switch( a->type )
{ {
case AST_EXPR_number: case AST_EXPR_integer:
if( a->u.i == 0 ) if( a->u.i == 0 )
v1 = 0; v1 = 0;
break; break;
@@ -848,13 +831,13 @@ op_compl (struct val *a)
} }
} }
r = make_number (!v1); r = make_integer (!v1);
free_value (a); free_value (a);
return r; return r;
} }
static int static int
chk_times (FP___TYPE a, FP___TYPE b, FP___TYPE r) chk_times (quad_t a, quad_t b, quad_t r)
{ {
/* special case: first operand is 0, no overflow possible */ /* special case: first operand is 0, no overflow possible */
if (a == 0) if (a == 0)
@@ -870,15 +853,15 @@ op_times (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a) || !to_number (b)) { if (!to_integer (a) || !to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return(make_number(0)); return(make_integer(0));
} }
r = make_number (a->u.i * b->u.i); r = make_integer (/*(quad_t)*/(a->u.i * b->u.i));
if (chk_times (a->u.i, b->u.i, r->u.i)) { if (chk_times (a->u.i, b->u.i, r->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -888,7 +871,7 @@ op_times (struct val *a, struct val *b)
} }
static int static int
chk_div (FP___TYPE a, FP___TYPE b) chk_div (quad_t a, quad_t b)
{ {
/* div by zero has been taken care of before */ /* div by zero has been taken care of before */
/* only QUAD_MIN / -1 causes overflow */ /* only QUAD_MIN / -1 causes overflow */
@@ -903,28 +886,28 @@ op_div (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a)) { if (!to_integer (a)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(0); return make_integer(0);
} else if (!to_number (b)) { } else if (!to_integer (b)) {
free_value(a); free_value(a);
free_value(b); free_value(b);
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
return make_number(INT_MAX); return make_integer(INT_MAX);
} }
if (b->u.i == 0) { 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(a);
free_value(b); free_value(b);
return make_number(INT_MAX); return make_integer(INT_MAX);
} }
r = make_number (a->u.i / b->u.i); r = make_integer (/*(quad_t)*/(a->u.i / b->u.i));
if (chk_div (a->u.i, b->u.i)) { if (chk_div (a->u.i, b->u.i)) {
ast_log(LOG_WARNING, "overflow\n"); ast_log(LOG_WARNING, "overflow\n");
} }
@@ -938,12 +921,12 @@ op_rem (struct val *a, struct val *b)
{ {
struct val *r; struct val *r;
if (!to_number (a) || !to_number (b)) { if (!to_integer (a) || !to_integer (b)) {
if( !extra_error_message_supplied ) if( !extra_error_message_supplied )
ast_log(LOG_WARNING, "non-numeric argument\n"); ast_log(LOG_WARNING, "non-numeric argument\n");
free_value(a); free_value(a);
free_value(b); free_value(b);
return make_number(0); return make_integer(0);
} }
if (b->u.i == 0) { if (b->u.i == 0) {
@@ -952,7 +935,7 @@ op_rem (struct val *a, struct val *b)
return(b); return(b);
} }
r = make_number (FP___FMOD(a->u.i, b->u.i)); /* either fmod or fmodl if FP___TYPE is available */ r = make_integer (/*(quad_t)*/(a->u.i % b->u.i));
/* chk_rem necessary ??? */ /* chk_rem necessary ??? */
free_value (a); free_value (a);
free_value (b); free_value (b);
@@ -992,11 +975,11 @@ op_colon (struct val *a, struct val *b)
v = make_str (a->u.s + rm[1].rm_so); v = make_str (a->u.s + rm[1].rm_so);
} else { } else {
v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so)); v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
} }
} else { } else {
if (rp.re_nsub == 0) { if (rp.re_nsub == 0) {
v = make_number ((FP___TYPE)0); v = make_integer ((quad_t)0);
} else { } else {
v = make_str (""); v = make_str ("");
} }
@@ -1043,11 +1026,11 @@ op_eqtilde (struct val *a, struct val *b)
v = make_str (a->u.s + rm[1].rm_so); v = make_str (a->u.s + rm[1].rm_so);
} else { } else {
v = make_number ((FP___TYPE)(rm[0].rm_eo - rm[0].rm_so)); v = make_integer ((quad_t)(rm[0].rm_eo - rm[0].rm_so));
} }
} else { } else {
if (rp.re_nsub == 0) { if (rp.re_nsub == 0) {
v = make_number ((FP___TYPE)0.0); v = make_integer ((quad_t)0);
} else { } else {
v = make_str (""); v = make_str ("");
} }

View File

@@ -732,8 +732,8 @@ static yyconst flex_int16_t yy_nxt[][128] =
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
-23, -23, -23, -23, -23, 39, 39, -23, -23, 39, -23, -23, -23, -23, -23, 39, 39, -23, -23, 39,
-23, -23, -23, -23, 39, -23, 42, -23, 43, 43, -23, -23, -23, -23, 39, -23, 39, -23, 42, 42,
43, 43, 43, 43, 43, 43, 43, 43, -23, 39, 42, 42, 42, 42, 42, 42, 42, 42, -23, 39,
-23, -23, -23, -23, 39, 39, 39, 39, 39, 39, -23, -23, -23, -23, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
@@ -750,7 +750,7 @@ static yyconst flex_int16_t yy_nxt[][128] =
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, 44, -24, -24, -24, -24, -24, -24, -24, -24, -24, 43, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
@@ -769,7 +769,7 @@ static yyconst flex_int16_t yy_nxt[][128] =
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, 45, -25, -25, -25, -25, -25, -25, -25, -25, -25, 44, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
@@ -786,14 +786,14 @@ static yyconst flex_int16_t yy_nxt[][128] =
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, 46, -26, -26, -26, -26, -26, -26, -26, -26, -26, 45, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, 47, -26 -26, -26, -26, -26, -26, -26, 46, -26
}, },
{ {
@@ -803,7 +803,7 @@ static yyconst flex_int16_t yy_nxt[][128] =
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
-27, 48, -27, -27, -27, -27, -27, -27, -27, -27, -27, 47, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
@@ -844,25 +844,25 @@ static yyconst flex_int16_t yy_nxt[][128] =
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
-29, -29, -29, -29, 49, -29, -29, -29 -29, -29, -29, -29, 48, -29, -29, -29
}, },
{ {
7, 50, 50, 50, 50, 50, 50, 50, 50, 50, 7, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
50, 50, 50, 51, 50, 52, 50, 50 49, 49, 49, 50, 49, 51, 49, 49
}, },
{ {
@@ -900,21 +900,21 @@ static yyconst flex_int16_t yy_nxt[][128] =
}, },
{ {
7, 53, 53, 53, 53, 53, 53, 53, 53, -33, 7, 52, 52, 52, 52, 52, 52, 52, 52, -33,
-33, 53, 53, -33, 53, 53, 53, 53, 53, 53, -33, 52, 52, -33, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, -33, -33, 53, 53, -33, -33, -33, 53, 52, 52, -33, -33, 52, 52, -33, -33, -33, 52,
-33, -33, -33, -33, 53, -33, 53, -33, 53, 53, -33, -33, -33, -33, 52, -33, 52, -33, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, -33, 53, 52, 52, 52, 52, 52, 52, 52, 52, -33, 52,
-33, -33, -33, -33, 53, 53, 53, 53, 53, 53, -33, -33, -33, -33, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53, 53, 53, 53, -33, 53, 53, 53 52, 52, 52, 52, -33, 52, 52, 52
}, },
{ {
@@ -948,7 +948,7 @@ static yyconst flex_int16_t yy_nxt[][128] =
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
-35, -35, -35, 54, -35, -35, -35, -35 -35, -35, -35, 53, -35, -35, -35, -35
}, },
{ {
@@ -1061,8 +1061,8 @@ static yyconst flex_int16_t yy_nxt[][128] =
-42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42,
-42, -42, -42, -42, -42, 39, 39, -42, -42, 39, -42, -42, -42, -42, -42, 39, 39, -42, -42, 39,
-42, -42, -42, -42, 39, -42, 39, -42, 55, 55, -42, -42, -42, -42, 39, -42, 39, -42, 42, 42,
55, 55, 55, 55, 55, 55, 55, 55, -42, 39, 42, 42, 42, 42, 42, 42, 42, 42, -42, 39,
-42, -42, -42, -42, 39, 39, 39, 39, 39, 39, -42, -42, -42, -42, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
@@ -1077,17 +1077,17 @@ static yyconst flex_int16_t yy_nxt[][128] =
-43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
-43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
-43, -43, -43, -43, -43, 39, 39, -43, -43, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
-43, -43, -43, -43, 39, -43, 42, -43, 43, 43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
43, 43, 43, 43, 43, 43, 43, 43, -43, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
-43, -43, -43, -43, 39, 39, 39, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, -43, 39, -43, 39, 39, -43, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43,
39, 39, 39, -43, -43, -43, -43, -43 -43, -43, -43, -43, -43, -43, -43, -43
}, },
{ {
@@ -1177,38 +1177,38 @@ static yyconst flex_int16_t yy_nxt[][128] =
}, },
{ {
7, -49, -49, -49, -49, -49, -49, -49, -49, -49, 7, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-49, -49, -49, -49, -49, -49, -49, -49 49, 49, 49, 50, 49, 51, 49, 49
}, },
{ {
7, 50, 50, 50, 50, 50, 50, 50, 50, 50, 7, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
50, 50, 50, 51, 50, 52, 50, 50 -50, -50, -50, -50, -50, -50, -50, -50
}, },
{ {
@@ -1229,72 +1229,38 @@ static yyconst flex_int16_t yy_nxt[][128] =
}, },
{ {
7, -52, -52, -52, -52, -52, -52, -52, -52, -52, 7, 52, 52, 52, 52, 52, 52, 52, 52, -52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, -52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, -52, -52, 52, 52, -52, -52, -52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, -52, 52, -52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, -52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-52, -52, -52, -52, -52, -52, -52, -52 52, 52, 52, 52, -52, 52, 52, 52
}, },
{ {
7, 53, 53, 53, 53, 53, 53, 53, 53, -53, 7, -53, -53, -53, -53, -53, -53, -53, -53, -53,
-53, 53, 53, -53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, -53, -53, 53, 53, -53, -53, -53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
-53, -53, -53, -53, 53, -53, 53, -53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, -53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
-53, -53, -53, -53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53,
53, 53, 53, 53, -53, 53, 53, 53 -53, -53, -53, -53, -53, -53, -53, -53
},
{
7, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54, -54, -54,
-54, -54, -54, -54, -54, -54, -54, -54
},
{
7, -55, -55, -55, -55, -55, -55, -55, -55, -55,
-55, -55, -55, -55, -55, -55, -55, -55, -55, -55,
-55, -55, -55, -55, -55, -55, -55, -55, -55, -55,
-55, -55, -55, -55, -55, 39, 39, -55, -55, 39,
-55, -55, -55, -55, 39, -55, 39, -55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, -55, 39,
-55, -55, -55, -55, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, -55, 39, -55, 39, 39, -55, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, -55, -55, -55, -55, -55
}, },
} ; } ;
@@ -1324,24 +1290,24 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static yyconst flex_int16_t yy_accept[56] = static yyconst flex_int16_t yy_accept[54] =
{ 0, { 0,
0, 0, 0, 0, 32, 32, 36, 35, 25, 27, 0, 0, 0, 0, 32, 32, 36, 35, 25, 27,
19, 35, 29, 29, 17, 2, 22, 23, 15, 13, 19, 35, 29, 29, 17, 2, 22, 23, 15, 13,
14, 16, 28, 20, 9, 3, 8, 18, 1, 35, 14, 16, 28, 20, 9, 3, 8, 18, 1, 35,
31, 30, 32, 33, 33, 12, 0, 26, 29, 24, 31, 30, 32, 33, 33, 12, 0, 26, 29, 24,
5, 29, 28, 21, 11, 6, 7, 10, 4, 0, 5, 28, 21, 11, 6, 7, 10, 4, 0, 31,
31, 30, 32, 34, 28 30, 32, 34
} ; } ;
static yyconst yy_state_type yy_NUL_trans[56] = static yyconst yy_state_type yy_NUL_trans[54] =
{ 0, { 0,
8, 8, 30, 30, 33, 33, 0, 0, 0, 0, 8, 8, 30, 30, 33, 33, 0, 0, 0, 0,
0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49,
0, 0, 53, 0, 0, 0, 37, 0, 0, 0, 0, 0, 52, 0, 0, 0, 37, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0,
0, 0, 53, 0, 0 0, 52, 0
} ; } ;
/* The intent behind this definition is that it'll catch /* The intent behind this definition is that it'll catch
@@ -1378,29 +1344,12 @@ static yyconst yy_state_type yy_NUL_trans[56] =
#include "asterisk.h" #include "asterisk.h"
#include <sys/types.h>
#include <stdio.h>
#ifndef STANDALONE #ifndef STANDALONE
ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#else
#ifndef __USE_ISOC99
#define __USE_ISOC99 1
#endif
#endif
#ifdef __USE_ISOC99
#define FP___PRINTF "%.16Lg"
#define FP___FMOD fmodl
#define FP___STRTOD strtold
#define FP___TYPE long double
#else
#define FP___PRINTF "%.8g"
#define FP___FMOD fmod
#define FP___STRTOD strtod
#define FP___TYPE double
#endif #endif
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
@@ -1419,14 +1368,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/strings.h" #include "asterisk/strings.h"
enum valtype { enum valtype {
AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string
} ; } ;
struct val { struct val {
enum valtype type; enum valtype type;
union { union {
char *s; char *s;
FP___TYPE i; /* long double or just double if it's a bad day */ quad_t i;
} u; } u;
} ; } ;
@@ -1462,7 +1411,7 @@ int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0; static int curlycount = 0;
static char *expr2_token_subst(char *mess); static char *expr2_token_subst(char *mess);
#line 1466 "ast_expr2f.c" #line 1415 "ast_expr2f.c"
#define INITIAL 0 #define INITIAL 0
#define var 1 #define var 1
@@ -1685,10 +1634,10 @@ YY_DECL
register int yy_act; register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 121 "ast_expr2.fl" #line 104 "ast_expr2.fl"
#line 1692 "ast_expr2f.c" #line 1641 "ast_expr2f.c"
yylval = yylval_param; yylval = yylval_param;
@@ -1771,122 +1720,122 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 123 "ast_expr2.fl" #line 106 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_OR;} { SET_COLUMNS; SET_STRING; return TOK_OR;}
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 124 "ast_expr2.fl" #line 107 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_AND;} { SET_COLUMNS; SET_STRING; return TOK_AND;}
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 125 "ast_expr2.fl" #line 108 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQ;} { SET_COLUMNS; SET_STRING; return TOK_EQ;}
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 126 "ast_expr2.fl" #line 109 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_OR;} { SET_COLUMNS; SET_STRING; return TOK_OR;}
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 127 "ast_expr2.fl" #line 110 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_AND;} { SET_COLUMNS; SET_STRING; return TOK_AND;}
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 128 "ast_expr2.fl" #line 111 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQ;} { SET_COLUMNS; SET_STRING; return TOK_EQ;}
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 129 "ast_expr2.fl" #line 112 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQTILDE;} { SET_COLUMNS; SET_STRING; return TOK_EQTILDE;}
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 130 "ast_expr2.fl" #line 113 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_GT;} { SET_COLUMNS; SET_STRING; return TOK_GT;}
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 131 "ast_expr2.fl" #line 114 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LT;} { SET_COLUMNS; SET_STRING; return TOK_LT;}
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 132 "ast_expr2.fl" #line 115 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_GE;} { SET_COLUMNS; SET_STRING; return TOK_GE;}
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 133 "ast_expr2.fl" #line 116 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LE;} { SET_COLUMNS; SET_STRING; return TOK_LE;}
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 134 "ast_expr2.fl" #line 117 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_NE;} { SET_COLUMNS; SET_STRING; return TOK_NE;}
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 135 "ast_expr2.fl" #line 118 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_PLUS;} { SET_COLUMNS; SET_STRING; return TOK_PLUS;}
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 136 "ast_expr2.fl" #line 119 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MINUS;} { SET_COLUMNS; SET_STRING; return TOK_MINUS;}
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 137 "ast_expr2.fl" #line 120 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MULT;} { SET_COLUMNS; SET_STRING; return TOK_MULT;}
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 138 "ast_expr2.fl" #line 121 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_DIV;} { SET_COLUMNS; SET_STRING; return TOK_DIV;}
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 139 "ast_expr2.fl" #line 122 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MOD;} { SET_COLUMNS; SET_STRING; return TOK_MOD;}
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 140 "ast_expr2.fl" #line 123 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COND;} { SET_COLUMNS; SET_STRING; return TOK_COND;}
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 141 "ast_expr2.fl" #line 124 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COMPL;} { SET_COLUMNS; SET_STRING; return TOK_COMPL;}
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
#line 142 "ast_expr2.fl" #line 125 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COLON;} { SET_COLUMNS; SET_STRING; return TOK_COLON;}
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
#line 143 "ast_expr2.fl" #line 126 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;} { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
#line 144 "ast_expr2.fl" #line 127 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LP;} { SET_COLUMNS; SET_STRING; return TOK_LP;}
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 145 "ast_expr2.fl" #line 128 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_RP;} { SET_COLUMNS; SET_STRING; return TOK_RP;}
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
#line 146 "ast_expr2.fl" #line 129 "ast_expr2.fl"
{ {
/* gather the contents of ${} expressions, with trailing stuff, /* gather the contents of ${} expressions, with trailing stuff,
* into a single TOKEN. * into a single TOKEN.
@@ -1899,24 +1848,24 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
#line 156 "ast_expr2.fl" #line 139 "ast_expr2.fl"
{} {}
YY_BREAK YY_BREAK
case 26: case 26:
/* rule 26 can match eol */ /* rule 26 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 157 "ast_expr2.fl" #line 140 "ast_expr2.fl"
{SET_COLUMNS; SET_STRING; return TOKEN;} {SET_COLUMNS; SET_STRING; return TOKEN;}
YY_BREAK YY_BREAK
case 27: case 27:
/* rule 27 can match eol */ /* rule 27 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 159 "ast_expr2.fl" #line 142 "ast_expr2.fl"
{/* what to do with eol */} {/* what to do with eol */}
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
#line 160 "ast_expr2.fl" #line 143 "ast_expr2.fl"
{ {
SET_COLUMNS; SET_COLUMNS;
/* the original behavior of the expression parser was /* the original behavior of the expression parser was
@@ -1928,7 +1877,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
#line 169 "ast_expr2.fl" #line 152 "ast_expr2.fl"
{ {
SET_COLUMNS; SET_COLUMNS;
SET_STRING; SET_STRING;
@@ -1938,7 +1887,7 @@ YY_RULE_SETUP
case 30: case 30:
/* rule 30 can match eol */ /* rule 30 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 176 "ast_expr2.fl" #line 159 "ast_expr2.fl"
{ {
curlycount--; curlycount--;
if (curlycount < 0) { if (curlycount < 0) {
@@ -1952,7 +1901,7 @@ YY_RULE_SETUP
case 31: case 31:
/* rule 31 can match eol */ /* rule 31 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 186 "ast_expr2.fl" #line 169 "ast_expr2.fl"
{ {
curlycount++; curlycount++;
yymore(); yymore();
@@ -1960,7 +1909,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
#line 192 "ast_expr2.fl" #line 175 "ast_expr2.fl"
{ {
BEGIN(0); BEGIN(0);
SET_COLUMNS; SET_COLUMNS;
@@ -1971,7 +1920,7 @@ YY_RULE_SETUP
case 33: case 33:
/* rule 33 can match eol */ /* rule 33 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 199 "ast_expr2.fl" #line 182 "ast_expr2.fl"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
BEGIN(0); BEGIN(0);
@@ -1983,7 +1932,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
#line 208 "ast_expr2.fl" #line 191 "ast_expr2.fl"
{ {
curlycount = 0; curlycount = 0;
BEGIN(var); BEGIN(var);
@@ -1991,7 +1940,7 @@ YY_RULE_SETUP
} }
YY_BREAK YY_BREAK
case YY_STATE_EOF(trail): case YY_STATE_EOF(trail):
#line 214 "ast_expr2.fl" #line 197 "ast_expr2.fl"
{ {
BEGIN(0); BEGIN(0);
SET_COLUMNS; SET_COLUMNS;
@@ -2002,10 +1951,10 @@ case YY_STATE_EOF(trail):
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
#line 222 "ast_expr2.fl" #line 205 "ast_expr2.fl"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 2009 "ast_expr2f.c" #line 1958 "ast_expr2f.c"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var): case YY_STATE_EOF(var):
yyterminate(); yyterminate();
@@ -3138,7 +3087,7 @@ void ast_yyfree (void * ptr , yyscan_t yyscanner)
#undef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS
#undef YY_DECL #undef YY_DECL
#endif #endif
#line 222 "ast_expr2.fl" #line 205 "ast_expr2.fl"
@@ -3173,10 +3122,10 @@ int ast_expr(char *expr, char *buf, int length)
return_value = 1; return_value = 1;
} }
} else { } else {
if (io.val->type == AST_EXPR_number) { if (io.val->type == AST_EXPR_integer) {
int res_length; int res_length;
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i); res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
return_value = (res_length <= length) ? res_length : length; return_value = (res_length <= length) ? res_length : length;
} else { } else {
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL) #if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)