1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

* Remove function scm_init_iprocs, remove struct scm_iproc and simplify

initialization of c[ad]+r functions.
* Remove structs scm_subr and scm_dsubr and access the function cell words
  directly instead of casting a cell to a C struct.
This commit is contained in:
Dirk Herrmann 2000-04-25 09:45:16 +00:00
parent 820920e6a3
commit e59bb51662
4 changed files with 50 additions and 64 deletions

View file

@ -1,3 +1,14 @@
2000-04-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* pairs.c (cxrs, scm_init_pairs): Simplify initialization of
c[ad]+r functions.
* procs.c (scm_init_iprocs), procs.h (scm_subr, scm_iproc,
scm_dsubr, scm_init_iprocs): Removed.
* procs.h (SCM_SUBRF, SCM_DSUBRF): Access the cell words
directly instead of casting a cell to a C struct.
2000-04-22 Mikael Djurfeldt <mdj@thalamus.nada.kth.se> 2000-04-22 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
Better modularization of GC extensions through new C level GC Better modularization of GC extensions through new C level GC

View file

@ -123,39 +123,39 @@ SCM_DEFINE (scm_set_cdr_x, "set-cdr!", 2, 0, 0,
static const scm_iproc cxrs[] = static const char * cxrs[] =
{ {
{"car", 0}, "car",
{"cdr", 0}, "cdr",
{"caar", 0}, "caar",
{"cadr", 0}, "cadr",
{"cdar", 0}, "cdar",
{"cddr", 0}, "cddr",
{"caaar", 0}, "caaar",
{"caadr", 0}, "caadr",
{"cadar", 0}, "cadar",
{"caddr", 0}, "caddr",
{"cdaar", 0}, "cdaar",
{"cdadr", 0}, "cdadr",
{"cddar", 0}, "cddar",
{"cdddr", 0}, "cdddr",
{"caaaar", 0}, "caaaar",
{"caaadr", 0}, "caaadr",
{"caadar", 0}, "caadar",
{"caaddr", 0}, "caaddr",
{"cadaar", 0}, "cadaar",
{"cadadr", 0}, "cadadr",
{"caddar", 0}, "caddar",
{"cadddr", 0}, "cadddr",
{"cdaaar", 0}, "cdaaar",
{"cdaadr", 0}, "cdaadr",
{"cdadar", 0}, "cdadar",
{"cdaddr", 0}, "cdaddr",
{"cddaar", 0}, "cddaar",
{"cddadr", 0}, "cddadr",
{"cdddar", 0}, "cdddar",
{"cddddr", 0}, "cddddr",
{0, 0} 0
}; };
@ -163,7 +163,11 @@ static const scm_iproc cxrs[] =
void void
scm_init_pairs () scm_init_pairs ()
{ {
scm_init_iprocs (cxrs, scm_tc7_cxr); unsigned int subnr = 0;
for (subnr = 0; cxrs [subnr]; subnr++)
scm_make_subr(cxrs [subnr], scm_tc7_cxr, NULL);
#include "libguile/pairs.x" #include "libguile/pairs.x"
} }

View file

@ -370,16 +370,6 @@ scm_setter (SCM proc)
} }
void
scm_init_iprocs(const scm_iproc *subra, int type)
{
for(;subra->scm_string; subra++)
scm_make_subr(subra->scm_string,
type,
subra->cproc);
}
void void
scm_init_subr_table () scm_init_subr_table ()
{ {

View file

@ -55,24 +55,6 @@
/* Subrs /* Subrs
*/ */
typedef struct scm_subr
{
long sname;
SCM (*cproc) ();
} scm_subr;
typedef struct scm_iproc
{
char *scm_string;
SCM (*cproc) ();
} scm_iproc;
typedef struct scm_dsubr
{
long sname;
double (*dproc) ();
} scm_dsubr;
typedef struct typedef struct
{ {
SCM handle; /* link back to procedure object */ SCM handle; /* link back to procedure object */
@ -89,8 +71,8 @@ typedef struct
SCM_SET_CELL_WORD_0 (subr, (num << 8) + SCM_TYP7 (subr)) SCM_SET_CELL_WORD_0 (subr, (num << 8) + SCM_TYP7 (subr))
#define SCM_SUBR_ENTRY(x) (scm_subr_table[SCM_SUBRNUM (x)]) #define SCM_SUBR_ENTRY(x) (scm_subr_table[SCM_SUBRNUM (x)])
#define SCM_SNAME(x) (SCM_SUBR_ENTRY (x).name) #define SCM_SNAME(x) (SCM_SUBR_ENTRY (x).name)
#define SCM_SUBRF(x) (((scm_subr *)(SCM2PTR(x)))->cproc) #define SCM_SUBRF(x) ((SCM (*)()) SCM_CELL_WORD_1 (x))
#define SCM_DSUBRF(x) (((scm_dsubr *)(SCM2PTR(x)))->dproc) #define SCM_DSUBRF(x) ((double (*)()) SCM_CELL_WORD_1 (x))
#define SCM_CCLO_SUBR(x) (SCM_VELTS(x)[0]) #define SCM_CCLO_SUBR(x) (SCM_VELTS(x)[0])
#define SCM_SUBR_GENERIC(x) (SCM_SUBR_ENTRY (x).generic) #define SCM_SUBR_GENERIC(x) (SCM_SUBR_ENTRY (x).generic)
@ -189,7 +171,6 @@ extern SCM scm_procedure_with_setter_p (SCM obj);
extern SCM scm_make_procedure_with_setter (SCM procedure, SCM setter); extern SCM scm_make_procedure_with_setter (SCM procedure, SCM setter);
extern SCM scm_procedure (SCM proc); extern SCM scm_procedure (SCM proc);
extern SCM scm_setter (SCM proc); extern SCM scm_setter (SCM proc);
extern void scm_init_iprocs (const scm_iproc *subra, int type);
extern void scm_init_subr_table (void); extern void scm_init_subr_table (void);
extern void scm_init_procs (void); extern void scm_init_procs (void);