add variable argument append.
This commit is contained in:
parent
3a29b03529
commit
ddccd4747a
|
@ -11,7 +11,7 @@ mes: mes.c mes.h
|
||||||
|
|
||||||
mes.h: mes.c GNUmakefile
|
mes.h: mes.c GNUmakefile
|
||||||
( echo '#if MES'; echo '#if MES' 1>&2;\
|
( echo '#if MES'; echo '#if MES' 1>&2;\
|
||||||
grep -E '^(scm [*])*[a-z_]+ \(.*\)( {|$$)' $< | grep -Ev '\(.*(char |bool |int )' | sed -e 's,^scm [*],,' | sort |\
|
grep -E '^(scm [*])*[a-z0-9_]+ \(.*\)( {|$$)' $< | grep -Ev '\(.*(char |bool |int )' | sed -e 's,^scm [*],,' | sort |\
|
||||||
while read f; do\
|
while read f; do\
|
||||||
fun=$$(echo $$f | sed -e 's,^scm [*],,' -e 's,{.*,,');\
|
fun=$$(echo $$f | sed -e 's,^scm [*],,' -e 's,{.*,,');\
|
||||||
name=$$(echo $$fun | sed -e 's,^scm [\*],,' | grep -o '^[^ ]*');\
|
name=$$(echo $$fun | sed -e 's,^scm [\*],,' | grep -o '^[^ ]*');\
|
||||||
|
|
17
mes.c
17
mes.c
|
@ -280,7 +280,7 @@ apply_ (scm *fn, scm *x, scm *a)
|
||||||
if (fn == &scm_symbol_current_module) // FIXME
|
if (fn == &scm_symbol_current_module) // FIXME
|
||||||
return a;
|
return a;
|
||||||
if (eq_p (fn, &scm_symbol_call_with_values) == &scm_t)
|
if (eq_p (fn, &scm_symbol_call_with_values) == &scm_t)
|
||||||
return call (&scm_call_with_values_env, append (x, cons (a, &scm_nil)));
|
return call (&scm_call_with_values_env, append2 (x, cons (a, &scm_nil)));
|
||||||
if (builtin_p (fn) == &scm_t)
|
if (builtin_p (fn) == &scm_t)
|
||||||
return call (fn, x);
|
return call (fn, x);
|
||||||
return apply (eval (fn, a), x, a);
|
return apply (eval (fn, a), x, a);
|
||||||
|
@ -497,13 +497,20 @@ call (scm *fn, scm *x)
|
||||||
}
|
}
|
||||||
|
|
||||||
scm *
|
scm *
|
||||||
append (scm *x, scm *y)
|
append2 (scm *x, scm *y)
|
||||||
{
|
{
|
||||||
if (x == &scm_nil) return y;
|
if (x == &scm_nil) return y;
|
||||||
assert (x->type == PAIR);
|
assert (x->type == PAIR);
|
||||||
return cons (car (x), append (cdr (x), y));
|
return cons (car (x), append2 (cdr (x), y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scm *
|
||||||
|
append (scm *x/*...*/)
|
||||||
|
{
|
||||||
|
if (x == &scm_nil) return &scm_nil;
|
||||||
|
return append2 (car (x), append (cdr (x)));
|
||||||
|
}
|
||||||
|
|
||||||
scm *
|
scm *
|
||||||
make_char (int x)
|
make_char (int x)
|
||||||
{
|
{
|
||||||
|
@ -689,7 +696,7 @@ lookup_char (int c, scm *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
list2str (scm *l)
|
list2str (scm *l) // char*
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
|
@ -722,7 +729,7 @@ vector_to_list (scm *v)
|
||||||
{
|
{
|
||||||
scm *x = &scm_nil;
|
scm *x = &scm_nil;
|
||||||
for (int i = 0; i < v->length; i++)
|
for (int i = 0; i < v->length; i++)
|
||||||
x = append (x, cons (v->vector[i], &scm_nil));
|
x = append2 (x, cons (v->vector[i], &scm_nil));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue