* pairs.h, eval.c, eval.h, feature.c, gc.c, list.c, load.c,
authorMikael Djurfeldt <djurfeldt@nada.kth.se>
Sun, 20 Oct 1996 03:29:38 +0000 (03:29 +0000)
committerMikael Djurfeldt <djurfeldt@nada.kth.se>
Sun, 20 Oct 1996 03:29:38 +0000 (03:29 +0000)
ramap.c, symbols.c: Added new selectors SCM_CARLOC and SCM_CDRLOC
for obtaining the address of a car or cdr field.  Motivation:
&SCM_CXR make assumptions about the internal structure of the
SCM_CXR selectors.

* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)

libguile/feature.c
libguile/list.c
libguile/load.c
libguile/ramap.c
libguile/symbols.c

index fceaea9..5bf986f 100644 (file)
@@ -76,7 +76,7 @@ scm_program_arguments ()
 void
 scm_init_feature()
 {
-  scm_loc_features = &SCM_CDR(scm_sysintern("*features*", SCM_EOL));
+  scm_loc_features = SCM_CDRLOC (scm_sysintern ("*features*", SCM_EOL));
 #ifdef RECKLESS
   scm_add_feature("reckless");
 #endif
index bb38ddf..5a72bfb 100644 (file)
@@ -77,7 +77,7 @@ scm_listify (elt, va_alist)
   while (elt != SCM_UNDEFINED)
     {
       *pos = scm_cons (elt, SCM_EOL);
-      pos = &SCM_CDR (*pos);
+      pos = SCM_CDRLOC (*pos);
       elt = va_arg (foo, SCM);
     }
   return answer;
@@ -187,7 +187,7 @@ scm_list_append(args)
     for(;SCM_NIMP(arg);arg = SCM_CDR(arg)) {
       SCM_ASSERT(SCM_CONSP(arg), arg, SCM_ARGn, s_list_append);
       *lloc = scm_cons(SCM_CAR(arg), SCM_EOL);
-      lloc = &SCM_CDR(*lloc);
+      lloc = SCM_CDRLOC(*lloc);
     }
     SCM_ASSERT(SCM_NULLP(arg), arg, SCM_ARGn, s_list_append);
   }
@@ -207,7 +207,7 @@ scm_list_append_x(args)
   args = SCM_CDR(args);
   if SCM_NULLP(args) return arg;
   if SCM_NULLP(arg) goto tail;
-  SCM_CDR(scm_last_pair(arg)) = scm_list_append_x(args);
+  SCM_SETCDR (scm_last_pair (arg), scm_list_append_x (args));
   return arg;
 }
 
@@ -318,7 +318,7 @@ scm_list_set_x(lst, k, val)
        }
 erout: SCM_ASSERT(SCM_NIMP(lst) && SCM_CONSP(lst),
               SCM_NULLP(lst)?k:lst, SCM_NULLP(lst)?SCM_OUTOFRANGE:SCM_ARG1, s_list_set_x);
-       SCM_CAR (lst) = val;
+       SCM_SETCAR (lst, val);
        return val;
 }
 
@@ -384,7 +384,7 @@ scm_list_head(lst, k)
     {
       SCM_ASSERT(SCM_NIMP(lst) && SCM_CONSP(lst), lst, SCM_ARG1, s_list_head);
       *pos = scm_cons (SCM_CAR (lst), SCM_EOL);
-      pos = &SCM_CDR (*pos);
+      pos = SCM_CDRLOC (*pos);
       lst = SCM_CDR(lst);
     }
   return answer;
@@ -409,7 +409,7 @@ scm_list_copy (lst)
       SCM c;
       c = scm_cons (SCM_CAR (from_here), SCM_CDR (from_here));
       *fill_here = c;
-      fill_here = &SCM_CDR (c);
+      fill_here = SCM_CDRLOC (c);
       from_here = SCM_CDR (from_here);
     }
   return newlst;
index a4527af..bb6ce3b 100644 (file)
@@ -221,7 +221,7 @@ scm_primitive_load_path (filename, case_insensitive_p, sharp)
 void
 scm_init_load ()
 {
-  scm_loc_load_path = &SCM_CDR(scm_sysintern("%load-path", SCM_EOL));
+  scm_loc_load_path = SCM_CDRLOC(scm_sysintern("%load-path", SCM_EOL));
 
 #include "load.x"
 }
