Configuration parsing code landed

Russ Allbery rra at stanford.edu
Thu Jun 21 09:21:20 UTC 2001


Okay, the beginnings (and some of the middles) of the new configuration
parsing code is now in the tree; I just finished implementing integer and
string parameters tonight and writing a test suite for the whole wad.
Currently the code isn't plugged into anything.  The next project is to
rewrite the inn.conf parser to use the new code, which should make it
considerably smaller.

Groups aren't implemented yet, only a flat list of parameters in a file,
since that's all we need for inn.conf and therefore all we need for 2.4.
Groups won't be hard to add, though.

Parsing of syntactically valid configuration is decently tested, but the
error handling isn't all that well-tested yet.  I need to devise a way to
test that part.  There may therefore still be bugs in it, like getting
line numbers wrong or what have you.

The code is in lib/confparse.c; please look it over and go through it with
a fine-tooth comb if you want.  I'm very open to any suggestions about how
to make it more readable.  I want this to be very maintainable code down
the road.  There's a large comment at the top of the file that lays out
the basic organization.

I've also committed the design documents I posted to the list earlier;
they're doc/config-*.

I may have missed tonight's snapshot, so those of you who work from
snapshots may need to wait until tomorrow night's.

Oh, and for those of you who like random statistics....

  1142   428    total lines/statements

   286  lines had comments        25.0 %
    11  comments are inline       -1.0 %
   130  lines were blank          11.4 %
     9  lines for preprocessor     0.8 %
   728  lines containing code     63.7 %
  1142  total lines              100.0 %

  9803  comment-chars             27.9 %
  1010  nontext-comment-chars      2.9 %
  9518  whitespace-chars          27.1 %
   178  preprocessor-chars         0.5 %
 14610  statement-chars           41.6 %
 35119  total characters         100.0 %

  1921  tokens, average length 5.86

  0.66  ratio of comment:code

    70  top-level blocks/statements
     5  maximum blocklevel
  2.37  ratio of blocklevel:code

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>


More information about the inn-workers mailing list