* Make sure that scm_display_error validates its port argument.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Wed, 24 Jan 2001 15:58:46 +0000 (15:58 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Wed, 24 Jan 2001 15:58:46 +0000 (15:58 +0000)
libguile/ChangeLog
libguile/backtrace.c
libguile/backtrace.h
libguile/throw.c

index e29d442..5866632 100644 (file)
@@ -1,3 +1,14 @@
+2001-01-24  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * backtrace.[ch] (scm_i_display_error):  New function.
+
+       * backtrace.c (scm_display_error):  Added parameter check and
+       extracted the core functionality into function
+       scm_i_display_error.
+
+       * throw.c (handler_message):  Call scm_i_display_error to display
+       the error message.
+
 2001-01-23  Mikael Djurfeldt  <mdj@linnaeus.mit.edu>
 
        * eval.c (SCM_APPLY): Added # args check for application of
index 9b279e1..67d8e2a 100644 (file)
@@ -219,10 +219,14 @@ display_error_handler (struct display_error_handler_data *data,
   return SCM_UNSPECIFIED;
 }
 
-SCM_DEFINE (scm_display_error, "display-error", 6, 0, 0,
-           (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest),
-"")
-#define FUNC_NAME s_scm_display_error
+
+/* The function scm_i_display_error prints out a detailed error message.  This
+ * function will be called directly within libguile to signal error messages.
+ * No parameter checks will be performed by scm_i_display_error.  Thus, User
+ * code should rather use the function scm_display_error.
+ */
+void
+scm_i_display_error (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest)
 {
   struct display_error_args a;
   struct display_error_handler_data data;
@@ -237,10 +241,23 @@ SCM_DEFINE (scm_display_error, "display-error", 6, 0, 0,
   scm_internal_catch (SCM_BOOL_T,
                      (scm_catch_body_t) display_error_body, &a,
                      (scm_catch_handler_t) display_error_handler, &data);
+}
+
+
+SCM_DEFINE (scm_display_error, "display-error", 6, 0, 0,
+           (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest),
+           "")
+#define FUNC_NAME s_scm_display_error
+{
+  SCM_VALIDATE_OUTPUT_PORT (2, port);
+
+  scm_i_display_error (stack, port, subr, message, args, rest);
+
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
 
+
 typedef struct {
   int level;
   int length;
index 49e5475..68f85a2 100644 (file)
@@ -52,6 +52,7 @@
 extern SCM scm_the_last_stack_fluid;
 
 void scm_display_error_message (SCM message, SCM args, SCM port);
+void scm_i_display_error (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest);
 SCM scm_display_error (SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest);
 SCM scm_display_application (SCM frame, SCM port, SCM indent);
 SCM scm_display_backtrace (SCM stack, SCM port, SCM first, SCM depth);
index 60d5bc9..faf2040 100644 (file)
@@ -434,7 +434,7 @@ handler_message (void *handler_data, SCM tag, SCM args)
          scm_display_backtrace (stack, p, SCM_UNDEFINED, SCM_UNDEFINED);
          scm_newline (p);
        }
-      scm_display_error (stack, p, subr, message, parts, rest);
+      scm_i_display_error (stack, p, subr, message, parts, rest);
     }
   else
     {