index 6731291..7d721bd 100644 (file)
@@ -282,7 +282,7 @@ scm_ramapc (cproc, data, ra0, lra, what)
              SCM_ARRAY_V (vra1) = SCM_ARRAY_V (ra1);
            }
          *plvra = scm_cons (vra1, SCM_EOL);
-         plvra = &SCM_CDR (*plvra);
+         plvra = SCM_CDRLOC (*plvra);
        }
       return (SCM_UNBNDP (data) ? cproc(vra0, lvra) : cproc(vra0, data, lvra));
     case 1:
@@ -338,7 +338,7 @@ scm_ramapc (cproc, data, ra0, lra, what)
              SCM_ARRAY_V (vra1) = ra1;
            }
          *plvra = scm_cons (vra1, SCM_EOL);
-         plvra = &SCM_CDR (*plvra);
+         plvra = SCM_CDRLOC (*plvra);
        }
       inds = scm_make_uve (SCM_ARRAY_NDIM (ra0), SCM_MAKINUM (-1L));
       vinds = (long *) SCM_VELTS (inds);
index caf6eae..ec3fb9f 100644 (file)
@@ -139,7 +139,7 @@ scm_sym2vcell (sym, thunk, definep)
 
       for (lsym = *(lsymp = &SCM_VELTS (scm_weak_symhash)[scm_hash]);
           SCM_NIMP (lsym);
-          lsym = *(lsymp = &SCM_CDR (lsym)))
+          lsym = *(lsymp = SCM_CDRLOC (lsym)))
        {
          z = SCM_CAR (lsym);
          if (SCM_CAR (z) == sym)
@@ -306,8 +306,8 @@ scm_intern_obarray_soft (name, len, obarray, softness)
       SCM_REALLOW_INTS;
       SCM_NEWCELL (answer);
       SCM_DEFER_INTS;
-      SCM_CAR (answer) = lsym;
-      SCM_CDR (answer) = SCM_UNDEFINED;
+      SCM_SETCAR (answer, lsym);
+      SCM_SETCDR (answer, SCM_UNDEFINED);
       SCM_REALLOW_INTS;
       return answer;
     }
@@ -368,7 +368,7 @@ scm_sysintern (name, val)
   easy_answer = scm_intern_obarray_soft (name, strlen (name), scm_symhash, 1);
   if (SCM_NIMP (easy_answer))
     {
-      SCM_CDR (easy_answer) = val;
+      SCM_SETCDR (easy_answer, val);
       SCM_ALLOW_INTS;
       return easy_answer;
     }
@@ -543,7 +543,7 @@ scm_unintern_symbol(o, s)
            if (lsym_follow == SCM_BOOL_F)
              SCM_VELTS(o)[hval] = lsym;
            else
-             SCM_CDR(lsym_follow) = SCM_CDR(lsym);
+             SCM_SETCDR (lsym_follow, SCM_CDR(lsym));
            SCM_ALLOW_INTS;
            return SCM_BOOL_T;
          }
@@ -625,7 +625,7 @@ scm_symbol_set_x (o, s, v)
     o = scm_symhash;
   SCM_ASSERT(SCM_NIMP(o) && SCM_VECTORP(o), o, SCM_ARG1, s_symbol_set_x);
   vcell = scm_sym2ovcell (s, o);
-  SCM_CDR(vcell) = v;
+  SCM_SETCDR (vcell, v);
   return SCM_UNSPECIFIED;
 }
 
@@ -638,8 +638,8 @@ msymbolize (s)
   SCM_SETCHARS (s, SCM_CHARS (string));
   SCM_SETLENGTH (s, SCM_LENGTH (s), scm_tc7_msymbol);
   SCM_SYMBOL_MULTI_BYTE_STRINGP (s) = SCM_BOOL_F;
-  SCM_CDR (string) = SCM_EOL;
-  SCM_CAR (string) = SCM_EOL;
+  SCM_SETCDR (string, SCM_EOL);
+  SCM_SETCAR (string, SCM_EOL);
 }