diff options
author | JSDurand <mmemmew@gmail.com> | 2022-01-04 11:51:58 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-01-04 11:51:58 +0800 |
commit | 55dc897da6e81f2a26cfc7e66ac942824773498b (patch) | |
tree | fce0d7d57832907c991d551833bf5eecde947dd2 /src/str.h | |
parent | 53b8b6ffab5a968db75e9babddf4e2dbb2c688a3 (diff) |
temporary commit
Now we can read grammars from a file.
But we need to check if it works for reading strings still.
Diffstat (limited to 'src/str.h')
-rw-r--r-- | src/str.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/str.h b/src/str.h new file mode 100644 index 0000000..39bddf6 --- /dev/null +++ b/src/str.h @@ -0,0 +1,35 @@ +#ifndef STR_H +#define STR_H + +#include <util.h> + +typedef struct str_s str; + +str *new_str(char *s, NUM size); + +/* flag non-zero => free the stored character array as well */ +void destroy_str(str *s, int flag); + +/* deliberately expose this struct */ +struct str_info_s { + NUM value; + size_t step; +}; + +typedef struct str_info_s str_info; + +#define EMPTY_STR_INFO ((str_info) { 0, 1 }) + +str_info get_info(str *, UNUM); + +char *get_data(str *s); + +NUM str_length(str *); + +void str_set_length(str *s, UNUM size); + +void change_str_content(str *, char *, NUM); + +unsigned char copy_str(str *dest, str *source); + +#endif |