* configure.in: check for hstrerror.
[bpt/guile.git] / libguile / print.c
index 81fc27f..15ceaf9 100644 (file)
@@ -53,6 +53,7 @@
 #include "unif.h"
 #include "alist.h"
 #include "struct.h"
+#include "objects.h"
 
 #include "print.h"
 \f
@@ -108,7 +109,9 @@ char *scm_isymnames[] =
   "#@0-cond",
   "#@0-ify",
   "#@1-ify",
-  "#@bind"
+  "#@bind",
+  
+  "#@delay"
 };
 
 scm_option scm_print_opts[] = {
@@ -283,7 +286,8 @@ print_circref (port, pstate, ref)
 
 /* Print generally.  Handles both write and display according to PSTATE.
  */
-
+SCM_GPROC(s_write, "write", 1, 1, 0, scm_write, g_write);
+SCM_GPROC(s_display, "display", 1, 1, 0, scm_display, g_display);
 
 void 
 scm_iprin1 (exp, port, pstate)
@@ -347,7 +351,21 @@ taloop:
          if (SCM_CDR (SCM_CAR (exp) - 1L) == 0)
            {
              ENTER_NESTED_DATA (pstate, exp, circref);
-             scm_print_struct (exp, port, pstate);
+             if (SCM_OBJ_CLASS_FLAGS (exp) & SCM_CLASSF_GOOPS)
+               {
+                 SCM pwps, print = pstate->writingp ? g_write : g_display;
+                 if (!print)
+                   goto print_struct;
+                 SCM_NEWSMOB (pwps,
+                              scm_tc16_port_with_ps,
+                              scm_cons (port, pstate->handle));
+                 scm_call_generic_2 (print, exp, pwps);
+               }
+             else
+               {
+               print_struct:
+                 scm_print_struct (exp, port, pstate);
+               }
              EXIT_NESTED_DATA (pstate);
              break;
            }
@@ -582,7 +600,7 @@ taloop:
        case scm_tc7_fvect:
        case scm_tc7_dvect:
        case scm_tc7_cvect:
-#ifdef LONGLONGS
+#ifdef HAVE_LONG_LONGS
        case scm_tc7_llvect:
 #endif
          scm_raprin1 (exp, port, pstate);
@@ -892,7 +910,7 @@ scm_valid_oport_value_p     (SCM val)
                  && SCM_OPOUTPORTP (SCM_PORT_WITH_PS_PORT (val)))));
 }
 
-SCM_PROC(s_write, "write", 1, 1, 0, scm_write);
+/* SCM_GPROC(s_write, "write", 1, 1, 0, scm_write, g_write); */
 
 SCM 
 scm_write (obj, port)
@@ -901,8 +919,8 @@ scm_write (obj, port)
 {
   if (SCM_UNBNDP (port))
     port = scm_cur_outp;
-  else
-    SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write);
+
+  SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write);
 
   scm_prin1 (obj, port, 1);
 #ifdef HAVE_PIPE
@@ -915,7 +933,7 @@ scm_write (obj, port)
 }
 
 
-SCM_PROC(s_display, "display", 1, 1, 0, scm_display);
+/* SCM_GPROC(s_display, "display", 1, 1, 0, scm_display, g_display); */
 
 SCM 
 scm_display (obj, port)
@@ -924,8 +942,8 @@ scm_display (obj, port)
 {
   if (SCM_UNBNDP (port))
     port = scm_cur_outp;
-  else
-    SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_display);
+
+  SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_display);
 
   scm_prin1 (obj, port, 0);
 #ifdef HAVE_PIPE
@@ -945,8 +963,8 @@ scm_newline (port)
 {
   if (SCM_UNBNDP (port))
     port = scm_cur_outp;
-  else
-    SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG1, s_newline);
+
+  SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG1, s_newline);
 
   scm_putc ('\n', SCM_COERCE_OUTPORT (port));
   return SCM_UNSPECIFIED;
@@ -961,8 +979,8 @@ scm_write_char (chr, port)
 {
   if (SCM_UNBNDP (port))
     port = scm_cur_outp;
-  else
-    SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write_char);
+
+  SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write_char);
 
   SCM_ASSERT (SCM_ICHRP (chr), chr, SCM_ARG1, s_write_char);
   scm_putc ((int) SCM_ICHR (chr), SCM_COERCE_OUTPORT (port));