X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fdoc%2Fconf.txt;h=813a18358365c893b3885fc3fc611b4a0e0d3e3d;hb=HEAD;hp=43f838ec22a92aaadac5fde721e8edbc6b590bad;hpb=0db6e10eac28f38bfc3b325b13ad95107c58ce1e;p=libucw.git diff --git a/ucw/doc/conf.txt b/ucw/doc/conf.txt index 43f838ec..813a1835 100644 --- a/ucw/doc/conf.txt +++ b/ucw/doc/conf.txt @@ -141,11 +141,11 @@ are three ways to do that: + For example, you can have an static array of five unsigned integers: + - static uns array[] = { 1, 2, 3, 4, 5 }; + static uint array[] = { 1, 2, 3, 4, 5 }; + static struct cf_section section = { CF_ITEMS { - CF_UNS_ARY("array", array, 5), + CF_UINT_ARY("array", array, 5), CF_END } }; @@ -153,9 +153,8 @@ For example, you can have an static array of five unsigned integers: *Dynamic arrays*:: Similar to static array, but you provide pointer to pointer to the given item (eg. if you want dynamic array of - integers, you give `**int`). The parser allocates an array of needed - size. You can use the <> macro to find out - the number of elements actually loaded. + integers, you give `**int`). The parser allocates a <> + of the required size. + If you want dynamic array of strings, you would use: + @@ -213,15 +212,18 @@ journal entries are removed and a new one, for the new configuration, is added. If it fails, the first one is replayed and the rollback entry is removed. -See <>. +See @cf_reload(). [[custom_parser]] Creating custom parsers ~~~~~~~~~~~~~~~~~~~~~~~ If you need to parse some data type the configuration system can't -handle, you can write your own parser. But before you start, you -should know a few things. +handle, you can write your own <> +and use <> macro to declare a new option. + +There is also an obsolete way to write a custom parser. +Before you start, you should know a few things. The parser needs to support <>. To accomplish that, you have to use the <> for memory allocation.