mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-10 16:28:21 +03:00
Implement more string instructions
Implement all of the string instructions that I could get the compiler to generate code for. Still ASCII-only.
This commit is contained in:
+9
-3
@@ -21,15 +21,21 @@
|
||||
#include <stddef.h>
|
||||
|
||||
struct string {
|
||||
unsigned int size;
|
||||
int size;
|
||||
bool literal;
|
||||
char text[];
|
||||
};
|
||||
|
||||
struct string *make_string(const char *str, unsigned int len);
|
||||
void free_string(struct string *str);
|
||||
struct string *string_dup(struct string *in);
|
||||
struct string *string_append(struct string *a, struct string *b);
|
||||
struct string *string_dup(const struct string *in);
|
||||
void string_append(struct string **a, const struct string *b);
|
||||
struct string *string_concatenate(const struct string *a, const struct string *b);
|
||||
struct string *string_copy(const struct string *s, int index, int len);
|
||||
int string_find(const struct string *haystack, const struct string *needle);
|
||||
void string_push_back(struct string **s, int c);
|
||||
void string_pop_back(struct string *s);
|
||||
void string_erase(struct string *s, int index);
|
||||
struct string *integer_to_string(int n);
|
||||
struct string *float_to_string(float f, int precision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user