Mail Archives: djgpp/2000/07/30/17:31:42
Tom Fjellstrom wrote:
>
> Version 1.2 of CFG brings some fairly
> significant changes, so it is a recommended
> update if you are already using it.
>
> And if you're not using CFG yet, I only have
> one thing to say: check it out at
> http://strangesoft.hypermart.net/
Sory about this... I fired it off late
last night. So here is a description.
CFG v1.2
--------
1. What is it?
1.1. New...
1.2. Examples
2. Where can I get it?
3. How do I compile it?
4. Known Bugs...
1. What is CFG???
--------------
CFG is another config library that loads
.ini 'like' files. But CFG has one major
difference from all the others... Sections
can be nested.
1.1. New...
------
o The parser now handles text using the default local..
o It is way more sane when handling different types of vars,
ie: numbers are saved as a bare string (no quotes),
single quoted strings are saved as single quoted strings. :)
o Blank CFG_FILE structures may now be created via the new_cfg(void) func.
o CFG_FILE's can be saved under a different name using the
save_cfg(CFG_FILE *, char *) function.
o Multiline options are alloud.. (kinda like the line continuation for the
c preprocessor) check the test.cfg file to se exactly what they look like.
o Redefined vars arn't a memory leak anymore and if the concat option is
set before a cfg file is parsed it will join them together.
1.2. Examples.
---------
example 1:
CFG_FILE *cfg = load_cfg("somefile.cfg"); // load a .cfg file.
char *get_cfg_string(cfg,"some.section","somevar","default value");
...
set_cfg_int(cfg,"some.section","somevar",123);
close_cfg(cfg);
exampe 2:
CFG_FILE *cfg = new_cfg(); // create new blank cfgfile
set_cfg_option(cfg, concat); // tell the parser that
// you want strcat() redefined cfg vars together.
set_cfg_int(cfg,"some.section","somevar",123);
save_cfg(cfg, "somefile.cfg");
2. Where can I get it?
-------------------
http://strangesoft.hypermart.net/cfg.html
3. How do I compile it?
--------------------
To compile CFG you must have DJGPP (http://www.delorie.com/djgpp/)
or linux. Type 'make' into a command prompt to compile,
and 'make install' to install.
4. Known Bugs...
-------------
o multi-line options arn't saved as a multiline option
o when a file is read in concat mode, the save function has no clue.
o the save function is all wrong but it's not to high a priority...
o nesting sections too deap may cause a crash (core dump)
thank you.
--
Top 10 reasons to procrastinate:
1.
Tom Fjellstrom
- Raw text -