From f47b03877b87d725b8ab442936df792c2c352aee Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Tue, 3 Mar 2009 22:12:02 +0000 Subject: [PATCH] Merged revisions 179807 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 I had some work to do to port these changes to trunk; the check_expr stuff hasn't been updated here for quite some time, it appears. I added some more tests to the check_expr2 suite. I had to play around with the makefile a bit, etc. I added STANDALONE2 #ifdefs to ast_expr2.y so as not to conflict structure with aelparse. ........ r179807 | murf | 2009-03-03 11:11:34 -0700 (Tue, 03 Mar 2009) | 19 lines These changes allow AEL to better check ${} constructs within $[...], that are concatenated with text. I modified and added rules in ast_expr2.fl to better handle the concatenations. I added some default routines to ast_expr2.y so the standalone would compile. It also looks like I haven't run this thru bison since 2.1, so it's good to get this updated. The Makefile has comments added now for check_expr2 and check_expr to explain what they are for, and how to run them. The testexpr2s stuff has been removed, in favor of check_expr2. expr2.testinput has been updated to include the two expressions that inspired these changes (from mcnobody on #asterisk this morning) The regression has been run and all looks well. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179973 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/ast_expr2.c | 231 ++++++++++++++++++++++++++---------------- main/ast_expr2.fl | 19 ++-- main/ast_expr2.h | 2 +- main/ast_expr2.y | 67 +++++++++++- main/ast_expr2f.c | 173 ++++++++++++++++--------------- utils/Makefile | 38 +++++-- utils/expr2.testinput | 8 ++ 7 files changed, 347 insertions(+), 191 deletions(-) diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 5e9c6f15f7..4dcda2e3b9 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -148,7 +148,8 @@ #include #include -#if !defined(STANDALONE) +#if !defined(STANDALONE) && !defined(STANDALONE2) \ + ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #else #ifndef __USE_ISOC99 @@ -343,7 +344,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/ast_expr.h" #include "asterisk/logger.h" -#ifndef STANDALONE +#if !defined(STANDALONE) && !defined(STANDALONE2) #include "asterisk/pbx.h" #endif @@ -371,7 +372,7 @@ enum valtype { AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string } ; -#ifdef STANDALONE +#if defined(STANDALONE) || defined(STANDALONE2) void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6))); #endif @@ -485,13 +486,13 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 344 "ast_expr2.y" +#line 345 "ast_expr2.y" { struct val *val; struct expr_node *arglist; } /* Line 187 of yacc.c. */ -#line 495 "ast_expr2.c" +#line 496 "ast_expr2.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -513,13 +514,13 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -#line 349 "ast_expr2.y" +#line 350 "ast_expr2.y" extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t)); /* Line 216 of yacc.c. */ -#line 523 "ast_expr2.c" +#line 524 "ast_expr2.c" #ifdef short # undef short @@ -817,9 +818,9 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 373, 373, 381, 388, 389, 395, 404, 410, 411, - 415, 419, 423, 427, 431, 435, 439, 443, 447, 451, - 455, 459, 463, 467, 471, 475, 479, 483, 488 + 0, 374, 374, 382, 389, 390, 396, 405, 411, 412, + 416, 420, 424, 428, 432, 436, 440, 444, 448, 452, + 456, 460, 464, 468, 472, 476, 480, 484, 489 }; #endif @@ -1472,119 +1473,119 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) switch (yytype) { case 4: /* "TOK_COLONCOLON" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1478 "ast_expr2.c" +#line 1479 "ast_expr2.c" break; case 5: /* "TOK_COND" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1483 "ast_expr2.c" +#line 1484 "ast_expr2.c" break; case 6: /* "TOK_OR" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1488 "ast_expr2.c" +#line 1489 "ast_expr2.c" break; case 7: /* "TOK_AND" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1493 "ast_expr2.c" +#line 1494 "ast_expr2.c" break; case 8: /* "TOK_NE" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1498 "ast_expr2.c" +#line 1499 "ast_expr2.c" break; case 9: /* "TOK_LE" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1503 "ast_expr2.c" +#line 1504 "ast_expr2.c" break; case 10: /* "TOK_GE" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1508 "ast_expr2.c" +#line 1509 "ast_expr2.c" break; case 11: /* "TOK_LT" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1513 "ast_expr2.c" +#line 1514 "ast_expr2.c" break; case 12: /* "TOK_GT" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1518 "ast_expr2.c" +#line 1519 "ast_expr2.c" break; case 13: /* "TOK_EQ" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1523 "ast_expr2.c" +#line 1524 "ast_expr2.c" break; case 14: /* "TOK_MINUS" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1528 "ast_expr2.c" +#line 1529 "ast_expr2.c" break; case 15: /* "TOK_PLUS" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1533 "ast_expr2.c" +#line 1534 "ast_expr2.c" break; case 16: /* "TOK_MOD" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1538 "ast_expr2.c" +#line 1539 "ast_expr2.c" break; case 17: /* "TOK_DIV" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1543 "ast_expr2.c" +#line 1544 "ast_expr2.c" break; case 18: /* "TOK_MULT" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1548 "ast_expr2.c" +#line 1549 "ast_expr2.c" break; case 19: /* "TOK_COMPL" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1553 "ast_expr2.c" +#line 1554 "ast_expr2.c" break; case 20: /* "TOK_TILDETILDE" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1558 "ast_expr2.c" +#line 1559 "ast_expr2.c" break; case 21: /* "TOK_EQTILDE" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1563 "ast_expr2.c" +#line 1564 "ast_expr2.c" break; case 22: /* "TOK_COLON" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1568 "ast_expr2.c" +#line 1569 "ast_expr2.c" break; case 23: /* "TOK_LP" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1573 "ast_expr2.c" +#line 1574 "ast_expr2.c" break; case 24: /* "TOK_RP" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1578 "ast_expr2.c" +#line 1579 "ast_expr2.c" break; case 25: /* "TOKEN" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1583 "ast_expr2.c" +#line 1584 "ast_expr2.c" break; case 29: /* "expr" */ -#line 367 "ast_expr2.y" +#line 368 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1588 "ast_expr2.c" +#line 1589 "ast_expr2.c" break; default: @@ -1907,7 +1908,7 @@ yyreduce: switch (yyn) { case 2: -#line 373 "ast_expr2.y" +#line 374 "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 ) @@ -1919,7 +1920,7 @@ yyreduce: break; case 3: -#line 381 "ast_expr2.y" +#line 382 "ast_expr2.y" {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = AST_EXPR_string; ((struct parse_io *)parseio)->val->u.s = strdup(""); @@ -1927,12 +1928,12 @@ yyreduce: break; case 4: -#line 388 "ast_expr2.y" +#line 389 "ast_expr2.y" { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;} break; case 5: -#line 389 "ast_expr2.y" +#line 390 "ast_expr2.y" {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); struct expr_node *t; DESTROY((yyvsp[(2) - (3)].val)); @@ -1942,7 +1943,7 @@ yyreduce: break; case 6: -#line 395 "ast_expr2.y" +#line 396 "ast_expr2.y" {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL); struct expr_node *t; /* NULL args should OK */ DESTROY((yyvsp[(2) - (2)].val)); @@ -1952,7 +1953,7 @@ yyreduce: break; case 7: -#line 404 "ast_expr2.y" +#line 405 "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)); @@ -1962,12 +1963,12 @@ yyreduce: break; case 8: -#line 410 "ast_expr2.y" +#line 411 "ast_expr2.y" {(yyval.val) = (yyvsp[(1) - (1)].val);;} break; case 9: -#line 411 "ast_expr2.y" +#line 412 "ast_expr2.y" { (yyval.val) = (yyvsp[(2) - (3)].val); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; (yyloc).first_line=0; (yyloc).last_line=0; @@ -1975,7 +1976,7 @@ yyreduce: break; case 10: -#line 415 "ast_expr2.y" +#line 416 "ast_expr2.y" { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1983,7 +1984,7 @@ yyreduce: break; case 11: -#line 419 "ast_expr2.y" +#line 420 "ast_expr2.y" { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1991,7 +1992,7 @@ yyreduce: break; case 12: -#line 423 "ast_expr2.y" +#line 424 "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; @@ -1999,7 +2000,7 @@ yyreduce: break; case 13: -#line 427 "ast_expr2.y" +#line 428 "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; @@ -2007,7 +2008,7 @@ yyreduce: break; case 14: -#line 431 "ast_expr2.y" +#line 432 "ast_expr2.y" { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2015,7 +2016,7 @@ yyreduce: break; case 15: -#line 435 "ast_expr2.y" +#line 436 "ast_expr2.y" { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2023,7 +2024,7 @@ yyreduce: break; case 16: -#line 439 "ast_expr2.y" +#line 440 "ast_expr2.y" { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2031,7 +2032,7 @@ yyreduce: break; case 17: -#line 443 "ast_expr2.y" +#line 444 "ast_expr2.y" { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2039,7 +2040,7 @@ yyreduce: break; case 18: -#line 447 "ast_expr2.y" +#line 448 "ast_expr2.y" { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2047,7 +2048,7 @@ yyreduce: break; case 19: -#line 451 "ast_expr2.y" +#line 452 "ast_expr2.y" { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2055,7 +2056,7 @@ yyreduce: break; case 20: -#line 455 "ast_expr2.y" +#line 456 "ast_expr2.y" { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; @@ -2063,7 +2064,7 @@ yyreduce: break; case 21: -#line 459 "ast_expr2.y" +#line 460 "ast_expr2.y" { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; @@ -2071,7 +2072,7 @@ yyreduce: break; case 22: -#line 463 "ast_expr2.y" +#line 464 "ast_expr2.y" { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2079,7 +2080,7 @@ yyreduce: break; case 23: -#line 467 "ast_expr2.y" +#line 468 "ast_expr2.y" { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2087,7 +2088,7 @@ yyreduce: break; case 24: -#line 471 "ast_expr2.y" +#line 472 "ast_expr2.y" { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2095,7 +2096,7 @@ yyreduce: break; case 25: -#line 475 "ast_expr2.y" +#line 476 "ast_expr2.y" { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2103,7 +2104,7 @@ yyreduce: break; case 26: -#line 479 "ast_expr2.y" +#line 480 "ast_expr2.y" { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2111,7 +2112,7 @@ yyreduce: break; case 27: -#line 483 "ast_expr2.y" +#line 484 "ast_expr2.y" { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); DESTROY((yyvsp[(2) - (5)].val)); DESTROY((yyvsp[(4) - (5)].val)); @@ -2120,7 +2121,7 @@ yyreduce: break; case 28: -#line 488 "ast_expr2.y" +#line 489 "ast_expr2.y" { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -2129,7 +2130,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 2133 "ast_expr2.c" +#line 2134 "ast_expr2.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2349,7 +2350,7 @@ yyreturn: } -#line 494 "ast_expr2.y" +#line 495 "ast_expr2.y" static struct expr_node *alloc_expr_node(enum node_type nt) @@ -2515,6 +2516,62 @@ is_zero_or_null (struct val *vp) /* NOTREACHED */ } +#ifdef STANDALONE2 + +void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) +{ + va_list vars; + va_start(vars,fmt); + + printf("LOG: lev:%d file:%s line:%d func: %s ", + level, file, line, function); + vprintf(fmt, vars); + fflush(stdout); + va_end(vars); +} + + +int main(int argc,char **argv) { + char s[4096]; + char out[4096]; + FILE *infile; + + if( !argv[1] ) + exit(20); + + if( access(argv[1],F_OK)== 0 ) + { + int ret; + + infile = fopen(argv[1],"r"); + if( !infile ) + { + printf("Sorry, couldn't open %s for reading!\n", argv[1]); + exit(10); + } + while( fgets(s,sizeof(s),infile) ) + { + if( s[strlen(s)-1] == '\n' ) + s[strlen(s)-1] = 0; + + ret = ast_expr(s, out, sizeof(out), NULL); + printf("Expression: %s Result: [%d] '%s'\n", + s, ret, out); + } + fclose(infile); + } + else + { + if (ast_expr(argv[1], s, sizeof(s), NULL)) + printf("=====%s======\n",s); + else + printf("No result\n"); + } + return 0; +} + +#endif + #undef ast_yyerror #define ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio) @@ -2539,7 +2596,7 @@ static void destroy_arglist(struct expr_node *arglist) } } -#if !defined(STANDALONE) +#if !defined(STANDALONE) && !defined(STANDALONE2) static char *compose_func_args(struct expr_node *arglist) { struct expr_node *t = arglist; @@ -2833,7 +2890,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru #endif } else { /* is this a custom function we should execute and collect the results of? */ -#ifndef STANDALONE +#if !defined(STANDALONE) && !defined(STANDALONE2) struct ast_custom_function *f = ast_custom_function_find(funcname->u.s); if (!chan) ast_log(LOG_WARNING,"Hey! chan is NULL.\n"); diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl index 6fca882931..499706811f 100644 --- a/main/ast_expr2.fl +++ b/main/ast_expr2.fl @@ -172,12 +172,17 @@ static char *expr2_token_subst(const char *mess); return TOKEN; } -([a-zA-Z0-9\.';\\_^#@]|[\x80-\xff]|($[^{]))+ { +([a-zA-Z0-9\.';\\_^#@]|[\x80-\xff]|($[^{]))+ { SET_COLUMNS; SET_STRING; return TOKEN; } +([a-zA-Z0-9\.';\\_^#@]|[\x80-\xff]|($[^{]))+\$\{ { + curlycount = 0; + BEGIN(var); + yymore(); + } [^{}]*\} { curlycount--; @@ -202,6 +207,12 @@ static char *expr2_token_subst(const char *mess); return TOKEN; } +[^-\t\r \n$():?%/+=*<>!|&]*\$\{ { + curlycount = 0; + BEGIN(var); + yymore(); + } + [-\t\r \n$():?%/+=*<>!|&] { char c = yytext[yyleng-1]; BEGIN(0); @@ -211,12 +222,6 @@ static char *expr2_token_subst(const char *mess); return TOKEN; } -\$\{ { - curlycount = 0; - BEGIN(var); - yymore(); - } - <> { BEGIN(0); SET_COLUMNS; diff --git a/main/ast_expr2.h b/main/ast_expr2.h index 5bf60f71a3..2d6dc479ce 100644 --- a/main/ast_expr2.h +++ b/main/ast_expr2.h @@ -94,7 +94,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 344 "ast_expr2.y" +#line 345 "ast_expr2.y" { struct val *val; struct expr_node *arglist; diff --git a/main/ast_expr2.y b/main/ast_expr2.y index cb8f9f6b04..dc90aaa571 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -17,7 +17,8 @@ #include #include -#if !defined(STANDALONE) +#if !defined(STANDALONE) && !defined(STANDALONE2) \ + ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #else #ifndef __USE_ISOC99 @@ -212,7 +213,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/ast_expr.h" #include "asterisk/logger.h" -#ifndef STANDALONE +#if !defined(STANDALONE) && !defined(STANDALONE2) #include "asterisk/pbx.h" #endif @@ -240,7 +241,7 @@ enum valtype { AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string } ; -#ifdef STANDALONE +#if defined(STANDALONE) || defined(STANDALONE2) void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6))); #endif @@ -656,6 +657,62 @@ is_zero_or_null (struct val *vp) /* NOTREACHED */ } +#ifdef STANDALONE2 + +void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) +{ + va_list vars; + va_start(vars,fmt); + + printf("LOG: lev:%d file:%s line:%d func: %s ", + level, file, line, function); + vprintf(fmt, vars); + fflush(stdout); + va_end(vars); +} + + +int main(int argc,char **argv) { + char s[4096]; + char out[4096]; + FILE *infile; + + if( !argv[1] ) + exit(20); + + if( access(argv[1],F_OK)== 0 ) + { + int ret; + + infile = fopen(argv[1],"r"); + if( !infile ) + { + printf("Sorry, couldn't open %s for reading!\n", argv[1]); + exit(10); + } + while( fgets(s,sizeof(s),infile) ) + { + if( s[strlen(s)-1] == '\n' ) + s[strlen(s)-1] = 0; + + ret = ast_expr(s, out, sizeof(out), NULL); + printf("Expression: %s Result: [%d] '%s'\n", + s, ret, out); + } + fclose(infile); + } + else + { + if (ast_expr(argv[1], s, sizeof(s), NULL)) + printf("=====%s======\n",s); + else + printf("No result\n"); + } + return 0; +} + +#endif + #undef ast_yyerror #define ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio) @@ -680,7 +737,7 @@ static void destroy_arglist(struct expr_node *arglist) } } -#if !defined(STANDALONE) +#if !defined(STANDALONE) && !defined(STANDALONE2) static char *compose_func_args(struct expr_node *arglist) { struct expr_node *t = arglist; @@ -974,7 +1031,7 @@ static struct val *op_func(struct val *funcname, struct expr_node *arglist, stru #endif } else { /* is this a custom function we should execute and collect the results of? */ -#ifndef STANDALONE +#if !defined(STANDALONE) && !defined(STANDALONE2) struct ast_custom_function *f = ast_custom_function_find(funcname->u.s); if (!chan) ast_log(LOG_WARNING,"Hey! chan is NULL.\n"); diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c index 409f4fd897..528afd9ae6 100644 --- a/main/ast_expr2f.c +++ b/main/ast_expr2f.c @@ -353,8 +353,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 37 -#define YY_END_OF_BUFFER 38 +#define YY_NUM_RULES 38 +#define YY_END_OF_BUFFER 39 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -362,14 +362,15 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[61] = +static yyconst flex_int16_t yy_accept[63] = { 0, - 0, 0, 0, 0, 34, 34, 38, 37, 27, 29, - 21, 37, 31, 37, 19, 2, 24, 25, 17, 14, + 0, 0, 0, 0, 35, 35, 39, 38, 27, 29, + 21, 38, 31, 38, 19, 2, 24, 25, 17, 14, 15, 16, 18, 30, 22, 10, 3, 9, 20, 1, - 37, 37, 33, 32, 34, 35, 35, 13, 0, 28, + 38, 38, 34, 33, 35, 37, 37, 13, 0, 28, 31, 0, 26, 5, 31, 30, 23, 12, 6, 7, - 11, 4, 8, 0, 33, 32, 34, 36, 30, 0 + 11, 4, 8, 0, 34, 33, 35, 0, 36, 32, + 30, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -406,75 +407,73 @@ static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_meta[29] = { 0, - 1, 2, 2, 2, 1, 3, 4, 2, 2, 2, + 1, 2, 2, 2, 1, 3, 3, 2, 2, 2, 2, 2, 2, 1, 2, 3, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1, 1, 3 } ; -static yyconst flex_int16_t yy_base[68] = +static yyconst flex_int16_t yy_base[70] = { 0, - 0, 0, 5, 6, 32, 60, 69, 137, 137, 137, - 47, 59, 56, 38, 137, 48, 137, 137, 137, 137, - 137, 137, 137, 83, 36, 33, 13, 32, 137, 27, - 24, 17, 137, 137, 0, 137, 25, 137, 42, 137, - 38, 12, 137, 137, 17, 0, 137, 137, 137, 137, - 137, 137, 137, 18, 137, 137, 0, 137, 0, 137, - 111, 115, 119, 121, 125, 129, 133 + 0, 0, 5, 6, 32, 60, 73, 130, 130, 130, + 51, 66, 63, 45, 130, 59, 130, 130, 130, 130, + 130, 130, 130, 83, 45, 42, 13, 41, 130, 32, + 28, 17, 130, 130, 47, 130, 29, 130, 47, 130, + 44, 25, 130, 130, 29, 0, 130, 130, 130, 130, + 130, 130, 130, 18, 130, 130, 38, 12, 130, 130, + 0, 130, 111, 114, 117, 32, 120, 123, 126 } ; -static yyconst flex_int16_t yy_def[68] = +static yyconst flex_int16_t yy_def[70] = { 0, - 60, 1, 61, 61, 62, 62, 60, 60, 60, 60, - 60, 63, 64, 65, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 66, 60, 60, 67, 60, 60, 60, 63, 60, - 64, 65, 60, 60, 41, 24, 60, 60, 60, 60, - 60, 60, 60, 66, 60, 60, 67, 60, 45, 0, - 60, 60, 60, 60, 60, 60, 60 + 62, 1, 63, 63, 64, 64, 62, 62, 62, 62, + 62, 65, 66, 67, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 68, 62, 62, 69, 62, 62, 62, 65, 62, + 66, 67, 62, 62, 41, 24, 62, 62, 62, 62, + 62, 62, 62, 68, 62, 62, 69, 62, 62, 62, + 45, 0, 62, 62, 62, 62, 62, 62, 62 } ; -static yyconst flex_int16_t yy_nxt[166] = +static yyconst flex_int16_t yy_nxt[159] = { 0, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 13, 23, 24, 25, 26, 27, 28, 29, 8, 30, 8, 31, 13, 33, 33, - 34, 34, 35, 49, 59, 60, 35, 35, 37, 50, - 55, 55, 56, 56, 42, 35, 40, 35, 58, 35, - 53, 52, 51, 48, 47, 35, 44, 35, 35, 35, - 35, 43, 42, 40, 35, 35, 37, 38, 60, 60, - 60, 60, 60, 35, 60, 35, 60, 35, 60, 60, - 60, 60, 60, 35, 60, 35, 35, 35, 41, 42, - 60, 60, 60, 60, 60, 60, 60, 60, 45, 60, - - 46, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 41, 32, 32, 32, 32, 36, 36, 36, 36, 39, - 39, 39, 39, 41, 41, 41, 41, 41, 41, 54, - 54, 54, 54, 57, 60, 57, 7, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60 + 34, 34, 35, 49, 41, 59, 35, 35, 37, 50, + 55, 55, 56, 56, 58, 35, 61, 35, 60, 35, + 42, 40, 59, 58, 53, 35, 52, 35, 35, 35, + 35, 51, 48, 47, 35, 35, 37, 44, 43, 42, + 40, 38, 62, 35, 62, 35, 62, 35, 62, 62, + 62, 62, 62, 35, 62, 35, 35, 35, 41, 42, + 62, 62, 62, 62, 62, 62, 62, 62, 45, 62, + + 46, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 41, 32, 32, 32, 36, 36, 36, 39, 39, 39, + 41, 41, 41, 54, 54, 54, 57, 62, 57, 7, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62 } ; -static yyconst flex_int16_t yy_chk[166] = +static yyconst flex_int16_t yy_chk[159] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, - 3, 4, 5, 27, 45, 42, 5, 5, 5, 27, - 32, 54, 32, 54, 41, 5, 39, 5, 37, 5, - 31, 30, 28, 26, 25, 5, 16, 5, 5, 5, - 6, 14, 13, 12, 6, 6, 6, 11, 7, 0, - 0, 0, 0, 6, 0, 6, 0, 6, 0, 0, + 3, 4, 5, 27, 66, 58, 5, 5, 5, 27, + 32, 54, 32, 54, 57, 5, 45, 5, 42, 5, + 41, 39, 37, 35, 31, 5, 30, 5, 5, 5, + 6, 28, 26, 25, 6, 6, 6, 16, 14, 13, + 12, 11, 7, 6, 0, 6, 0, 6, 0, 0, 0, 0, 0, 6, 0, 6, 6, 6, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 24, 61, 61, 61, 61, 62, 62, 62, 62, 63, - 63, 63, 63, 64, 64, 65, 65, 65, 65, 66, - 66, 66, 66, 67, 0, 67, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60 + 24, 63, 63, 63, 64, 64, 64, 65, 65, 65, + 67, 67, 67, 68, 68, 68, 69, 0, 69, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62 } ; /* The intent behind this definition is that it'll catch @@ -597,7 +596,7 @@ int ast_yyget_column(yyscan_t yyscanner); static int curlycount = 0; static char *expr2_token_subst(const char *mess); -#line 599 "ast_expr2f.c" +#line 598 "ast_expr2f.c" #define INITIAL 0 #define var 1 @@ -843,7 +842,7 @@ YY_DECL #line 125 "ast_expr2.fl" -#line 845 "ast_expr2f.c" +#line 844 "ast_expr2f.c" yylval = yylval_param; @@ -906,13 +905,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 61 ) + if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 60 ); + while ( yy_current_state != 62 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1112,7 +1111,17 @@ YY_RULE_SETUP case 32: /* rule 32 can match eol */ YY_RULE_SETUP -#line 182 "ast_expr2.fl" +#line 181 "ast_expr2.fl" +{ + curlycount = 0; + BEGIN(var); + yymore(); + } + YY_BREAK +case 33: +/* rule 33 can match eol */ +YY_RULE_SETUP +#line 187 "ast_expr2.fl" { curlycount--; if (curlycount < 0) { @@ -1123,18 +1132,18 @@ YY_RULE_SETUP } } YY_BREAK -case 33: -/* rule 33 can match eol */ +case 34: +/* rule 34 can match eol */ YY_RULE_SETUP -#line 192 "ast_expr2.fl" +#line 197 "ast_expr2.fl" { curlycount++; yymore(); } YY_BREAK -case 34: +case 35: YY_RULE_SETUP -#line 198 "ast_expr2.fl" +#line 203 "ast_expr2.fl" { BEGIN(0); SET_COLUMNS; @@ -1142,10 +1151,19 @@ YY_RULE_SETUP return TOKEN; } YY_BREAK -case 35: -/* rule 35 can match eol */ +case 36: YY_RULE_SETUP -#line 205 "ast_expr2.fl" +#line 210 "ast_expr2.fl" +{ + curlycount = 0; + BEGIN(var); + yymore(); + } + YY_BREAK +case 37: +/* rule 37 can match eol */ +YY_RULE_SETUP +#line 216 "ast_expr2.fl" { char c = yytext[yyleng-1]; BEGIN(0); @@ -1155,17 +1173,8 @@ YY_RULE_SETUP return TOKEN; } YY_BREAK -case 36: -YY_RULE_SETUP -#line 214 "ast_expr2.fl" -{ - curlycount = 0; - BEGIN(var); - yymore(); - } - YY_BREAK case YY_STATE_EOF(trail): -#line 220 "ast_expr2.fl" +#line 225 "ast_expr2.fl" { BEGIN(0); SET_COLUMNS; @@ -1174,12 +1183,12 @@ case YY_STATE_EOF(trail): /*actually, if an expr is only a variable ref, this could happen a LOT */ } YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 228 "ast_expr2.fl" +#line 233 "ast_expr2.fl" ECHO; YY_BREAK -#line 1181 "ast_expr2f.c" +#line 1190 "ast_expr2f.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(var): yyterminate(); @@ -1475,7 +1484,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 61 ) + if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1504,11 +1513,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 61 ) + if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 60); + yy_is_jam = (yy_current_state == 62); return yy_is_jam ? 0 : yy_current_state; } @@ -2355,7 +2364,7 @@ void *ast_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 228 "ast_expr2.fl" +#line 233 "ast_expr2.fl" diff --git a/utils/Makefile b/utils/Makefile index 03ecdf6343..3bf1afc79b 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -16,10 +16,21 @@ ASTTOPDIR?=.. .PHONY: clean all uninstall -ALL_UTILS:=astman smsq stereorize streamplayer muted check_expr hashtest2 hashtest astcanary refcounter aelparse conf2ael +# to get check_expr, add it to the ALL_UTILS list -- this is a somewhat old checking +# program that wants an ael file for input, and will check each $[] expr for +# possible (old) problems, like spacing around operators, which dates back to +# the 1.2 days. The neat part is that it will actually evaluate the expressions. +# Users could use this to quickly check expressions in their .ael file. +# to get check_expr2, add it to the ALL_UTILS list -- this is a program that will +# read in a file containing expressions (as if they were in $[ ]), one per line. +# It will, of course signal any syntax errors. Devs (like murf) should use this whenever +# changes are made to ast_expr2.y or ast_expr2.fl (or the corresponding .c files), +# as a regression test. Others (mere mortals?) need not bother, but they are +# more than welcome to play! The regression test itself is in expr2.testinput. +ALL_UTILS:=astman smsq stereorize streamplayer muted hashtest2 hashtest astcanary refcounter aelparse conf2ael check_expr2 UTILS:=$(ALL_UTILS) -LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace +LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace include $(ASTTOPDIR)/Makefile.rules @@ -73,7 +84,7 @@ clean: rm -f *.o $(ALL_UTILS) check_expr rm -f .*.d rm -f *.s *.i - rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c + rm -f md5.c strcompat.c ast_expr2.c ast_expr2.h ast_expr2f.c pbx_ael.c pval.c hashtab.c rm -f aelparse.c aelbison.c conf2ael rm -f utils.c strings.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter @@ -110,6 +121,10 @@ ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c $(CMD_PREFIX) cp "$<" "$@" ast_expr2.o: ASTCFLAGS+=-DSTANDALONE +ast_expr2.h: $(ASTTOPDIR)/main/ast_expr2.h + $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@" + $(CMD_PREFIX) cp "$<" "$@" + ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@" $(CMD_PREFIX) cp "$<" "$@" @@ -135,6 +150,7 @@ aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c ael_main.o: ASTCFLAGS+=-DSTANDALONE aelparse.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res -DSTANDALONE -Wno-unused +aelparse: LIBS+=-lm aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o astobj2.c: $(ASTTOPDIR)/main/astobj2.c @@ -175,12 +191,16 @@ extconf.o: extconf.c conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o -testexpr2s: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h - $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2f.o - $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2.o - $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o - rm ast_expr2.o ast_expr2f.o - ./testexpr2s expr2.testinput +check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h + $(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o" + $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o + $(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o" + $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o + $(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2" + $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o -lm + $(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o" + rm ast_expr2z.o ast_expr2fz.o + ./check_expr2 expr2.testinput smsq: smsq.o strcompat.o smsq: LIBS+=$(POPT_LIB) diff --git a/utils/expr2.testinput b/utils/expr2.testinput index 9e1532b27b..8e1169be7d 100644 --- a/utils/expr2.testinput +++ b/utils/expr2.testinput @@ -123,4 +123,12 @@ ACOS(12) ASIN(1) ATAN(10) SQRT(2)*SQRT(2) +ATAN(12) + TRUNC(2.4) *ASIN(14.3) *ACOS(1.2) +ATAN(.912) +TRUNC(2.4) +ASIN(0.705) +ACOS(.12) +ATAN(.912) + TRUNC(2.4) - ASIN(0.705) + ACOS(.12) MATH(3*9) +${GLOBAL(ULKOPREFIX)}9${x} +512059${x}