Menu

parse_conf version 1.0 released!

parse_conf (http://anton.kulchitsky.org/pcnf/) is a library for parsing standard configuration or initialization files and supports some extensions over the standard syntax. It supports the separation of config files into different groups and reading strings and numbers. The library is written in ANSI C and designed to be fine with C++. Originally (in 2002, 2004) it was designed for reading initial values for scientific applications of special type. It was rewritten and extended since to be a flexible general purpose library. Since version 1.0, a very extensive reference substitution system is included into the library. The library is reentrant and allows to read/write as many configuration files simultaneously as necessary. The complete documentation in info format is included into the distribution. The library is released under the LGPL version 3 license.

The configuration file consists of sections, led by a [section] header and followed by name: value entries, name=value is also accepted. You also can concatenate a string to the previous value using name += value or name +: value commands. Note that leading and ending whitespaces are removed from string values and ignored from numeric values. To add a whitespace to a string, the string should be quoted by quote sign or you may use \s and \t values for spaces and tabulations. The rest of lines from # or ; are ignored and may be used to provide comments.

Any variable definition can contain references to other values. For example, to substitute the value from variable a of the same section or from the global variables, one may use $a reference or Pythonish %(a)s. To reference the variable from another section, the reference $[section]name should be used.

The reference substitution system is a unique feature that makes this library so different from similar libraries. parse_conf also has a pretty simple interface while allows read, compose, and write configuration files, list sections and fields, correctly read boolean values like yes/true. The library includes a special utility that reads configuration files and print them in parse_conf readable view with resolved references if necessary. After much discussions on specialized forums, the version 1.0 is finally released.

The web site of the library is http://anton.kulchitsky.org/pcnf

Posted by Anton Kulchitsky 2008-10-03

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.