1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +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

@ -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);