Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Go to the source code of this file.
Macros | |
#define | HI_WORD(x) |
#define | LO_WORD(x) |
#define | HI_BYTE(x) |
#define | LO_BYTE(x) |
Functions | |
long | getFileSize (const char *fname) |
Return the total size of the given file by opening it and seeking to the end. | |
bool | doesFileExist (const char *fname) |
Returns true if the file at the given path exists. | |
const char * | get_filename (const char *filename) |
Get the filename part of a file path, after the last '/'. | |
bool | isSourceFileNewer (const char *sourceFile, const char *destFile) |
Returns true if the file sourceFile has a last-modified time after that of destFile , or if destFile does not exist. | |
bool | deleteFile (const char *path) |
Delete the file at the given path in a cross-platform way. | |
bool | getOptionsFromIniFile (processorOptions_t *options, const char *file) |
Parse the file with the given name as an INI file and write its data to options. | |
void | deleteOptions (processorOptions_t *options) |
Deallocates memory for a processorOptions_t. | |
const char * | getFullOptionKey (char *tmp, size_t n, const optPair_t *option) |
Writes the <section>.<key> value to the given buffer and returns the key. | |
const char * | getStrOption (const processorOptions_t *options, const char *name) |
Retrieve an option by name and return its value as a string, or NULL if the key is not found. | |
int | getIntOption (const processorOptions_t *options, const char *name, int defaultVal) |
Retrieve an option by name from the given options list and parse it as an integer, using a default value if it cannot be found or is not an integer. | |
bool | getBoolOption (const processorOptions_t *options, const char *name, bool defaultVal) |
Retrieve an option by name from the given options list and parse it as a boolean, using a default value if it cannot be found or is not a boolean. | |
bool | hasOption (const processorOptions_t *options, const char *name) |
Searches the given options list for a key with the given name. | |
#define HI_WORD | ( | x | ) |
#define LO_WORD | ( | x | ) |
#define HI_BYTE | ( | x | ) |
#define LO_BYTE | ( | x | ) |
long getFileSize | ( | const char * | fname | ) |
Return the total size of the given file by opening it and seeking to the end.
fname | The path to the file to measure |
bool doesFileExist | ( | const char * | fname | ) |
Returns true if the file at the given path exists.
fname | The path to the file to check |
const char * get_filename | ( | const char * | filename | ) |
Get the filename part of a file path, after the last '/'.
filename | The path to return the filename of |
bool isSourceFileNewer | ( | const char * | sourceFile, |
const char * | destFile ) |
Returns true if the file sourceFile
has a last-modified time after that of destFile
, or if destFile
does not exist.
sourceFile | The path to the "source" file, from which destFile is generated |
destFile | The path to the "destination" file path, which should be regenerated if older than sourceFile . |
bool deleteFile | ( | const char * | path | ) |
Delete the file at the given path in a cross-platform way.
path | The file to delete |
bool getOptionsFromIniFile | ( | processorOptions_t * | options, |
const char * | file ) |
Parse the file with the given name as an INI file and write its data to options.
options | An uninitialized options array to write INI file data to |
file | The path to the INI file to read |
void deleteOptions | ( | processorOptions_t * | options | ) |
Deallocates memory for a processorOptions_t.
options | A pointer to the processorOptions_t to delete memory for |
const char * getFullOptionKey | ( | char * | buf, |
size_t | n, | ||
const optPair_t * | option ) |
Writes the <section>.<key> value to the given buffer and returns the key.
If the given option has no section, the original key may be returned without using the buffer.
buf | The buffer to write the key to if necessary |
n | The maximum number of characters to write to buf |
option | The option to write the key name of |
const char * getStrOption | ( | const processorOptions_t * | options, |
const char * | name ) |
Retrieve an option by name and return its value as a string, or NULL if the key is not found.
options | The options list to search |
name | The key name to search for |
int getIntOption | ( | const processorOptions_t * | options, |
const char * | name, | ||
int | defaultVal ) |
Retrieve an option by name from the given options list and parse it as an integer, using a default value if it cannot be found or is not an integer.
options | The options list to search |
name | The key name to search for |
defaultVal | A value to return if the key cannot be found or the value is not an integer |
bool getBoolOption | ( | const processorOptions_t * | options, |
const char * | name, | ||
bool | defaultVal ) |
Retrieve an option by name from the given options list and parse it as a boolean, using a default value if it cannot be found or is not a boolean.
The following values are considered as true
: yes
, true
, 1
, y
, t
, on
And the following values are considered as false
: no
, false
, 0
, n
, f
, off
Matching is case-insensitive. If the option value matches none of these strings, the default value will be returned instead.
options | The options list to search |
name | The name of the key to search |
defaultVal | A value to return if the value is not found or not a boolean |
bool hasOption | ( | const processorOptions_t * | options, |
const char * | name ) |
Searches the given options list for a key with the given name.
options | The options list to search |
name | The key name to search for |