summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-12-01 19:21:17 +0100
committerJohannes Weiner <hannes@cmpxchg.org>2009-12-01 19:21:17 +0100
commit6c7d66346c246f75cb605e654b810d2c008266f9 (patch)
tree67d3067132128e108c760a8a1257b3004dd85b06
parent133b32b4161ae03816097029950c2fc40a39a85e (diff)
change prefix of builtin functions
eval_foo() is confusing, although correct. Rename to builtin_foo(), it is more descriptive. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--sheep/bool.c12
-rw-r--r--sheep/function.c4
-rw-r--r--sheep/list.c24
-rw-r--r--sheep/number.c72
-rw-r--r--sheep/sequence.c12
-rw-r--r--sheep/string.c12
6 files changed, 68 insertions, 68 deletions
diff --git a/sheep/bool.c b/sheep/bool.c
index 9a037ac..bd3544b 100644
--- a/sheep/bool.c
+++ b/sheep/bool.c
@@ -41,7 +41,7 @@ struct sheep_object sheep_false = {
};
/* (= a b) */
-static sheep_t eval_equal(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_equal(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t a, b;
@@ -54,7 +54,7 @@ static sheep_t eval_equal(struct sheep_vm *vm, unsigned int nr_args)
}
/* (bool object) */
-static sheep_t eval_bool(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_bool(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t sheep;
@@ -67,7 +67,7 @@ static sheep_t eval_bool(struct sheep_vm *vm, unsigned int nr_args)
}
/* (not object) */
-static sheep_t eval_not(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_not(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t sheep;
@@ -84,7 +84,7 @@ void sheep_bool_builtins(struct sheep_vm *vm)
sheep_vm_variable(vm, "true", &sheep_true);
sheep_vm_variable(vm, "false", &sheep_false);
- sheep_vm_function(vm, "=", eval_equal);
- sheep_vm_function(vm, "bool", eval_bool);
- sheep_vm_function(vm, "not", eval_not);
+ sheep_vm_function(vm, "=", builtin_equal);
+ sheep_vm_function(vm, "bool", builtin_bool);
+ sheep_vm_function(vm, "not", builtin_not);
}
diff --git a/sheep/function.c b/sheep/function.c
index 045287b..19600a7 100644
--- a/sheep/function.c
+++ b/sheep/function.c
@@ -151,7 +151,7 @@ sheep_t sheep_closure_function(struct sheep_vm *vm,
}
/* (disassemble function) */
-static sheep_t eval_disassemble(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_disassemble(struct sheep_vm *vm, unsigned int nr_args)
{
struct sheep_function *function;
unsigned int nr_foreigns;
@@ -173,5 +173,5 @@ static sheep_t eval_disassemble(struct sheep_vm *vm, unsigned int nr_args)
void sheep_function_builtins(struct sheep_vm *vm)
{
- sheep_vm_function(vm, "disassemble", eval_disassemble);
+ sheep_vm_function(vm, "disassemble", builtin_disassemble);
}
diff --git a/sheep/list.c b/sheep/list.c
index ae002c2..e7b2d13 100644
--- a/sheep/list.c
+++ b/sheep/list.c
@@ -175,7 +175,7 @@ sheep_t sheep_make_list(struct sheep_vm *vm, sheep_t head, sheep_t tail)
}
/* (cons item list) */
-static sheep_t eval_cons(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_cons(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t item, list, new;
@@ -191,7 +191,7 @@ static sheep_t eval_cons(struct sheep_vm *vm, unsigned int nr_args)
}
/* (list expr*) */
-static sheep_t eval_list(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_list(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t list;
@@ -215,7 +215,7 @@ static sheep_t eval_list(struct sheep_vm *vm, unsigned int nr_args)
}
/* (head list) */
-static sheep_t eval_head(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_head(struct sheep_vm *vm, unsigned int nr_args)
{
struct sheep_list *list;
sheep_t sheep;
@@ -230,7 +230,7 @@ static sheep_t eval_head(struct sheep_vm *vm, unsigned int nr_args)
}
/* (tail list) */
-static sheep_t eval_tail(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_tail(struct sheep_vm *vm, unsigned int nr_args)
{
struct sheep_list *list;
sheep_t sheep;
@@ -245,7 +245,7 @@ static sheep_t eval_tail(struct sheep_vm *vm, unsigned int nr_args)
}
/* (map function list) */
-static sheep_t eval_map(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_map(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t mapper, old, new, result = NULL;
struct sheep_list *l_old, *l_new;
@@ -279,7 +279,7 @@ out:
}
/* (reduce function list) */
-static sheep_t eval_reduce(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_reduce(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t reducer, list_, a, b, value, result = NULL;
struct sheep_list *list;
@@ -314,10 +314,10 @@ out:
void sheep_list_builtins(struct sheep_vm *vm)
{
- sheep_vm_function(vm, "cons", eval_cons);
- sheep_vm_function(vm, "list", eval_list);
- sheep_vm_function(vm, "head", eval_head);
- sheep_vm_function(vm, "tail", eval_tail);
- sheep_vm_function(vm, "map", eval_map);
- sheep_vm_function(vm, "reduce", eval_reduce);
+ sheep_vm_function(vm, "cons", builtin_cons);
+ sheep_vm_function(vm, "list", builtin_list);
+ sheep_vm_function(vm, "head", builtin_head);
+ sheep_vm_function(vm, "tail", builtin_tail);
+ sheep_vm_function(vm, "map", builtin_map);
+ sheep_vm_function(vm, "reduce", builtin_reduce);
}
diff --git a/sheep/number.c b/sheep/number.c
index 0e2bb0c..831eb16 100644
--- a/sheep/number.c
+++ b/sheep/number.c
@@ -59,7 +59,7 @@ int sheep_parse_number(struct sheep_vm *vm, const char *buf, sheep_t *sheepp)
}
/* (number expression) */
-static sheep_t eval_number(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_number(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t sheep;
@@ -125,25 +125,25 @@ static sheep_t do_cmp(struct sheep_vm *vm, unsigned int nr_args,
}
/* (< a b) */
-static sheep_t eval_less(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_less(struct sheep_vm *vm, unsigned int nr_args)
{
return do_cmp(vm, nr_args, "<", LESS);
}
/* (<= a b) */
-static sheep_t eval_lesseq(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_lesseq(struct sheep_vm *vm, unsigned int nr_args)
{
return do_cmp(vm, nr_args, "<=", LESSEQ);
}
/* (>= a b) */
-static sheep_t eval_moreeq(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_moreeq(struct sheep_vm *vm, unsigned int nr_args)
{
return do_cmp(vm, nr_args, ">=", MOREEQ);
}
/* (> a b) */
-static sheep_t eval_more(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_more(struct sheep_vm *vm, unsigned int nr_args)
{
return do_cmp(vm, nr_args, ">", MORE);
}
@@ -195,13 +195,13 @@ static sheep_t do_binop(struct sheep_vm *vm, unsigned int nr_args,
}
/* (+ a b) */
-static sheep_t eval_plus(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_plus(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "+");
}
/* (- a &optional b) */
-static sheep_t eval_minus(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_minus(struct sheep_vm *vm, unsigned int nr_args)
{
if (nr_args == 1) {
long number;
@@ -215,25 +215,25 @@ static sheep_t eval_minus(struct sheep_vm *vm, unsigned int nr_args)
}
/* (* a b) */
-static sheep_t eval_multiply(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_multiply(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "*");
}
/* (/ a b) */
-static sheep_t eval_divide(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_divide(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "/");
}
/* (% a b) */
-static sheep_t eval_modulo(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_modulo(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "%");
}
/* (~ number) */
-static sheep_t eval_lnot(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_lnot(struct sheep_vm *vm, unsigned int nr_args)
{
long number;
@@ -244,55 +244,55 @@ static sheep_t eval_lnot(struct sheep_vm *vm, unsigned int nr_args)
}
/* (| a b) */
-static sheep_t eval_lor(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_lor(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "|");
}
/* (& a b) */
-static sheep_t eval_land(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_land(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "&");
}
/* (^ a b) */
-static sheep_t eval_lxor(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_lxor(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "^");
}
/* (<< a b) */
-static sheep_t eval_shiftl(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_shiftl(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, "<<");
}
/* (>> a b) */
-static sheep_t eval_shiftr(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_shiftr(struct sheep_vm *vm, unsigned int nr_args)
{
return do_binop(vm, nr_args, ">>");
}
void sheep_number_builtins(struct sheep_vm *vm)
{
- sheep_vm_function(vm, "number", eval_number);
-
- sheep_vm_function(vm, "<", eval_less);
- sheep_vm_function(vm, "<=", eval_lesseq);
- sheep_vm_function(vm, ">=", eval_moreeq);
- sheep_vm_function(vm, ">", eval_more);
-
- sheep_vm_function(vm, "+", eval_plus);
- sheep_vm_function(vm, "-", eval_minus);
- sheep_vm_function(vm, "*", eval_multiply);
- sheep_vm_function(vm, "/", eval_divide);
- sheep_vm_function(vm, "%", eval_modulo);
-
- sheep_vm_function(vm, "~", eval_lnot);
- sheep_vm_function(vm, "|", eval_lor);
- sheep_vm_function(vm, "&", eval_land);
- sheep_vm_function(vm, "^", eval_lxor);
-
- sheep_vm_function(vm, "<<", eval_shiftl);
- sheep_vm_function(vm, ">>", eval_shiftr);
+ sheep_vm_function(vm, "number", builtin_number);
+
+ sheep_vm_function(vm, "<", builtin_less);
+ sheep_vm_function(vm, "<=", builtin_lesseq);
+ sheep_vm_function(vm, ">=", builtin_moreeq);
+ sheep_vm_function(vm, ">", builtin_more);
+
+ sheep_vm_function(vm, "+", builtin_plus);
+ sheep_vm_function(vm, "-", builtin_minus);
+ sheep_vm_function(vm, "*", builtin_multiply);
+ sheep_vm_function(vm, "/", builtin_divide);
+ sheep_vm_function(vm, "%", builtin_modulo);
+
+ sheep_vm_function(vm, "~", builtin_lnot);
+ sheep_vm_function(vm, "|", builtin_lor);
+ sheep_vm_function(vm, "&", builtin_land);
+ sheep_vm_function(vm, "^", builtin_lxor);
+
+ sheep_vm_function(vm, "<<", builtin_shiftl);
+ sheep_vm_function(vm, ">>", builtin_shiftr);
}
diff --git a/sheep/sequence.c b/sheep/sequence.c
index 25d007c..04e026b 100644
--- a/sheep/sequence.c
+++ b/sheep/sequence.c
@@ -12,7 +12,7 @@
#include <sheep/sequence.h>
/* (length sequence) */
-static sheep_t eval_length(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_length(struct sheep_vm *vm, unsigned int nr_args)
{
unsigned int len;
sheep_t seq;
@@ -25,7 +25,7 @@ static sheep_t eval_length(struct sheep_vm *vm, unsigned int nr_args)
}
/* (concat a b) */
-static sheep_t eval_concat(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_concat(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t a, b;
@@ -42,7 +42,7 @@ static sheep_t eval_concat(struct sheep_vm *vm, unsigned int nr_args)
}
/* (reverse sequence) */
-static sheep_t eval_reverse(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_reverse(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t sheep;
@@ -54,7 +54,7 @@ static sheep_t eval_reverse(struct sheep_vm *vm, unsigned int nr_args)
void sheep_sequence_builtins(struct sheep_vm *vm)
{
- sheep_vm_function(vm, "length", eval_length);
- sheep_vm_function(vm, "concat", eval_concat);
- sheep_vm_function(vm, "reverse", eval_reverse);
+ sheep_vm_function(vm, "length", builtin_length);
+ sheep_vm_function(vm, "concat", builtin_concat);
+ sheep_vm_function(vm, "reverse", builtin_reverse);
}
diff --git a/sheep/string.c b/sheep/string.c
index fd0afcf..d8d0aae 100644
--- a/sheep/string.c
+++ b/sheep/string.c
@@ -115,7 +115,7 @@ char *sheep_format(sheep_t sheep)
}
/* (string expression) */
-static sheep_t eval_string(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_string(struct sheep_vm *vm, unsigned int nr_args)
{
sheep_t sheep;
char *buf;
@@ -147,7 +147,7 @@ static char *do_split(char **stringp, const char *delim)
}
/* (split string string) */
-static sheep_t eval_split(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_split(struct sheep_vm *vm, unsigned int nr_args)
{
const char *string, *token;
struct sheep_list *list;
@@ -197,7 +197,7 @@ static sheep_t eval_split(struct sheep_vm *vm, unsigned int nr_args)
}
/* (join delimiter list-of-strings) */
-static sheep_t eval_join(struct sheep_vm *vm, unsigned int nr_args)
+static sheep_t builtin_join(struct sheep_vm *vm, unsigned int nr_args)
{
char *new = NULL, *result = NULL;
size_t length = 0, dlength;
@@ -248,7 +248,7 @@ out:
void sheep_string_builtins(struct sheep_vm *vm)
{
- sheep_vm_function(vm, "string", eval_string);
- sheep_vm_function(vm, "split", eval_split);
- sheep_vm_function(vm, "join", eval_join);
+ sheep_vm_function(vm, "string", builtin_string);
+ sheep_vm_function(vm, "split", builtin_split);
+ sheep_vm_function(vm, "join", builtin_join);
}