Message-ID: <39CFADA6.DBCD77A@home.com> From: Tom Fjellstrom X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.15-4mdk i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: [Announce] CFG 1.4 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 104 Date: Mon, 25 Sep 2000 19:55:07 GMT NNTP-Posting-Host: 24.70.88.141 X-Complaints-To: abuse AT home DOT net X-Trace: news1.rdc1.ab.home.com 969911707 24.70.88.141 (Mon, 25 Sep 2000 12:55:07 PDT) NNTP-Posting-Date: Mon, 25 Sep 2000 12:55:07 PDT Organization: Excite AT Home - The Leader in Broadband To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com CFG v1.4 -------- 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 just another config library that loads .ini 'like' files, but CFG has one major difference from all the others... Sections can be nested up to 200 in depth. (might be unlimited if I have nothing to do one day :) 1.1. New... ------ 1.4 --- o *MAJOR* bug fixed in the 'split' function. o added the 'set_section' function. o added the 'set_cfg_var_type' function. o added *some* documentation. :) 1.2 --- 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_section(cfg, "some"); set_cfg_int(cfg,"section","somevar",123); // sets 'some.section.somevar' 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. (It should work under any GCC compiler but it has only been tested under DJGPP and Linux on an Intel processor) 4. Known Bugs... ------------- o multi-line options arn't saved as a multiline option o when a file has been 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) -- Tom Fjellstrom tfjellstrom AT home DOT com http://strangesoft.hypermart.net/