diff --git a/src/main.c b/src/main.c index 1254f88..bd92b5e 100644 --- a/src/main.c +++ b/src/main.c @@ -132,7 +132,7 @@ void repl(struct Environment* env) void loadArgsIntoEnv(int argc, const char* argv[], struct Environment* env) { - BuildListNamed(args); + Object BuildListNamed(args); for (int i = 0; i < argc; i++) { addToList(args, nullTerminated(argv[i])); } diff --git a/src/object.c b/src/object.c index b7d512f..9981f6c 100644 --- a/src/object.c +++ b/src/object.c @@ -502,7 +502,7 @@ void deleteList(Object* dest) */ Object cloneList(const Object* src) { - BuildListNamed(list); + Object BuildListNamed(list); FOR_POINTER_IN_LIST(src) { addToList(list, cloneObject(*POINTER)); } @@ -726,13 +726,13 @@ inline Object constructLambda(const Object* params, const Object* docs, const Ob } if (params->type != TYPE_LIST) { - throw(LAMBDA_ARGS_NOT_LIST, "params are %s", getTypeName(params)); + throw(LAMBDA_ARGS_NOT_LIST, "fn params must be TYPE_LIST, but is %s", getTypeName(params)); } if (body->type != TYPE_LIST) { - throw(LAMBDA_ARGS_NOT_LIST, "body is %s", getTypeName(body)); + throw(LAMBDA_ARGS_NOT_LIST, "fn body must be TYPE_LIST, but is %s", getTypeName(body)); } if (docs && docs->type != TYPE_STRING) { - throw(BAD_TYPE, "fn docstring must be a string, but received %s", getTypeName(docs)); + throw(BAD_TYPE, "fn docstring must be TYPE_STRING, but is %s", getTypeName(docs)); } Object o = newObject(TYPE_LAMBDA); diff --git a/src/object.h b/src/object.h index 1e0fdae..8f4b4fb 100644 --- a/src/object.h +++ b/src/object.h @@ -27,7 +27,7 @@ _element = _element->forward) #define POINTER _element -#define BuildListNamed(LIST) Object LIST = listObject(); Object** LIST ## _LIST_ITEM = &(LIST.list) +#define BuildListNamed(LIST) LIST = listObject(); Object** LIST ## _LIST_ITEM = &(LIST.list) #define addToList(LIST, OBJECT) allocObject(LIST ## _LIST_ITEM, OBJECT); LIST ## _LIST_ITEM = &(*LIST ## _LIST_ITEM)->forward #ifdef PBL_PLATFORM_APLITE diff --git a/src/pebblisp.c b/src/pebblisp.c index d2ebbcd..b128d20 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -129,7 +129,7 @@ Object mapO(Object* params, int length, struct Environment* env) throw(BAD_TYPE, "First argument of (map) should be func-like."); } - BuildListNamed(outputList); + Object BuildListNamed(outputList); FOR_POINTER_IN_LIST(inputList) { // Create a new list for each element, // since lambda evaluation looks for a list diff --git a/src/plfunc/plfunc.c b/src/plfunc/plfunc.c index 56346e0..f5fd9dc 100644 --- a/src/plfunc/plfunc.c +++ b/src/plfunc/plfunc.c @@ -37,7 +37,7 @@ Object filter(Object* params, unused int length, struct Environment* env) Object condition = params[0]; Object list = params[1]; - BuildListNamed(filtered); + Object BuildListNamed(filtered); FOR_POINTER_IN_LIST(&list) { Object cloned = cloneObject(condition); Object first_eval = eval(&cloned, env); @@ -102,7 +102,7 @@ Object rest(Object* params, unused int length, unused struct Environment* env) checkTypes(rest) Object list = params[0]; - BuildListNamed(ret); + Object BuildListNamed(ret); if (list.list) { for (Object* _element = list.list->forward; _element != NULL; _element = _element->forward) { addToList(ret, cloneObject(*POINTER));