[uim-commit] r1429 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Sep 5 07:23:12 PDT 2005
Author: yamaken
Date: 2005-09-05 07:23:09 -0700 (Mon, 05 Sep 2005)
New Revision: 1429
Modified:
branches/r5rs/sigscheme/datas.c
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
branches/r5rs/sigscheme/read.c
Log:
* sigscheme/operations-srfi1.c
* sigscheme/io.c
* sigscheme/read.c
* sigscheme/operations-srfi8.c
* sigscheme/operations-siod.c
* sigscheme/operations.c
* sigscheme/eval.c
* sigscheme/datas.c
- Replace all 'Scm_NewCons' with 'CONS' for readability
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/datas.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -592,7 +592,7 @@
/*===========================================================================
Allocate Structure Functions
===========================================================================*/
-ScmObj Scm_NewCons(ScmObj a, ScmObj b)
+ScmObj CONS(ScmObj a, ScmObj b)
{
ScmObj obj = SCM_NULL;
SCM_NEW_OBJ_INTERNAL(obj);
@@ -866,7 +866,7 @@
sym = Scm_NewSymbol(symname, SCM_UNBOUND);
/* And Append it to the head of symbol_hash */
- sym_list = Scm_NewCons(sym, sym_list);
+ sym_list = CONS(sym, sym_list);
symbol_hash[n] = sym_list;
return sym;
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/eval.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -102,8 +102,8 @@
/* dot list appears */
if (!NULLP(CDR(tmp_vars)) && !CONSP(CDR(tmp_vars))) {
/* create new value */
- SET_CDR(tmp_vals, Scm_NewCons(CDR(tmp_vals),
- SCM_NULL));
+ SET_CDR(tmp_vals, CONS(CDR(tmp_vals),
+ SCM_NULL));
}
tmp_vars = CDR(tmp_vars);
@@ -111,13 +111,13 @@
}
/* create new frame */
- frame = Scm_NewCons(vars, vals);
+ frame = CONS(vars, vals);
/* add to env */
if (NULLP(env))
- env = Scm_NewCons(frame, SCM_NULL);
+ env = CONS(frame, SCM_NULL);
else if (CONSP(env))
- env = Scm_NewCons(frame, env);
+ env = CONS(frame, env);
else
SigScm_Error("Broken environment.\n");
@@ -135,16 +135,16 @@
/* add (var val) pair to the newest frame in env */
if (NULLP(env)) {
- newest_frame = Scm_NewCons(Scm_NewCons(var, SCM_NULL),
- Scm_NewCons(val, SCM_NULL));
- env = Scm_NewCons(newest_frame,
+ newest_frame = CONS(CONS(var, SCM_NULL),
+ CONS(val, SCM_NULL));
+ env = CONS(newest_frame,
SCM_NULL);
} else if (CONSP(env)) {
newest_frame = CAR(env);
- new_varlist = Scm_NewCons(var, CAR(newest_frame));
- new_vallist = Scm_NewCons(val, CDR(newest_frame));
+ new_varlist = CONS(var, CAR(newest_frame));
+ new_vallist = CONS(val, CDR(newest_frame));
- tmp = Scm_NewCons(Scm_NewCons(new_varlist, new_vallist), CDR(env));
+ tmp = CONS(CONS(new_varlist, new_vallist), CDR(env));
*env = *tmp;
} else {
SigScm_Error("broken environment\n");
@@ -393,9 +393,9 @@
if (SYMBOLP(arg)) {
/* (1) : <variable> */
- env = extend_environment(Scm_NewCons(arg, SCM_NULL),
- Scm_NewCons(map_eval(CDR(obj), env),
- SCM_NULL),
+ env = extend_environment(CONS(arg, SCM_NULL),
+ CONS(map_eval(CDR(obj), env),
+ SCM_NULL),
SCM_CLOSURE_ENV(tmp));
} else if (CONSP(arg)) {
/*
@@ -555,8 +555,8 @@
args = CAR(SCM_CLOSURE_EXP(proc)); /* arg is <formals> */
if (SYMBOLP(args)) {
/* (1) : <variable> */
- env = extend_environment(Scm_NewCons(args, SCM_NULL),
- Scm_NewCons(obj, SCM_NULL),
+ env = extend_environment(CONS(args, SCM_NULL),
+ CONS(obj, SCM_NULL),
SCM_CLOSURE_ENV(proc));
} else if (CONSP(args)) {
/*
@@ -637,11 +637,11 @@
return SCM_NULL;
/* eval each element of args */
- result = Scm_NewCons(ScmOp_eval(CAR(args), env), SCM_NULL);
+ result = CONS(ScmOp_eval(CAR(args), env), SCM_NULL);
tail = result;
newtail = SCM_NULL;
for (args = CDR(args); !NULLP(args); args = CDR(args)) {
- newtail = Scm_NewCons(ScmOp_eval(CAR(args), env), SCM_NULL);
+ newtail = CONS(ScmOp_eval(CAR(args), env), SCM_NULL);
SET_CDR(tail, newtail);
tail = newtail;
}
@@ -681,7 +681,7 @@
ScmObj src = qexpr; \
ret_tail = &ret_list; \
while (!EQ(src, end)) { \
- *ret_tail = Scm_NewCons(CAR(src), SCM_NULL); \
+ *ret_tail = CONS(CAR(src), SCM_NULL); \
ret_tail = &CDR(*ret_tail); \
src = CDR(src); \
} \
@@ -735,7 +735,7 @@
if (QQUOTE_IS_VERBATIM(result)) {
if (!qquote_copy_delayed()) {
- *ret_tail = Scm_NewCons(obj, SCM_NULL);
+ *ret_tail = CONS(obj, SCM_NULL);
ret_tail = &CDR(*ret_tail);
}
} else {
@@ -751,7 +751,7 @@
SigScm_ErrorObj("unquote-splicing: bad list: ",
result);
} else {
- *ret_tail = Scm_NewCons(result, SCM_NULL);
+ *ret_tail = CONS(result, SCM_NULL);
ret_tail = &CDR(*ret_tail);
}
}
@@ -836,8 +836,8 @@
SigScm_Error("unquote-splicing: bad list");
growth += SCM_INT_VALUE(splice_len) - 1;
- splices = Scm_NewCons(Scm_NewCons(result, Scm_NewInt(i)),
- splices);
+ splices = CONS(CONS(result, Scm_NewInt(i)),
+ splices);
}
}
if (!NULLP(splices)) {
@@ -1025,7 +1025,7 @@
SigScm_ErrorObj("cond : the value of exp after => must be the procedure but got ", proc);
return ScmOp_apply(SCM_LIST_2(proc,
- Scm_NewCons(test, SCM_NULL)),
+ CONS(test, SCM_NULL)),
env);
}
@@ -1178,11 +1178,11 @@
SigScm_ErrorObj("let : invalid binding form : ", binding);
#else
if (NULLP(CDR(binding)))
- SET_CDR(binding, Scm_NewCons(SCM_NULL, SCM_NULL));
+ SET_CDR(binding, CONS(SCM_NULL, SCM_NULL));
#endif
- vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), vals);
+ vars = CONS(CAR(binding), vars);
+ vals = CONS(ScmOp_eval(CADR(binding), env), vals);
}
/* create new environment for */
@@ -1205,21 +1205,21 @@
body = CDDR(arg);
for (; !NULLP(bindings); bindings = CDR(bindings)) {
binding = CAR(bindings);
- vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(CADR(binding), vals);
+ vars = CONS(CAR(binding), vars);
+ vals = CONS(CADR(binding), vals);
}
vars = ScmOp_reverse(vars);
vals = ScmOp_reverse(vals);
/* (define (<variable> <variable1> <variable2> ...>) <body>) */
- ScmExp_define(Scm_NewCons(Scm_NewCons(CAR(arg),
- vars),
- body),
+ ScmExp_define(CONS(CONS(CAR(arg),
+ vars),
+ body),
env);
/* (func <init1> <init2> ...) */
- return Scm_NewCons(CAR(arg), vals);
+ return CONS(CAR(arg), vals);
}
ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp)
@@ -1254,11 +1254,11 @@
SigScm_ErrorObj("let* : invalid binding form : ", binding);
#else
if (NULLP(CDR(binding)))
- SET_CDR(binding, Scm_NewCons(SCM_NULL, SCM_NULL));
+ SET_CDR(binding, CONS(SCM_NULL, SCM_NULL));
#endif
- vars = Scm_NewCons(CAR(binding), SCM_NULL);
- vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), SCM_NULL);
+ vars = CONS(CAR(binding), SCM_NULL);
+ vals = CONS(ScmOp_eval(CADR(binding), env), SCM_NULL);
/* add env to each time!*/
env = extend_environment(vars, vals, env);
@@ -1317,20 +1317,20 @@
SigScm_ErrorObj("letrec : invalid binding form : ", binding);
#else
if (NULLP(CDR(binding)))
- SET_CDR(binding, Scm_NewCons(SCM_NULL, SCM_NULL));
+ SET_CDR(binding, CONS(SCM_NULL, SCM_NULL));
#endif
var = CAR(binding);
val = CADR(binding);
/* construct vars and vals list */
- vars = Scm_NewCons(var, vars);
- vals = Scm_NewCons(val, vals);
+ vars = CONS(var, vars);
+ vals = CONS(val, vals);
}
/* construct new frame for scm_letrec_env */
- frame = Scm_NewCons(vars, vals);
- scm_letrec_env = Scm_NewCons(frame, scm_letrec_env);
+ frame = CONS(vars, vals);
+ scm_letrec_env = CONS(frame, scm_letrec_env);
/* extend environment by scm_letrec_env */
env = extend_environment(CAR(frame), CDR(frame), env);
@@ -1423,15 +1423,15 @@
/* construct Environment and steps */
for (; !NULLP(bindings); bindings = CDR(bindings)) {
binding = CAR(bindings);
- vars = Scm_NewCons(CAR(binding), vars);
- vals = Scm_NewCons(ScmOp_eval(CADR(binding), env), vals);
+ vars = CONS(CAR(binding), vars);
+ vals = CONS(ScmOp_eval(CADR(binding), env), vals);
/* append <step> to steps */
step = CDDR(binding);
if (NULLP(step))
- steps = Scm_NewCons(CAR(binding), steps);
+ steps = CONS(CAR(binding), steps);
else
- steps = Scm_NewCons(CAR(step), steps);
+ steps = CONS(CAR(step), steps);
}
/* now extend environment */
@@ -1462,7 +1462,7 @@
!NULLP(tmp_steps);
tmp_steps = CDR(tmp_steps))
{
- vals = Scm_NewCons(ScmOp_eval(CAR(tmp_steps), env), vals);
+ vals = CONS(ScmOp_eval(CAR(tmp_steps), env), vals);
}
vals = ScmOp_reverse(vals);
@@ -1579,7 +1579,7 @@
/* (val (lambda formals body)) */
arg = SCM_LIST_2(val,
- ScmExp_lambda(Scm_NewCons(formals, body), env));
+ ScmExp_lambda(CONS(formals, body), env));
return ScmExp_define(arg, env);
}
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/io.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -98,7 +98,7 @@
/* (apply proc (port)) */
ret = ScmOp_apply(SCM_LIST_2(proc,
- Scm_NewCons(port, SCM_NULL)),
+ CONS(port, SCM_NULL)),
SCM_NULL);
/* close port */
@@ -122,7 +122,7 @@
/* (apply proc (port)) */
ret = ScmOp_apply(SCM_LIST_2(proc,
- Scm_NewCons(port, SCM_NULL)),
+ CONS(port, SCM_NULL)),
SCM_NULL);
/* close port */
@@ -173,7 +173,7 @@
/* (apply thunk ())*/
ret = ScmOp_apply(SCM_LIST_2(thunk,
- Scm_NewCons(SCM_NULL, SCM_NULL)),
+ CONS(SCM_NULL, SCM_NULL)),
SCM_NULL);
/* close port */
@@ -201,7 +201,7 @@
/* (apply thunk ())*/
ret = ScmOp_apply(SCM_LIST_2(thunk,
- Scm_NewCons(SCM_NULL, SCM_NULL)),
+ CONS(SCM_NULL, SCM_NULL)),
SCM_NULL);
/* close port */
@@ -533,7 +533,7 @@
ScmOp_load(filename);
/* record to SigScm_features */
- SCM_SYMBOL_VCELL(SigScm_features) = Scm_NewCons(loaded_str, SCM_SYMBOL_VCELL(SigScm_features));
+ SCM_SYMBOL_VCELL(SigScm_features) = CONS(loaded_str, SCM_SYMBOL_VCELL(SigScm_features));
}
/* now no need to protect stack */
@@ -565,7 +565,7 @@
SigScm_ErrorObj("provide : string required but got ", feature);
/* record to SigScm_features */
- SCM_SYMBOL_VCELL(SigScm_features) = Scm_NewCons(feature, SCM_SYMBOL_VCELL(SigScm_features));
+ SCM_SYMBOL_VCELL(SigScm_features) = CONS(feature, SCM_SYMBOL_VCELL(SigScm_features));
return SCM_TRUE;
}
Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/operations-siod.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -142,9 +142,9 @@
if (NULLP(CDDR(exp)))
body = CADR(exp);
else
- body = Scm_NewCons(Scm_Intern("begin"), CDR(exp));
+ body = CONS(Scm_Intern("begin"), CDR(exp));
- return Scm_NewCons(CAR(exp), body);
+ return CONS(CAR(exp), body);
}
ScmObj ScmOp_verbose(ScmObj args, ScmObj env)
Modified: branches/r5rs/sigscheme/operations-srfi1.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/operations-srfi1.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -79,7 +79,7 @@
==============================================================================*/
ScmObj ScmOp_SRFI1_xcons(ScmObj a, ScmObj b)
{
- return Scm_NewCons(b, a);
+ return CONS(b, a);
}
ScmObj ScmOp_SRFI1_cons_star(ScmObj obj, ScmObj env)
@@ -125,9 +125,9 @@
/* then create list */
for (i = n; 0 < i; i--) {
if (!NULLP(fill))
- head = Scm_NewCons(fill, head);
+ head = CONS(fill, head);
else
- head = Scm_NewCons(Scm_NewInt(i), head);
+ head = CONS(Scm_NewInt(i), head);
}
return head;
@@ -159,12 +159,12 @@
if (!NULLP(proc)) {
/* evaluate (proc num) */
- num = ScmOp_eval(Scm_NewCons(proc,
- Scm_NewCons(num, SCM_NULL)),
+ num = ScmOp_eval(CONS(proc,
+ CONS(num, SCM_NULL)),
env);
}
- head = Scm_NewCons(num, head);
+ head = CONS(num, head);
}
return head;
@@ -187,7 +187,7 @@
obj = ScmOp_SRFI1_list_copy(obj);
/* then create new cons */
- obj = Scm_NewCons(obj, SCM_NULL);
+ obj = CONS(obj, SCM_NULL);
if (!NULLP(tail)) {
SET_CDR(tail, obj);
tail = obj;
@@ -252,7 +252,7 @@
start = NULLP(scm_start) ? 0 : SCM_INT_VALUE(scm_start);
step = NULLP(scm_step) ? 1 : SCM_INT_VALUE(scm_step);
for (i = count - 1; 0 <= i; i--) {
- head = Scm_NewCons(Scm_NewInt(start + i*step), head);
+ head = CONS(Scm_NewInt(start + i*step), head);
}
return head;
Modified: branches/r5rs/sigscheme/operations-srfi8.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/operations-srfi8.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -90,12 +90,12 @@
if (VALUEPACKETP(actuals))
actuals = SCM_VALUEPACKET_VALUES(actuals);
else
- actuals = Scm_NewCons(actuals, SCM_NULL);
+ actuals = CONS(actuals, SCM_NULL);
- closure = Scm_NewClosure(Scm_NewCons(formals, body), env);
+ closure = Scm_NewClosure(CONS(formals, body), env);
/* set new env */
(*envp) = env;
- return Scm_NewCons(closure, actuals);
+ return CONS(closure, actuals);
}
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/operations.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -791,7 +791,7 @@
ScmObj ScmOp_cons(ScmObj car, ScmObj cdr)
{
- return Scm_NewCons(car, cdr);
+ return CONS(car, cdr);
}
ScmObj ScmOp_setcar(ScmObj pair, ScmObj car)
@@ -1012,7 +1012,7 @@
for (; !NULLP(CDR(args)); args = CDR(args)) {
for (ls = CAR(args); CONSP(ls); ls = CDR(ls)) {
obj = CAR(ls);
- *ret_tail = Scm_NewCons(obj, SCM_NULL);
+ *ret_tail = CONS(obj, SCM_NULL);
ret_tail = &CDR(*ret_tail);
}
if (!NULLP(ls))
@@ -1031,7 +1031,7 @@
ScmObj ret_list = SCM_NULL;
for (; CONSP(list); list = CDR(list))
- ret_list = Scm_NewCons(CAR(list), ret_list);
+ ret_list = CONS(CAR(list), ret_list);
if (!NULLP(list))
SigScm_ErrorObj("reverse: got improper list: ", list);
@@ -1061,7 +1061,7 @@
if (EQ(ret, SCM_INVALID))
SigScm_ErrorObj("list-tail: out of range or bad list, arglist is: ",
- Scm_NewCons(list, scm_k));
+ CONS(list, scm_k));
return ret;
}
@@ -1075,7 +1075,7 @@
list_tail = ScmOp_listtail_internal(list, SCM_INT_VALUE(scm_k));
if (EQ(list_tail, SCM_INVALID))
SigScm_ErrorObj("list-ref : out of range or bad list, arglist is: ",
- Scm_NewCons(list, scm_k));
+ CONS(list, scm_k));
return CAR(list_tail);
}
@@ -1593,7 +1593,7 @@
memset(new_ch, 0, sizeof(char) * (ch_end_ptr - ch_start_ptr + 1));
strncpy(new_ch, ch_start_ptr, (sizeof(char) * (ch_end_ptr - ch_start_ptr)));
- next = Scm_NewCons(Scm_NewChar(new_ch), SCM_NULL);
+ next = CONS(Scm_NewChar(new_ch), SCM_NULL);
if (prev)
SET_CDR(prev, next);
else
@@ -1788,7 +1788,7 @@
return SCM_NULL;
for (i = 0; i < c_len; i++) {
- next = Scm_NewCons(v[i], SCM_NULL);
+ next = CONS(v[i], SCM_NULL);
if (prev) {
SET_CDR(prev, next);
@@ -1874,10 +1874,10 @@
/* create list for "apply" op */
tmp = SCM_LIST_2(proc,
- Scm_NewCons(tmp, SCM_NULL));
+ CONS(tmp, SCM_NULL));
/* apply proc */
- ret = Scm_NewCons(ScmOp_apply(tmp, env), ret);
+ ret = CONS(ScmOp_apply(tmp, env), ret);
}
return ScmOp_reverse(ret);
}
@@ -1896,7 +1896,7 @@
return ScmOp_reverse(ret);
}
- arg1 = Scm_NewCons(CAR(tmp), arg1);
+ arg1 = CONS(CAR(tmp), arg1);
SCM_VECTOR_SET_CREF(arg_vector, i, CDR(tmp));
}
@@ -1904,7 +1904,7 @@
arg1 = ScmOp_reverse(arg1);
/* apply proc to arg1 */
- ret = Scm_NewCons(ScmOp_apply(SCM_LIST_2(proc, arg1), env),
+ ret = CONS(ScmOp_apply(SCM_LIST_2(proc, arg1), env),
ret);
}
@@ -1950,7 +1950,7 @@
}
/* execute (proc cont) */
- SET_CDR(arg, Scm_NewCons(cont, SCM_NULL));
+ SET_CDR(arg, CONS(cont, SCM_NULL));
return ScmOp_eval(arg, env);
}
@@ -1975,12 +1975,12 @@
SigScm_ErrorObj("call-with-values: too few arguments: ", argl);
/* make the list (producer) and evaluate it */
- cons_wrapper = Scm_NewCons(CAR(argl), SCM_NULL);
+ cons_wrapper = CONS(CAR(argl), SCM_NULL);
vals = ScmOp_eval(cons_wrapper, *envp);
if (!VALUEPACKETP(vals)) {
/* got back a single value */
- vals = Scm_NewCons(vals, SCM_NULL);
+ vals = CONS(vals, SCM_NULL);
} else {
/* extract */
vals = SCM_VALUEPACKET_VALUES(vals);
Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c 2005-09-05 13:50:39 UTC (rev 1428)
+++ branches/r5rs/sigscheme/read.c 2005-09-05 14:23:09 UTC (rev 1429)
@@ -302,11 +302,11 @@
/* Append item to the list_tail. */
if (NULLP(list_tail)) {
/* create new list */
- list_head = Scm_NewCons(item, SCM_NULL);
+ list_head = CONS(item, SCM_NULL);
list_tail = list_head;
} else {
/* update list_tail */
- SET_CDR(list_tail, Scm_NewCons(item, SCM_NULL));
+ SET_CDR(list_tail, CONS(item, SCM_NULL));
list_tail = CDR(list_tail);
}
}
More information about the uim-commit
mailing list