Module: sip-router Branch: master Commit: 20cddb28e968d8e0f79a7910d3cc83fa6f40887f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=20cddb28...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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=20cd...
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=20cddb28...
Author: Daniel-Constantin Mierlamiconda@gmail.com Committer: Daniel-Constantin Mierlamiconda@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=20cd...
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla writes:
- multilines defines are reduced to single line, so line counter should be fine
daniel,
it should be possible to place the defines in a separate file from the main config file, which would thus not need to be changed, when some constant values are changed.
the line numbers in error messages should match the ones of the main config file. is this currently supported?
-- juha
On 4/24/10 10:29 AM, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
- multilines defines are reduced to single line, so line counter should be fine
daniel,
it should be possible to place the defines in a separate file from the main config file, which would thus not need to be changed, when some constant values are changed.
the line numbers in error messages should match the ones of the main config file. is this currently supported?
the lines match even with defines, there is no issue with that. However, there is include_file that you can use for a special file with defines. http://www.kamailio.org/dokuwiki/doku.php/core-cookbook:3.0.x#include_file
Cheers, Daniel
nice, thanks
Am 24.04.2010 00:25, schrieb Daniel-Constantin Mierla:
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=20cddb28...
Author: Daniel-Constantin Mierlamiconda@gmail.com Committer: Daniel-Constantin Mierlamiconda@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=20cd...
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev