Re: [Sablevm-developer] Re: Config File Parsing
Brought to you by:
egagnon
From: Etienne M. G. <eg...@j-...> - 2000-12-04 04:58:06
|
I forgot something: I am already using popt. I now remember that it can parse arbitrary strings in argv[] style arrays. A very simple program could read options from a configuration file, strip leading/trailing space characters (at the line beginning/end, and around the first "=" character) then add a "--" prefix, then store the result in an array of strings, then simply add to this array the strings of argv[]. As usual, empty lines (after stripping) and comment lines (starting with #) would be ignored. Line continuation support would be nice to have, too;-) i.e.: file content ------------ # comment boot-class-path = /usr/share/sablepath/classes boot-library-path \ = /usr/share/sablepath/lib ... converted into: "--boot-class-path=/usr/share/sablepath/classes" "--boot-library-path=/usr/share/sablepath/lib" The nice thing, with this approach, is that we would automatically get popt's error messages for invalid options (and optinally option aliasing, too!) This would probably be the best solution, as it fits nicely with the current command line parsing code. Etienne Brent Fulgham wrote: > > Have a look at "dot.conf", http://www.azzit.de/dotconf. I think > it might do what we need. It's also LGPL'd. > > It doesn't appear to be packaged for Debian yet, so I'll take care > of that (after checking with others to see if it's in the works.) > > -Brent > _______________________________________________ > Sablevm-developer mailing list > Sab...@li... > http://lists.sourceforge.net/mailman/listinfo/sablevm-developer -- ---------------------------------------------------------------------- Etienne M. Gagnon, M.Sc. e-mail: eg...@j-... Author of SableCC: http://www.sable.mcgill.ca/sablecc/ and SableVM: http://www.sablevm.org/ ---------------------------------------------------------------------- |