[uim-commit] r1431 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Sep 5 07:49:00 PDT 2005
Author: yamaken
Date: 2005-09-05 07:48:55 -0700 (Mon, 05 Sep 2005)
New Revision: 1431
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/eval.c
branches/r5rs/sigscheme/io.c
branches/r5rs/sigscheme/main.c
branches/r5rs/sigscheme/operations-srfi1.c
branches/r5rs/sigscheme/operations-srfi8.c
branches/r5rs/sigscheme/operations.c
branches/r5rs/sigscheme/sigscheme.h
branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigscheme.h
- (SCM_EVAL): New macro
* sigscheme/sigschemeinternal.h
- (EVAL): New macro
- (SCM_SHIFT_EVALED, SCM_REDUCE_EXT): Simplify with EVAL macro
* sigscheme/operations-srfi1.c
* sigscheme/io.c
* sigscheme/operations-srfi8.c
* sigscheme/operations.c
* sigscheme/main.c
* sigscheme/eval.c
* sigscheme/datas.c
- Replace almost ScmOp_eval() in these files with EVAL for
readability. The ScmOp_eval() definition itself and "eval"
registration in SigScm_Initialize() are still use the canonical
name ScmOp_eval()
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/datas.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -884,7 +884,7 @@
str_port = Scm_NewStringPort(exp);
ret = SigScm_Read(str_port);
- ret = ScmOp_eval(ret, SCM_NULL);
+ ret = EVAL(ret, SCM_NULL);
#if SCM_COMPAT_SIOD
scm_return_value = ret;
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/eval.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -494,7 +494,7 @@
case FUNCTYPE_RAW_LIST_WITH_TAIL_FLAG:
obj = SCM_FUNC_EXEC_SUBRF(proc, obj, &env, &tail_flag);
if (tail_flag)
- obj = ScmOp_eval(obj, env);
+ obj = EVAL(obj, env);
return obj;
case FUNCTYPE_0:
@@ -585,7 +585,7 @@
* So we need to re-evaluate this!.
*/
obj = ScmExp_begin(CDR(SCM_CLOSURE_EXP(proc)), &env);
- return ScmOp_eval(obj, env);
+ return EVAL(obj, env);
default:
SigScm_ErrorObj("apply : invalid application ", args);
@@ -637,11 +637,11 @@
return SCM_NULL;
/* eval each element of args */
- result = CONS(ScmOp_eval(CAR(args), env), SCM_NULL);
+ result = CONS(EVAL(CAR(args), env), SCM_NULL);
tail = result;
newtail = SCM_NULL;
for (args = CDR(args); !NULLP(args); args = CDR(args)) {
- newtail = CONS(ScmOp_eval(CAR(args), env), SCM_NULL);
+ newtail = CONS(EVAL(CAR(args), env), SCM_NULL);
SET_CDR(tail, newtail);
tail = newtail;
}
@@ -698,7 +698,7 @@
if (!IS_LIST_LEN_1(args))
SigScm_ErrorObj("syntax error: ", qexpr);
if (--nest == 0)
- return ScmOp_eval(CAR(args), env);
+ return EVAL(CAR(args), env);
} else if (EQ(car, SCM_QUASIQUOTE)) {
if (!IS_LIST_LEN_1(args))
SigScm_ErrorObj("syntax error: ", qexpr);
@@ -724,7 +724,7 @@
} else if (EQ(obj, SCM_UNQUOTE) && IS_LIST_LEN_1(CDR(ls))) {
/* we're at the comma in (x . ,y) or qexpr was ,z */
if (--nest == 0) {
- result = ScmOp_eval(CADR(ls), env);
+ result = EVAL(CADR(ls), env);
goto append_last_item;
}
QQUOTE_SET_VERBATIM(result);
@@ -829,7 +829,7 @@
if (!IS_LIST_LEN_1(CDR(expr)))
SigScm_ErrorObj("syntax error: ", expr);
- result = ScmOp_eval(CADR(expr), env);
+ result = EVAL(CADR(expr), env);
splice_len = ScmOp_length(result);
if (SCM_INT_VALUE(splice_len) < 0)
@@ -924,7 +924,7 @@
SigScm_ErrorObj("if : syntax error : ", exp);
/* eval predicates */
- pred = ScmOp_eval(CAR(exp), env);
+ pred = EVAL(CAR(exp), env);
/* if pred is true value */
if (NFALSEP(pred)) {
@@ -951,7 +951,7 @@
ScmObj ret = SCM_NULL;
ScmObj tmp = SCM_NULL;
- ret = ScmOp_eval(val, env);
+ ret = EVAL(val, env);
tmp = lookup_environment(sym, env);
if (NULLP(tmp)) {
/* Not found in the environment
@@ -1002,7 +1002,7 @@
exps = CDR(clause);
/* evaluate test */
- test = ScmOp_eval(test, env);
+ test = EVAL(test, env);
/* check the result */
if (NFALSEP(test)) {
@@ -1020,7 +1020,7 @@
* returned by this procedure is returned by the cond expression.
*/
if (EQ(Scm_Intern("=>"), CAR(exps))) {
- proc = ScmOp_eval(CADR(exps), env);
+ proc = EVAL(CADR(exps), env);
if (FALSEP(ScmOp_procedurep(proc)))
SigScm_ErrorObj("cond : the value of exp after => must be the procedure but got ", proc);
@@ -1039,7 +1039,7 @@
ScmObj ScmExp_case(ScmObj arg, ScmObj *envp)
{
ScmObj env = *envp;
- ScmObj key = ScmOp_eval(CAR(arg), env);
+ ScmObj key = EVAL(CAR(arg), env);
ScmObj clause = SCM_NULL;
ScmObj data = SCM_NULL;
ScmObj exps = SCM_NULL;
@@ -1091,7 +1091,7 @@
}
/* evaluate obj */
- obj = ScmOp_eval(obj, env);
+ obj = EVAL(obj, env);
if (FALSEP(obj)) {
/* set tail_flag */
(*tail_flag) = 0;
@@ -1126,7 +1126,7 @@
return obj;
}
- obj = ScmOp_eval(obj, env);
+ obj = EVAL(obj, env);
if (NFALSEP(obj)) {
/* set tail_flag */
(*tail_flag) = 0;
@@ -1182,7 +1182,7 @@
#endif
vars = CONS(CAR(binding), vars);
- vals = CONS(ScmOp_eval(CADR(binding), env), vals);
+ vals = CONS(EVAL(CADR(binding), env), vals);
}
/* create new environment for */
@@ -1258,7 +1258,7 @@
#endif
vars = CONS(CAR(binding), SCM_NULL);
- vals = CONS(ScmOp_eval(CADR(binding), env), SCM_NULL);
+ vals = CONS(EVAL(CADR(binding), env), SCM_NULL);
/* add env to each time!*/
env = extend_environment(vars, vals, env);
@@ -1343,7 +1343,7 @@
/* evaluate vals */
for (; !NULLP(vals); vals = CDR(vals)) {
- SET_CAR(vals, ScmOp_eval(CAR(vals), env));
+ SET_CAR(vals, EVAL(CAR(vals), env));
}
/* evaluate body */
@@ -1380,7 +1380,7 @@
}
/* evaluate exp */
- ScmOp_eval(exp, env);
+ EVAL(exp, env);
/* set new env */
*envp = env;
@@ -1424,7 +1424,7 @@
for (; !NULLP(bindings); bindings = CDR(bindings)) {
binding = CAR(bindings);
vars = CONS(CAR(binding), vars);
- vals = CONS(ScmOp_eval(CADR(binding), env), vals);
+ vals = CONS(EVAL(CADR(binding), env), vals);
/* append <step> to steps */
step = CDDR(binding);
@@ -1446,9 +1446,9 @@
commands = CDDR(arg);
/* now excution phase! */
- while (FALSEP(ScmOp_eval(test, env))) {
+ while (FALSEP(EVAL(test, env))) {
/* execute commands */
- ScmOp_eval(ScmExp_begin(commands, &env), env);
+ EVAL(ScmExp_begin(commands, &env), env);
/*
* Notice
@@ -1462,7 +1462,7 @@
!NULLP(tmp_steps);
tmp_steps = CDR(tmp_steps))
{
- vals = CONS(ScmOp_eval(CAR(tmp_steps), env), vals);
+ vals = CONS(EVAL(CAR(tmp_steps), env), vals);
}
vals = ScmOp_reverse(vals);
@@ -1551,10 +1551,10 @@
if (SYMBOLP(var)) {
if (NULLP(env)) {
/* given NIL environment */
- SCM_SYMBOL_SET_VCELL(var, ScmOp_eval(body, env));
+ SCM_SYMBOL_SET_VCELL(var, EVAL(body, env));
} else {
/* add val to the environment */
- env = add_environment(var, ScmOp_eval(body, env), env);
+ env = add_environment(var, EVAL(body, env), env);
}
return var;
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/io.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -439,7 +439,7 @@
!EOFP(s_expression);
s_expression = SigScm_Read(port))
{
- ScmOp_eval(s_expression, SCM_NULL);
+ EVAL(s_expression, SCM_NULL);
}
/* close port */
Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/main.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -76,7 +76,7 @@
!EOFP(s_exp);
s_exp = SigScm_Read(stdin_port))
{
- result = ScmOp_eval(s_exp, SCM_NULL);
+ result = EVAL(s_exp, SCM_NULL);
#if SCM_USE_SRFI38
SigScm_WriteToPortWithSharedStructure(stdout_port, result);
#else
Modified: branches/r5rs/sigscheme/operations-srfi1.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -159,9 +159,9 @@
if (!NULLP(proc)) {
/* evaluate (proc num) */
- num = ScmOp_eval(CONS(proc,
- CONS(num, SCM_NULL)),
- env);
+ num = EVAL(CONS(proc,
+ CONS(num, SCM_NULL)),
+ env);
}
head = CONS(num, head);
Modified: branches/r5rs/sigscheme/operations-srfi8.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -85,7 +85,7 @@
/* TODO: Check: do we have to extend the environment first? The SRFI-8
* document contradicts itself on this part. */
- actuals = ScmOp_eval(expr, env);
+ actuals = EVAL(expr, env);
if (VALUEPACKETP(actuals))
actuals = SCM_VALUEPACKET_VALUES(actuals);
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/operations.c 2005-09-05 14:48:55 UTC (rev 1431)
@@ -257,7 +257,7 @@
ScmObj operand = SCM_NULL;
for (; !NULLP(args); args = CDR(args)) {
- operand = ScmOp_eval(CAR(args), env);
+ operand = EVAL(CAR(args), env);
if (!INTP(operand))
SigScm_ErrorObj("+ : integer required but got ", operand);
result += SCM_INT_VALUE(operand);
@@ -272,7 +272,7 @@
ScmObj operand = SCM_NULL;
for (; !NULLP(args); args = CDR(args)) {
- operand = ScmOp_eval(CAR(args), env);
+ operand = EVAL(CAR(args), env);
if (!INTP(operand))
SigScm_ErrorObj("* : integer required but got ", operand);
result *= SCM_INT_VALUE(operand);
@@ -289,7 +289,7 @@
if (NULLP(args))
SigScm_Error("- : at least 1 argument required\n");
- result = SCM_INT_VALUE(ScmOp_eval(CAR(args), env));
+ result = SCM_INT_VALUE(EVAL(CAR(args), env));
args = CDR(args);
/* single arg */
@@ -297,7 +297,7 @@
return Scm_NewInt(-result);
for (; !NULLP(args); args = CDR(args)) {
- operand = ScmOp_eval(CAR(args), env);
+ operand = EVAL(CAR(args), env);
if (!INTP(operand))
SigScm_ErrorObj("- : integer required but got ", operand);
result -= SCM_INT_VALUE(operand);
@@ -314,7 +314,7 @@
if (NULLP(args))
SigScm_Error("/ : at least 1 argument required\n");
- result = SCM_INT_VALUE(ScmOp_eval(CAR(args), env));
+ result = SCM_INT_VALUE(EVAL(CAR(args), env));
args = CDR(args);
/* single arg */
@@ -322,7 +322,7 @@
return Scm_NewInt(1 / result);
for (; !NULLP(args); args = CDR(args)) {
- operand = ScmOp_eval(CAR(args), env);
+ operand = EVAL(CAR(args), env);
if (!INTP(operand))
SigScm_ErrorObj("/ : integer required but got ", operand);
@@ -551,7 +551,7 @@
SigScm_Error("max : at least 1 number required\n");
for (; !NULLP(args); args = CDR(args)) {
- scm_num = ScmOp_eval(CAR(args), env);
+ scm_num = EVAL(CAR(args), env);
if (FALSEP(ScmOp_numberp(scm_num)))
SigScm_ErrorObj("max : number required but got ", scm_num);
@@ -573,7 +573,7 @@
SigScm_Error("min : at least 1 number required\n");
for (; !NULLP(args); args = CDR(args)) {
- scm_num = ScmOp_eval(CAR(args), env);
+ scm_num = EVAL(CAR(args), env);
if (FALSEP(ScmOp_numberp(scm_num)))
SigScm_ErrorObj("min : number required but got ", scm_num);
@@ -1928,7 +1928,7 @@
SigScm_Error("force : not proper delayed object\n");
/* the caller's already wrapped arg in a list for us */
- return ScmOp_eval(arg, env);
+ return EVAL(arg, env);
}
ScmObj ScmOp_call_with_current_continuation(ScmObj arg, ScmObj env)
@@ -1952,7 +1952,7 @@
/* execute (proc cont) */
SET_CDR(arg, CONS(cont, SCM_NULL));
- return ScmOp_eval(arg, env);
+ return EVAL(arg, env);
}
ScmObj ScmOp_values(ScmObj argl, ScmObj env)
@@ -1976,7 +1976,7 @@
/* make the list (producer) and evaluate it */
cons_wrapper = CONS(CAR(argl), SCM_NULL);
- vals = ScmOp_eval(cons_wrapper, *envp);
+ vals = EVAL(cons_wrapper, *envp);
if (!VALUEPACKETP(vals)) {
/* got back a single value */
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-09-05 14:48:55 UTC (rev 1431)
@@ -101,6 +101,8 @@
#define SCM_LIST_5(elm0, elm1, elm2, elm3, elm4) \
(SCM_CONS((elm0), SCM_LIST_4(elm1, elm2, elm3, elm4)))
+#define SCM_EVAL(obj, env) (ScmOp_eval(obj, env))
+
#define SCM_DEFINE_ALIAS(newsym, sym) \
(SCM_SYMBOL_SET_VCELL(Scm_Intern(newsym), \
SCM_SYMBOL_VCELL(Scm_Intern(sym))))
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-09-05 14:31:19 UTC (rev 1430)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-09-05 14:48:55 UTC (rev 1431)
@@ -113,6 +113,8 @@
#define LIST_4 SCM_LIST_4
#define LIST_5 SCM_LIST_5
+#define EVAL SCM_EVAL
+
#define INTP SCM_INTP
#define CONSP SCM_CONSP
#define SYMBOLP SCM_SYMBOLP
@@ -201,7 +203,7 @@
#define SCM_SHIFT_EVALED(elm, lst, env) \
((!NULLP(lst)) \
- && ((elm) = ScmOp_eval(CAR(lst), env), (lst) = CDR(lst), (lst)))
+ && ((elm) = EVAL(CAR(lst), env), (lst) = CDR(lst), (lst)))
#define SCM_SHIFT_EVALED_1(elm0, lst, env) \
(SCM_SHIFT_EVALED(elm0, lst, env) ? (lst) : 0)
@@ -258,7 +260,7 @@
} \
\
/* 1 */ \
- scm_elm = ScmOp_eval(CAR(lst), env); \
+ scm_elm = EVAL(CAR(lst), env); \
accum = elm = extract(scm_elm); \
if (!validp(scm_elm)) { \
SigScm_ErrorObj(err_header, scm_elm); \
@@ -270,7 +272,7 @@
/* 2+ */ \
rest = CDR(lst); \
do { \
- scm_elm = ScmOp_eval(CAR(rest), env); \
+ scm_elm = EVAL(CAR(rest), env); \
rest = CDR(rest); \
if (!validp(scm_elm)) { \
SigScm_ErrorObj(err_header, scm_elm); \
More information about the uim-commit
mailing list