[uim-commit] r1427 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Sep 5 05:09:06 PDT 2005
Author: yamaken
Date: 2005-09-05 05:09:03 -0700 (Mon, 05 Sep 2005)
New Revision: 1427
Modified:
branches/r5rs/sigscheme/eval.c
branches/r5rs/sigscheme/io.c
branches/r5rs/sigscheme/operations-siod.c
branches/r5rs/sigscheme/operations-srfi1.c
branches/r5rs/sigscheme/operations-srfi8.c
branches/r5rs/sigscheme/operations.c
Log:
* sigscheme/operations-srfi1.c
* sigscheme/io.c
* sigscheme/operations-srfi8.c
* sigscheme/operations-siod.c
* sigscheme/operations.c
* sigscheme/eval.c
- Simplify CAR, CDR, CADR, etc. All changes are checked by my own eye.
* s/SCM_(C[AD]+R)/\1/g
* s/C([AD])R\(C([AD])R\((\w+)\)\)/C\1\2R(\3)/g
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/eval.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -440,7 +440,7 @@
* the stack. Is there any efficient way to implement first
* class continuation? (TODO).
*/
- obj = CAR(CDR(obj));
+ obj = CADR(obj);
scm_continuation_thrown_obj = ScmOp_eval(obj, env);
longjmp(SCM_CONTINUATION_JMPENV(tmp), 1);
break;
@@ -473,14 +473,14 @@
/* sanity check */
if CHECK_2_ARGS(args)
SigScm_Error("apply : Wrong number of arguments\n");
- if (!NULLP(CDR(CDR(args))))
+ if (!NULLP(CDDR(args)))
SigScm_Error("apply : Doesn't support multiarg apply\n");
/* 1st elem of list is proc */
proc = CAR(args);
/* 2nd elem of list is obj */
- obj = CAR(CDR(args));
+ obj = CADR(args);
/* apply proc */
switch (SCM_TYPE(proc)) {
@@ -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(SCM_CADR(ls), env);
+ result = ScmOp_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(SCM_CADR(expr), env);
+ result = ScmOp_eval(CADR(expr), env);
splice_len = ScmOp_length(result);
if (SCM_INT_VALUE(splice_len) < 0)
@@ -841,7 +841,7 @@
}
}
if (!NULLP(splices)) {
- next_splice_index = SCM_INT_VALUE(SCM_CDAR(splices));
+ next_splice_index = SCM_INT_VALUE(CDAR(splices));
qquote_force_copy_upto(0);
}
}
@@ -850,14 +850,14 @@
/* j will be the index for copy_buf */
if (i == next_splice_index) {
/* spliced */
- for (expr=SCM_CAAR(splices); !NULLP(expr); expr=CDR(expr))
+ for (expr=CAAR(splices); !NULLP(expr); expr=CDR(expr))
copy_buf[j++] = CAR(expr);
splices = CDR(splices);
if (NULLP(splices))
next_splice_index = -1;
else
- next_splice_index = SCM_INT_VALUE(SCM_CDAR(splices));
+ next_splice_index = SCM_INT_VALUE(CDAR(splices));
/* continue; */
} else {
expr = SCM_VECTOR_CREF(src, i);
@@ -929,11 +929,11 @@
/* if pred is true value */
if (NFALSEP(pred)) {
/* doesn't evaluate now for tail-recursion. */
- return CAR(CDR(exp));
+ return CADR(exp);
}
/* if pred is SCM_FALSE */
- false_exp = CDR(CDR(exp));
+ false_exp = CDDR(exp);
if (NULLP(false_exp))
return SCM_UNDEF;
@@ -947,7 +947,7 @@
ScmObj ScmExp_set(ScmObj arg, ScmObj env)
{
ScmObj sym = CAR(arg);
- ScmObj val = CAR(CDR(arg));
+ ScmObj val = CADR(arg);
ScmObj ret = SCM_NULL;
ScmObj tmp = SCM_NULL;
@@ -1020,7 +1020,7 @@
* returned by this procedure is returned by the cond expression.
*/
if (EQ(Scm_Intern("=>"), CAR(exps))) {
- proc = ScmOp_eval(CAR(CDR(exps)), env);
+ proc = ScmOp_eval(CADR(exps), env);
if (FALSEP(ScmOp_procedurep(proc)))
SigScm_ErrorObj("cond : the value of exp after => must be the procedure but got ", proc);
@@ -1182,7 +1182,7 @@
#endif
vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(ScmOp_eval(CAR(CDR(binding)), env), vals);
+ vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), vals);
}
/* create new environment for */
@@ -1201,12 +1201,12 @@
(<variable2> <init2>)
...)
========================================================================*/
- bindings = CAR(CDR(arg));
- body = CDR(CDR(arg));
+ bindings = CADR(arg);
+ body = CDDR(arg);
for (; !NULLP(bindings); bindings = CDR(bindings)) {
binding = CAR(bindings);
vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(CAR(CDR(binding)), vals);
+ vals = Scm_NewCons(CADR(binding), vals);
}
vars = ScmOp_reverse(vars);
@@ -1258,7 +1258,7 @@
#endif
vars = Scm_NewCons(CAR(binding), SCM_NULL);
- vals = Scm_NewCons(ScmOp_eval(CAR(CDR(binding)), env), SCM_NULL);
+ vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), SCM_NULL);
/* add env to each time!*/
env = extend_environment(vars, vals, env);
@@ -1321,7 +1321,7 @@
#endif
var = CAR(binding);
- val = CAR(CDR(binding));
+ val = CADR(binding);
/* construct vars and vals list */
vars = Scm_NewCons(var, vars);
@@ -1424,10 +1424,10 @@
for (; !NULLP(bindings); bindings = CDR(bindings)) {
binding = CAR(bindings);
vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(ScmOp_eval(CAR(CDR(binding)), env), vals);
+ vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), vals);
/* append <step> to steps */
- step = CDR(CDR(binding));
+ step = CDDR(binding);
if (NULLP(step))
steps = Scm_NewCons(CAR(binding), steps);
else
@@ -1438,12 +1438,12 @@
env = extend_environment(vars, vals, env);
/* construct test */
- testframe = CAR(CDR(arg));
+ testframe = CADR(arg);
test = CAR(testframe);
expression = CDR(testframe);
/* construct commands */
- commands = CDR(CDR(arg));
+ commands = CDDR(arg);
/* now excution phase! */
while (FALSEP(ScmOp_eval(test, env))) {
@@ -1531,7 +1531,7 @@
ScmObj ScmExp_define(ScmObj arg, ScmObj env)
{
ScmObj var = CAR(arg);
- ScmObj body = CAR(CDR(arg));
+ ScmObj body = CADR(arg);
ScmObj val = SCM_NULL;
ScmObj formals = SCM_NULL;
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/io.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -293,9 +293,9 @@
if (NULLP(arg)) {
/* (read-char) */
port = scm_current_input_port;
- } else if (!NULLP(CDR(arg)) && PORTP(CAR(CDR(arg)))) {
+ } else if (!NULLP(CDR(arg)) && PORTP(CADR(arg))) {
/* (read-char port) */
- port = CAR(CDR(arg));
+ port = CADR(arg);
} else {
SigScm_ErrorObj("read-char : invalid parameter", arg);
}
Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/operations-siod.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -141,8 +141,8 @@
exp = SCM_CLOSURE_EXP(closure);
- if (NULLP(CDR(CDR(exp))))
- body = CAR(CDR(exp));
+ if (NULLP(CDDR(exp)))
+ body = CADR(exp);
else
body = Scm_NewCons(Scm_Intern("begin"), CDR(exp));
Modified: branches/r5rs/sigscheme/operations-srfi1.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -120,7 +120,7 @@
/* get filler if available */
if (!NULLP(CDR(args)))
- fill = CAR(CDR(args));
+ fill = CADR(args);
/* then create list */
for (i = n; 0 < i; i--) {
@@ -151,7 +151,7 @@
/* get init_proc if available */
if (!NULLP(CDR(args)))
- proc = CAR(CDR(args));
+ proc = CADR(args);
/* then create list */
for (i = n; 0 < i; i--) {
@@ -232,10 +232,10 @@
scm_count = CAR(args);
if (!NULLP(CDR(args)))
- scm_start = CAR(CDR(args));
+ scm_start = CADR(args);
- if (!NULLP(scm_start) && !NULLP(CDR(CDR(args))))
- scm_step = CAR(CDR(CDR(args)));
+ if (!NULLP(scm_start) && !NULLP(CDDR(args)))
+ scm_step = CAR(CDDR(args));
/* param type check */
if (FALSEP(ScmOp_numberp(scm_count)))
Modified: branches/r5rs/sigscheme/operations-srfi8.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -79,9 +79,9 @@
if (CHECK_3_ARGS(args))
SigScm_ErrorObj("receive: bad argument list: ", args);
- formals = SCM_CAR(args);
- expr = SCM_CADR(args);
- body = SCM_CDDR(args);
+ formals = CAR(args);
+ expr = CADR(args);
+ body = CDDR(args);
/* TODO: Check: do we have to extend the environment first? The SRFI-8
* document contradicts itself on this part. */
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-09-05 11:47:08 UTC (rev 1426)
+++ branches/r5rs/sigscheme/operations.c 2005-09-05 12:09:03 UTC (rev 1427)
@@ -692,10 +692,10 @@
r = 10;
else {
#ifdef SCM_STRICT_ARGCHECK
- if (!NULLP(SCM_CDDR(args)))
+ if (!NULLP(CDDR(args)))
SigScm_ErrorObj("number->string: too many arguments: ", args);
#endif
- radix = SCM_CADR(args);
+ radix = CADR(args);
if (!INTP(radix))
SigScm_ErrorObj("number->string: integer required but got ", radix);
r = SCM_INT_VALUE(radix);
@@ -1392,8 +1392,8 @@
SigScm_Error("make-string : invalid use\n");
if (!INTP(CAR(arg)))
SigScm_ErrorObj("make-string : integer required but got ", CAR(arg));
- if (argc == 2 && !CHARP(CAR(CDR(arg))))
- SigScm_ErrorObj("make-string : character required but got ", CAR(CDR(arg)));
+ if (argc == 2 && !CHARP(CADR(arg)))
+ SigScm_ErrorObj("make-string : character required but got ", CADR(arg));
/* get length */
len = SCM_INT_VALUE(CAR(arg));
@@ -1409,7 +1409,7 @@
ch = Scm_NewChar(tmp);
} else {
/* also specify filler char */
- ch = CAR(CDR(arg));
+ ch = CADR(arg);
}
/* make string */
@@ -1740,7 +1740,7 @@
/* fill vector */
fill = SCM_UNDEF;
if (!NULLP(CDR(arg)))
- fill = CAR(CDR(arg));
+ fill = CADR(arg);
for (i = 0; i < c_k; i++) {
vec[i] = fill;
@@ -1896,7 +1896,7 @@
/* 1proc and 1arg case */
if (arg_len == 2) {
/* apply func to each item */
- for (args = CAR(CDR(map_arg)); !NULLP(args); args = CDR(args)) {
+ for (args = CADR(map_arg); !NULLP(args); args = CDR(args)) {
/* create proc's arg */
tmp = CAR(args);
@@ -2016,7 +2016,7 @@
/* cons_wrapper would have no chance of being referenced from
* anywhere else, so we'll reuse that object. */
- SET_CAR(cons_wrapper, SCM_CADR(argl));
+ SET_CAR(cons_wrapper, CADR(argl));
SET_CDR(cons_wrapper, vals);
return cons_wrapper;
}
More information about the uim-commit
mailing list