diff options
author | Keisuke Nishida <kxn30@po.cwru.edu> | 2001-06-28 01:11:59 +0000 |
---|---|---|
committer | Keisuke Nishida <kxn30@po.cwru.edu> | 2001-06-28 01:11:59 +0000 |
commit | 1afff620541041a7b680a85fee6d641092091b7c (patch) | |
tree | 02eb8dd8e195a47339873520221b04dfc46a13b9 /libguile/list.c | |
parent | 02d9f388177fc440ad7648544cfd1034ca0bbd13 (diff) | |
download | guile-1afff620541041a7b680a85fee6d641092091b7c.tar.gz |
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
Diffstat (limited to 'libguile/list.c')
-rw-r--r-- | libguile/list.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/libguile/list.c b/libguile/list.c index 043444aa3..f39c99c91 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -60,8 +60,54 @@ /* creating lists */ +#define SCM_I_CONS(cell,x,y) \ +do { \ + SCM_NEWCELL (cell); \ + SCM_SET_CELL_OBJECT_0 (cell, x); \ + SCM_SET_CELL_OBJECT_1 (cell, y); \ +} while (0) + +SCM +scm_list_1 (SCM e1) +{ + SCM c1; + SCM_I_CONS (c1, e1, SCM_EOL); + return c1; +} + +SCM +scm_list_2 (SCM e1, SCM e2) +{ + SCM c1, c2; + SCM_I_CONS (c2, e2, SCM_EOL); + SCM_I_CONS (c1, e1, c2); + return c1; +} + +SCM +scm_list_3 (SCM e1, SCM e2, SCM e3) +{ + SCM c1, c2, c3; + SCM_I_CONS (c3, e3, SCM_EOL); + SCM_I_CONS (c2, e2, c3); + SCM_I_CONS (c1, e1, c2); + return c1; +} + +SCM +scm_list_4 (SCM e1, SCM e2, SCM e3, SCM e4) +{ + return scm_cons2 (e1, e2, scm_list_2 (e3, e4)); +} + +SCM +scm_list_5 (SCM e1, SCM e2, SCM e3, SCM e4, SCM e5) +{ + return scm_cons2 (e1, e2, scm_list_3 (e3, e4, e5)); +} + SCM -scm_listify (SCM elt, ...) +scm_list_n (SCM elt, ...) { va_list foo; SCM answer = SCM_EOL; @@ -286,7 +332,7 @@ SCM_DEFINE (scm_last_pair, "last-pair", 1, 0, 0, tortoise = SCM_CDR(tortoise); } while (! SCM_EQ_P (hare, tortoise)); - SCM_MISC_ERROR ("Circular structure in position 1: ~S", SCM_LIST1 (lst)); + SCM_MISC_ERROR ("Circular structure in position 1: ~S", scm_list_1 (lst)); } #undef FUNC_NAME @@ -315,7 +361,7 @@ SCM_DEFINE (scm_reverse, "reverse", 1, 0, 0, tortoise = SCM_CDR (tortoise); } while (! SCM_EQ_P (hare, tortoise)); - SCM_MISC_ERROR ("Circular structure in position 1: ~S", SCM_LIST1 (lst)); + SCM_MISC_ERROR ("Circular structure in position 1: ~S", scm_list_1 (lst)); } #undef FUNC_NAME |