<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [SR-Users] My wish</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<BR>

<P><FONT SIZE=2>Hello Alex,<BR>
<BR>
&gt;&nbsp; Thus, it is not possible<BR>
&gt; in advance to know which modules will be loaded, nor possible to<BR>
&gt; iterate through some list and combine them into a string, so I cannot do:<BR>
&gt;<BR>
&gt;&nbsp;&nbsp;&nbsp; modparam(&quot;mod1|mod2|mod3&quot;, &quot;db_url&quot;, ...)<BR>
<BR>
Regarding the modparam statement, I think you can. Unfortunately, I can't test it a.t.m., but as far as I remember I think the modparam statement succeeds even if only one of the modules listed in the module section is configured correctly. For example you can have something like<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp; modparam(&quot;carrierroute|xyz&quot;, &quot;db_url&quot;, ....)<BR>
<BR>
and work, even if xyz module doesn't exist (yet).<BR>
<BR>
As another approach goes, I was thinking of having something like a preprocessor for ser cfg language. The lexer now only supports #define and #ifdef's but doesn't support macro substitution. The #define's and #ifdef's are integrated into the lexer and not an performed as a separate initial step, thus full macro support is hard to integrate.<BR>
<BR>
Your code might look smth like this :<BR>
<BR>
&nbsp;&nbsp; #define DBURL &quot;mysql://...&quot;<BR>
<BR>
&nbsp;&nbsp; modparam(&quot;module&quot;, &quot;db_url&quot;, DBURL)<BR>
<BR>
In my opinion it will be a nice feature.<BR>
<BR>
Marius&nbsp;<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Alex Balashov [<A HREF="mailto:abalashov@evaristesys.com">mailto:abalashov@evaristesys.com</A>]<BR>
Sent: Fri 4/9/2010 2:53 PM<BR>
To: Marius Zbihlei<BR>
Cc: SR-Users<BR>
Subject: Re: [SR-Users] My wish<BR>
<BR>
Marius,<BR>
<BR>
On 04/09/2010 08:50 AM, marius zbihlei wrote:<BR>
<BR>
&gt; I see what you mean, but I don't really know if it's possible, because<BR>
&gt; at the time of module initialization some core cfg's might not be<BR>
&gt; registered(especially for built-in modules which are initialized before<BR>
&gt; sr_cfg_init() ).<BR>
<BR>
I understand the practical obstacles, and that it may not be possible.<BR>
<BR>
The reason I would like this is that I have a flexible configuration I<BR>
reuse that has different modules loaded, primarily based on<BR>
preprocessor macros (#!ifdef ... #!endif).&nbsp; Thus, it is not possible<BR>
in advance to know which modules will be loaded, nor possible to<BR>
iterate through some list and combine them into a string, so I cannot do:<BR>
<BR>
&nbsp;&nbsp;&nbsp; modparam(&quot;mod1|mod2|mod3&quot;, &quot;db_url&quot;, ...)<BR>
<BR>
As a result, I have to have a manual db_url setting for every module<BR>
as well as at least one DB URL as an 'sqlcon' parameter to 'sqlops'.<BR>
<BR>
It is very frustrating and tedious to have to deal with problems like<BR>
this.&nbsp; I have written a Perl script to recursively update all db_url's<BR>
automatically, but it is an inelegant stopgap solution.&nbsp; There are<BR>
also other situations in which the ability to include some sort of PV<BR>
or variable (that is statically initialised globally) in the modparams.<BR>
<BR>
--<BR>
Alex Balashov - Principal<BR>
Evariste Systems LLC<BR>
1170 Peachtree Street<BR>
12th Floor, Suite 1200<BR>
Atlanta, GA 30309<BR>
Tel: +1-678-954-0670<BR>
Fax: +1-404-961-1892<BR>
Web: <A HREF="http://www.evaristesys.com/">http://www.evaristesys.com/</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>