[lug] Advice on writing a config file (probably XML)
Timothy C. Klein
teece at silverklein.net
Sun Dec 14 03:17:36 MST 2003
* Jon Bowman (solarisjon at gawab.com) wrote:
>
> Hi I'm looking for some advice. I'm writing a Gnome application
> to
> handle wireless profiles. Anyway I need to keep track of the
> profiles,
> data in the profile for example would include
>
> ESSID, WEP KEY, Network Device amongst some others
>
> Anyway I assume XML is probably the cleanest way to write a
> config
> file. Never having done this before or used XML does anyone have
> any
> recommendation / pointers to get me started. The application is
> written
> in C so are there any libraries / functions I can make use of ?
>
> Any help , advise and pointers or just personal experience would
> be
> appreciated.
I don't really know what advantages XML would have, but LEX and YACC
(flex and bison versions from GNU) are tailor made for this job. Lex is
pretty darn easy to learn, but is probably not enough (it is the lexical
analyzer, so it tokenizes for you). YACC (the part that understands a
grammar built up from tokens) is harder to learn, but could generate the
beginnings of a compiler if you wanted. Probably overkill for a simple
config-file, but parsing a language is what these tools were built to
do.
If you ever plan on your config file getting big and full-featured,
these two tools would make a whole lot of sense.
Tim
--
==============================================
== Timothy Klein || teece at silverklein.net ==
== ---------------------------------------- ==
== Hello_World.c: 17 Errors, 31 Warnings... ==
==============================================
More information about the LUG
mailing list