aboutsummaryrefslogtreecommitdiffstats
path: root/main/ast_expr2.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-08 21:01:28 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-08 21:01:28 +0000
commit6917c984363c8967aa5d32812e2b89303ae40197 (patch)
treee26097b2e32f70833c0f6cdbc88889414c2b31f0 /main/ast_expr2.c
parentd5b88e332d74145e3d53290eb61f1c66410bd3aa (diff)
Restore EXP2 and LOG2 functions, by providing mathematical identify functions, when the underlying C functions are not available.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@73911 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/ast_expr2.c')
-rw-r--r--main/ast_expr2.c269
1 files changed, 156 insertions, 113 deletions
diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index 2e25e0766..a1b1e652b 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -1,7 +1,9 @@
-/* A Bison parser, made by GNU Bison 2.1a. */
+/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* 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
@@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ 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. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
@@ -37,7 +47,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.1a"
+#define YYBISON_VERSION "2.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -116,7 +126,7 @@
/* Copy the first part of user declarations. */
-#line 1 "ast_expr2.y"
+#line 1 "../main/ast_expr2.y"
/* Written by Pace Willisson (pace@blitz.com)
* and placed in the public domain.
@@ -160,14 +170,27 @@
#define FUNC_RINT rintl
#define FUNC_TRUNC truncl
#define FUNC_EXP expl
-#ifdef HAVE_EXP2
+#ifdef HAVE_EXP2L
#define FUNC_EXP2 exp2l
+#else
+#define FUNC_EXP2(x) expl((x) * logl(2))
+#endif
+#ifdef HAVE_EXP10L
+#define FUNC_EXP10 exp10l
+#else
+#define FUNC_EXP10(x) expl((x) * logl(10))
#endif
#define FUNC_LOG logl
-#ifdef HAVE_LOG2
+#ifdef HAVE_LOG2L
#define FUNC_LOG2 log2l
+#else
+#define FUNC_LOG2(x) (logl(x) / logl(2))
#endif
+#ifdef HAVE_LOG10L
#define FUNC_LOG10 log10l
+#else
+#define FUNC_LOG10(x) (logl(x) / logl(10))
+#endif
#define FUNC_REMAINDER remainderl
#else
#define FP___PRINTF "%.16g"
@@ -191,12 +214,25 @@
#define FUNC_EXP exp
#ifdef HAVE_EXP2
#define FUNC_EXP2 exp2
+#else
+#define FUNC_EXP2(x) exp((x) * log(2))
+#endif
+#ifdef HAVE_EXP10
+#define FUNC_EXP10 exp10
+#else
+#define FUNC_EXP10(x) exp((x) * log(10))
#endif
#define FUNC_LOG log
#ifdef HAVE_LOG2
#define FUNC_LOG2 log2
+#else
+#define FUNC_LOG2(x) (log(x) / log(2))
#endif
+#ifdef HAVE_LOG10
#define FUNC_LOG10 log10
+#else
+#define FUNC_LOG10(x) (log(x) / log(10))
+#endif
#define FUNC_REMAINDER remainder
#endif
@@ -363,13 +399,13 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *);
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 226 "ast_expr2.y"
+#line 260 "../main/ast_expr2.y"
{
struct val *val;
struct expr_node *arglist;
}
-/* Line 198 of yacc.c. */
-#line 365 "ast_expr2.c"
+/* Line 187 of yacc.c. */
+#line 409 "../main/ast_expr2.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -391,13 +427,13 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-#line 231 "ast_expr2.y"
+#line 265 "../main/ast_expr2.y"
extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
-/* Line 221 of yacc.c. */
-#line 393 "ast_expr2.c"
+/* Line 216 of yacc.c. */
+#line 437 "../main/ast_expr2.c"
#ifdef short
# undef short
@@ -527,8 +563,13 @@ YYID (i)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# ifdef __cplusplus
-extern "C" {
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
@@ -544,9 +585,6 @@ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
-# ifdef __cplusplus
-}
-# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
@@ -691,9 +729,9 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 257, 257, 265, 272, 273, 282, 288, 289, 293,
- 297, 301, 305, 309, 313, 317, 321, 325, 329, 333,
- 337, 341, 345, 349, 353, 357, 361
+ 0, 291, 291, 299, 306, 307, 316, 322, 323, 327,
+ 331, 335, 339, 343, 347, 351, 355, 359, 363, 367,
+ 371, 375, 379, 383, 387, 391, 395
};
#endif
@@ -956,14 +994,14 @@ do { \
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
FILE *yyoutput;
int yytype;
- const YYSTYPE * const yyvaluep;
- const YYLTYPE * const yylocationp;
+ YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
#endif
{
if (!yyvaluep)
@@ -990,14 +1028,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp)
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
FILE *yyoutput;
int yytype;
- const YYSTYPE * const yyvaluep;
- const YYLTYPE * const yylocationp;
+ YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
#endif
{
if (yytype < YYNTOKENS)
@@ -1050,8 +1088,7 @@ static void
yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
#else
static void
-yy_reduce_print (yyvsp, yylsp, yyrule
- )
+yy_reduce_print (yyvsp, yylsp, yyrule)
YYSTYPE *yyvsp;
YYLTYPE *yylsp;
int yyrule;
@@ -1174,7 +1211,7 @@ yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
- size_t yyn = 0;
+ YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
@@ -1221,7 +1258,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
{
int yyn = yypact[yystate];
- if (! (YYPACT_NINF < yyn && yyn < YYLAST))
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
@@ -1259,7 +1296,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
+ int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
@@ -1347,114 +1384,114 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
switch (yytype)
{
case 4: /* "TOK_COLONCOLON" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1345 "ast_expr2.c"
+#line 1390 "../main/ast_expr2.c"
break;
case 5: /* "TOK_COND" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1350 "ast_expr2.c"
+#line 1395 "../main/ast_expr2.c"
break;
case 6: /* "TOK_OR" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1355 "ast_expr2.c"
+#line 1400 "../main/ast_expr2.c"
break;
case 7: /* "TOK_AND" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1360 "ast_expr2.c"
+#line 1405 "../main/ast_expr2.c"
break;
case 8: /* "TOK_NE" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1365 "ast_expr2.c"
+#line 1410 "../main/ast_expr2.c"
break;
case 9: /* "TOK_LE" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1370 "ast_expr2.c"
+#line 1415 "../main/ast_expr2.c"
break;
case 10: /* "TOK_GE" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1375 "ast_expr2.c"
+#line 1420 "../main/ast_expr2.c"
break;
case 11: /* "TOK_LT" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1380 "ast_expr2.c"
+#line 1425 "../main/ast_expr2.c"
break;
case 12: /* "TOK_GT" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1385 "ast_expr2.c"
+#line 1430 "../main/ast_expr2.c"
break;
case 13: /* "TOK_EQ" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1390 "ast_expr2.c"
+#line 1435 "../main/ast_expr2.c"
break;
case 14: /* "TOK_MINUS" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1395 "ast_expr2.c"
+#line 1440 "../main/ast_expr2.c"
break;
case 15: /* "TOK_PLUS" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1400 "ast_expr2.c"
+#line 1445 "../main/ast_expr2.c"
break;
case 16: /* "TOK_MOD" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1405 "ast_expr2.c"
+#line 1450 "../main/ast_expr2.c"
break;
case 17: /* "TOK_DIV" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1410 "ast_expr2.c"
+#line 1455 "../main/ast_expr2.c"
break;
case 18: /* "TOK_MULT" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1415 "ast_expr2.c"
+#line 1460 "../main/ast_expr2.c"
break;
case 19: /* "TOK_COMPL" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1420 "ast_expr2.c"
+#line 1465 "../main/ast_expr2.c"
break;
case 20: /* "TOK_EQTILDE" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1425 "ast_expr2.c"
+#line 1470 "../main/ast_expr2.c"
break;
case 21: /* "TOK_COLON" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1430 "ast_expr2.c"
+#line 1475 "../main/ast_expr2.c"
break;
case 22: /* "TOK_LP" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1435 "ast_expr2.c"
+#line 1480 "../main/ast_expr2.c"
break;
case 23: /* "TOK_RP" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1440 "ast_expr2.c"
+#line 1485 "../main/ast_expr2.c"
break;
case 24: /* "TOKEN" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1445 "ast_expr2.c"
+#line 1490 "../main/ast_expr2.c"
break;
case 28: /* "expr" */
-#line 251 "ast_expr2.y"
+#line 285 "../main/ast_expr2.y"
{ free_value((yyvaluep->val)); };
-#line 1450 "ast_expr2.c"
+#line 1495 "../main/ast_expr2.c"
break;
default:
@@ -1777,7 +1814,7 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 257 "ast_expr2.y"
+#line 291 "../main/ast_expr2.y"
{ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
@@ -1789,7 +1826,7 @@ yyreduce:
break;
case 3:
-#line 265 "ast_expr2.y"
+#line 299 "../main/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("");
@@ -1797,12 +1834,12 @@ yyreduce:
break;
case 4:
-#line 272 "ast_expr2.y"
+#line 306 "../main/ast_expr2.y"
{ (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
break;
case 5:
-#line 273 "ast_expr2.y"
+#line 307 "../main/ast_expr2.y"
{struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
struct expr_node *t;
DESTROY((yyvsp[(2) - (3)].val));
@@ -1812,7 +1849,7 @@ yyreduce:
break;
case 6:
-#line 282 "ast_expr2.y"
+#line 316 "../main/ast_expr2.y"
{ (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
DESTROY((yyvsp[(2) - (4)].val));
DESTROY((yyvsp[(4) - (4)].val));
@@ -1822,12 +1859,12 @@ yyreduce:
break;
case 7:
-#line 288 "ast_expr2.y"
+#line 322 "../main/ast_expr2.y"
{(yyval.val) = (yyvsp[(1) - (1)].val);;}
break;
case 8:
-#line 289 "ast_expr2.y"
+#line 323 "../main/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_line=0; (yyloc).last_line=0;
@@ -1835,7 +1872,7 @@ yyreduce:
break;
case 9:
-#line 293 "ast_expr2.y"
+#line 327 "../main/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;
@@ -1843,7 +1880,7 @@ yyreduce:
break;
case 10:
-#line 297 "ast_expr2.y"
+#line 331 "../main/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;
@@ -1851,7 +1888,7 @@ yyreduce:
break;
case 11:
-#line 301 "ast_expr2.y"
+#line 335 "../main/ast_expr2.y"
{ (yyval.val) = op_eq ((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;
@@ -1859,7 +1896,7 @@ yyreduce:
break;
case 12:
-#line 305 "ast_expr2.y"
+#line 339 "../main/ast_expr2.y"
{ (yyval.val) = op_gt ((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;
@@ -1867,7 +1904,7 @@ yyreduce:
break;
case 13:
-#line 309 "ast_expr2.y"
+#line 343 "../main/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;
@@ -1875,7 +1912,7 @@ yyreduce:
break;
case 14:
-#line 313 "ast_expr2.y"
+#line 347 "../main/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;
@@ -1883,7 +1920,7 @@ yyreduce:
break;
case 15:
-#line 317 "ast_expr2.y"
+#line 351 "../main/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;
@@ -1891,7 +1928,7 @@ yyreduce:
break;
case 16:
-#line 321 "ast_expr2.y"
+#line 355 "../main/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;
@@ -1899,7 +1936,7 @@ yyreduce:
break;
case 17:
-#line 325 "ast_expr2.y"
+#line 359 "../main/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;
@@ -1907,7 +1944,7 @@ yyreduce:
break;
case 18:
-#line 329 "ast_expr2.y"
+#line 363 "../main/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;
@@ -1915,7 +1952,7 @@ yyreduce:
break;
case 19:
-#line 333 "ast_expr2.y"
+#line 367 "../main/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;
@@ -1923,7 +1960,7 @@ yyreduce:
break;
case 20:
-#line 337 "ast_expr2.y"
+#line 371 "../main/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;
@@ -1931,7 +1968,7 @@ yyreduce:
break;
case 21:
-#line 341 "ast_expr2.y"
+#line 375 "../main/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;
@@ -1939,7 +1976,7 @@ yyreduce:
break;
case 22:
-#line 345 "ast_expr2.y"
+#line 379 "../main/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;
@@ -1947,7 +1984,7 @@ yyreduce:
break;
case 23:
-#line 349 "ast_expr2.y"
+#line 383 "../main/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;
@@ -1955,7 +1992,7 @@ yyreduce:
break;
case 24:
-#line 353 "ast_expr2.y"
+#line 387 "../main/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;
@@ -1963,7 +2000,7 @@ yyreduce:
break;
case 25:
-#line 357 "ast_expr2.y"
+#line 391 "../main/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;
@@ -1971,7 +2008,7 @@ yyreduce:
break;
case 26:
-#line 361 "ast_expr2.y"
+#line 395 "../main/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));
@@ -1980,8 +2017,8 @@ yyreduce:
break;
-/* Line 1270 of yacc.c. */
-#line 1977 "ast_expr2.c"
+/* Line 1267 of yacc.c. */
+#line 2022 "../main/ast_expr2.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2196,11 +2233,12 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
-#line 368 "ast_expr2.y"
+#line 402 "../main/ast_expr2.y"
static struct expr_node *alloc_expr_node(enum node_type nt)
@@ -2639,7 +2677,6 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
return make_number(0.0);
}
-#ifdef HAVE_EXP2
} else if (strcmp(funcname->u.s,"EXP2") == 0) {
if (arglist && !arglist->right && arglist->val){
to_number(arglist->val);
@@ -2649,7 +2686,15 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
return make_number(0.0);
}
-#endif
+ } else if (strcmp(funcname->u.s,"EXP10") == 0) {
+ if (arglist && !arglist->right && arglist->val){
+ to_number(arglist->val);
+ result = make_number(FUNC_EXP10(arglist->val->u.i));
+ return result;
+ } else {
+ ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
+ return make_number(0.0);
+ }
} else if (strcmp(funcname->u.s,"LOG") == 0) {
if (arglist && !arglist->right && arglist->val){
to_number(arglist->val);
@@ -2659,7 +2704,6 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
return make_number(0.0);
}
-#ifdef HAVE_LOG2
} else if (strcmp(funcname->u.s,"LOG2") == 0) {
if (arglist && !arglist->right && arglist->val){
to_number(arglist->val);
@@ -2669,7 +2713,6 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru
ast_log(LOG_WARNING,"Wrong args to %s() function\n",funcname->u.s);
return make_number(0.0);
}
-#endif
} else if (strcmp(funcname->u.s,"LOG10") == 0) {
if (arglist && !arglist->right && arglist->val){
to_number(arglist->val);