mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
* list.h (SCM_LISTn): New macros. Make list creation in C code
prettier. The idea comes from STk. * sequences.h, sequences.c, append.h, append.c: Removed. These files implemented non-R4RS operations which would encourage non-portable programming style and less easy-to-read code. * Makefile.am (sequences.h, sequences.c, append.h, append.c): Removed. * libguile.h, eval.c, init.c, stime.c, unif.c: Removed #include sequences.h, #include append.h. * gh.h, gh_list.c: Renamed gh_list_length --> gh_length. * list.h, list.c: Renamed scm_list_length --> scm_length, scm
This commit is contained in:
parent
e69807f074
commit
92396c0aa1
9 changed files with 84 additions and 32 deletions
|
@ -1,3 +1,37 @@
|
|||
Mon Sep 15 20:42:03 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||
|
||||
* list.h (SCM_LISTn): New macros. Make list creation in C code
|
||||
prettier. The idea comes from STk.
|
||||
|
||||
* sequences.h, sequences.c, append.h, append.c: Removed. These
|
||||
files implemented non-R4RS operations which would encourage
|
||||
non-portable programming style and less easy-to-read code.
|
||||
|
||||
* Makefile.am (sequences.h, sequences.c, append.h, append.c):
|
||||
Removed.
|
||||
|
||||
* libguile.h, eval.c, init.c, stime.c, unif.c: Removed #include
|
||||
sequences.h, #include append.h.
|
||||
|
||||
* init.c (scm_boot_guile_1): Removed calls to scm_init_append and
|
||||
scm_init_sequences.
|
||||
|
||||
* gh.h, gh_list.c: Renamed gh_list_length --> gh_length.
|
||||
|
||||
* list.h, list.c: Renamed scm_list_length --> scm_length, scm
|
||||
|
||||
* stime.c (bdtime2c): Changed scm_obj_length --> scm_vector_length.
|
||||
|
||||
Sat Sep 13 00:21:41 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||
|
||||
* eval.c: Added #include "objects.h"
|
||||
|
||||
* tags.h (scm_tc16_object, scm_tc16_entity): Smobtags for objects
|
||||
and entities.
|
||||
|
||||
* smob.c (scm_smob_prehistory): Create two objectsmobs with
|
||||
adjacent smob numbers.
|
||||
|
||||
Thu Sep 11 00:59:17 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||
|
||||
* procprop.h: Added declaration of scm_i_inner_name.
|
||||
|
|
|
@ -153,7 +153,7 @@ SCM gh_module_lookup (SCM vector, char *sname);
|
|||
|
||||
SCM gh_cons(SCM x, SCM y);
|
||||
#define gh_list scm_listify
|
||||
unsigned long gh_list_length(SCM l);
|
||||
unsigned long gh_length(SCM l);
|
||||
|
||||
SCM gh_car(SCM x);
|
||||
SCM gh_cdr(SCM x);
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
|
||||
/* returns the length of a list */
|
||||
unsigned long
|
||||
gh_list_length (SCM l)
|
||||
gh_length (SCM l)
|
||||
{
|
||||
return gh_scm2ulong (scm_list_length (l));
|
||||
return gh_scm2ulong (scm_length (l));
|
||||
}
|
||||
|
||||
/* list operations */
|
||||
|
|
|
@ -148,14 +148,14 @@ scm_ilength(sx)
|
|||
return -1;
|
||||
}
|
||||
|
||||
SCM_PROC(s_list_length, "list-length", 1, 0, 0, scm_list_length);
|
||||
SCM_PROC(s_length, "length", 1, 0, 0, scm_length);
|
||||
SCM
|
||||
scm_list_length(x)
|
||||
scm_length(x)
|
||||
SCM x;
|
||||
{
|
||||
int i;
|
||||
i = scm_ilength(x);
|
||||
SCM_ASSERT(i >= 0, x, SCM_ARG1, s_list_length);
|
||||
SCM_ASSERT(i >= 0, x, SCM_ARG1, s_length);
|
||||
return SCM_MAKINUM (i);
|
||||
}
|
||||
|
||||
|
@ -163,40 +163,40 @@ scm_list_length(x)
|
|||
|
||||
/* appending lists */
|
||||
|
||||
SCM_PROC (s_list_append, "list-append", 0, 0, 1, scm_list_append);
|
||||
SCM_PROC (s_append, "append", 0, 0, 1, scm_append);
|
||||
SCM
|
||||
scm_list_append(args)
|
||||
scm_append(args)
|
||||
SCM args;
|
||||
{
|
||||
SCM res = SCM_EOL;
|
||||
SCM *lloc = &res, arg;
|
||||
if SCM_IMP(args) {
|
||||
SCM_ASSERT(SCM_NULLP(args), args, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_NULLP(args), args, SCM_ARGn, s_append);
|
||||
return res;
|
||||
}
|
||||
SCM_ASSERT(SCM_CONSP(args), args, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_CONSP(args), args, SCM_ARGn, s_append);
|
||||
while (1) {
|
||||
arg = SCM_CAR(args);
|
||||
args = SCM_CDR(args);
|
||||
if SCM_IMP(args) {
|
||||
*lloc = arg;
|
||||
SCM_ASSERT(SCM_NULLP(args), args, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_NULLP(args), args, SCM_ARGn, s_append);
|
||||
return res;
|
||||
}
|
||||
SCM_ASSERT(SCM_CONSP(args), args, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_CONSP(args), args, SCM_ARGn, s_append);
|
||||
for(;SCM_NIMP(arg);arg = SCM_CDR(arg)) {
|
||||
SCM_ASSERT(SCM_CONSP(arg), arg, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_CONSP(arg), arg, SCM_ARGn, s_append);
|
||||
*lloc = scm_cons(SCM_CAR(arg), SCM_EOL);
|
||||
lloc = SCM_CDRLOC(*lloc);
|
||||
}
|
||||
SCM_ASSERT(SCM_NULLP(arg), arg, SCM_ARGn, s_list_append);
|
||||
SCM_ASSERT(SCM_NULLP(arg), arg, SCM_ARGn, s_append);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCM_PROC (s_list_append_x, "list-append!", 0, 0, 1, scm_list_append_x);
|
||||
SCM_PROC (s_append_x, "append!", 0, 0, 1, scm_append_x);
|
||||
SCM
|
||||
scm_list_append_x(args)
|
||||
scm_append_x(args)
|
||||
SCM args;
|
||||
{
|
||||
SCM arg;
|
||||
|
@ -206,8 +206,8 @@ scm_list_append_x(args)
|
|||
args = SCM_CDR(args);
|
||||
if SCM_NULLP(args) return arg;
|
||||
if SCM_NULLP(arg) goto tail;
|
||||
SCM_ASSERT(SCM_NIMP(arg) && SCM_CONSP(arg), arg, SCM_ARG1, s_list_append_x);
|
||||
SCM_SETCDR (scm_last_pair (arg), scm_list_append_x (args));
|
||||
SCM_ASSERT(SCM_NIMP(arg) && SCM_CONSP(arg), arg, SCM_ARG1, s_append_x);
|
||||
SCM_SETCDR (scm_last_pair (arg), scm_append_x (args));
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
@ -239,24 +239,24 @@ scm_last_pair(sx)
|
|||
|
||||
/* reversing lists */
|
||||
|
||||
SCM_PROC (s_list_reverse, "list-reverse", 1, 0, 0, scm_list_reverse);
|
||||
SCM_PROC (s_reverse, "reverse", 1, 0, 0, scm_reverse);
|
||||
SCM
|
||||
scm_list_reverse(lst)
|
||||
scm_reverse(lst)
|
||||
SCM lst;
|
||||
{
|
||||
SCM res = SCM_EOL;
|
||||
SCM p = lst;
|
||||
for(;SCM_NIMP(p);p = SCM_CDR(p)) {
|
||||
SCM_ASSERT(SCM_CONSP(p), lst, SCM_ARG1, s_list_reverse);
|
||||
SCM_ASSERT(SCM_CONSP(p), lst, SCM_ARG1, s_reverse);
|
||||
res = scm_cons(SCM_CAR(p), res);
|
||||
}
|
||||
SCM_ASSERT(SCM_NULLP(p), lst, SCM_ARG1, s_list_reverse);
|
||||
SCM_ASSERT(SCM_NULLP(p), lst, SCM_ARG1, s_reverse);
|
||||
return res;
|
||||
}
|
||||
|
||||
SCM_PROC (s_list_reverse_x, "list-reverse!", 1, 1, 0, scm_list_reverse_x);
|
||||
SCM_PROC (s_reverse_x, "reverse!", 1, 1, 0, scm_reverse_x);
|
||||
SCM
|
||||
scm_list_reverse_x (lst, newtail)
|
||||
scm_reverse_x (lst, newtail)
|
||||
SCM lst;
|
||||
SCM newtail;
|
||||
{
|
||||
|
|
|
@ -47,17 +47,36 @@
|
|||
#include "libguile/__scm.h"
|
||||
|
||||
|
||||
|
||||
#define SCM_LIST0 SCM_EOL
|
||||
#define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
|
||||
#define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
|
||||
#define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
|
||||
#define SCM_LIST4(e0, e1, e2, e3)\
|
||||
scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
|
||||
#define SCM_LIST5(e0, e1, e2, e3, e4)\
|
||||
scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
|
||||
#define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
|
||||
scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
|
||||
#define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
|
||||
scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
|
||||
#define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
|
||||
scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
|
||||
#define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
|
||||
scm_cons ((e0),\
|
||||
SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
|
||||
|
||||
extern SCM scm_list_head SCM_P ((SCM lst, SCM k));
|
||||
extern SCM scm_listify SCM_P ((SCM elt, ...));
|
||||
extern SCM scm_list SCM_P ((SCM objs));
|
||||
extern SCM scm_null_p SCM_P ((SCM x));
|
||||
extern SCM scm_list_p SCM_P ((SCM x));
|
||||
extern long scm_ilength SCM_P ((SCM sx));
|
||||
extern SCM scm_list_length SCM_P ((SCM x));
|
||||
extern SCM scm_list_append SCM_P ((SCM args));
|
||||
extern SCM scm_list_append_x SCM_P ((SCM args));
|
||||
extern SCM scm_list_reverse SCM_P ((SCM lst));
|
||||
extern SCM scm_list_reverse_x SCM_P ((SCM lst, SCM newtail));
|
||||
extern SCM scm_length SCM_P ((SCM x));
|
||||
extern SCM scm_append SCM_P ((SCM args));
|
||||
extern SCM scm_append_x SCM_P ((SCM args));
|
||||
extern SCM scm_reverse SCM_P ((SCM lst));
|
||||
extern SCM scm_reverse_x SCM_P ((SCM lst, SCM newtail));
|
||||
extern SCM scm_list_ref SCM_P ((SCM lst, SCM k));
|
||||
extern SCM scm_list_set_x SCM_P ((SCM lst, SCM k, SCM val));
|
||||
extern SCM scm_list_cdr_set_x SCM_P ((SCM lst, SCM k, SCM val));
|
||||
|
|
|
@ -634,7 +634,7 @@ scm_compile_shell_switches (int argc, char **argv)
|
|||
}
|
||||
|
||||
{
|
||||
SCM val = scm_cons (sym_begin, scm_list_reverse_x (tail, SCM_UNDEFINED));
|
||||
SCM val = scm_cons (sym_begin, scm_reverse_x (tail, SCM_UNDEFINED));
|
||||
|
||||
#if 0
|
||||
scm_write (val, SCM_UNDEFINED);
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "eval.h"
|
||||
#include "genio.h"
|
||||
#include "smob.h"
|
||||
#include "sequences.h"
|
||||
#include "strop.h"
|
||||
#include "feature.h"
|
||||
|
||||
|
@ -725,7 +724,7 @@ scm_make_shared_array (oldra, mapfunc, dims)
|
|||
return ra;
|
||||
}
|
||||
}
|
||||
imap = scm_apply (mapfunc, scm_list_reverse (inds), SCM_EOL);
|
||||
imap = scm_apply (mapfunc, scm_reverse (inds), SCM_EOL);
|
||||
if (SCM_ARRAYP (oldra))
|
||||
i = (scm_sizet) scm_aind (oldra, imap, s_make_shared_array);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue