diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-18 19:36:11 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-18 19:36:11 +0100 |
| commit | 9df5b01201498081e20bf85a3b80d85f88a0161f (patch) | |
| tree | a58f8bb732ab2523a4cfc63ddd3ebc42f5b14f95 /src/format.h | |
| parent | aa19580474f96c9aacf5e85008013891ad2a7045 (diff) | |
Update format
Diffstat (limited to 'src/format.h')
| -rw-r--r-- | src/format.h | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/format.h b/src/format.h index bceff0c..69d9fa8 100644 --- a/src/format.h +++ b/src/format.h @@ -6,36 +6,18 @@ typedef struct { char **parts; + uint8_t *marks; size_t length; } format_t; -typedef enum { - FORMAT_SUCCESS, - FORMAT_NESTED, - FORMAT_UNKNOWN, - FORMAT_UNTERMINATED, -} format_status_t; - -typedef enum { - FORMAT_NONE, - FORMAT_STRING, - FORMAT_BYTE, - FORMAT_FUNCTION, -} format_action_t; - -typedef char *(*format_function_t)(const char *key); - typedef struct { - format_action_t action; const char *key; - union { - const char *value; - uint8_t byte; - format_function_t fn; - }; + uint8_t mark; } format_pair_t; -format_status_t format_init(format_t *format, const char *string, char delim, const format_pair_t *pairs); +bool format_init(format_t *format, const char *string, char delim); + +bool format_remark(format_t *format, const char *label, const format_pair_t *pairs); void format_free(format_t *format); |
