21#elif defined(_POSIX_MAPPED_FILES)
25#elif defined(PRISM_HAS_FILESYSTEM)
70#define PM_STRING_EMPTY ((pm_string_t) { .type = PM_STRING_CONSTANT, .source = NULL, .length = 0 })
79void pm_string_shared_init(
pm_string_t *
string,
const uint8_t *start,
const uint8_t *end);
88void pm_string_owned_init(
pm_string_t *
string, uint8_t *source,
size_t length);
97void pm_string_constant_init(
pm_string_t *
string,
const char *source,
size_t length);
VALUE type(ANYARGS)
ANYARGS-ed function type.
pm_string_init_result_t
Represents the result of calling pm_string_mapped_init or pm_string_file_init.
@ PM_STRING_INIT_SUCCESS
Indicates that the string was successfully initialized.
@ PM_STRING_INIT_ERROR_GENERIC
Indicates a generic error from a string_*_init function, where the type of error should be read from ...
@ PM_STRING_INIT_ERROR_DIRECTORY
Indicates that the file that was attempted to be opened was a directory.
Macro definitions used throughout the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
C99 shim for <stdbool.h>.
A generic string type that can have various ownership semantics.
const uint8_t * source
A pointer to the start of the string.
size_t length
The length of the string in bytes of memory.
@ PM_STRING_OWNED
This string owns its memory, and should be freed using pm_string_free().
@ PM_STRING_CONSTANT
This string is a constant string, and should not be freed.
@ PM_STRING_SHARED
This is a slice of another string, and should not be freed.