1.16.1. cft_init()

[<<<] [>>>]

Before calling any other configuration handling function the caller has to prepare a tConfigTree structure. To do this it has to call this function.

The first argument has to point to an allocated and uninitialized tConfigTree structure. The second argument has to point to a memory allocating function. The third argument has to point to the memory releasing function that is capable releasing the memory allocated by the memory allocating function.

The argument pMemorySegment should be the segment pointer to the memory handling functions. All memory allocation will be performed calling the memory_allocating_function and passing the pMemorySegment pointer as second argument to it. All memory releasing will be done via the function memory_releasing_function passing pMemorySegment pointer as second argument. This lets the caller to use sophisticated memory handling architecture.

On the other hand for the simple use all these three arguments can be NULL. In this case the configuration management system will use its own memory allocating and releasing function that simply uses malloc and free. In this case pMemorySegment is ignored.

For a ready made module that delivers more features see the alloc module of the ScriptBasic project at http://scriptbasic.com

int cft_init(ptConfigTree pCT,
              void *(*memory_allocating_function)(size_t, void *),
              void (*memory_releasing_function)(void *, void *),
              void *pMemorySegment
Note that suggested convention is to use the '.' character as separator for hierarchical key structures, but this is only a suggestion. In other words the module writers advice is to use key.subkey.subsubkey as key string for hierarchical strings. On the other hand you can use any character as separator except the zero character and except the characters that are used as key characters. You can write


if you are a windows geek. To do this you have to change the character saying

    pCT->TC = '\\';

after calling the initialization function. You can change this character any time, this character is not used in the configuration structure. The only point is that you have to use the actual character when you have changed it. The best practice is to use the dot ever.

[<<<] [>>>]