[sr-dev] [PATCH] Adding define/ifdef/ifndef to cfg preprocessing

Jan Janak jan at ryngle.com
Wed Oct 14 14:44:36 CEST 2009


On Tue, Oct 13, 2009 at 12:13 PM, Andrei Pelinescu-Onciul
<andrei at iptel.org> wrote:
> On Oct 02, 2009 at 02:51, Bogdan Harjoc <harjoc at gmail.com> wrote:
>> Since include_file was just added, why not go one extra step and
>> allow things like (adapted from etc/kamailio.cfg):
>>
>> #!define PRESENCE
>>
>> #!ifdef PRESENCE
>>   loadmodule "presence.so"
>>   loadmodule "presence_xml.so"
>> #!else
>>   #!ifndef KAMAILIO
>>     ...
>>   #!endif
>> #!endif
>>
>> M4 is already used and a better alternative IMO, but cfg is clearly not a
>> typical language, so I imagine someone may find this useful. Patch against
>> commit 7362f824.
>
> Good idea. I would only add support for comments
> (e.g. endif # from ifdef FOO) and probaby would also allow defines on
> the command line.

The prefix #! looks good to me.

> What we should decide is if we go with #!define or some other format
> (e.g. .define FOO). We should use the same format for
> include/include_file.

Yes, I agree that we should use the same prefix for the include directive.

   -- Jan



More information about the sr-dev mailing list