iris

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

commit 71de3f58655049cb67d770903c334c984147a9ce
parent b05003b726829c89d79aa895f7f7da1417779bfe
Author: sin <sin@2f30.org>
Date:   Fri, 16 May 2014 13:23:45 +0100

Rename some variables to reflect their meaning better

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

diff --git a/parser.c b/parser.c @@ -433,16 +433,16 @@ evalboolean(struct object *o) static struct object * dodiff(struct object *o, struct object *n) { - struct object *otmp; + struct object *arg; if (!car(o)) return n; - otmp = eval(car(o)); - if (otmp->type == OError) - return otmp; - if (otmp->type != OInteger) + arg = eval(car(o)); + if (arg->type == OError) + return arg; + if (arg->type != OInteger) return error("expected integer"); - n->d.n.v -= otmp->d.n.v; + n->d.n.v -= arg->d.n.v; return dodiff(cdr(o), n); } @@ -511,16 +511,16 @@ evalnull(struct object *o) static struct object * doplus(struct object *o, struct object *n) { - struct object *otmp; + struct object *arg; if (!car(o)) return n; - otmp = eval(car(o)); - if (otmp->type == OError) - return otmp; - if (otmp->type != OInteger) + arg = eval(car(o)); + if (arg->type == OError) + return arg; + if (arg->type != OInteger) return error("expected integer"); - n->d.n.v += otmp->d.n.v; + n->d.n.v += arg->d.n.v; return doplus(cdr(o), n); } @@ -539,7 +539,7 @@ struct object * eval(struct object *o) { size_t i; - struct object *otmp; + struct object *tmp; /* self-evaluating objects */ switch (o->type) { @@ -553,21 +553,21 @@ eval(struct object *o) } /* evaluate identifiers */ if (o->type == OIdentifier) { - otmp = lookupsym(o->d.i.name); - if (!otmp) + tmp = lookupsym(o->d.i.name); + if (!tmp) return error("unbound identifier"); - return otmp; + return tmp; } /* evaluate builtins and procedures */ if (o->type == OPair) { - otmp = lookupsym(car(o)->d.i.name); - if (otmp) { - if (otmp->type == OIdentifier) { + tmp = lookupsym(car(o)->d.i.name); + if (tmp) { + if (tmp->type == OIdentifier) { for (i = 0; i < LEN(builtins); i++) - if (strcmp(otmp->d.i.name, builtins[i].name) == 0) + if (strcmp(tmp->d.i.name, builtins[i].name) == 0) return builtins[i].fn(o); - } else if (otmp->type == OProc) { - return otmp->d.proc.fn(o); + } else if (tmp->type == OProc) { + return tmp->d.proc.fn(o); } } }