The following bug has been CLOSED
======================================================================
http://dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000129
======================================================================
Reported By:                ilja
Assigned To:                ilja
======================================================================
Project:                    DBMail
Bug ID:                     129
Category:                   General
Reproducibility:            N/A
Severity:                   feature
Priority:                   low
Status:                     closed
======================================================================
Date Submitted:             30-Nov-04 09:24 CET
Last Modified:              13-Dec-04 11:05 CET
======================================================================
Summary:                    config file parser needs to be more robust
Description: 
The parser for the config file needs to be better and simpler. This can be
easily fixed by using the "Key-value file parser" in GLib
(http://developer.gnome.org/doc/API/2.0/glib/glib-Key-value-file-parser.html)

======================================================================

----------------------------------------------------------------------
 ilja - 01-Dec-04 13:52 CET 
----------------------------------------------------------------------
We can't use the key-value from GLib yet. It's only available from GLib
2.6, which is a bit to new for my liking.

I'll go find another one (some PD code, of some examples of how to do it
in the right way.

----------------------------------------------------------------------
 aaron - 02-Dec-04 08:11 CET 
----------------------------------------------------------------------
This one, iniParser, looks awesome.

http://ndevilla.free.fr/iniparser/html/index.html

----------------------------------------------------------------------
 aaron - 02-Dec-04 08:19 CET 
----------------------------------------------------------------------
There's just one major thing that prevents us from using iniparser as a
stepping stone to Glib's key-value parser, and that's the comment
character. Glib uses # while iniparser uses ;. Glib uses ; for separating
multiple values in a field, which apparently is needed for things like the
freedesktop.org specs. Anyways, it's a pretty trivial modification to make
to iniparser, which we should place into the source tree rather than
trying to make it a library dependency.

>From the Glib key-value parser page:

This syntax is obviously inspired by the .ini files commonly met on
Windows, but there are some important differences:

    * .ini files use the ';' character to begin comments, key files use
the '#' character.
    * Key files allow only comments before the first group.
    * Key files are always encoded in UTF-8.

----------------------------------------------------------------------
 ilja - 03-Dec-04 11:44 CET 
----------------------------------------------------------------------
iniparser is indeed very good. I looked through through the source very
briefly, just to change it code for finding comments and as a matter of
fact, it already treats '#' as a comment starting character. 

I've done some quick hacking in config.c (and in some calls to ReadConfig
and GetConfigValue) and everything works really brilliantly. Config
functions are now much simpler, without all the list magic.

Now, I only need to find out how to put this stuff in our tree and let
libtool do it's magic.

----------------------------------------------------------------------
 ilja - 03-Dec-04 14:36 CET 
----------------------------------------------------------------------
OK, I've managed to persuade libtool and autotools to compile and link it
all, and it works :)

I'll do some cleanups and then commit it to CVS.

Ilja

----------------------------------------------------------------------
 ilja - 03-Dec-04 15:37 CET 
----------------------------------------------------------------------
cleanups done. committed to cvs. A clean cvs checkout compiles and works
ok.

----------------------------------------------------------------------
 ilja - 03-Dec-04 15:38 CET 
----------------------------------------------------------------------
HEAD now has a new config parser, which uses the iniparser library.

----------------------------------------------------------------------
 ilja - 13-Dec-04 11:05 CET 
----------------------------------------------------------------------
closed as fixed

Bug History
Date Modified  Username       Field                    Change              
======================================================================
30-Nov-04 09:24ilja           New Bug                                      
01-Dec-04 13:52ilja           Bugnote Added: 0000405                       
01-Dec-04 13:52ilja           Assigned To               => ilja            
01-Dec-04 13:52ilja           Status                   new => assigned     
02-Dec-04 08:11aaron          Bugnote Added: 0000409                       
02-Dec-04 08:19aaron          Bugnote Added: 0000410                       
03-Dec-04 11:44ilja           Bugnote Added: 0000417                       
03-Dec-04 14:36ilja           Bugnote Added: 0000418                       
03-Dec-04 15:37ilja           Bugnote Added: 0000419                       
03-Dec-04 15:38ilja           Bugnote Added: 0000420                       
03-Dec-04 15:38ilja           Resolution               open => fixed       
03-Dec-04 15:38ilja           Status                   assigned => resolved
13-Dec-04 11:05ilja           Bugnote Added: 0000444                       
13-Dec-04 11:05ilja           Status                   resolved => closed  
======================================================================

Reply via email to