1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

* Make sure that scm_display_error validates its port argument.

This commit is contained in:
Dirk Herrmann 2001-01-24 15:58:46 +00:00
parent f1e06a96a2
commit e40a4095d6
4 changed files with 34 additions and 5 deletions

View 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> 2001-01-23 Mikael Djurfeldt <mdj@linnaeus.mit.edu>
* eval.c (SCM_APPLY): Added # args check for application of * eval.c (SCM_APPLY): Added # args check for application of

View file

@ -219,10 +219,14 @@ display_error_handler (struct display_error_handler_data *data,
return SCM_UNSPECIFIED; 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), /* The function scm_i_display_error prints out a detailed error message. This
"") * function will be called directly within libguile to signal error messages.
#define FUNC_NAME s_scm_display_error * 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_args a;
struct display_error_handler_data data; 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_internal_catch (SCM_BOOL_T,
(scm_catch_body_t) display_error_body, &a, (scm_catch_body_t) display_error_body, &a,
(scm_catch_handler_t) display_error_handler, &data); (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; return SCM_UNSPECIFIED;
} }
#undef FUNC_NAME #undef FUNC_NAME
typedef struct { typedef struct {
int level; int level;
int length; int length;

View file

@ -52,6 +52,7 @@
extern SCM scm_the_last_stack_fluid; extern SCM scm_the_last_stack_fluid;
void scm_display_error_message (SCM message, SCM args, SCM port); 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_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_application (SCM frame, SCM port, SCM indent);
SCM scm_display_backtrace (SCM stack, SCM port, SCM first, SCM depth); SCM scm_display_backtrace (SCM stack, SCM port, SCM first, SCM depth);

View file

@ -434,7 +434,7 @@ handler_message (void *handler_data, SCM tag, SCM args)
scm_display_backtrace (stack, p, SCM_UNDEFINED, SCM_UNDEFINED); scm_display_backtrace (stack, p, SCM_UNDEFINED, SCM_UNDEFINED);
scm_newline (p); scm_newline (p);
} }
scm_display_error (stack, p, subr, message, parts, rest); scm_i_display_error (stack, p, subr, message, parts, rest);
} }
else else
{ {