diff --git a/src/dlist.c b/src/dlist.c index 31c508c..12ee743 100644 --- a/src/dlist.c +++ b/src/dlist.c @@ -33,14 +33,14 @@ char *dlist_repr(LakeDottedList *dlist) char *s2; if (dlist->head) { for (i = 0; i < LIST_N(dlist->head); ++i) { - s2 = repr(LIST_VAL(dlist->head, i)); + s2 = lake_repr(LIST_VAL(dlist->head, i)); g_string_append(s, s2); g_free(s2); if (i != LIST_N(dlist->head) - 1) g_string_append(s, " "); } } g_string_append(s, " . "); - s2 = repr(dlist->tail); + s2 = lake_repr(dlist->tail); g_string_append(s, s2); g_free(s2); g_string_append(s, ")"); diff --git a/src/eval.c b/src/eval.c index 445a693..1181ca9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -19,7 +19,7 @@ typedef LakeVal *(*special_form_handler)(LakeCtx *ctx, Env *env, LakeList *expr) static void invalid_special_form(LakeList *expr, char *detail) { - ERR("malformed special form, %s: %s", detail, repr(VAL(expr))); + ERR("malformed special form, %s: %s", detail, lake_repr(VAL(expr))); } /* expr begins with the symbol "quote" so the quoted value is the 2nd value */ @@ -376,7 +376,7 @@ LakeVal *apply(LakeCtx *ctx, LakeVal *fnVal, LakeList *args) result = eval_exprs1(ctx, env, fn->body); } else { - ERR("not a function: %s", repr(fnVal)); + ERR("not a function: %s", lake_repr(fnVal)); } return result; } diff --git a/src/fn.c b/src/fn.c index 1081741..9dd584d 100644 --- a/src/fn.c +++ b/src/fn.c @@ -42,19 +42,19 @@ char *fn_repr(LakeFn *fn) free(s2); } else if (fn->varargs) { - s2 = repr(VAL(fn->varargs)); + s2 = lake_repr(VAL(fn->varargs)); g_string_append(s, s2); free(s2); } else { - s2 = repr(VAL(fn->params)); + s2 = lake_repr(VAL(fn->params)); g_string_append(s, s2); free(s2); } g_string_append(s, " "); int i; for (i = 0; i < LIST_N(fn->body); ++i) { - s2 = repr(LIST_VAL(fn->body, i)); + s2 = lake_repr(LIST_VAL(fn->body, i)); g_string_append(s, s2); g_free(s2); if (i != LIST_N(fn->body) - 1) g_string_append(s, " "); diff --git a/src/fn.h b/src/fn.h index 1f43849..053ad2c 100644 --- a/src/fn.h +++ b/src/fn.h @@ -17,6 +17,4 @@ LakeFn *fn_make(LakeList *params, LakeSym *varargs, LakeList *body, Env *closure); char *fn_repr(LakeFn *fn); -/* TODO: function operations */ - #endif \ No newline at end of file diff --git a/src/lake.c b/src/lake.c index 5d2d43c..21a8164 100644 --- a/src/lake.c +++ b/src/lake.c @@ -91,7 +91,7 @@ static LakeVal *prompt_read(LakeCtx *ctx, Env *env, char *prompt) return result; } -char *repr(LakeVal *expr) +char *lake_repr(LakeVal *expr) { if (expr == NULL) return g_strdup("(null)"); diff --git a/src/lake.h b/src/lake.h index a5a4c99..150ac14 100644 --- a/src/lake.h +++ b/src/lake.h @@ -162,7 +162,7 @@ typedef struct lake_comment LakeComment; gboolean lake_is(LakeVal *a, LakeVal *b); gboolean lake_equal(LakeVal *a, LakeVal *b); -char *repr(LakeVal *val); +char *lake_repr(LakeVal *val); #include diff --git a/src/list.c b/src/list.c index 86c9de8..ebe9306 100644 --- a/src/list.c +++ b/src/list.c @@ -187,7 +187,7 @@ char *list_repr(LakeList *list) int i; char *s2; for (i = 0; i < LIST_N(list); ++i) { - s2 = repr(LIST_VAL(list, i)); + s2 = lake_repr(LIST_VAL(list, i)); g_string_append(s, s2); g_free(s2); if (i != LIST_N(list) - 1) g_string_append(s, " "); diff --git a/src/primitive.c b/src/primitive.c index 934bc9f..b1b780e 100644 --- a/src/primitive.c +++ b/src/primitive.c @@ -105,11 +105,11 @@ static LakeVal *_not(LakeCtx *ctx, LakeList *args) return VAL(not); } -#define ENSURE_INT(x, i) do { \ - if (!IS(TYPE_INT, x)) { \ - ERR("argument %zu is not an integer: %s", i, repr(x)); \ - return NULL; \ - } \ +#define ENSURE_INT(x, i) do { \ + if (!IS(TYPE_INT, x)) { \ + ERR("argument %zu is not an integer: %s", i, lake_repr(x)); \ + return NULL; \ + } \ } while (0) static LakeVal *_add(LakeCtx *ctx, LakeList *args)