From ccdffc87aa458553d57792508c392fa73db34766 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 23 Apr 2011 11:55:43 -0700 Subject: [PATCH] clean out cruft, make things more uniform --- src/bool.c | 7 +------ src/bool.h | 1 - src/comment.c | 2 +- src/comment.h | 2 +- src/env.c | 5 ----- src/env.h | 1 - src/int.c | 15 --------------- src/int.h | 2 -- src/lake.c | 2 +- src/list.c | 6 ------ src/list.h | 1 - src/string.c | 7 +------ src/string.h | 2 -- 13 files changed, 5 insertions(+), 48 deletions(-) diff --git a/src/bool.c b/src/bool.c index 96052f1..8eeca8e 100644 --- a/src/bool.c +++ b/src/bool.c @@ -10,18 +10,13 @@ #include #include "bool.h" #include "lake.h" -#include "sym.h" +#include "string.h" LakeBool *bool_from_int(int n) { return n ? T : F; } -gboolean bool_val(LakeBool *b) -{ - return b->val; -} - char *bool_repr(LakeBool *b) { return g_strdup(BOOL_VAL(b) ? "#t" : "#f"); diff --git a/src/bool.h b/src/bool.h index e16aba2..ffb4d49 100644 --- a/src/bool.h +++ b/src/bool.h @@ -14,7 +14,6 @@ #include "lake.h" LakeBool *bool_from_int(int b); -gboolean bool_val(LakeBool *b); LakeStr *bool_to_str(LakeBool *b); char *bool_repr(LakeBool *b); LakeVal* bool_and(LakeVal *a, LakeVal *b); diff --git a/src/comment.c b/src/comment.c index e65d4d4..bddc25b 100644 --- a/src/comment.c +++ b/src/comment.c @@ -37,7 +37,7 @@ char *comment_repr(LakeComment *comment) return g_strdup(STR_S(comment->text)); } -gboolean comm_equal(LakeComment *a, LakeComment *b) +gboolean comment_equal(LakeComment *a, LakeComment *b) { return str_equal(COMM_TEXT(a), COMM_TEXT(b)); } diff --git a/src/comment.h b/src/comment.h index e5c66a3..4824f3a 100644 --- a/src/comment.h +++ b/src/comment.h @@ -16,6 +16,6 @@ LakeComment *comment_make(LakeStr *text); LakeComment *comment_from_c(char *text); char *comment_repr(LakeComment *comment); -gboolean comm_equal(LakeComment *a, LakeComment *b); +gboolean comment_equal(LakeComment *a, LakeComment *b); #endif diff --git a/src/env.c b/src/env.c index ffcb2c9..db86e88 100644 --- a/src/env.c +++ b/src/env.c @@ -16,11 +16,6 @@ static Env *_top = NULL; -void env_set_toplevel(Env *env) -{ - _top = env; -} - Env *env_toplevel(void) { if (!_top) { diff --git a/src/env.h b/src/env.h index 2d44fd1..faaff1c 100644 --- a/src/env.h +++ b/src/env.h @@ -20,7 +20,6 @@ typedef struct env Env; #include "lake.h" -void env_set_toplevel(Env *env); Env *env_toplevel(void); Env *env_make(Env *parent); diff --git a/src/int.c b/src/int.c index 12e7460..e608a47 100644 --- a/src/int.c +++ b/src/int.c @@ -26,13 +26,6 @@ LakeInt *int_make(void) return i; } -LakeInt *int_copy(LakeInt *i) -{ - LakeInt *copy = int_alloc(); - copy->val = i->val; - return copy; -} - LakeInt *int_from_c(int n) { LakeInt *i = int_alloc(); @@ -40,14 +33,6 @@ LakeInt *int_from_c(int n) return i; } -LakeInt *int_cmp(LakeInt *a, LakeInt *b) -{ - int aN = a->val, bN = b->val; - LakeInt *result = int_alloc(); - result->val = aN < bN ? -1 : (aN == bN ? 0 : 1); - return result; -} - LakeStr *int_to_str(LakeInt *i) { char *s = g_strdup_printf("%d", i->val); diff --git a/src/int.h b/src/int.h index 4832259..547ed35 100644 --- a/src/int.h +++ b/src/int.h @@ -13,9 +13,7 @@ #include "lake.h" LakeInt *int_make(void); -LakeInt *int_copy(LakeInt *i); LakeInt *int_from_c(int n); -LakeInt *int_cmp(LakeInt *a, LakeInt *b); LakeStr *int_to_str(LakeInt *i); #endif \ No newline at end of file diff --git a/src/lake.c b/src/lake.c index 4bf7eaf..c5fdf0f 100644 --- a/src/lake.c +++ b/src/lake.c @@ -184,7 +184,7 @@ gboolean lake_equal(LakeVal *a, LakeVal *b) return dlist_equal(DLIST(a), DLIST(b)); case TYPE_COMM: - return comm_equal(COMM(a), COMM(b)); + return comment_equal(COMM(a), COMM(b)); default: ERR("unknown type %d (%s)", a->type, type_name(a)); diff --git a/src/list.c b/src/list.c index 753e3b8..a2748dd 100644 --- a/src/list.c +++ b/src/list.c @@ -164,12 +164,6 @@ LakeVal *list_pop(LakeList *list) return tail; } -LakeInt *list_cmp(LakeList *a, LakeList *b) -{ - /* TODO */ - return 0; -} - gboolean list_equal(LakeList *a, LakeList *b) { if (a == b) return TRUE; diff --git a/src/list.h b/src/list.h index 43858d1..1b774d6 100644 --- a/src/list.h +++ b/src/list.h @@ -28,7 +28,6 @@ LakeInt *list_len(LakeList *list); LakeVal *list_pop(LakeList *list); LakeVal *list_shift(LakeList *list); LakeVal *list_unshift(LakeList *list, LakeVal *val); -LakeInt *list_cmp(LakeList *a, LakeList *b); gboolean list_equal(LakeList *a, LakeList *b); LakeStr *list_to_str(LakeList *list); char *list_repr(LakeList *list); diff --git a/src/string.c b/src/string.c index ea9439d..31e93e5 100644 --- a/src/string.c +++ b/src/string.c @@ -28,7 +28,7 @@ void str_free(LakeStr *str) g_free(str); } -LakeVal *str_set(LakeStr *str, char *s) +static LakeVal *str_set(LakeStr *str, char *s) { str->n = strlen(s); str->s = g_strdup(s); @@ -62,11 +62,6 @@ char *str_val(LakeStr *str) return g_strdup(str->s); } -LakeInt *str_cmp(LakeStr *a, LakeStr *b) -{ - return int_from_c(g_strcmp0(a->s, b->s)); -} - gboolean str_equal(LakeStr *a, LakeStr *b) { size_t n = STR_N(a); diff --git a/src/string.h b/src/string.h index 185354a..0badcf7 100644 --- a/src/string.h +++ b/src/string.h @@ -19,8 +19,6 @@ LakeStr *str_copy(LakeStr *str); LakeStr *str_from_c(char *s); char *str_val(LakeStr *str); LakeInt *str_len(LakeStr *str); -LakeVal *str_set(LakeStr *str, char *s); -LakeInt *str_cmp(LakeStr *a, LakeStr *b); gboolean str_equal(LakeStr *a, LakeStr *b); LakeStr *str_to_str(LakeStr *str);