[Asterisk-Dev] generation of config files from source code ?

Luigi Rizzo rizzo at icir.org
Sun Nov 20 14:43:15 MST 2005


On Sun, Nov 20, 2005 at 12:47:44PM -0600, Tilghman Lesher wrote:
> On Sunday 20 November 2005 03:42, Luigi Rizzo wrote:
> > How about this to keep sample config files in sync with the source
> > code:
> >
> > put the example config file for a channel/module/whatever embedded
> > in a comment in the source code (much like what is in
> > channels/chan_oss.c) and put in the configs/ directory a Makefile
> > and a small awk script to generate the sample from the source file.
> 
> I think I understand what you're trying to do, but I also think this
> is the wrong approach.  We certainly need to keep the config files in
> sync with the source, so we don't have undocumented configuration
> options.  That's best done with a policy directive that whenever you
> add or change an option, you must also update the configuration file.
> 
> Keeping the configuration file inline with the source doesn't actually
> solve the problem -- it merely moves the problem to a different
> source file.  Keeping the configuration inline with the source may

the goal is make life easier to people -- both for
the lazy programmer and for the police officer doing the code review.

If you change or fix or add an option and see the description
10-20 lines above, you as a lazy programmer are a lot more likely to fix
the documentation as well, and your reviewer will need a lot less time
to verify consistency rather than having to go look at a different file.

Basically that's the reason why we have doxygen and other documentation
generation tools and why they are used in asterisk as well.

I am really not inventing anything new here, just applying a principle
that was already used in the project...

	cheers
	luigi



More information about the asterisk-dev mailing list