This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

getting rid of scm_init_iprocs in procs.c


Hi!

I would like to remove scm_init_iprocs from procs.c.  This function is
only used to initialize the functions c[ad]*r.  I'd rather perform the
corresponding initialization directly in pairs.c.

Also, the type definitions scm_subr, scm_iproc and scm_dsubr from
procs.h are not used within guile.

I nobody objects, I will apply the attached patch, which removes
respectively simplifies the corresponding code.

Best regards
Dirk Herrmann


diff -u -r1.14 pairs.c
--- pairs.c     2000/03/19 19:01:12     1.14
+++ pairs.c     2000/04/20 10:06:14
@@ -123,39 +123,39 @@
 
 ^L
 
-static const scm_iproc cxrs[] = 
+static const char * cxrs[] = 
 {
-  {"car", 0},
-  {"cdr", 0},
-  {"caar", 0},
-  {"cadr", 0},
-  {"cdar", 0},
-  {"cddr", 0},
-  {"caaar", 0},
-  {"caadr", 0},
-  {"cadar", 0},
-  {"caddr", 0},
-  {"cdaar", 0},
-  {"cdadr", 0},
-  {"cddar", 0},
-  {"cdddr", 0},
-  {"caaaar", 0},
-  {"caaadr", 0},
-  {"caadar", 0},
-  {"caaddr", 0},
-  {"cadaar", 0},
-  {"cadadr", 0},
-  {"caddar", 0},
-  {"cadddr", 0},
-  {"cdaaar", 0},
-  {"cdaadr", 0},
-  {"cdadar", 0},
-  {"cdaddr", 0},
-  {"cddaar", 0},
-  {"cddadr", 0},
-  {"cdddar", 0},
-  {"cddddr", 0},
-  {0, 0}
+  "car",
+  "cdr",
+  "caar",
+  "cadr",
+  "cdar",
+  "cddr",
+  "caaar",
+  "caadr",
+  "cadar",
+  "caddr",
+  "cdaar",
+  "cdadr",
+  "cddar",
+  "cdddr",
+  "caaaar",
+  "caaadr",
+  "caadar",
+  "caaddr",
+  "cadaar",
+  "cadadr",
+  "caddar",
+  "cadddr",
+  "cdaaar",
+  "cdaadr",
+  "cdadar",
+  "cdaddr",
+  "cddaar",
+  "cddadr",
+  "cdddar",
+  "cddddr",
+  0
 };
 
 ^L
@@ -163,7 +163,11 @@
 void
 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 "pairs.x"
 }
 

===================================================================


diff -u -r1.37 procs.c
--- procs.c     2000/04/19 03:25:22     1.37
+++ procs.c     2000/04/20 10:06:14
@@ -371,16 +371,6 @@
 
 
 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
 scm_init_subr_table ()
 {
   scm_subr_table


===================================================================


diff -u -r1.29 procs.h
--- procs.h     2000/04/19 09:37:48     1.29
+++ procs.h     2000/04/20 10:06:14
@@ -55,24 +55,6 @@
 /* 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
 {
   SCM handle;                  /* link back to procedure object */
@@ -89,8 +71,8 @@
         SCM_SET_CELL_WORD_0 (subr, (num << 8) + SCM_TYP7 (subr))
 #define SCM_SUBR_ENTRY(x) (scm_subr_table[SCM_SUBRNUM (x)])
 #define SCM_SNAME(x) (SCM_SUBR_ENTRY (x).name)
-#define SCM_SUBRF(x) (((scm_subr *)(SCM2PTR(x)))->cproc)
-#define SCM_DSUBRF(x) (((scm_dsubr *)(SCM2PTR(x)))->dproc)
+#define SCM_SUBRF(x) ((SCM (*)()) SCM_CELL_WORD_1 (x))
+#define SCM_DSUBRF(x) ((double (*)()) SCM_CELL_WORD_1 (x))
 #define SCM_CCLO_SUBR(x) (SCM_VELTS(x)[0])
 
 #define SCM_SUBR_GENERIC(x) (SCM_SUBR_ENTRY (x).generic)
@@ -189,7 +171,6 @@
 extern SCM scm_make_procedure_with_setter (SCM procedure, SCM setter);
 extern SCM scm_procedure (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_procs (void);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]