[gtkada] configuration files
Preben Randhol
randhol at pvv.org
Wed May 29 16:16:13 CEST 2002
"Ebert, Rolf" <rolf.ebert at bms.de> wrote on 29/05/2002 (15:29) :
> I think we should split the discussion into two areas:
>
> A) functionality that has to be provided to clients of the package B)
> file (database) format of the actual configuration file
>
> Defining the functionality (A) leads to the design of a specification
> file.
>
> Defining the file format (B) defines the requirements for the
> implementation of the body.
>
> Some of the requirements for A:
>
> A.1: The underlying file format shall not be implied by the spec file
That is ok.
> A.2: A hierarchy of keys shall be possible Note: The top level
> hierarchy is usually called section by now.
Please give an example
>
> A.3: Multiple levels of hierarchy are preferable (I do not think that
> there is consensus on this one)
You mean sections inside sections? Is this needed?
> A.4: All values shall be accessible as strings at least
Yes, Strings.
> A.5: A list of keys available in a given section shall be retrievable
Yes.
> A.6: others...
>
> I do not like the idea to write values back to a configuration file.
> I would place the writing routines in child package or leave them out
> completely.
You mean that one should only be able to read config files? I would like
to use the package to write the config files too. Then I know that the
config file gets correct.
What about that the package reads only one section at a time? Of course
this can be a problem if it is allowed to have an arbitrary order of the
sections.
>
> Notes on B:
> I think we can write multiple bodies for the different file formats.
> I can even imagine a heursitic that at least the reading routines
> detect the file format automatically.
Why? It leads only to confussion on the syntax of a programs config file
It would be nice if all Ada program have the same config file format.
Besides at least I would like the package as small as simple as
possible.
> I like the idea of the
>
> Section "Directory" EndSection
>
> format. This looks quite similar to Ada itself. Is it possible to
> have nested sections. How do they look like?
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 16
SubSection "Display"
Depth 1
Modes "1024x768"
EndSubSection
SubSection "Display"
Depth 4
Modes "1024x768"
EndSubSection
EndSection
I would though prefer:
Section "Screen"
Identifier = "Default Screen"
Device = "Generic Video Card"
Monitor = "Generic Monitor"
etc...
to distinguish keyword and value better.
> As an aside: has anybody looked at the file format for the gnat
> project files as of gcc-3.1. This is almost pure Ada!
No, can you show an example here?
--
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
«For me, Ada95 puts back the joy in programming.»
More information about the gtkada
mailing list