Bienvenue sur le site de la LibLapin.
Jetez un coup d'oeil en bas de la page pour choisir votre niveau de documentation en fonction de votre niveau avec la LibLapin.
Pour l'instant, c'est réglé sur 'Manuel complet'. Si c'est votre première fois avec la LibLapin, il vaudrait mieux choisir 'Débutant'.
De même, n'oubliez pas de préciser une version de la bibliothèque.
Misc
The allocator module header is lapin/allocator.h
Description
  Load a full file. It could be a text or a binary file.
This file is managed by the ressource manager, like sound effects
and pictures.
Parameters
-
const char *file:
  The file to load.
-
void **data:
  A pointer to a pointer in which a memory space address with be saved.
The memory space itself will be filled with the content of the file.
The size of the memory space will be stored inside size.
-
size_t *size:
  A pointer to a space in which save the size of the loaded file.
If set to NULL, an additionnal '\0' will be added at the end of the data.
Return value
-
On success, the function returns the size of the loaded data.
-
On failure, it returns -1.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "file" or "ressource label.
INDEX
Description
  Save size bytes from data into file.
Parameters
-
const char *file:
  The file to in which save.
-
void *data:
  The data to save.
-
size_t size:
  The size of the data to save.
Return value
Return true if everything went well.
Error values and logs
On error, $Vbunny_errno is set to:
-
Any errno code that can be set by open or write.
Logs written by this function are tagged with the "file" or "ressource label.
INDEX
k
Description
  In the bunny library, some bottom level ressources are shared. This means
that when you load several times the same file, the content of the file
itself is only loaded once and then it is given to multiples holders.
Sometimes, you only base your work on a file but plan to edit
it to create a new one... And editing it would edit all files used
by all other holders, so before doing it, you will need to call
bunny_make_file_unique so your file got duplicated and pulled
out the ressource manager.
Parameters
-
const char *file:
  The name of the file you want to turn unique.
-
const void *data:
  The data of the file.
-
size_t length:
  The size of the data of the file you want to turn unique.
Return value
Return the data turned unique. NULL on error.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function or subfunctions may be tagged with
"allocator" label.
INDEX
Description
  Delete the sent loaded file.
Parameters
-
void *data:
  The data to delete.
-
const char *file:
  The file from which the data was loaded.
INDEX
Description
  Compute the operation sent as first parameter. Supported operators are:
+, -, *, /, >, <, >=, <=, !=, ==, ?: and parenthesis to modify priority.
It supports double and integers and variable and variable address.
Return value
Return the result of the operation or nan("") on error.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "misc" label.
Additional informations
When compiling LibLapin:
INDEX
Description
  Encode using base64 algorithm the sent data of size length.
Store the memory space used address at *out or use the one given directly.
Store the size of the output in *outlen.
The output size is up to 4 * (length + 2) / 3.
Parameters
-
const void *data:
  The data to encode.
-
size_t length:
  The length of data in bytes.
-
char **out:
If *out is NULL, then the function will allocate a memory space
wide enough with bunny_malloc and store its address in *out.
If it is not NULL, then it may allocate, depending on the size sent
in *outlen being sufficient or not.
The encoded data will be stored there.
-
size_t *outlen:
  The size of the sent buffer in *out if one is sent, or any
space where to store the size of the function output. It will
be overwritten if the function is succesfull. NULL may be sent
if you do not want to retrieve the size.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
INDEX
Description
  Decode using base64 algorithm the sent data of size length.
Store the memory space used address at *out or use the one given directly.
Store the size of the output in *outlen.
The output size is up to 3 * length / 4.
Parameters
-
const void *data:
  The data to decode.
-
size_t length:
  The length of data in bytes.
-
char **out:
If *out is NULL, then the function will allocate a memory space
wide enough with bunny_malloc and store its address in *out.
If it is not NULL, then it may allocate, depending on the size sent
in *outlen being sufficient or not.
The decoded data with be store there.
-
size_t *outlen:
  The size of the sent buffer in *out if one is sent, or any
space where to store the size of the function output. It will
be overwritten if the function is succesfull. NULL may be sent
if you do not want to retrieve the size.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
INDEX
Description
  Check the sent base64 encoded data is valid base64.
Parameters
-
const void *data:
  The data to check
-
size_t length:
  The length of data in bytes.
Return value
Returns true or false depending if the base64 is correct or not.
INDEX
Description
  Split the sent
string accordingly to the sent tokens.
For example:
const char tok[3] = {
",",
"==",
NULL};
bunny_split(
"a, b == c", &tok[0], false);
Will return "a", " b " and " c".
The aggregate parameter is useful to ignore several following tokens.
Play attention with the order in tokens: the priority is the order of the
token themselves! Not the length! The more they are close to the beginning, the
higher they are.
The returned memory must be deleted with bunny_delete_split.
Parameters
-
const char *string:
  The string to split. bunny_split can only handle less than 4096 words.
-
const char **tokens:
  An array of strings that are separator for the string to split.
It must be NULL terminated. There cannot be more than 31 tokens.
-
bool aggregate:
  Can the separator be stacked or not?
Return value
Return a valid array of string if successful, NULL on error.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "misc" label.
INDEX
Description
  Delete the sent splitted string.
Parameters
-
const char * const * splitted:
  The splitted string to delete.
INDEX
Description
  Quicker to write.
INDEX
Description
  Copy the sent memory chunk pointed by ptr and of size len.
The same as memdup.
INDEX
Description
  Swap sent elements.
INDEX
Description
  Return the amount of cells of the sent length defined array.
Return value
The length of the sent defined length array
INDEX
Parameters
-
const char *litteral_string:
  A string litteral.
Return value
The length of the string litteral or -1 on error.
INDEX
Parameters
-
const char *litteral_string:
  A string litteral.
Return value
The length of the string litteral or -1 on error.
INDEX
Description
  Write the name of the function, '-', the name of the file followed
by ':' and the line where
bunny_trace is written.
Return value
The length of the written string or -1 on error.
INDEX
k
Description
  Return the experience required to achieve the sent level. You may
multiply it by 1000 to have more granularity.
INDEX
Description
  Move current to target at the sent speed. The movement is
not linear.
INDEX
k
Description
  Self evaluate private/public structure.
INDEX
Description
  Printed a list of managed ressources.
INDEX
Description
  Enable or disable the ressource management.
INDEX
Description
  A 16 megabytes free space for general purpose.
INDEX
Description
  Make value reaching limit step by step. Returns true if
value reached limit.
Parameters
-
double *value:
  The value that must reach limit.
-
double limit:
  The limit to reach.
-
double step:
  The value that will be added or removed from *value to make it
reach limit. step must be positive.
Return value
Returns true if *value have reached limit.
INDEX