Fixed some SCM/scm_bits_t mixups and initialization problems.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 18 Apr 2000 07:24:24 +0000 (07:24 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 18 Apr 2000 07:24:24 +0000 (07:24 +0000)
libguile/ChangeLog
libguile/print.c
libguile/srcprop.c

index d4e757a..48eaff3 100644 (file)
@@ -1,3 +1,14 @@
+2000-04-18  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * print.c (ENTER_NESTED_DATA, print_circref, scm_iprlist):
+       Compare SCM's with SCM_EQ_P.
+
+       * print.c (scm_make_print_state), srcprop.c
+       (scm_source_properties):  Use valid scheme object to initialize
+       SCM variable.
+
+       * print.c (scm_iprin1):  Remove redundant calls to SCM_UNPACK.
+
 2000-04-17  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * struct.c (scm_alloc_struct, scm_struct_free_0,
index 73f75a4..e92cd78 100644 (file)
@@ -166,7 +166,7 @@ do { \
 do { \
   register unsigned long i; \
   for (i = 0; i < pstate->top; ++i) \
-    if (pstate->ref_stack[i] == (obj)) \
+    if (SCM_EQ_P (pstate->ref_stack[i], (obj))) \
       goto label; \
   if (pstate->fancyp) \
     { \
@@ -218,7 +218,7 @@ make_print_state (void)
 SCM
 scm_make_print_state ()
 {
-  SCM answer = 0;
+  SCM answer = SCM_BOOL_F;
 
   /* First try to allocate a print state from the pool */
   SCM_DEFER_INTS;
@@ -229,7 +229,7 @@ scm_make_print_state ()
     }
   SCM_ALLOW_INTS;
   
-  return answer ? answer : make_print_state ();
+  return SCM_FALSEP (answer) ? make_print_state () : answer;
 }
 
 void
@@ -273,14 +273,15 @@ print_circref (SCM port,scm_print_state *pstate,SCM ref)
       while (i > 0)
        {
          if (SCM_NCONSP (pstate->ref_stack[i - 1])
-             || SCM_CDR (pstate->ref_stack[i - 1]) != pstate->ref_stack[i])
+             || !SCM_EQ_P (SCM_CDR (pstate->ref_stack[i - 1]), 
+                           pstate->ref_stack[i]))
            break;
          --i;
        }
       self = i;
     }
   for (i = pstate->top - 1; 1; --i)
-    if (pstate->ref_stack[i] == ref)
+    if (SCM_EQ_P (pstate->ref_stack[i], ref))
       break;
   scm_putc ('#', port);
   scm_intprint (i - self, 10, port);
@@ -327,9 +328,9 @@ taloop:
       else if (SCM_ILOCP (exp))
        {
          scm_puts ("#@", port);
-         scm_intprint (SCM_UNPACK (SCM_IFRAME (exp)), 10, port);
+         scm_intprint (SCM_IFRAME (exp), 10, port);
          scm_putc (SCM_ICDRP (exp) ? '-' : '+', port);
-         scm_intprint (SCM_UNPACK (SCM_IDIST (exp)), 10, port);
+         scm_intprint (SCM_IDIST (exp), 10, port);
        }
       else
        goto idef;
@@ -819,7 +820,7 @@ scm_iprlist (char *hdr,SCM exp,int tlr,SCM port,scm_print_state *pstate)
       if (SCM_NECONSP (exp))
        break;
       for (i = floor; i >= 0; --i)
-       if (pstate->ref_stack[i] == exp)
+       if (SCM_EQ_P (pstate->ref_stack[i], exp))
          goto circref;
       PUSH_REF (pstate, exp);
       scm_putc (' ', port);
@@ -850,7 +851,7 @@ fancy_printing:
        if (SCM_NECONSP (exp))
          break;
        for (i = 0; i < pstate->top; ++i)
-         if (pstate->ref_stack[i] == exp)
+         if (SCM_EQ_P (pstate->ref_stack[i], exp))
            goto fancy_circref;
        if (pstate->fancyp)
          {
index 6dd200b..6dce8a9 100644 (file)
@@ -177,8 +177,8 @@ SCM_DEFINE (scm_source_properties, "source-properties", 1, 0, 0,
   else if (SCM_NCONSP (obj))
     SCM_WRONG_TYPE_ARG (1, obj);
 #endif
-  p = scm_hashq_ref (scm_source_whash, obj, (SCM) NULL);
-  if (p != (SCM) NULL && SRCPROPSP (p))
+  p = scm_hashq_ref (scm_source_whash, obj, SCM_BOOL_F);
+  if (SRCPROPSP (p))
     return scm_srcprops_to_plist (p);
   return SCM_EOL;
 }