Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] libvariable

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Mark Andrews <msasgl AT msa-enterprises.com>
  • To: Dufflebunk <dufflebunk AT dufflebunk.homeip.net>
  • Cc: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] libvariable
  • Date: Mon, 7 Oct 2002 12:39:31 +0100

Hello Dufflebunk,

Saturday, October 5, 2002, 8:25:48 PM, you wrote:

>> 1) It is immediately obvious where data values are coming from.
D> Standard problem of flexibility vs readability. With intelegent variable
D> choice, not much readability should be sacrificed.

I'm working on improving both. Not coded it yet, but I think I can
provide a significant amount of XML style functionality in bash using
this colon seperated format. Be easier to explain later in the week
when there's code to look at but....

If you think of the description of output from cpu2gcc in my earlier
message as a schema, a directory as a "table", a file as a record,
then the MANAGER: entry points to the default DTD (a bash script), and
the data emulates this XML structure :-

<OPTIONS>
<SPEEDY>-O3</SPEEDY>
<STRIP>-Os</STRIP>
</OPTIONS>

with :-

OPTIONS1:-O3:SPEEDY
OPTIONS2:-Os:STRIP

(Yes, this is a slight change to the draft!)

So it might give you an idea of how I'm thinking on this. (speedy /
strip is just an example - they aren't processor specific and won't
really be in the output)

>> 6) If it's good enough for the kernel routines...
D> The kernel routines, if you'll look at your kernel .config uses and the
D> Makefile, you'll notice that the Makefile includes the .config, which
D> looks very much like the local/config...

8-) I was refering to the running kernel routines that put the info in
the /proc namespace. But I take your point.

D> There is a nice function you might like to use in libmisc called
D> explode. It's similar to the PHP explode function. It's used in several
D> functions that deal with files in the colon field separated format.

I did look at that, but it was overkill for what cpudetect needed at
that time.

D> I will have to take a close read on your variables lib. It would be nice
D> to have a set of functions to deal with that stuff.

No problem. I plan on having the following functions

varlookup variable filename (gets 1st :*: after var name only)
linelookup variable filename (gets entire line after 1st :)
store variable value filename (store new or update as appropriate)
remove variable filename (delete variable entry from file)

plus extra routines to handle those variables with more than one value
(OPTIONS etc) - Possibly the current explode function ;-)

After recent discussions I don't see much point in including the
"bashwalk" function to take an entire colon seperated file into bash
variables at this time. I'll just do the stuff I actually need and if
someone requests "bashwalk" or other features then we can talk about the
most useful way to implement them.

--
Best regards,
Mark mailto:msasgl AT msa-enterprises.com





Archive powered by MHonArc 2.6.24.

Top of Page