koliseo 0.4.8
|
Go to the source code of this file.
Data Structures | |
struct | Kstr |
Macros | |
#define | KSTR(c_lit) |
#define | KSTR_NULL kstr_new(NULL, 0) |
#define | Kstr_Fmt "%.*s" |
Format macro for a Kstr. | |
#define | Kstr_Arg(kstr) |
Format matching macro for a Kstr. | |
#define | ONEGB_DEC_INT 1073741824 |
Defines a one GB size as decimal integer representation. | |
#define | GULP_MAX_FILE_SIZE ONEGB_DEC_INT |
Defines max size allowed for a file passed to KLS_GULP_FILE(). | |
#define | Gulp_Res_Fmt "%s" |
Format macro for a Gulp_Res. | |
#define | Gulp_Res_Arg(gr) |
Format matching macro for a Gulp_Res. | |
#define | KLS_GULP_FILE(kls, filepath) |
#define | KLS_GULP_FILE_KSTR(kls, filepath) |
Typedefs | |
typedef struct Kstr | Kstr |
typedef enum Gulp_Res | Gulp_Res |
Defines possible results for kls_gulp_file_sized(). | |
Enumerations | |
enum | Gulp_Res { GULP_FILE_OK =0 , GULP_FILE_NOT_EXIST , GULP_FILE_TOO_LARGE , GULP_FILE_READ_ERROR , GULP_FILE_CONTAINS_NULLCHAR , GULP_FILE_KLS_NULL , TOT_GULP_RES } |
Defines possible results for kls_gulp_file_sized(). More... | |
Functions | |
Kstr | kstr_new (const char *str, size_t len) |
Returns a new Kstr with the passed args set. | |
Kstr | kstr_from_c_lit (const char *c_lit) |
Returns a new Kstr from the passed null-terminated string. | |
bool | kstr_eq (Kstr left, Kstr right) |
Checks if the two passed Kstr have exactly equal data. | |
bool | kstr_eq_ignorecase (Kstr left, Kstr right) |
Checks if the two passed Kstr have equal data, ignoring case. | |
Kstr | kstr_cut_l (Kstr *k, size_t n) |
Cuts the passed Kstr by up to n chars, from the left. | |
Kstr | kstr_cut_r (Kstr *k, size_t n) |
Cuts the passed Kstr by up to n chars, from the right. | |
Kstr | kstr_trim_left (Kstr kstr) |
Returns a new Kstr after removing heading spaces from the passed one. | |
Kstr | kstr_trim_right (Kstr kstr) |
Returns a new Kstr after removing trailing spaces from the passed one. | |
Kstr | kstr_trim (Kstr kstr) |
Returns a new Kstr after removing heading and trailing spaces from the passed one. | |
bool | kstr_indexof (Kstr k, char c, int *idx) |
Checks if passed Kstr contains the passed char, and if so, sets the value pointed by idx to the first occurrence. | |
Kstr | kstr_token (Kstr *k, char delim) |
Scans the passed Kstr and cuts it up to the first occurrence of passed char, even if it is not present. | |
bool | kstr_try_token (Kstr *k, char delim, Kstr *part) |
Scans the first passed Kstr and if the passed char is present, the old Kstr is set to second pointer and the first one is cut at the first occurrence of it. | |
Kstr | kstr_token_kstr (Kstr *k, Kstr delim) |
const char * | string_from_Gulp_Res (Gulp_Res g) |
Return a constant string for the passed Gulp_Res. | |
char * | kls_gulp_file_sized (Koliseo *kls, const char *filepath, Gulp_Res *err, size_t max_size) |
Tries mapping the passed file on the Koliseo. | |
char * | try_kls_gulp_file (Koliseo *kls, const char *filepath, size_t max_size) |
Tries mapping the passed file on the Koliseo. | |
Kstr * | kls_gulp_file_sized_to_kstr (Koliseo *kls, const char *filepath, Gulp_Res *err, size_t max_size, bool allow_nullchar) |
Tries mapping the passed file on the Koliseo. | |
Kstr * | try_kls_gulp_file_to_kstr (Koliseo *kls, const char *filepath, size_t max_size, bool allow_nullchar) |
Tries mapping the passed file on the Koliseo. | |
Variables | |
const char * | gulp_res_names [TOT_GULP_RES+1] |
String array for representations of Gulp_Res. | |
#define GULP_MAX_FILE_SIZE ONEGB_DEC_INT |
Defines max size allowed for a file passed to KLS_GULP_FILE().
Use try_kls_gulp_file() if you want a different upper limit.
#define Gulp_Res_Arg | ( | gr | ) |
Format matching macro for a Gulp_Res.
#define Gulp_Res_Fmt "%s" |
Format macro for a Gulp_Res.
#define KLS_GULP_FILE | ( | kls, | |
filepath ) |
#define KLS_GULP_FILE_KSTR | ( | kls, | |
filepath ) |
#define KSTR | ( | c_lit | ) |
#define Kstr_Arg | ( | kstr | ) |
Format matching macro for a Kstr.
#define Kstr_Fmt "%.*s" |
Format macro for a Kstr.
#define KSTR_NULL kstr_new(NULL, 0) |
#define ONEGB_DEC_INT 1073741824 |
Defines a one GB size as decimal integer representation.
Defines possible results for kls_gulp_file_sized().
typedef struct Kstr Kstr |
enum Gulp_Res |
Defines possible results for kls_gulp_file_sized().
Enumerator | |
---|---|
GULP_FILE_OK | |
GULP_FILE_NOT_EXIST | |
GULP_FILE_TOO_LARGE | |
GULP_FILE_READ_ERROR | |
GULP_FILE_CONTAINS_NULLCHAR | |
GULP_FILE_KLS_NULL | |
TOT_GULP_RES |
char * kls_gulp_file_sized | ( | Koliseo * | kls, |
const char * | filepath, | ||
Gulp_Res * | err, | ||
size_t | max_size ) |
Tries mapping the passed file on the Koliseo.
Sets the passed Gulp_Res to the result of the operation, .
kls | The Koliseo to push to. |
filepath | Path to the file to gulp. |
err | Pointer to the Gulp_Res variable to store result. |
max_size | Max size allowed for the read file. |
Kstr * kls_gulp_file_sized_to_kstr | ( | Koliseo * | kls, |
const char * | filepath, | ||
Gulp_Res * | err, | ||
size_t | max_size, | ||
bool | allow_nullchar ) |
Tries mapping the passed file on the Koliseo.
Sets the passed Gulp_Res to the result of the operation.
kls | The Koliseo to push to. |
filepath | Path to the file to gulp. |
err | Pointer to the Gulp_Res variable to store result. |
max_size | Max size allowed for the read file. |
allow_nullchar | Bool to avoid returning NULL for a binary file. |
Kstr kstr_from_c_lit | ( | const char * | c_lit | ) |
bool kstr_indexof | ( | Kstr | k, |
char | c, | ||
int * | idx ) |
Checks if passed Kstr contains the passed char, and if so, sets the value pointed by idx to the first occurrence.
k | The Kstr to scan. |
c | The char to look for. |
idx | Pointer to the value to be set as index. |
Kstr kstr_new | ( | const char * | data, |
size_t | len ) |
Scans the first passed Kstr and if the passed char is present, the old Kstr is set to second pointer and the first one is cut at the first occurrence of it.
k | The Kstr to scan. |
delim | The char to look for. |
part | The Kstr to set to the original data, if the delimiter is found. |
const char * string_from_Gulp_Res | ( | Gulp_Res | g | ) |
Return a constant string for the passed Gulp_Res.
g | The Gulp_Res to get a string for. |
char * try_kls_gulp_file | ( | Koliseo * | kls, |
const char * | filepath, | ||
size_t | max_size ) |
Tries mapping the passed file on the Koliseo.
kls | The Koliseo to push to. |
filepath | Path to the file to gulp. |
max_size | Max size allowed for the read file. |
Kstr * try_kls_gulp_file_to_kstr | ( | Koliseo * | kls, |
const char * | filepath, | ||
size_t | max_size, | ||
bool | allow_nullchar ) |
Tries mapping the passed file on the Koliseo.
kls | The Koliseo to push to. |
filepath | Path to the file to gulp. |
max_size | Max size allowed for the read file. |
allow_nullchar | Boolean to avoid returning NULL for a binary file. |
|
extern |
String array for representations of Gulp_Res.
String array for representations of Gulp_Res.