iris

small scheme interpreter
git clone git://git.2f30.org/iris
Log | Files | Refs | LICENSE

commit cefd68741f4ca414f4455554cd17ce3350db227d
parent 00d7556a1443ee2047887f20440320c459f1d272
Author: sin <sin@2f30.org>
Date:   Fri, 16 May 2014 15:49:55 +0100

Prepare the ground for compound procedures

Diffstat:
Mparser.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/parser.c b/parser.c @@ -18,7 +18,7 @@ enum objtype { OString, OEmptylist, OPair, - OProc, + OPrimitiveproc, }; struct object { @@ -61,7 +61,7 @@ struct object { struct { char *name; struct object *(*fn)(struct object *); - } proc; + } pproc; } d; }; @@ -250,9 +250,9 @@ proc(char *s, struct object *(*fn)(struct object *)) struct object *o; o = newobject(); - o->type = OProc; - o->d.proc.name = estrdup(s); - o->d.proc.fn = fn; + o->type = OPrimitiveproc; + o->d.pproc.name = estrdup(s); + o->d.pproc.fn = fn; return o; } @@ -714,8 +714,8 @@ eval(struct object *o) for (i = 0; i < LEN(builtins); i++) if (strcmp(tmp->d.i.name, builtins[i].name) == 0) return builtins[i].fn(o); - } else if (tmp->type == OProc) { - return tmp->d.proc.fn(o); + } else if (tmp->type == OPrimitiveproc) { + return tmp->d.pproc.fn(o); } break; } @@ -773,8 +773,8 @@ print(struct object *o) printpair(o); putchar(')'); break; - case OProc: - printf("#<procedure %s>", o->d.proc.name); + case OPrimitiveproc: + printf("#<primitive procedure %s>", o->d.pproc.name); break; } }