1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-05 15:10:27 +02:00

* On errors, show line and column information even for unnamed ports.

This commit is contained in:
Dirk Herrmann 2001-01-25 23:34:31 +00:00
parent c4a9b7bbd1
commit 2f2b390c83
2 changed files with 28 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2001-01-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* backtrace.c (display_header): Make sure that line and column
information is shown independent of whether the port the code was
read from had an associated filename. Thanks to Martin
Grabmueller for providing this patch.
2001-01-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* fports.[ch] (scm_file_port_p): New primitive.

View file

@ -86,20 +86,28 @@ SCM scm_the_last_stack_fluid;
static void
display_header (SCM source, SCM port)
{
SCM fname = (SCM_MEMOIZEDP (source)
? scm_source_property (source, scm_sym_filename)
: SCM_BOOL_F);
if (SCM_STRINGP (fname))
if (SCM_MEMOIZEDP (source))
{
scm_prin1 (fname, port, 0);
scm_putc (':', port);
scm_intprint (SCM_INUM (scm_source_property (source, scm_sym_line)) + 1,
10,
port);
scm_putc (':', port);
scm_intprint (SCM_INUM (scm_source_property (source, scm_sym_column)) + 1,
10,
port);
SCM fname = scm_source_property (source, scm_sym_filename);
SCM line = scm_source_property (source, scm_sym_line);
SCM col = scm_source_property (source, scm_sym_column);
/* Dirk:FIXME:: Maybe we should store the _port_ rather than the
* filename with the source properties? Then we could in case of
* non-file ports give at least some more details than just
* "<unnamed port>". */
if (SCM_STRINGP (fname))
scm_prin1 (fname, port, 0);
else
scm_puts ("<unnamed port>", port);
if (!SCM_FALSEP (line) && !SCM_FALSEP (col))
{
scm_putc (':', port);
scm_intprint (SCM_INUM (line) + 1, 10, port);
scm_putc (':', port);
scm_intprint (SCM_INUM (col) + 1, 10, port);
}
}
else
scm_puts ("ERROR", port);