llconf
0.0.2
|
Data Structures | |
struct | cnfmodule |
Information for registering a parser module. More... | |
Functions | |
void | register_cnfmodule (struct cnfmodule *cm, struct cnfnode *opt_root) |
Register a module. More... | |
void | unregister_all (void) |
struct cnfmodule * | find_cnfmodule (const char *name) |
Find a module by name. More... | |
void | cnfmodule_setopts (struct cnfmodule *cm, struct cnfnode *opt_root) |
Set module options. More... | |
struct cnfnode * | parse_options (const char *string) |
Parse module options Parse an option string into a cnfnode tree. More... | |
struct cnfnode * | cnfmodule_parse (struct cnfmodule *cm, FILE *fin) |
Parse from a stream. More... | |
struct cnfnode * | cnfmodule_parse_file (struct cnfmodule *cm, const char *fname) |
Parse from a file. More... | |
void | destroy_cnfmodule (struct cnfmodule *cm) |
Destroy a module previously created using clone_cnfmodule(). More... | |
struct cnfmodule * | clone_cnfmodule (struct cnfmodule *cm, const char *new_name, const char *default_file, struct cnfnode *opt_root) |
Clone a module. More... | |
int | cnfmodule_unparse (struct cnfmodule *cm, FILE *fout, struct cnfnode *cn_root) |
Unparse to a stream. More... | |
int | cnfmodule_unparse_file (struct cnfmodule *cm, const char *fname, struct cnfnode *cn_root) |
Unparse to a file. More... | |
int | cnfmodule_register_plugin (const char *name, const char *path, struct cnfnode *opt_root) |
Load a shared library module Load a shared library module and register a new parser by calling a register function. More... | |
Variables | |
struct cnfmodule * | cnfmodules |
struct cnfmodule* clone_cnfmodule | ( | struct cnfmodule * | cm, |
const char * | new_name, | ||
const char * | default_file, | ||
struct cnfnode * | opt_root | ||
) |
Clone a module.
Copy a module structure, and give the copy a new name, and optionally another default file and options.
cm | pointer to the module to be copied |
new_name | pointer to the name of the new module |
default_file | pointer to the new default file. If NULL, the value of the original will be copied |
opt_root | pointer to the root of the options tree. If NULL, the value of the original will be copied |
Parse from a stream.
cm | pointer to the module |
fin | pointer to the stream |
Parse from a file.
cm | pointer to the module |
fname | pointer to the filename. If NULL, the default of the module will be used. |
int cnfmodule_register_plugin | ( | const char * | name, |
const char * | path, | ||
struct cnfnode * | opt_root | ||
) |
Load a shared library module Load a shared library module and register a new parser by calling a register function.
The register function needs to have a register function of the prototype void llconf_register_foo(struct cnfnode *opt_root), with 'foo' replaced by the name.
name | name of the parser |
path | path to the shared library object |
opt_root | pointer to the root of the options tree. Can be NULL. |
Set module options.
cm | pointer to the module |
opt_root | pointer to the root of the options tree. Although the |
opt_root | syntax of this tree depends on the implementation of the module, |
opt_root | this will most likely be one returned by the parse_options() function |
Unparse to a stream.
cm | pointer to the module |
fout | pointer to the stream |
cn_root | the pointer to root of the parsed tree |
Unparse to a file.
cm | pointer to the module |
fname | pointer to the filename. If NULL, the default of the module will be used. |
cn_root | the pointer to root of the parsed tree |
void destroy_cnfmodule | ( | struct cnfmodule * | cm | ) |
Destroy a module previously created using clone_cnfmodule().
free the resources of a module. The module MUST have been created by clone_module.
cm | pointer to the module to be destroyed |
struct cnfmodule* find_cnfmodule | ( | const char * | name | ) |
Find a module by name.
Searches in the list of registered modules for a module with a matching name.
name | the name |
struct cnfnode* parse_options | ( | const char * | string | ) |
Parse module options Parse an option string into a cnfnode tree.
This can be used to set options for a particular node.
string |
Register a module.
This will usually be called by the parser module in one of the register_* functions.
cm | pointer to the module |
opt_root | pointer to the root of the options tree. Can be NULL. |
void unregister_all | ( | void | ) |
struct cnfmodule* cnfmodules |