diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-01-01 19:44:35 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-01-01 19:44:35 +0100 |
commit | 31cf3ac5ac7054890810190d6f526ec1eb38c64d (patch) | |
tree | 52970f6d6b4c7b402ce0da72a7d3d33dad7ebe94 /std/str.c | |
parent | e031725c41c2970e5bc417f27b9abec79c5b72fb (diff) | |
download | uwu-lang-31cf3ac5ac7054890810190d6f526ec1eb38c64d.tar.xz |
Turn std into a submodule
Diffstat (limited to 'std/str.c')
-rw-r--r-- | std/str.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/std/str.c b/std/str.c deleted file mode 100644 index 29b94db..0000000 --- a/std/str.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <string.h> -#include <stdlib.h> -#include "api/vm.h" -#include "api/str.h" -#include "api/util.h" - -UwUVMValue uwu_cat(UwUVMArgs *args) -{ - size_t total_len = 0; - size_t lengths[args->num]; - char *substrs[args->num]; - - for (size_t i = 0; i < args->num; i++) { - substrs[i] = uwustr_get(uwuvm_get_arg(args, i)); - lengths[i] = strlen(substrs[i]); - total_len += lengths[i]; - } - - char result[total_len + 1]; - char *result_ptr = result; - - for (size_t i = 0; i < args->num; i++) { - strcpy(result_ptr, substrs[i]); - free(substrs[i]); - result_ptr += lengths[i]; - } - - *result_ptr = 0; - - return uwustr_create(result); -} - -UwUVMValue uwu_is(UwUVMArgs *args) -{ - return uwuutil_is_type("str.is", args, &uwustr_type); -} |