Module: sip-router
Branch: andrei/script_vars
Commit: 0b3512af8f5c42bea2e17de6efce9571e85241f8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0b3512a…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Dec 11 19:30:41 2008 +0100
script engine: more rvalue optimizations
- optimize:
($v * a) * b -> $v * (a * b) if '*' is associative
(a * $v) * b -> (a * b) * $v if '*' is assoc. and commutative
a * ($v * b) -> (a * b) * $v if '*' is assoc. and commutative
a * (b * $v) -> (a * b) * $v if '*' is associative
where a & b are constants, $v is a var (pvar or avp) and '*' is
the operator.
- special hacks for optimizing '+' ('+' is a special case because
in the current form it can work both with strings and ints which
combined with the dynamic typed vars make it very hard to
optimize)
---
rvalue.c | 400 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 366 insertions(+), 34 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=0b3…
Module: sip-router
Branch: andrei/script_vars
Commit: 5219ecb708daba13749ec8d242129a117449ba9f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5219ecb…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Dec 10 14:52:12 2008 +0100
core: new command line option (debugging)
- new command line option controlling the script optimization
level: -O (e.g. -O0 - no optimizations). By default the
optimization level is set to maximum (2 for now).
- renamed sctp max process number command line option from -O to -Q
---
main.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/main.c b/main.c
index 86c7a2f..802e1f0 100644
--- a/main.c
+++ b/main.c
@@ -222,7 +222,7 @@ Options:\n\
#endif
#ifdef USE_SCTP
" -S disable sctp\n\
- -O Number of sctp child processes (default: equal to `-n')\n"
+ -Q Number of sctp child processes (default: equal to `-n')\n"
#endif /* USE_SCTP */
" -V Version number\n\
-h This help message\n\
@@ -234,7 +234,8 @@ Options:\n\
-u uid Change uid \n\
-g gid Change gid \n\
-P file Create a pid file\n\
- -G file Create a pgid file\n"
+ -G file Create a pgid file\n\
+ -O nr Script optimization level (debugging option)\n"
#ifdef STATS
" -s file File to which statistics is dumped (disabled otherwise)\n"
#endif
@@ -1502,7 +1503,7 @@ int main(int argc, char** argv)
"DBG_MSG_QA enabled, ser may exit abruptly\n");
#endif
- options= ":f:cm:dVhEb:l:L:n:vrRDTN:W:w:t:u:g:P:G:SO:"
+ options= ":f:cm:dVhEb:l:L:n:vrRDTN:W:w:t:u:g:P:G:SQ:O:"
#ifdef STATS
"s:"
#endif
@@ -1572,6 +1573,14 @@ int main(int argc, char** argv)
case 'E':
log_stderr=1;
break;
+ case 'O':
+ scr_opt_lev=strtol(optarg, &tmp, 10);
+ if (tmp &&(*tmp)){
+ fprintf(stderr, "bad optimization level: -O %s\n",
+ optarg);
+ goto error;
+ };
+ break;
case 'b':
case 'l':
case 'n':
@@ -1589,7 +1598,7 @@ int main(int argc, char** argv)
case 'P':
case 'G':
case 'S':
- case 'O':
+ case 'Q':
case 's':
break;
case '?':
@@ -1676,6 +1685,7 @@ try_again:
case 'd':
case 'V':
case 'h':
+ case 'O':
break;
case 'E':
log_stderr=1; // use in both getopt switches
@@ -1762,7 +1772,7 @@ try_again:
fprintf(stderr,"WARNING: sctp support not compiled in\n");
#endif
break;
- case 'O':
+ case 'Q':
#ifdef USE_SCTP
sctp_children_no=strtol(optarg, &tmp, 10);
if ((tmp==0) ||(*tmp)){