some lines starting with '#' where
auto-stripped from git commit, so again:
>
cfg: extended preprocessor directives
- you can define values for IDs
#!define MYINT 123
#!define MYSTR "xyz"
- defined IDs are replaced at startup, during config parsing, e.g.,:
$var(x) = 100 + MYINT;
- is interpreted as:
$var(x) = 100 + 123;
- you can have multi-line defined IDs
#!define IDLOOP $var(i) = 0; \
while($var(i)<5) { \
xlog("++++ $var(i)\n"); \
$var(i) = $var(i) + 1; \
}
- then in routing block
route {
...
IDLOOP
...
}
- new preprocessor directive
#!subst "/regexp/subst/"
- perform substitutions inside the strings of config (note that define is
replacing only IDs - alphanumeric tokens not enclosed in quotes)
- #!subst offers an easy way to search and replace inside strings before
cfg parsing. E.g.,:
#!subst "/DBPASSWD/xyz/"
modparam("acc", "db_url",
"mysql://user:DBPASSWD@localhost/db")
- will do the substitution of db password in db_url parameter value
- number of allowed defines set to 256
- credits to Andrei for quick hints on ID defines
- notes:
- multilines defines are reduced to single line, so line counter
should be fine
- column counter goes inside the define value, but you have to omit
the \ and CR for the accurate inside-define position
On 4/24/10 12:18 AM, Daniel-Constantin Mierla wrote:
Module: sip-router
Branch: master
Commit: 20cddb28e968d8e0f79a7910d3cc83fa6f40887f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=20cddb2…
Author: Daniel-Constantin Mierla<miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla<miconda(a)gmail.com>
Date: Fri Apr 23 23:58:43 2010 +0200
cfg: extended preprocessor directives
- you can define values for IDs
- defined IDs are replaced at startup, during config parsing, e.g.,:
$var(x) = 100 + MYINT;
- is interpreted as:
$var(x) = 100 + 123;
- you can have multi-line defined IDs
while($var(i)<5) { \
xlog("++++ $var(i)\n"); \
$var(i) = $var(i) + 1; \
}
- then in routing block
route {
...
IDLOOP
...
}
- new preprocessor directive
- perform substitutions inside the strings of config (not that define is
replacing only IDs - alphanumeric tokens not enclosed in quotes)
- #!subst offers an easy way to search and replace inside strings before
cfg parsing. E.g.,:
modparam("acc", "db_url",
"mysql://user:DBPASSWD@localhost/db")
- will do the substitution of db password in db_url parameter value
- number of allowed defines set to 256
- credits to Andrei for quick hints on ID defines
- notes:
- multilines defines are reduced to single line, so line counter
should be fine
- column counter goes inside the define value, but you have to omit
the \ and CR for the accurate inside-define position
---
cfg.lex | 137
+++++++++++++++++++++++++++++++++++++++++++++++++++++----------
cfg.y | 8 ++++
ppcfg.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++
ppcfg.h | 30 ++++++++++++++
4 files changed, 270 insertions(+), 21 deletions(-)
Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=20c…
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev