Anyway, this isn't a new concept, but I've not found any library that does this in a completely isolated manner, so the program and the config reader can be seperate. Now, the program just requests config info by name when it needs it.
This is an example config file:
/* C style comments work */ // C++, too (oh, and whitespace is ignored) # And bourne if you dig that kind of thing avariable=itsvalue; anothervariable="A string value"; # This is an example of a subsection tree { type="broadleaf"; branch1 { color=blue; broken=1; } size="big"; branch2 { color=orange; } }
The parser doesn't care what's in the file, just what the file looks
like. Sections and subsections can be created (recursively), and
variables can be defined and referenced from whatever section they
exist in.
In this example, the table to the right (for lynx users, the garbage looking blob below) shows which variables were parsed from the config file, and how they can be referenced from the program.
|
|
There is a working model of this in use right now, but it won't be available for another week or so. If you'd like more information before then, please send E-mail to dustin@spy.net.