|
symbolic4
|
#include "symbolic4.h"Go to the source code of this file.
Data Structures | |
| struct | error |
Macros | |
| #define | ERROR_CHECK(F) if ((F) == RETS_ERROR) return RETS_ERROR |
Check if the return status of a function is RETS_ERROR. If so, return RETS_ERROR. More... | |
Functions | |
| void * | smart_alloc (uint8_t length, size_t size) |
| Allocates and keeps track of memory. More... | |
| void * | smart_realloc (void *source, uint8_t length, size_t size) |
| Resizes a pointer. More... | |
| void | smart_free (void *pointer) |
| Frees a pointer. More... | |
| void | smart_free_all (void) |
| Frees all pointers. More... | |
| uint8_t | set_error (error_domain domain, error_identifier identifier, const char *body) |
Sets current_error to the arguments provided. More... | |
| void | set_handle_unrecoverable_error (error_domain domain, error_identifier identifier, const char *body) |
| Handles severe and unrecoverable errors. More... | |
| double | uintmax_max_value (void) |
| char * | string_to_lower (const char *string) |
| Converts a string to lowercase. More... | |
| void | itoa (char *buffer, uintmax_t source) |
| void | dtoa (char *buffer, uint8_t length, double source) |
Variables | |
| error | current_error |
| void ** | allocated_pointers |
| bool | smart_alloc_is_recording |
| #define ERROR_CHECK | ( | F | ) | if ((F) == RETS_ERROR) return RETS_ERROR |
Check if the return status of a function is RETS_ERROR. If so, return RETS_ERROR.
Definition at line 31 of file foundation.h.
| enum error_domain |
| Enumerator | |
|---|---|
| ERRD_NULL | |
| ERRD_SYSTEM | |
| ERRD_SYNTAX | |
| ERRD_MATH | |
| ERRD_EXPRESSION | |
| ERRD_PARSER | |
| ERRD_SIMPLFY | |
| ERRD_SOLVE | |
| ERRD_DERIVATIVE | |
| ERRD_INTEGRAL | |
| ERRD_POLY | |
| ERRD_MATRIX | |
| ERRD_VECTOR | |
Definition at line 33 of file foundation.h.
| enum error_identifier |
Definition at line 49 of file foundation.h.
| enum return_status |
| Enumerator | |
|---|---|
| RETS_NULL | |
| RETS_ERROR | |
| RETS_SUCCESS | |
| RETS_CHANGED | |
| RETS_UNCHANGED | |
Definition at line 64 of file foundation.h.
| void dtoa | ( | char * | buffer, |
| uint8_t | length, | ||
| double | source | ||
| ) |
Definition at line 233 of file foundation.c.
| void itoa | ( | char * | buffer, |
| uintmax_t | source | ||
| ) |
Definition at line 216 of file foundation.c.
| uint8_t set_error | ( | error_domain | domain, |
| error_identifier | identifier, | ||
| const char * | body | ||
| ) |
Sets current_error to the arguments provided.
| [in] | domain | |
| [in] | identifier | |
| [in] | body |
RETS_ERROR Definition at line 152 of file foundation.c.
| void set_handle_unrecoverable_error | ( | error_domain | domain, |
| error_identifier | identifier, | ||
| const char * | body | ||
| ) |
Handles severe and unrecoverable errors.
This function serves as the last resort when the program encounters exceptionally severe errors, such as a failed memory allocation, from which it can't recover itself. The
loop may be replaced with system-specific error handling.
| [in] | domain | The error domain. |
| [in] | identifier | The error identifier. |
| [in] | body | The error body. |
Definition at line 181 of file foundation.c.
| void* smart_alloc | ( | uint8_t | length, |
| size_t | size | ||
| ) |
Allocates and keeps track of memory.
The pointer to the allocated memory is stored in the allocated_pointers array.
allocated_pointers array must be initialized with NULL, or else the loop won't work.set_handle_unrecoverable_error() is called.| [in] | length | The length/count of the elements. |
| [in] | size | The size of one element (see sizeof()). |
Definition at line 59 of file foundation.c.
| void smart_free | ( | void * | pointer | ) |
Frees a pointer.
This function frees a pointer and sets its corresponding entry in the allocated_pointers array to NULL.
| [in] | pointer | The pointer to be freed. |
Definition at line 112 of file foundation.c.
| void smart_free_all | ( | void | ) |
Frees all pointers.
This function frees all pointers allocated with smart_alloc() by iteratively calling smart_free().
Definition at line 133 of file foundation.c.
| void* smart_realloc | ( | void * | source, |
| uint8_t | length, | ||
| size_t | size | ||
| ) |
Resizes a pointer.
The resized pointer to the allocated memory is stored in the allocated_pointers array.
| [in] | source | The pointer to be resized. |
| [in] | length | The new length/count of the elements. |
| [in] | size | The size of one element (see sizeof()). |
Definition at line 86 of file foundation.c.
| char* string_to_lower | ( | const char * | string | ) |
Converts a string to lowercase.
This function copies the source string and converts that copy character-wise to lowercase. The resulting string must be freed.
| [in] | string | The string to convert. |
Definition at line 206 of file foundation.c.
| double uintmax_max_value | ( | void | ) |
Definition at line 188 of file foundation.c.
| void** allocated_pointers |
Definition at line 29 of file foundation.c.
| error current_error |
Definition at line 28 of file foundation.c.
| bool smart_alloc_is_recording |
Definition at line 30 of file foundation.c.