Newbee: Lispy alternatives for configuration information file
From: Rodney (Rodney.malone_at_rodneyware.com)
Date: 08/05/04
- Previous message: Dave Roberts: "Data structure for raw byte manipulation"
- Next in thread: Yuji Minejima: "Re: Newbee: Lispy alternatives for configuration information file"
- Reply: Yuji Minejima: "Re: Newbee: Lispy alternatives for configuration information file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 05 Aug 2004 05:58:54 GMT
I currently have a program that stores configuration information
in a modified window's INI file format. The information is
read at runtime and loads internal values and arrays. I would
like to replace this file with a Lisp friendly format to allow me
to utilize the lisp reader facilities, but not make the data appear
to criptic for a non-lisp maintainer to be able to make minor
manual edits to the file, or at minimum, view it and understand
the data in it. I feel XML is too verbose and seems to require
a fairly large, not-very-easy-to-use library, at least for this
particular purpose.
The current (non-lisp) file format looks something like this:
[File]
Version=1.5
Name=my_data
[Section 1]
Name="Section name 1"
[Feature 1]
Id=123
Value="hi there 1 - 1"
[Feature 2]
Id=456
Value="so long"
[Section 2]
Name="Section name 2"
[Feature 1]
Id=123
Value="hi there 2 - 1"
In this example, there are multiple sections with both key value
pairs and other sections under them. The current program reads
and parses out the sections (stuff with [brackets]) and the
key value pairs, and puts them in internal arrays and variables that
allow the user to find out how many Features are under Section 1,
and then cycle through the array to pull out the key value pairs
that fall under each [Section].
For example the following call would set x to "hi there 2 - 1".
x = GetValue("[Section 2].[Feature 1]:Value")
The notation is arbitrary and doesn't really matter, but there
has to be a way to specify where in the data tree you want to
look, and how many of the entries you want to get, if there
is more than one.
But to do that parsing and processing is ugly and hard to maintain,
as it is in a scripting language that does not have much in the way
of data storage and searching facilities. I have created a Common
Lisp plug-in that I can now use to give me a more robust data handling
capablility. However, being new to Lisp, I haven't been able to come
up with a sensible Lispy method or data format that allows
that would allow easy fetching of both individual values and
groups of values, for example, all of the "Id" values under [Section 1].
Any suggestions would be welcome.
Rodney
- Previous message: Dave Roberts: "Data structure for raw byte manipulation"
- Next in thread: Yuji Minejima: "Re: Newbee: Lispy alternatives for configuration information file"
- Reply: Yuji Minejima: "Re: Newbee: Lispy alternatives for configuration information file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|