typedef enum e_bunny_configuration_type
{
 
BC_INI,
 
BC_DABSIC,
 
BC_DABSIC_SEQUENCE,
 
BC_DABSIC_FUNCTION,
 
BC_DABSIC_EXPRESSION,
 
BC_XML,
 
BC_LUA,
 
BC_CSV,
 
BC_JSON,
 
BC_LISP,
 
BC_CUSTOM
}
t_bunny_rgb;
INDEX
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "configuration" label.
INDEX
Description
  Generate a configuration structure from a file. The
format of the file will be detected thanks to its extensions:
- Dabsic file: .dab
- INI file: .ini
- Lisp file: .lisp
- XML file: .xml
- LUA file: .lua
- CSV file: .csv
- JSON file: .json
It must be destroyed by
bunny_delete_configuration.
Parameters
-
const char *file:
  The file to load into a configuration.
-
t_bunny_configuration *configuration:
  If this parameter is not NULL, then instead of creating a
new configuration, informations will be loaded inside the sent one.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "configuration" label.
INDEX
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "configuration" label.
INDEX
Description
  Save the sent configuration structure into a file with the sent format.
Return value
Returns true or false depending of the success or failure.
Error values and logs
On error, $Vbunny_errno is set to:
-
ENOMEM:
Out of memory.
-
Any errno value that can be set by open or write.
Logs written by this function are tagged with the "configuration" label.
INDEX
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "configuration" label.
INDEX
Description
  When set, this function pointer is called by loading and reading
configuration functions when the sent type of grammar is BC_CUSTOM or
greater.
INDEX
Description
  Generate a string containing a written configuration that match
the sent grammar and the sent configuration.
Return value
-
On success, the function returns a string containing
the generated configuration.
-
On failure, it returns NULL.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "configuration" label.
INDEX
Description
  When set, this function pointer is called by saving and writing
configuration functions when the sent type of grammar is BC_CUSTOM or
greater.
INDEX
Description
  Delete the node at the sent address in the sent configuration.
All children of this node will be destroyed as well.
INDEX
Description
  Switch to read/write mode or to read/write/create mode. While being in create mode,
nodes are automatically generated when accessed. While being in
read/write mode, values can only be read or written, but nodes cannot be
created.
Parameters
-
bool cmode:
  Switch to create mode or to readwrite mode.
INDEX
Description
  Get the parent node of the sent configuration node.
Return value
Returns the parent node or NULL if there is none.
INDEX
Description
  Get the root node of the sent configuration node.
Return value
Returns the root node. It can be the sent node.
INDEX
Description
  Get the name of the sent node.
Return value
Returns the name of the sent node.
INDEX
Description
  Get the address of the sent node. '.' is the character that signals
a hashmap entering. '[' and ']' signals an array index.
Return value
Returns the address of the sent node. "" is the sent node is the root one.
INDEX
Description
  Return the first children node of the sent one.
INDEX
Description
  Return the next children of the parent of configuration.
INDEX
Description
  Return NULL.
Return value
Returns NULL.
INDEX
Description
  Return if the sent node is the last existing children of its father.
Return value
Returns true or false if the node is the last one or not.
INDEX
Description
  Return the type of the sent file, after its extension.
- Dabsic file: .dab
- INI file: .ini
- Lisp file: .lisp
- XML file: .xml
- LUA file: .lua
- CSV file: .csv
- JSON file: .json
Return value
Returns the found type or BC_CUSTOM if no handled format is found.
INDEX
Description
  Add a research directory to the include/insert directive resolution.
The path container act as a stack so the last inserted give priority.
Parameters
-
const char *path:
  A directory to add.
INDEX
Description
  Remove the most recently added path from the path stack.
INDEX
Description
  Get a data inside the configuration tree. The address of the node
is composed in a printf fashion with the pattern and variadic parameters.
This macro is
only available if you are using
C11 or a newer
version of C. C++ does not support this macro.
Underlying functions, that you must use if you cannot use the macro, are:
Parameters
-
t_bunny_configuration *configuration:
  The configuration to inspect.
-
storage_space:
  This storage_space can be a t_bunny_configuration**, const char**, a double* or
