projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/lisp: add length, pack, unpack and flush
[fw/altos]
/
src
/
lisp
/
ao_lisp_make_const.c
diff --git
a/src/lisp/ao_lisp_make_const.c
b/src/lisp/ao_lisp_make_const.c
index bb4afbfb322363c7a13140abab952378128819da..0b3e25a6df079787182787abecf0dc120d1b07ae 100644
(file)
--- a/
src/lisp/ao_lisp_make_const.c
+++ b/
src/lisp/ao_lisp_make_const.c
@@
-43,6
+43,7
@@
struct builtin_func funcs[] = {
"cdr", AO_LISP_FUNC_LAMBDA, builtin_cdr,
"cons", AO_LISP_FUNC_LAMBDA, builtin_cons,
"last", AO_LISP_FUNC_LAMBDA, builtin_last,
"cdr", AO_LISP_FUNC_LAMBDA, builtin_cdr,
"cons", AO_LISP_FUNC_LAMBDA, builtin_cons,
"last", AO_LISP_FUNC_LAMBDA, builtin_last,
+ "length", AO_LISP_FUNC_LAMBDA, builtin_length,
"quote", AO_LISP_FUNC_NLAMBDA, builtin_quote,
"set", AO_LISP_FUNC_LAMBDA, builtin_set,
"setq", AO_LISP_FUNC_MACRO, builtin_setq,
"quote", AO_LISP_FUNC_NLAMBDA, builtin_quote,
"set", AO_LISP_FUNC_LAMBDA, builtin_set,
"setq", AO_LISP_FUNC_MACRO, builtin_setq,
@@
-61,6
+62,9
@@
struct builtin_func funcs[] = {
">", AO_LISP_FUNC_LEXPR, builtin_greater,
"<=", AO_LISP_FUNC_LEXPR, builtin_less_equal,
">=", AO_LISP_FUNC_LEXPR, builtin_greater_equal,
">", AO_LISP_FUNC_LEXPR, builtin_greater,
"<=", AO_LISP_FUNC_LEXPR, builtin_less_equal,
">=", AO_LISP_FUNC_LEXPR, builtin_greater_equal,
+ "pack", AO_LISP_FUNC_LAMBDA, builtin_pack,
+ "unpack", AO_LISP_FUNC_LAMBDA, builtin_unpack,
+ "flush", AO_LISP_FUNC_LAMBDA, builtin_flush,
"delay", AO_LISP_FUNC_LAMBDA, builtin_delay,
"led", AO_LISP_FUNC_LEXPR, builtin_led,
};
"delay", AO_LISP_FUNC_LAMBDA, builtin_delay,
"led", AO_LISP_FUNC_LEXPR, builtin_led,
};
@@
-105,20
+109,12
@@
main(int argc, char **argv)
ao_lisp_atom_set(ao_lisp_atom_poly(a),
ao_lisp_atom_poly(a));
ao_lisp_atom_set(ao_lisp_atom_poly(a),
ao_lisp_atom_poly(a));
- for (;;) {
- sexpr = ao_lisp_read();
- if (!sexpr)
- break;
- printf ("sexpr: ");
- ao_lisp_poly_print(sexpr);
- printf("\n");
- val = ao_lisp_eval(sexpr);
- if (ao_lisp_exception)
- exit(1);
- printf("\t");
- ao_lisp_poly_print(val);
- printf("\n");
- }
+ /* end of file value */
+ a = ao_lisp_atom_intern("eof");
+ ao_lisp_atom_set(ao_lisp_atom_poly(a),
+ ao_lisp_atom_poly(a));
+
+ ao_lisp_read_eval_print();
/* Reduce to referenced values */
ao_lisp_collect();
/* Reduce to referenced values */
ao_lisp_collect();