diff options
| author | Carson Fleming <[email protected]> | 2026-01-24 22:28:22 -0500 |
|---|---|---|
| committer | Carson Fleming <[email protected]> | 2026-01-24 22:28:22 -0500 |
| commit | e72088d79804e4f689196f4bc700fb9348c77209 (patch) | |
| tree | 195e8b20cf633a0b9fc2ef6754c08742a9ce30e1 /array.h | |
| download | safec-e72088d79804e4f689196f4bc700fb9348c77209.tar.gz | |
initial commit
Diffstat (limited to 'array.h')
| -rw-r--r-- | array.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +#ifndef __SAFEC_ARRAY_H +#define __SAFEC_ARRAY_H +#include <stddef.h> + +/* TODO: it might be good to just have itemsz and char* data */ +typedef struct { + size_t length; + void** data; +} array_t; + +void array_set(array_t* array, size_t idx, void* val); +void* array_get(const array_t* array, size_t idx); + +typedef struct { + size_t length; + char* data; +} str_t; + +void str_set(str_t* str, size_t idx, char val); +char str_get(const str_t* str, size_t idx); +/* TODO: I would like to implement string slicing as part of this */ +/* TODO: reimplement string.h functions for this new string construct */ +#endif |