an int*. This is the place in which the catched data will be stored.
-
const char *fpattern_address:
  The pattern to be combined with variadic parameters to create the address
of the node to reach.
-
...:
  Any valid printf-pattern valid parameter.
Return value
Returns true if a value was stored inside storage_space or false if
it was not.
Additional informations
This macro wraps several calls to real functions, which are:
bool bunny_configuration_getf_node(
t_bunny_configuration *configuration,
t_bunny_configuration **storage_space,
const char *fpattern_address,
...
);
bool bunny_configuration_getf_string(
t_bunny_configuration *configuration,
const char **storage_space,
const char *fpattern_address,
...
);
bool bunny_configuration_getf_int(
t_bunny_configuration *configuration,
int *storage_space,
const char *fpattern_address,
...
);
bool bunny_configuration_getf_double(
t_bunny_configuration *configuration,
double *storage_space,
const char *fpattern_address,
...
);
INDEX
Description
  Set a data inside the configuration tree. The address of the node
is composed in a printf fashion with the pattern and variadic parameters.
This macro is
only available if you are using
C11 or a newer
version of C. C++ does not support this macro.
Underlying functions, that you must use if you cannot use the macro, are:
Parameters
-
t_bunny_configuration *configuration:
  The configuration to inspect.
-
data:
  This data can be a t_bunny_configuration**, const char**, a double* or
an int*. This is the place in which the catched data will be stored.
-
const char *fpattern_address:
  The pattern to be combined with variadic parameters to create the address
of the node to reach.
-
...:
  Any valid printf-pattern valid parameter.
Return value
Returns true if the value was stored inside the tree or false if
it was not.
Additional informations
This macro wraps several calls to real functions, which are:
bool bunny_configuration_setf_node(
t_bunny_configuration *configuration,
t_bunny_configuration *data,
const char *fpattern_address,
...
);
bool bunny_configuration_setf_string(
t_bunny_configuration *configuration,
const char *data,
const char *fpattern_address,
...
);
bool bunny_configuration_setf_int(
t_bunny_configuration *configuration,
int data,
const char *fpattern_address,
...
);
bool bunny_configuration_setf_double(
t_bunny_configuration *configuration,
double data,
const char *fpattern_address,
...
);
INDEX
Description
  Get how many nodes are immediate children of the node at the sent address.
Parameters
-
t_bunny_configuration *configuration:
  The configuration to inspect.
-
const char *fpattern_address:
  The pattern to be combined with variadic parameters to create the address
of the node to reach.
-
...:
  Any valid printf-pattern valid parameter.
Return value
Returns the amount of children the found node have. It returns -1 if the node
does not exist.
INDEX
Description
  Get how many cases there is inside the array of the node at the sent address.
Parameters
-
t_bunny_configuration *configuration:
  The configuration to inspect.
-
const char *fpattern_address:
  The pattern to be combined with variadic parameters to create the address
of the node to reach.
-
...:
  Any valid printf-pattern valid parameter.
Return value
Returns the length of the arrya of the found node. It returns -1 if the node
does not exist.
INDEX
Description
  Execute scripts and expressions located at the sent address from the sent node
or behind.
Every scripts and expressions will be executed.
They will consider the root of the sent node as the root context.
The local context as the one containing local variables.
The parameter context as the sent one for parameters.
The artifical context is the context where the node at the sent address is located,
but can be modified by the "with" statement.
Parameters
-
t_bunny_configuration *configuration:
  The configuration node that serves as artifical context and that will be executed.
-
bool recursive:
  If true, all fields under the sent one will be executed too.
-
t_bunny_configuration *parameters:
  Parameters sent to the function inside configuration.
-
const char *fpattern:
  The pattern to be combined with variadic parameters to create the address
of the node to reach.
-
...:
  Any valid printf-pattern valid parameter.
Return value
-
On success, the function was correctly executed. The result of the operation
can be found in nodes themselves. It returns true.
-
On failure, it returns false.
Error values and logs
Many error logs can happen when executing a script and a lot of them may not be
related to the script execution itself but about what is executed. A simple
error value is not enough to signify enough information, a look at logs is required.
Logs written by this function are tagged with the "syntax" label.
INDEX