aboutsummaryrefslogtreecommitdiff
path: root/src/builtins.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-20 16:51:55 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-20 16:51:55 -0800
commita029f736b01fdf566954a8fc91002804869eb444 (patch)
tree38c0c021ac9626dedc31a824b50226db62b93edc /src/builtins.c
parentff43bd2fb2c2617b53a0157d62d07cf96b2ef92f (diff)
fix some stuff
Diffstat (limited to 'src/builtins.c')
-rw-r--r--src/builtins.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/builtins.c b/src/builtins.c
index baeaafc..301104d 100644
--- a/src/builtins.c
+++ b/src/builtins.c
@@ -920,22 +920,6 @@ void nequals(value_t *v) {
value_free(v2);
}
-void wtostr(value_t *v) {
- value_t *v1 = array_pop(STACK);
- if (v1 == NULL) {
- eval_error("EMPTY STACK");
- return;
- }
-
- if (v1->type != VWORD) {
- array_append(STACK, v1);
- eval_error("INCORRECT TYPE ARGUMENT");
- return;
- }
- v1->type = VSTR;
- array_append(STACK, v1);
-}
-
void compose(value_t *v) {
value_t *v2 = array_pop(STACK);
if (v2 == NULL) {
@@ -1134,13 +1118,13 @@ void undef(value_t *v) {
value_free(v1);
}
-void errtostr(value_t *v) {
+void tostr(value_t *v) {
value_t *v1 = array_pop(STACK);
if (v1 == NULL) {
eval_error("EMPTY STACK");
return;
}
- if (v1->type == VERR)
+ if (v1->type == VERR || v1->type == VWORD)
v1->type = VSTR;
else {
array_append(STACK, v1);
@@ -1177,7 +1161,6 @@ void add_funcs() {
add_func(FLIT, stoi, "stoi");
add_func(FLIT, isnum, "isnum");
add_func(FLIT, compose, "compose");
- add_func(FLIT, stemfwrite, "wtostr");
add_func(FLIT, lthan, "<");
add_func(FLIT, ltequals, "<=");
add_func(FLIT, gthan, ">");
@@ -1201,5 +1184,5 @@ void add_funcs() {
add_func(FLIT, clib, "clib");
add_func(FLIT, stemsleep, "sleep");
add_func(FLIT, undef, "undef");
- add_func(FLIT, errtostr, "errtostr");
+ add_func(FLIT, tostr, "tostr");
}