Ideas for a modular config file?

Ideas for a modular config file?

Post by Andy Smit » Thu, 03 Jul 2003 16:23:19



Hi folk,

Right now I have a project that has a "bind-style" config file that is
parsed with the aid of flex and bison.  It looks a bit like this:

foo {
        some_key = "value";
        another_key = 42;

Quote:};

bar {
        you = "get the idea I suspect";

Quote:};

In my code, I have structures that would be like this:

struct foo {
        char *some_key;
        int another_key;

Quote:} foosection;

struct bar {
        char *you;

Quote:} barsection;

Then the parser produced by bison reads the config file and fills in each
section's structure with the relevant values.

All well and good, but now I come to a stage where I want to add module
functionality to this software, and some of the modules I wish to write may
extend the config file syntax.

I'm very new to bison (yacc) and I don't really understand how I might
achieve this, since the syntax of my config file seems to need to be
defined at compile-time whereas modules are obviously a run-time thing.

Might anyone have any tips?

 
 
 

Ideas for a modular config file?

Post by M?ns Rullg? » Thu, 03 Jul 2003 18:09:26



> Right now I have a project that has a "bind-style" config file that is
> parsed with the aid of flex and bison.  It looks a bit like this:

> Then the parser produced by bison reads the config file and fills in each
> section's structure with the relevant values.

> All well and good, but now I come to a stage where I want to add module
> functionality to this software, and some of the modules I wish to write may
> extend the config file syntax.

> I'm very new to bison (yacc) and I don't really understand how I might
> achieve this, since the syntax of my config file seems to need to be
> defined at compile-time whereas modules are obviously a run-time thing.

> Might anyone have any tips?

Maybe libtc can be of some use.  It has a config file parser with a
similar syntax.  The parser will accept any names of keys and reads
the entire file into memory.  Then you use some functions to extract
the information you want.  The drawback is that you won't catch
spelling errors and the like.

http://libtc.sf.net

--
M?ns Rullg?rd


 
 
 

Ideas for a modular config file?

Post by Johan den Boe » Sun, 06 Jul 2003 14:46:25


Hi,

Maybe XML is an option



Quote:> Hi folk,

> Right now I have a project that has a "bind-style" config file that is
> parsed with the aid of flex and bison.  It looks a bit like this:

> foo {
>         some_key = "value";
>         another_key = 42;
> };

> bar {
>         you = "get the idea I suspect";
> };

> In my code, I have structures that would be like this:

> struct foo {
>         char *some_key;
>         int another_key;
> } foosection;

> struct bar {
>         char *you;
> } barsection;

> Then the parser produced by bison reads the config file and fills in each
> section's structure with the relevant values.

> All well and good, but now I come to a stage where I want to add module
> functionality to this software, and some of the modules I wish to write
may
> extend the config file syntax.

> I'm very new to bison (yacc) and I don't really understand how I might
> achieve this, since the syntax of my config file seems to need to be
> defined at compile-time whereas modules are obviously a run-time thing.

> Might anyone have any tips?

 
 
 

1. Modular VPN/Router/Firewall idea/question

Hello all,
        I've been thinking of the possibility saing 'Fuck the frame relay',
getting fractional T1's (or even DSL) into my romotes, and tagging
everyone together via a modular OpenBSD VPN design. My thoughts were
along the lines of a low profile Dell GX110 733 w/ 256M ram with a 100M
ethernet card and a WAN card (suggestions of brands, please). I was
thinking of keeping a full OS setup on a bootable CD-ROM, with all of
the config files on a floppy (links on the CD-ROM pointing to the files
on the floppy), and with /var and /tmp mounted from hda1 (different name
in BSD?). Does this seem like a good idea? Redistributing config and or
OS updates to the remotes via a new CD and a new floppy seems pretty
attractive. Has anyone done this already? What come to mind as the major
drawbacks to this approach? Please let me know your thoughts on this
idea. I am _fairly_ versed in Linux, but OpenBSD will new ground for me.

Thanks everyone,
Christopher Barry

2. startup company

3. Microsoft PISSES at Modular idea...

4. Looking for Toshiba Satellite Pro 405CD Laptop Secondary Storage Recommendations

5. idea: GUI for .config files

6. "ping"ing broadcast under OSE 5.0

7. Modular IDE Build Failing Without Modular Generic PCI bus-master DMA support

8. perfmeter graphics refresh weirdness

9. translating kppp config files to ppp config files

10. Booting a modular kernel through a multiple streams file

11. Research modular file systems matching concept

12. tar vs cpio (was: Booting a modular kernel through a multiple streams file)