1996-10-14 03:24:16 +00:00
|
|
|
|
/* Printing of backtraces and error messages
|
2006-04-17 00:05:42 +00:00
|
|
|
|
* Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006 Free Software Foundation
|
1996-10-14 03:24:16 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
|
|
* as published by the Free Software Foundation; either version 3 of
|
|
|
|
|
|
* the License, or (at your option) any later version.
|
1996-10-14 03:24:16 +00:00
|
|
|
|
*
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
* Lesser General Public License for more details.
|
1996-10-14 03:24:16 +00:00
|
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-06-17 00:22:09 +01:00
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
|
|
* 02110-1301 USA
|
2003-04-05 19:15:35 +00:00
|
|
|
|
*/
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
2008-09-13 15:35:27 +02:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-03-25 23:52:40 +00:00
|
|
|
|
# include <config.h>
|
|
|
|
|
|
#endif
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2001-07-03 15:27:56 +00:00
|
|
|
|
#include <stdio.h>
|
1999-09-12 02:23:39 +00:00
|
|
|
|
#include <ctype.h>
|
* socket.c, rw.c, deprecated.h, validate.h
(SCM_VALIDATE_STRING_COPY): Deprecated. Replaced all uses with
SCM_VALIDATE_STRING plus SCM_I_STRING_CHARS or
scm_to_locale_string, etc.
(SCM_VALIDATE_SUBSTRING_SPEC_COPY): Deprecated. Replaced as
above, plus scm_i_get_substring_spec.
* regex-posix.c, read.c, random.c, ramap.c, print.c, numbers.c,
hash.c, gc.c, gc-card.c, convert.i.c, backtrace.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, ports.c: Use
SCM_I_STRING_CHARS, SCM_I_STRING_UCHARS, and SCM_I_STRING_LENGTH
instead of SCM_STRING_CHARS, SCM_STRING_UCHARS, and
SCM_STRING_LENGTH, respectively. Also, replaced scm_return_first
with more explicit scm_remember_upto_here_1, etc, or introduced
them in the first place.
2004-08-12 17:45:03 +00:00
|
|
|
|
#include <assert.h>
|
1999-09-12 02:23:39 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
1999-09-22 04:36:56 +00:00
|
|
|
|
|
1999-09-15 15:22:07 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
2001-06-26 17:53:09 +00:00
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
|
|
#include <io.h>
|
|
|
|
|
|
#endif
|
1999-09-15 15:22:07 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/stacks.h"
|
|
|
|
|
|
#include "libguile/srcprop.h"
|
|
|
|
|
|
#include "libguile/struct.h"
|
|
|
|
|
|
#include "libguile/strports.h"
|
|
|
|
|
|
#include "libguile/throw.h"
|
|
|
|
|
|
#include "libguile/fluids.h"
|
|
|
|
|
|
#include "libguile/ports.h"
|
|
|
|
|
|
#include "libguile/strings.h"
|
2003-05-12 20:46:52 +00:00
|
|
|
|
#include "libguile/dynwind.h"
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/validate.h"
|
2002-01-28 21:15:55 +00:00
|
|
|
|
#include "libguile/lang.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/backtrace.h"
|
2001-05-25 00:19:36 +00:00
|
|
|
|
#include "libguile/filesys.h"
|
* backtrace.c, debug.c, debug.h, deprecation.c, eq.c, eval.c
eval.h, gsubr.c, init.c, macros.c, print.c, print.h, read.c,
read.h, stacks.c, symbols.c, throw.c: use private-options.h
* private-options.h: new file: contain hardcoded option
definitions.
2007-01-22 15:14:40 +00:00
|
|
|
|
#include "libguile/private-options.h"
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* {Error reporting and backtraces}
|
|
|
|
|
|
*
|
|
|
|
|
|
* Note that these functions shouldn't generate errors themselves.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-05-12 20:46:52 +00:00
|
|
|
|
/* Print parameters for error messages. */
|
|
|
|
|
|
|
|
|
|
|
|
#define DISPLAY_ERROR_MESSAGE_MAX_LEVEL 7
|
|
|
|
|
|
#define DISPLAY_ERROR_MESSAGE_MAX_LENGTH 10
|
|
|
|
|
|
|
|
|
|
|
|
/* Print parameters for failing expressions in error messages.
|
|
|
|
|
|
* (See also `print_params' below for backtrace print parameters.)
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define DISPLAY_EXPRESSION_MAX_LEVEL 2
|
|
|
|
|
|
#define DISPLAY_EXPRESSION_MAX_LENGTH 3
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
#undef SCM_ASSERT
|
|
|
|
|
|
#define SCM_ASSERT(_cond, _arg, _pos, _subr) \
|
|
|
|
|
|
if (!(_cond)) \
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM scm_the_last_stack_fluid_var;
|
1997-11-29 10:49:18 +00:00
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
static void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
display_header (SCM source, SCM port)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2001-01-25 23:34:31 +00:00
|
|
|
|
if (SCM_MEMOIZEDP (source))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2001-01-25 23:34:31 +00:00
|
|
|
|
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>". */
|
2004-08-10 13:31:22 +00:00
|
|
|
|
if (scm_is_true (fname))
|
2001-01-25 23:34:31 +00:00
|
|
|
|
scm_prin1 (fname, port, 0);
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_puts ("<unnamed port>", port);
|
|
|
|
|
|
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_true (line) && scm_is_true (col))
|
2001-01-25 23:34:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_putc (':', port);
|
2004-07-23 15:43:02 +00:00
|
|
|
|
scm_intprint (scm_to_long (line) + 1, 10, port);
|
2001-01-25 23:34:31 +00:00
|
|
|
|
scm_putc (':', port);
|
2004-07-23 15:43:02 +00:00
|
|
|
|
scm_intprint (scm_to_long (col) + 1, 10, port);
|
2001-01-25 23:34:31 +00:00
|
|
|
|
}
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("ERROR", port);
|
|
|
|
|
|
scm_puts (": ", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1996-12-10 01:41:37 +00:00
|
|
|
|
|
2003-05-12 20:46:52 +00:00
|
|
|
|
struct display_error_message_data {
|
|
|
|
|
|
SCM message;
|
|
|
|
|
|
SCM args;
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
scm_print_state *pstate;
|
|
|
|
|
|
int old_fancyp;
|
|
|
|
|
|
int old_level;
|
|
|
|
|
|
int old_length;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
|
display_error_message (struct display_error_message_data *d)
|
|
|
|
|
|
{
|
2004-08-10 13:31:22 +00:00
|
|
|
|
if (scm_is_string (d->message) && scm_is_true (scm_list_p (d->args)))
|
2003-05-12 20:46:52 +00:00
|
|
|
|
scm_simple_format (d->port, d->message, d->args);
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_display (d->message, d->port);
|
|
|
|
|
|
scm_newline (d->port);
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
before_display_error_message (struct display_error_message_data *d)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_print_state *pstate = d->pstate;
|
|
|
|
|
|
d->old_fancyp = pstate->fancyp;
|
|
|
|
|
|
d->old_level = pstate->level;
|
|
|
|
|
|
d->old_length = pstate->length;
|
|
|
|
|
|
pstate->fancyp = 1;
|
|
|
|
|
|
pstate->level = DISPLAY_ERROR_MESSAGE_MAX_LEVEL;
|
|
|
|
|
|
pstate->length = DISPLAY_ERROR_MESSAGE_MAX_LENGTH;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
after_display_error_message (struct display_error_message_data *d)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_print_state *pstate = d->pstate;
|
|
|
|
|
|
pstate->fancyp = d->old_fancyp;
|
|
|
|
|
|
pstate->level = d->old_level;
|
|
|
|
|
|
pstate->length = d->old_length;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-12-10 01:41:37 +00:00
|
|
|
|
void
|
1999-12-12 20:35:02 +00:00
|
|
|
|
scm_display_error_message (SCM message, SCM args, SCM port)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2003-05-12 20:46:52 +00:00
|
|
|
|
struct display_error_message_data d;
|
|
|
|
|
|
SCM print_state;
|
|
|
|
|
|
scm_print_state *pstate;
|
|
|
|
|
|
|
|
|
|
|
|
port = scm_i_port_with_print_state (port, SCM_UNDEFINED);
|
|
|
|
|
|
print_state = SCM_PORT_WITH_PS_PS (port);
|
|
|
|
|
|
pstate = SCM_PRINT_STATE (print_state);
|
|
|
|
|
|
|
|
|
|
|
|
d.message = message;
|
|
|
|
|
|
d.args = args;
|
|
|
|
|
|
d.port = port;
|
|
|
|
|
|
d.pstate = pstate;
|
|
|
|
|
|
scm_internal_dynamic_wind ((scm_t_guard) before_display_error_message,
|
|
|
|
|
|
(scm_t_inner) display_error_message,
|
|
|
|
|
|
(scm_t_guard) after_display_error_message,
|
|
|
|
|
|
&d,
|
|
|
|
|
|
&d);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2002-07-20 14:08:34 +00:00
|
|
|
|
display_expression (SCM frame, SCM pname, SCM source, SCM port)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM print_state = scm_make_print_state ();
|
|
|
|
|
|
scm_print_state *pstate = SCM_PRINT_STATE (print_state);
|
|
|
|
|
|
pstate->writingp = 0;
|
|
|
|
|
|
pstate->fancyp = 1;
|
2003-05-12 20:46:52 +00:00
|
|
|
|
pstate->level = DISPLAY_EXPRESSION_MAX_LEVEL;
|
|
|
|
|
|
pstate->length = DISPLAY_EXPRESSION_MAX_LENGTH;
|
* strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to
replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all
uses.
(scm_i_make_string, scm_c_make_string): New, to replace
scm_allocate_string. Updated all uses.
(SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS,
SCM_STRING_LENGTH): Deprecated.
(scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string,
scm_str2string, scm_makfrom0str, scm_makfrom0str_opt):
Discouraged. Replaced all uses with scm_from_locale_string or
similar, as appropriate.
(scm_c_string_length, scm_c_string_ref, scm_c_string_set_x,
scm_c_substring, scm_c_substring_shared, scm_c_substring_copy,
scm_substring_shared, scm_substring_copy): New.
* symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC,
SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS,
SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol,
scm_str2symbol, scm_mem2uninterned_symbol): Discouraged.
(SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str):
Deprecated.
(SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS,
SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed.
(scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln):
New, to replace scm_str2symbol and scm_mem2symbol, respectively.
Updated all uses.
(scm_gensym): Generate only the number suffix in the buffer, just
string-append the prefix.
2004-08-19 17:19:44 +00:00
|
|
|
|
if (scm_is_symbol (pname) || scm_is_string (pname))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2000-01-03 16:26:28 +00:00
|
|
|
|
if (SCM_FRAMEP (frame)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
&& SCM_FRAME_EVAL_ARGS_P (frame))
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("While evaluating arguments to ", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
else
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("In procedure ", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
scm_iprin1 (pname, port, pstate);
|
1999-12-16 20:48:05 +00:00
|
|
|
|
if (SCM_MEMOIZEDP (source))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts (" in expression ", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
pstate->writingp = 1;
|
* backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
single memoized expression.
* debug.c (memoized_print): Don't try to unmemoize the memoized
object, since we can't know whether it holds a single expression
or a body.
(scm_mem_to_proc): Removed check for lambda expression, since it
was moot anyway. Whoever uses these functions for debugging
purposes should know what they do: Creating invalid memoized code
will cause crashes, independent of whether this check is present
or not.
(scm_proc_to_mem): Take the closure's code as it is and don't
append a SCM_IM_LAMBDA isym. To allow easier debugging, the
memoized code should not be modified.
* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
scm_unmemoize from public use, but made scm_i_unmemoize_expr
available as a guile internal function instead. However,
scm_i_unmemoize_expr will only work on memoized objects that hold
a single memoized expression. It won't work with bodies.
* debug.c (scm_procedure_source), macros.c (macro_print), print.c
(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
i. e. a list of expressions.
* eval.c (unmemoize_exprs): Drop internal body markers from the
output during unmemoization.
* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
as guile internal functions instead. scm_i_unmemoize_expr will
only work on a single memoized expression, while
scm_i_unmemocopy_body will only work on bodies.
2004-06-27 12:34:54 +00:00
|
|
|
|
scm_iprin1 (scm_i_unmemoize_expr (source), port, pstate);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2001-06-23 15:25:57 +00:00
|
|
|
|
else if (SCM_MEMOIZEDP (source))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("In expression ", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
pstate->writingp = 1;
|
* backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
single memoized expression.
* debug.c (memoized_print): Don't try to unmemoize the memoized
object, since we can't know whether it holds a single expression
or a body.
(scm_mem_to_proc): Removed check for lambda expression, since it
was moot anyway. Whoever uses these functions for debugging
purposes should know what they do: Creating invalid memoized code
will cause crashes, independent of whether this check is present
or not.
(scm_proc_to_mem): Take the closure's code as it is and don't
append a SCM_IM_LAMBDA isym. To allow easier debugging, the
memoized code should not be modified.
* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
scm_unmemoize from public use, but made scm_i_unmemoize_expr
available as a guile internal function instead. However,
scm_i_unmemoize_expr will only work on memoized objects that hold
a single memoized expression. It won't work with bodies.
* debug.c (scm_procedure_source), macros.c (macro_print), print.c
(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
i. e. a list of expressions.
* eval.c (unmemoize_exprs): Drop internal body markers from the
output during unmemoization.
* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
as guile internal functions instead. scm_i_unmemoize_expr will
only work on a single memoized expression, while
scm_i_unmemocopy_body will only work on bodies.
2004-06-27 12:34:54 +00:00
|
|
|
|
scm_iprin1 (scm_i_unmemoize_expr (source), port, pstate);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts (":\n", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
scm_free_print_state (print_state);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1997-09-24 20:18:54 +00:00
|
|
|
|
struct display_error_args {
|
|
|
|
|
|
SCM stack;
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
SCM subr;
|
|
|
|
|
|
SCM message;
|
|
|
|
|
|
SCM args;
|
|
|
|
|
|
SCM rest;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
* backtrace.c (display_error_body, display_backtrace_body),
coop-threads.c (scheme_body_bootstrip, c_body_bootstrip),
gh_eval.c (eval_str_wrapper, eval_file_wrapper), init.c
(invoke_main_func), root.c (cwdr_body), throw.c (cwss_body,
scm_body_thunk, hbpca_body): Removed the second jmpbuf arg on body
functions.
1998-02-02 15:00:14 +00:00
|
|
|
|
display_error_body (struct display_error_args *a)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM current_frame = SCM_BOOL_F;
|
|
|
|
|
|
SCM source = SCM_BOOL_F;
|
1998-10-04 16:44:34 +00:00
|
|
|
|
SCM prev_frame = SCM_BOOL_F;
|
2000-11-02 10:36:31 +00:00
|
|
|
|
SCM pname = a->subr;
|
1998-10-04 16:44:34 +00:00
|
|
|
|
|
Introduce scm_debug_mode_p as a replacement for scm_debug_mode and
SCM_DEBUGGINGP:
* debug.h (scm_debug_mode_p, scm_debug_mode, SCM_DEBUGGINGP),
eval.c (scm_debug_mode_p): Deprecated scm_debug_mode and
SCM_DEBUGGINGP. Provided scm_debug_mode_p instead, to have one
single interface that also matches the naming conventions.
Probably scm_debug_mode_p should be part of the private interface
anyway.
* debug.h (scm_debug_mode_p), backtrace.c (display_error_body),
eval.c (SCM_APPLY, scm_trampoline_0, scm_trampoline_1,
scm_trampoline_2): Change uses of scm_debug_mode or SCM_DEBUGGINGP
to scm_debug_mode_p.
Deprecate direct access to scm_ceval, scm_deval and scm_ceval_ptr:
* eval.h (scm_ceval, scm_deval, scm_ceval_ptr), debug.h
(scm_ceval_ptr): Deprecated. Moved declaration of scm_ceval_ptr
from debug.h to eval.h.
* debug.h (SCM_RESET_DEBUG_MODE): Don't access scm_ceval_ptr any
more, just leave it with setting scm_debug_mode_p, which is
equivalent for practical purposes.
* deprecated.h (SCM_XEVAL, SCM_XEVALCAR): Call scm_i_eval_x
instead of *scm_ceval_ptr. Leave all evaluating to scm_i_eval_x.
* gdbint.c (gdb_eval): Call scm_i_eval_x instead of scm_ceval.
* eval.c (ceval, deval, scm_ceval, scm_deval): Made scm_ceval
static and renamed it to ceval throughout. Provide a new exported
but deprecated function scm_ceval as a wrapper for backwards
compatibility. The same is done for the deval/scm_deval pair of
functions.
* eval.c (CEVAL, SCM_CEVAL): Renamed SCM_CEVAL to CEVAL
throughout. Defined CEVAL to ceval or deval, based on compilation
phase.
* eval.c (SCM_XEVAL, SCM_XEVALCAR): Dispatch on scm_debug_mode_p
to ceval and deval instead of calling *scm_ceval_ptr.
* eval.c (dispatching_eval): New deprecated static function.
* eval.c (scm_ceval_ptr): Initialized to dispatching_eval in order
to emulate its old behaviour as closely as possible.
Change the evaluator such that only expressions for which pair? is
true are passed to CEVAL, and such that all other expressions are
evaluated outside of CEVAL:
* eval.c (EVAL): New, provided in analogy to EVALCAR. Evaluate an
expression that is assumed to be memoized already. All but
expressions of the form '(<form> <form> ...)' are evaluated inline
without calling an evaluator.
* eval.c (SCM_XEVAL, SCM_XEVALCAR, EVALCAR): Evaluate all but
expressions of the form '(<form> <form> ...)' inline without
calling an evaluator.
* eval.c (scm_i_eval_x, scm_i_eval, scm_ceval, scm_deval): Handle
the special case of unmemoized symbols passed on the top level.
* eval.c (CEVAL): Change calls to CEVAL to EVAL, except where it
is known that the expression passed to CEVAL is of the form
'(<form> <form> ...)'. Remove handling of the tc7-objects, since
now it is known that the input expression of CEVAL is a pair.
2004-03-29 19:59:43 +00:00
|
|
|
|
if (scm_debug_mode_p
|
1997-09-24 20:18:54 +00:00
|
|
|
|
&& SCM_STACKP (a->stack)
|
|
|
|
|
|
&& SCM_STACK_LENGTH (a->stack) > 0)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
1997-09-24 20:18:54 +00:00
|
|
|
|
current_frame = scm_stack_ref (a->stack, SCM_INUM0);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
source = SCM_FRAME_SOURCE (current_frame);
|
1998-10-04 16:44:34 +00:00
|
|
|
|
prev_frame = SCM_FRAME_PREV (current_frame);
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (!SCM_MEMOIZEDP (source) && scm_is_true (prev_frame))
|
1998-10-04 16:44:34 +00:00
|
|
|
|
source = SCM_FRAME_SOURCE (prev_frame);
|
* strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to
replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all
uses.
(scm_i_make_string, scm_c_make_string): New, to replace
scm_allocate_string. Updated all uses.
(SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS,
SCM_STRING_LENGTH): Deprecated.
(scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string,
scm_str2string, scm_makfrom0str, scm_makfrom0str_opt):
Discouraged. Replaced all uses with scm_from_locale_string or
similar, as appropriate.
(scm_c_string_length, scm_c_string_ref, scm_c_string_set_x,
scm_c_substring, scm_c_substring_shared, scm_c_substring_copy,
scm_substring_shared, scm_substring_copy): New.
* symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC,
SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS,
SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol,
scm_str2symbol, scm_mem2uninterned_symbol): Discouraged.
(SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str):
Deprecated.
(SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS,
SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed.
(scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln):
New, to replace scm_str2symbol and scm_mem2symbol, respectively.
Updated all uses.
(scm_gensym): Generate only the number suffix in the buffer, just
string-append the prefix.
2004-08-19 17:19:44 +00:00
|
|
|
|
if (!scm_is_symbol (pname)
|
2004-08-10 13:31:22 +00:00
|
|
|
|
&& !scm_is_string (pname)
|
|
|
|
|
|
&& SCM_FRAME_PROC_P (current_frame)
|
2004-07-27 15:41:49 +00:00
|
|
|
|
&& scm_is_true (scm_procedure_p (SCM_FRAME_PROC (current_frame))))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
pname = scm_procedure_name (SCM_FRAME_PROC (current_frame));
|
|
|
|
|
|
}
|
* strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to
replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all
uses.
(scm_i_make_string, scm_c_make_string): New, to replace
scm_allocate_string. Updated all uses.
(SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS,
SCM_STRING_LENGTH): Deprecated.
(scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string,
scm_str2string, scm_makfrom0str, scm_makfrom0str_opt):
Discouraged. Replaced all uses with scm_from_locale_string or
similar, as appropriate.
(scm_c_string_length, scm_c_string_ref, scm_c_string_set_x,
scm_c_substring, scm_c_substring_shared, scm_c_substring_copy,
scm_substring_shared, scm_substring_copy): New.
* symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC,
SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS,
SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol,
scm_str2symbol, scm_mem2uninterned_symbol): Discouraged.
(SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str):
Deprecated.
(SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS,
SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed.
(scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln):
New, to replace scm_str2symbol and scm_mem2symbol, respectively.
Updated all uses.
(scm_gensym): Generate only the number suffix in the buffer, just
string-append the prefix.
2004-08-19 17:19:44 +00:00
|
|
|
|
if (scm_is_symbol (pname) || scm_is_string (pname) || SCM_MEMOIZEDP (source))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
1997-09-24 20:18:54 +00:00
|
|
|
|
display_header (source, a->port);
|
|
|
|
|
|
display_expression (current_frame, pname, source, a->port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
1997-09-24 20:18:54 +00:00
|
|
|
|
display_header (source, a->port);
|
|
|
|
|
|
scm_display_error_message (a->message, a->args, a->port);
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct display_error_handler_data {
|
|
|
|
|
|
char *mode;
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* This is the exception handler for error reporting routines.
|
|
|
|
|
|
Note that it is very important that this handler *doesn't* try to
|
|
|
|
|
|
print more than the error tag, since the error very probably is
|
|
|
|
|
|
caused by an erroneous print call-back routine. If we would
|
2000-01-09 01:07:17 +00:00
|
|
|
|
try to print all objects, we would enter an infinite loop. */
|
1997-09-24 20:18:54 +00:00
|
|
|
|
static SCM
|
|
|
|
|
|
display_error_handler (struct display_error_handler_data *data,
|
2001-06-07 21:12:19 +00:00
|
|
|
|
SCM tag, SCM args SCM_UNUSED)
|
1997-09-24 20:18:54 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM print_state = scm_make_print_state ();
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("\nException during displaying of ", data->port);
|
|
|
|
|
|
scm_puts (data->mode, data->port);
|
|
|
|
|
|
scm_puts (": ", data->port);
|
1997-09-24 20:18:54 +00:00
|
|
|
|
scm_iprin1 (tag, data->port, SCM_PRINT_STATE (print_state));
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('\n', data->port);
|
1997-09-24 20:18:54 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2001-01-24 15:58:46 +00:00
|
|
|
|
|
|
|
|
|
|
/* 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)
|
1997-09-24 20:18:54 +00:00
|
|
|
|
{
|
1998-07-12 13:22:51 +00:00
|
|
|
|
struct display_error_args a;
|
|
|
|
|
|
struct display_error_handler_data data;
|
|
|
|
|
|
a.stack = stack;
|
|
|
|
|
|
a.port = port;
|
|
|
|
|
|
a.subr = subr;
|
|
|
|
|
|
a.message = message;
|
|
|
|
|
|
a.args = args;
|
|
|
|
|
|
a.rest = rest;
|
|
|
|
|
|
data.mode = "error";
|
|
|
|
|
|
data.port = port;
|
1997-09-24 20:18:54 +00:00
|
|
|
|
scm_internal_catch (SCM_BOOL_T,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
(scm_t_catch_body) display_error_body, &a,
|
|
|
|
|
|
(scm_t_catch_handler) display_error_handler, &data);
|
2001-01-24 15:58:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCM_DEFINE (scm_display_error, "display-error", 6, 0, 0,
|
|
|
|
|
|
(SCM stack, SCM port, SCM subr, SCM message, SCM args, SCM rest),
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"Display an error message to the output port @var{port}.\n"
|
|
|
|
|
|
"@var{stack} is the saved stack for the error, @var{subr} is\n"
|
2002-03-15 10:37:40 +00:00
|
|
|
|
"the name of the procedure in which the error occurred and\n"
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"@var{message} is the actual error message, which may contain\n"
|
|
|
|
|
|
"formatting instructions. These will format the arguments in\n"
|
|
|
|
|
|
"the list @var{args} accordingly. @var{rest} is currently\n"
|
|
|
|
|
|
"ignored.")
|
2001-01-24 15:58:46 +00:00
|
|
|
|
#define FUNC_NAME s_scm_display_error
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_VALIDATE_OUTPUT_PORT (2, port);
|
|
|
|
|
|
|
|
|
|
|
|
scm_i_display_error (stack, port, subr, message, args, rest);
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
2001-01-24 15:58:46 +00:00
|
|
|
|
|
1999-09-12 02:23:39 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
|
int level;
|
|
|
|
|
|
int length;
|
|
|
|
|
|
} print_params_t;
|
|
|
|
|
|
|
|
|
|
|
|
static int n_print_params = 9;
|
|
|
|
|
|
static print_params_t default_print_params[] = {
|
|
|
|
|
|
{ 4, 9 }, { 4, 3 },
|
|
|
|
|
|
{ 3, 4 }, { 3, 3 },
|
|
|
|
|
|
{ 2, 4 }, { 2, 3 },
|
|
|
|
|
|
{ 1, 4 }, { 1, 3 }, { 1, 2 }
|
|
|
|
|
|
};
|
|
|
|
|
|
static print_params_t *print_params = default_print_params;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef GUILE_DEBUG
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_set_print_params_x, "set-print-params!", 1, 0, 0,
|
1999-12-14 17:08:25 +00:00
|
|
|
|
(SCM params),
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"Set the print parameters to the values from @var{params}.\n"
|
|
|
|
|
|
"@var{params} must be a list of two-element lists which must\n"
|
|
|
|
|
|
"hold two integer values.")
|
1999-12-14 17:41:59 +00:00
|
|
|
|
#define FUNC_NAME s_scm_set_print_params_x
|
1999-09-12 02:23:39 +00:00
|
|
|
|
{
|
2000-01-18 18:24:57 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
int n;
|
1999-09-12 02:23:39 +00:00
|
|
|
|
SCM ls;
|
|
|
|
|
|
print_params_t *new_params;
|
2000-01-18 18:24:57 +00:00
|
|
|
|
|
|
|
|
|
|
SCM_VALIDATE_NONEMPTYLIST_COPYLEN (2, params, n);
|
2002-01-22 23:31:39 +00:00
|
|
|
|
for (ls = params; !SCM_NULL_OR_NIL_P (ls); ls = SCM_CDR (ls))
|
1999-09-12 02:23:39 +00:00
|
|
|
|
SCM_ASSERT (scm_ilength (SCM_CAR (params)) == 2
|
2004-07-23 15:43:02 +00:00
|
|
|
|
&& scm_is_unsigned_integer (SCM_CAAR (ls), 0, INT_MAX)
|
|
|
|
|
|
&& scm_is_unsigned_integer (SCM_CADAR (ls), 0, INT_MAX),
|
1999-09-12 02:23:39 +00:00
|
|
|
|
params,
|
|
|
|
|
|
SCM_ARG2,
|
1999-12-14 17:41:59 +00:00
|
|
|
|
s_scm_set_print_params_x);
|
* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.
* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate. Return zero from smob and port free functions.
* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".
* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
2002-02-11 18:06:50 +00:00
|
|
|
|
new_params = scm_malloc (n * sizeof (print_params_t));
|
1999-09-12 02:23:39 +00:00
|
|
|
|
if (print_params != default_print_params)
|
* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.
* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate. Return zero from smob and port free functions.
* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".
* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
2002-02-11 18:06:50 +00:00
|
|
|
|
free (print_params);
|
1999-09-12 02:23:39 +00:00
|
|
|
|
print_params = new_params;
|
|
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
|
|
{
|
2004-07-23 15:43:02 +00:00
|
|
|
|
print_params[i].level = scm_to_int (SCM_CAAR (params));
|
|
|
|
|
|
print_params[i].length = scm_to_int (SCM_CADAR (params));
|
1999-09-12 02:23:39 +00:00
|
|
|
|
params = SCM_CDR (params);
|
|
|
|
|
|
}
|
|
|
|
|
|
n_print_params = n;
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1999-09-12 02:23:39 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
static void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
indent (int n, SCM port)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < n; ++i)
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2002-07-20 14:08:34 +00:00
|
|
|
|
display_frame_expr (char *hdr, SCM exp, char *tlr, int indentation, SCM sport, SCM port, scm_print_state *pstate)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
1999-09-12 02:23:39 +00:00
|
|
|
|
int i = 0, n;
|
2001-06-14 19:50:43 +00:00
|
|
|
|
scm_t_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (sport);
|
1999-09-12 02:23:39 +00:00
|
|
|
|
do
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
1999-09-12 02:23:39 +00:00
|
|
|
|
pstate->length = print_params[i].length;
|
|
|
|
|
|
ptob->seek (sport, 0, SEEK_SET);
|
2004-09-22 17:41:37 +00:00
|
|
|
|
if (scm_is_pair (exp))
|
1999-09-12 02:23:39 +00:00
|
|
|
|
{
|
|
|
|
|
|
pstate->level = print_params[i].level - 1;
|
|
|
|
|
|
scm_iprlist (hdr, exp, tlr[0], sport, pstate);
|
|
|
|
|
|
scm_puts (&tlr[1], sport);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pstate->level = print_params[i].level;
|
|
|
|
|
|
scm_iprin1 (exp, sport, pstate);
|
|
|
|
|
|
}
|
|
|
|
|
|
ptob->flush (sport);
|
|
|
|
|
|
n = ptob->seek (sport, 0, SEEK_CUR);
|
|
|
|
|
|
++i;
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
1999-09-12 02:23:39 +00:00
|
|
|
|
while (indentation + n > SCM_BACKTRACE_WIDTH && i < n_print_params);
|
|
|
|
|
|
ptob->truncate (sport, n);
|
|
|
|
|
|
|
2004-09-29 17:40:11 +00:00
|
|
|
|
scm_display (scm_strport_to_string (sport), port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
1997-03-07 21:42:32 +00:00
|
|
|
|
static void
|
2002-07-20 14:08:34 +00:00
|
|
|
|
display_application (SCM frame, int indentation, SCM sport, SCM port, scm_print_state *pstate)
|
1997-03-07 21:42:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM proc = SCM_FRAME_PROC (frame);
|
2004-07-06 10:59:25 +00:00
|
|
|
|
SCM name = (scm_is_true (scm_procedure_p (proc))
|
1997-03-07 21:42:32 +00:00
|
|
|
|
? scm_procedure_name (proc)
|
|
|
|
|
|
: SCM_BOOL_F);
|
|
|
|
|
|
display_frame_expr ("[",
|
2004-07-06 10:59:25 +00:00
|
|
|
|
scm_cons (scm_is_true (name) ? name : proc,
|
1997-03-07 21:42:32 +00:00
|
|
|
|
SCM_FRAME_ARGS (frame)),
|
|
|
|
|
|
SCM_FRAME_EVAL_ARGS_P (frame) ? " ..." : "]",
|
|
|
|
|
|
indentation,
|
|
|
|
|
|
sport,
|
|
|
|
|
|
port,
|
|
|
|
|
|
pstate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_display_application, "display-application", 1, 2, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM frame, SCM port, SCM indent),
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"Display a procedure application @var{frame} to the output port\n"
|
|
|
|
|
|
"@var{port}. @var{indent} specifies the indentation of the\n"
|
|
|
|
|
|
"output.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_display_application
|
1997-03-07 21:42:32 +00:00
|
|
|
|
{
|
2002-07-20 14:08:34 +00:00
|
|
|
|
SCM_VALIDATE_FRAME (1, frame);
|
1997-03-07 21:42:32 +00:00
|
|
|
|
if (SCM_UNBNDP (port))
|
2005-03-02 20:42:01 +00:00
|
|
|
|
port = scm_current_output_port ();
|
1999-09-12 02:23:39 +00:00
|
|
|
|
else
|
2002-07-20 14:08:34 +00:00
|
|
|
|
SCM_VALIDATE_OPOUTPORT (2, port);
|
1999-09-12 02:23:39 +00:00
|
|
|
|
if (SCM_UNBNDP (indent))
|
|
|
|
|
|
indent = SCM_INUM0;
|
|
|
|
|
|
|
1997-03-07 21:42:32 +00:00
|
|
|
|
if (SCM_FRAME_PROC_P (frame))
|
|
|
|
|
|
/* Display an application. */
|
|
|
|
|
|
{
|
1999-09-12 02:23:39 +00:00
|
|
|
|
SCM sport, print_state;
|
1997-03-07 21:42:32 +00:00
|
|
|
|
scm_print_state *pstate;
|
|
|
|
|
|
|
1999-09-12 02:23:39 +00:00
|
|
|
|
/* Create a string port used for adaptation of printing parameters. */
|
|
|
|
|
|
sport = scm_mkstrport (SCM_INUM0,
|
2004-07-08 15:58:11 +00:00
|
|
|
|
scm_make_string (scm_from_int (240),
|
1999-09-12 02:23:39 +00:00
|
|
|
|
SCM_UNDEFINED),
|
|
|
|
|
|
SCM_OPN | SCM_WRTNG,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
FUNC_NAME);
|
1999-09-12 02:23:39 +00:00
|
|
|
|
|
1997-03-07 21:42:32 +00:00
|
|
|
|
/* Create a print state for printing of frames. */
|
|
|
|
|
|
print_state = scm_make_print_state ();
|
|
|
|
|
|
pstate = SCM_PRINT_STATE (print_state);
|
|
|
|
|
|
pstate->writingp = 1;
|
|
|
|
|
|
pstate->fancyp = 1;
|
|
|
|
|
|
|
* validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible. Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
|
|
|
|
display_application (frame, scm_to_int (indent), sport, port, pstate);
|
1997-03-07 21:42:32 +00:00
|
|
|
|
return SCM_BOOL_T;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1997-03-07 21:42:32 +00:00
|
|
|
|
|
2001-05-25 00:19:36 +00:00
|
|
|
|
SCM_SYMBOL (sym_base, "base");
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
display_backtrace_get_file_line (SCM frame, SCM *file, SCM *line)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM source = SCM_FRAME_SOURCE (frame);
|
2008-12-26 16:35:43 +01:00
|
|
|
|
*file = *line = SCM_BOOL_F;
|
|
|
|
|
|
if (SCM_MEMOIZEDP (source))
|
|
|
|
|
|
{
|
|
|
|
|
|
*file = scm_source_property (source, scm_sym_filename);
|
|
|
|
|
|
*line = scm_source_property (source, scm_sym_line);
|
|
|
|
|
|
}
|
propagate much more source info through compilation
* module/language/ghil/compile-glil.scm (codegen): Record source location
for offset 0 into a lambda, if we can.
* module/language/scheme/compile-ghil.scm (translate-1)
(define-scheme-translator): In the retrans procedures, propagate the
location information from the enclosing expression if the subexpression
has no location information. Gives source information to many more
expressions.
(location): Just propagate the source properties as they are, the
glil->assembly compiler will interpret them.
* module/language/glil.scm (<glil>): Change glil-source to take "props"
and not "loc", as it's the source properties that we're interested in.
* module/language/glil/compile-assembly.scm (limn-sources): New function,
takes a list of addr-source property pairs and "compresses" them for
serialization to disk.
(glil->assembly): Limn the sources before writing them to disk. Avoid
non-tail recursion when determining total byte length of code.
* module/system/vm/program.scm (source:file, source:line, source:column):
Update for new source representation.
(program-source): Export.
(write-program): Nicer pretty-printing of anonymous procedures.
* libguile/backtrace.c (display_backtrace_get_file_line): Update for the
new VM source representation.
* libguile/programs.h:
* libguile/programs.c (scm_program_sources): Update for the new
serialized source representation, where the filename is not in the
stream unless it changes.
(scm_program_source): New exported function, looks up the source for a
given ip offset.
(scm_c_program_source): Update to return the last source information
that was <= the given IP, because we only serialize source info when it
changes.
2009-02-10 11:53:23 +01:00
|
|
|
|
else if (scm_is_pair (source)
|
|
|
|
|
|
&& scm_is_pair (scm_cdr (source))
|
|
|
|
|
|
&& scm_is_pair (scm_cddr (source))
|
|
|
|
|
|
&& !scm_is_pair (scm_cdddr (source)))
|
2008-12-26 16:35:43 +01:00
|
|
|
|
{
|
propagate much more source info through compilation
* module/language/ghil/compile-glil.scm (codegen): Record source location
for offset 0 into a lambda, if we can.
* module/language/scheme/compile-ghil.scm (translate-1)
(define-scheme-translator): In the retrans procedures, propagate the
location information from the enclosing expression if the subexpression
has no location information. Gives source information to many more
expressions.
(location): Just propagate the source properties as they are, the
glil->assembly compiler will interpret them.
* module/language/glil.scm (<glil>): Change glil-source to take "props"
and not "loc", as it's the source properties that we're interested in.
* module/language/glil/compile-assembly.scm (limn-sources): New function,
takes a list of addr-source property pairs and "compresses" them for
serialization to disk.
(glil->assembly): Limn the sources before writing them to disk. Avoid
non-tail recursion when determining total byte length of code.
* module/system/vm/program.scm (source:file, source:line, source:column):
Update for new source representation.
(program-source): Export.
(write-program): Nicer pretty-printing of anonymous procedures.
* libguile/backtrace.c (display_backtrace_get_file_line): Update for the
new VM source representation.
* libguile/programs.h:
* libguile/programs.c (scm_program_sources): Update for the new
serialized source representation, where the filename is not in the
stream unless it changes.
(scm_program_source): New exported function, looks up the source for a
given ip offset.
(scm_c_program_source): Update to return the last source information
that was <= the given IP, because we only serialize source info when it
changes.
2009-02-10 11:53:23 +01:00
|
|
|
|
/* (addr . (filename . (line . column))), from vm compilation */
|
|
|
|
|
|
*file = scm_cadr (source);
|
|
|
|
|
|
*line = scm_caddr (source);
|
2008-12-26 16:35:43 +01:00
|
|
|
|
}
|
2001-05-25 00:19:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
display_backtrace_file (frame, last_file, port, pstate)
|
|
|
|
|
|
SCM frame;
|
|
|
|
|
|
SCM *last_file;
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
scm_print_state *pstate;
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM file, line;
|
|
|
|
|
|
|
|
|
|
|
|
display_backtrace_get_file_line (frame, &file, &line);
|
|
|
|
|
|
|
2004-07-27 15:41:49 +00:00
|
|
|
|
if (scm_is_eq (file, *last_file))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
*last_file = file;
|
|
|
|
|
|
|
|
|
|
|
|
scm_puts ("In ", port);
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (file))
|
|
|
|
|
|
if (scm_is_false (line))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
scm_puts ("unknown file", port);
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_puts ("current input", port);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pstate->writingp = 0;
|
|
|
|
|
|
scm_iprin1 (file, port, pstate);
|
|
|
|
|
|
pstate->writingp = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
scm_puts (":\n", port);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
display_backtrace_file_and_line (SCM frame, SCM port, scm_print_state *pstate)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM file, line;
|
|
|
|
|
|
|
|
|
|
|
|
display_backtrace_get_file_line (frame, &file, &line);
|
|
|
|
|
|
|
2004-07-27 15:41:49 +00:00
|
|
|
|
if (scm_is_eq (SCM_PACK (SCM_SHOW_FILE_NAME), sym_base))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
{
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (file))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
{
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (line))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
scm_putc ('?', port);
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_puts ("<stdin>", port);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
pstate -> writingp = 0;
|
2001-10-13 15:41:40 +00:00
|
|
|
|
#ifdef HAVE_POSIX
|
2004-08-10 13:31:22 +00:00
|
|
|
|
scm_iprin1 ((scm_is_string (file)?
|
|
|
|
|
|
scm_basename (file, SCM_UNDEFINED) : file),
|
2001-05-25 00:19:36 +00:00
|
|
|
|
port, pstate);
|
2001-10-13 15:41:40 +00:00
|
|
|
|
#else
|
|
|
|
|
|
scm_iprin1 (file, port, pstate);
|
|
|
|
|
|
#endif
|
2001-05-25 00:19:36 +00:00
|
|
|
|
pstate -> writingp = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
scm_putc (':', port);
|
|
|
|
|
|
}
|
2004-07-06 10:59:25 +00:00
|
|
|
|
else if (scm_is_true (line))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
{
|
|
|
|
|
|
int i, j=0;
|
2004-07-23 15:43:02 +00:00
|
|
|
|
for (i = scm_to_int (line)+1; i > 0; i = i/10, j++)
|
2001-05-25 00:19:36 +00:00
|
|
|
|
;
|
|
|
|
|
|
indent (4-j, port);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (line))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
scm_puts (" ?", port);
|
|
|
|
|
|
else
|
2004-07-23 15:43:02 +00:00
|
|
|
|
scm_intprint (scm_to_int (line) + 1, 10, port);
|
2001-05-25 00:19:36 +00:00
|
|
|
|
scm_puts (": ", port);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
static void
|
2002-07-20 14:08:34 +00:00
|
|
|
|
display_frame (SCM frame, int nfield, int indentation, SCM sport, SCM port, scm_print_state *pstate)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
|
int n, i, j;
|
|
|
|
|
|
|
|
|
|
|
|
/* Announce missing frames? */
|
|
|
|
|
|
if (!SCM_BACKWARDS_P && SCM_FRAME_OVERFLOW_P (frame))
|
|
|
|
|
|
{
|
|
|
|
|
|
indent (nfield + 1 + indentation, port);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("...\n", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2001-05-25 00:19:36 +00:00
|
|
|
|
/* display file name and line number */
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_true (SCM_PACK (SCM_SHOW_FILE_NAME)))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
display_backtrace_file_and_line (frame, port, pstate);
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
/* Check size of frame number. */
|
|
|
|
|
|
n = SCM_FRAME_NUMBER (frame);
|
|
|
|
|
|
for (i = 0, j = n; j > 0; ++i) j /= 10;
|
|
|
|
|
|
|
|
|
|
|
|
/* Number indentation. */
|
|
|
|
|
|
indent (nfield - (i ? i : 1), port);
|
|
|
|
|
|
|
|
|
|
|
|
/* Frame number. */
|
2004-07-08 15:58:11 +00:00
|
|
|
|
scm_iprin1 (scm_from_int (n), port, pstate);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Real frame marker */
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (SCM_FRAME_REAL_P (frame) ? '*' : ' ', port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Indentation. */
|
|
|
|
|
|
indent (indentation, port);
|
|
|
|
|
|
|
|
|
|
|
|
if (SCM_FRAME_PROC_P (frame))
|
|
|
|
|
|
/* Display an application. */
|
1997-03-07 21:42:32 +00:00
|
|
|
|
display_application (frame, nfield + 1 + indentation, sport, port, pstate);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
else
|
|
|
|
|
|
/* Display a special form. */
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM source = SCM_FRAME_SOURCE (frame);
|
2004-09-22 17:41:37 +00:00
|
|
|
|
SCM copy = (scm_is_pair (source)
|
* backtrace.c, backtrace.h, debug.c, debug.h, eval.c, eval.h,
gsubr.c, gsubr.h, read.c, read.h, srcprop.c, srcprop.h
(scm_i_filename, scm_i_line, scm_i_column, scm_i_copy, scm_i_name,
scm_i_lambda, scm_i_source, scm_i_more, scm_i_procname, scm_i_dot,
scm_i_arrow, scm_i_else, scm_i_unquote, scm_i_uq_splicing,
scm_i_apply, scm_i_enter_frame, scm_i_apply_frame,
scm_i_exit_frame, scm_i_trace, scm_i_quote, scm_i_begin, scm_i_if,
scm_i_and, scm_i_or, scm_i_case, scm_i_cond, scm_i_letstar,
scm_i_do, scm_i_quasiquote, scm_i_define, scm_i_letrec, scm_i_let,
scm_i_atapply, scm_i_atcall_cc, scm_i_breakpoint): Renamed:
Consequently use scm_sym_ as prefix for symbols.
1999-08-17 08:44:38 +00:00
|
|
|
|
? scm_source_property (source, scm_sym_copy)
|
1998-12-04 11:41:03 +00:00
|
|
|
|
: SCM_BOOL_F);
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM umcopy = (SCM_MEMOIZEDP (source)
|
* backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
single memoized expression.
* debug.c (memoized_print): Don't try to unmemoize the memoized
object, since we can't know whether it holds a single expression
or a body.
(scm_mem_to_proc): Removed check for lambda expression, since it
was moot anyway. Whoever uses these functions for debugging
purposes should know what they do: Creating invalid memoized code
will cause crashes, independent of whether this check is present
or not.
(scm_proc_to_mem): Take the closure's code as it is and don't
append a SCM_IM_LAMBDA isym. To allow easier debugging, the
memoized code should not be modified.
* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
scm_unmemoize from public use, but made scm_i_unmemoize_expr
available as a guile internal function instead. However,
scm_i_unmemoize_expr will only work on memoized objects that hold
a single memoized expression. It won't work with bodies.
* debug.c (scm_procedure_source), macros.c (macro_print), print.c
(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
i. e. a list of expressions.
* eval.c (unmemoize_exprs): Drop internal body markers from the
output during unmemoization.
* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
as guile internal functions instead. scm_i_unmemoize_expr will
only work on a single memoized expression, while
scm_i_unmemocopy_body will only work on bodies.
2004-06-27 12:34:54 +00:00
|
|
|
|
? scm_i_unmemoize_expr (source)
|
1998-12-04 11:41:03 +00:00
|
|
|
|
: SCM_BOOL_F);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
display_frame_expr ("(",
|
2004-09-22 17:41:37 +00:00
|
|
|
|
scm_is_pair (copy) ? copy : umcopy,
|
1996-10-14 03:24:16 +00:00
|
|
|
|
")",
|
|
|
|
|
|
nfield + 1 + indentation,
|
|
|
|
|
|
sport,
|
|
|
|
|
|
port,
|
|
|
|
|
|
pstate);
|
|
|
|
|
|
}
|
1999-09-11 13:53:24 +00:00
|
|
|
|
scm_putc ('\n', port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Announce missing frames? */
|
|
|
|
|
|
if (SCM_BACKWARDS_P && SCM_FRAME_OVERFLOW_P (frame))
|
|
|
|
|
|
{
|
|
|
|
|
|
indent (nfield + 1 + indentation, port);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("...\n", port);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1997-09-24 20:18:54 +00:00
|
|
|
|
struct display_backtrace_args {
|
|
|
|
|
|
SCM stack;
|
|
|
|
|
|
SCM port;
|
|
|
|
|
|
SCM first;
|
|
|
|
|
|
SCM depth;
|
2004-09-23 17:51:53 +00:00
|
|
|
|
SCM highlight_objects;
|
1997-09-24 20:18:54 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static SCM
|
2001-06-23 15:25:57 +00:00
|
|
|
|
display_backtrace_body (struct display_backtrace_args *a)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME "display_backtrace_body"
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
|
int n_frames, beg, end, n, i, j;
|
|
|
|
|
|
int nfield, indent_p, indentation;
|
|
|
|
|
|
SCM frame, sport, print_state;
|
2001-05-25 00:19:36 +00:00
|
|
|
|
SCM last_file;
|
1996-10-14 03:24:16 +00:00
|
|
|
|
scm_print_state *pstate;
|
|
|
|
|
|
|
* filesys.c (scm_close, set_element, get_element, scm_chown,
scm_chmod, scm_stat, scm_truncate_file, scm_fcntl, scm_fsync): Use
SCM_COERCE_OUTPORT to cope with the printstate/port magic.
* ports.c (scm_port_revealed, scm_set_port_revealed_x,
scm_close_port, scm_port_line, scm_set_port_line_x,
scm_port_column, scm_set_port_column_x, scm_port_filename,
scm_set_port_filename_x, scm_port_mode,
scm_close_all_ports_except, scm_set_current_output_port,
scm_set_current_error_port): Likewise
* ioext.c (scm_redirect_port, scm_dup_to_fdes, scm_freopen,
scm_ftell, scm_fileno, scm_isatty_p, scm_primitive_move_to_fdes):
Likewise
* posix.c (scm_ttyname, scm_tcgetpgrp, scm_tcsetpgrp): Likewise
* backtrace.c (display_backtrace_body): Likewise
* fports (scm_setvbuf): Likewise
* socket.c (scm_getsockopt, scm_setsockopt, scm_shutdown,
scm_connect, scm_bind, scm_listen, scm_accept, scm_getsockname,
scm_getpeername, scm_send, scm_sendto): Likewise
* unif.c (scm_uniform_array_write): Likewise
1997-10-25 21:54:12 +00:00
|
|
|
|
a->port = SCM_COERCE_OUTPORT (a->port);
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
/* Argument checking and extraction. */
|
2001-06-23 15:25:57 +00:00
|
|
|
|
SCM_VALIDATE_STACK (1, a->stack);
|
|
|
|
|
|
SCM_VALIDATE_OPOUTPORT (2, a->port);
|
2004-07-23 15:43:02 +00:00
|
|
|
|
n_frames = scm_to_int (scm_stack_length (a->stack));
|
|
|
|
|
|
n = scm_is_integer (a->depth) ? scm_to_int (a->depth) : SCM_BACKTRACE_DEPTH;
|
1996-10-14 03:24:16 +00:00
|
|
|
|
if (SCM_BACKWARDS_P)
|
|
|
|
|
|
{
|
2004-07-23 15:43:02 +00:00
|
|
|
|
beg = scm_is_integer (a->first) ? scm_to_int (a->first) : 0;
|
1996-10-14 03:24:16 +00:00
|
|
|
|
end = beg + n - 1;
|
|
|
|
|
|
if (end >= n_frames)
|
|
|
|
|
|
end = n_frames - 1;
|
|
|
|
|
|
n = end - beg + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-07-23 15:43:02 +00:00
|
|
|
|
if (scm_is_integer (a->first))
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2004-07-23 15:43:02 +00:00
|
|
|
|
beg = scm_to_int (a->first);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
end = beg - n + 1;
|
|
|
|
|
|
if (end < 0)
|
|
|
|
|
|
end = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
beg = n - 1;
|
|
|
|
|
|
end = 0;
|
|
|
|
|
|
if (beg >= n_frames)
|
|
|
|
|
|
beg = n_frames - 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
n = beg - end + 1;
|
|
|
|
|
|
}
|
1997-09-24 20:18:54 +00:00
|
|
|
|
SCM_ASSERT (beg >= 0 && beg < n_frames, a->first, SCM_ARG3, s_display_backtrace);
|
|
|
|
|
|
SCM_ASSERT (n > 0, a->depth, SCM_ARG4, s_display_backtrace);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Create a string port used for adaptation of printing parameters. */
|
|
|
|
|
|
sport = scm_mkstrport (SCM_INUM0,
|
2004-07-08 15:58:11 +00:00
|
|
|
|
scm_make_string (scm_from_int (240), SCM_UNDEFINED),
|
1996-10-14 03:24:16 +00:00
|
|
|
|
SCM_OPN | SCM_WRTNG,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
FUNC_NAME);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Create a print state for printing of frames. */
|
|
|
|
|
|
print_state = scm_make_print_state ();
|
|
|
|
|
|
pstate = SCM_PRINT_STATE (print_state);
|
|
|
|
|
|
pstate->writingp = 1;
|
|
|
|
|
|
pstate->fancyp = 1;
|
2004-09-23 17:51:53 +00:00
|
|
|
|
pstate->highlight_objects = a->highlight_objects;
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* First find out if it's reasonable to do indentation. */
|
|
|
|
|
|
if (SCM_BACKWARDS_P)
|
|
|
|
|
|
indent_p = 0;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2001-06-23 15:25:57 +00:00
|
|
|
|
unsigned int j;
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
indent_p = 1;
|
2004-07-08 15:58:11 +00:00
|
|
|
|
frame = scm_stack_ref (a->stack, scm_from_int (beg));
|
1996-10-14 03:24:16 +00:00
|
|
|
|
for (i = 0, j = 0; i < n; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_FRAME_REAL_P (frame))
|
|
|
|
|
|
++j;
|
|
|
|
|
|
if (j > SCM_BACKTRACE_INDENT)
|
|
|
|
|
|
{
|
|
|
|
|
|
indent_p = 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
frame = (SCM_BACKWARDS_P
|
|
|
|
|
|
? SCM_FRAME_PREV (frame)
|
|
|
|
|
|
: SCM_FRAME_NEXT (frame));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Determine size of frame number field. */
|
2004-07-08 15:58:11 +00:00
|
|
|
|
j = SCM_FRAME_NUMBER (scm_stack_ref (a->stack, scm_from_int (end)));
|
1996-10-14 03:24:16 +00:00
|
|
|
|
for (i = 0; j > 0; ++i) j /= 10;
|
|
|
|
|
|
nfield = i ? i : 1;
|
|
|
|
|
|
|
|
|
|
|
|
/* Print frames. */
|
2004-07-08 15:58:11 +00:00
|
|
|
|
frame = scm_stack_ref (a->stack, scm_from_int (beg));
|
1996-10-14 03:24:16 +00:00
|
|
|
|
indentation = 1;
|
2001-05-25 00:19:36 +00:00
|
|
|
|
last_file = SCM_UNDEFINED;
|
|
|
|
|
|
for (i = 0; i < n; ++i)
|
1996-10-14 03:24:16 +00:00
|
|
|
|
{
|
2004-07-27 15:41:49 +00:00
|
|
|
|
if (!scm_is_eq (SCM_PACK (SCM_SHOW_FILE_NAME), sym_base))
|
2001-05-25 00:19:36 +00:00
|
|
|
|
display_backtrace_file (frame, &last_file, a->port, pstate);
|
|
|
|
|
|
|
|
|
|
|
|
display_frame (frame, nfield, indentation, sport, a->port, pstate);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
if (indent_p && SCM_FRAME_EVAL_ARGS_P (frame))
|
|
|
|
|
|
++indentation;
|
2001-05-25 00:19:36 +00:00
|
|
|
|
frame = (SCM_BACKWARDS_P ?
|
|
|
|
|
|
SCM_FRAME_PREV (frame) : SCM_FRAME_NEXT (frame));
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
1997-09-24 20:18:54 +00:00
|
|
|
|
|
2001-03-31 21:19:50 +00:00
|
|
|
|
scm_remember_upto_here_1 (print_state);
|
|
|
|
|
|
|
1997-09-24 20:18:54 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1997-09-24 20:18:54 +00:00
|
|
|
|
|
2004-11-02 22:49:14 +00:00
|
|
|
|
SCM_DEFINE (scm_display_backtrace_with_highlights, "display-backtrace", 2, 3, 0,
|
2004-09-23 17:51:53 +00:00
|
|
|
|
(SCM stack, SCM port, SCM first, SCM depth, SCM highlights),
|
2006-08-28 22:17:26 +00:00
|
|
|
|
"Display a backtrace to the output port @var{port}. @var{stack}\n"
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"is the stack to take the backtrace from, @var{first} specifies\n"
|
2006-08-28 22:17:26 +00:00
|
|
|
|
"where in the stack to start and @var{depth} how many frames\n"
|
|
|
|
|
|
"to display. @var{first} and @var{depth} can be @code{#f},\n"
|
2004-09-23 18:42:59 +00:00
|
|
|
|
"which means that default values will be used.\n"
|
2006-08-28 22:17:26 +00:00
|
|
|
|
"If @var{highlights} is given it should be a list; the elements\n"
|
|
|
|
|
|
"of this list will be highlighted wherever they appear in the\n"
|
|
|
|
|
|
"backtrace.")
|
2004-09-23 17:51:53 +00:00
|
|
|
|
#define FUNC_NAME s_scm_display_backtrace_with_highlights
|
1997-09-24 20:18:54 +00:00
|
|
|
|
{
|
1998-07-12 13:22:51 +00:00
|
|
|
|
struct display_backtrace_args a;
|
|
|
|
|
|
struct display_error_handler_data data;
|
|
|
|
|
|
a.stack = stack;
|
|
|
|
|
|
a.port = port;
|
|
|
|
|
|
a.first = first;
|
|
|
|
|
|
a.depth = depth;
|
2004-09-23 17:51:53 +00:00
|
|
|
|
if (SCM_UNBNDP (highlights))
|
|
|
|
|
|
a.highlight_objects = SCM_EOL;
|
|
|
|
|
|
else
|
|
|
|
|
|
a.highlight_objects = highlights;
|
1998-07-12 13:22:51 +00:00
|
|
|
|
data.mode = "backtrace";
|
|
|
|
|
|
data.port = port;
|
1997-09-24 20:18:54 +00:00
|
|
|
|
scm_internal_catch (SCM_BOOL_T,
|
2001-06-14 19:50:43 +00:00
|
|
|
|
(scm_t_catch_body) display_backtrace_body, &a,
|
|
|
|
|
|
(scm_t_catch_handler) display_error_handler, &data);
|
1996-10-14 03:24:16 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
2004-09-23 17:51:53 +00:00
|
|
|
|
SCM
|
|
|
|
|
|
scm_display_backtrace (SCM stack, SCM port, SCM first, SCM depth)
|
|
|
|
|
|
{
|
|
|
|
|
|
return scm_display_backtrace_with_highlights (stack, port, first, depth,
|
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM_VARIABLE (scm_has_shown_backtrace_hint_p_var, "has-shown-backtrace-hint?");
|
1997-02-10 01:01:54 +00:00
|
|
|
|
|
2004-09-23 17:51:53 +00:00
|
|
|
|
SCM_DEFINE (scm_backtrace_with_highlights, "backtrace", 0, 1, 0,
|
|
|
|
|
|
(SCM highlights),
|
2001-02-16 15:21:21 +00:00
|
|
|
|
"Display a backtrace of the stack saved by the last error\n"
|
2006-08-28 22:17:26 +00:00
|
|
|
|
"to the current output port. If @var{highlights} is given\n"
|
|
|
|
|
|
"it should be a list; the elements of this list will be\n"
|
|
|
|
|
|
"highlighted wherever they appear in the backtrace.")
|
2004-09-23 17:51:53 +00:00
|
|
|
|
#define FUNC_NAME s_scm_backtrace_with_highlights
|
1997-02-10 01:01:54 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
SCM port = scm_current_output_port ();
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM the_last_stack =
|
|
|
|
|
|
scm_fluid_ref (SCM_VARIABLE_REF (scm_the_last_stack_fluid_var));
|
2004-09-23 17:51:53 +00:00
|
|
|
|
|
|
|
|
|
|
if (SCM_UNBNDP (highlights))
|
|
|
|
|
|
highlights = SCM_EOL;
|
|
|
|
|
|
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_true (the_last_stack))
|
1997-02-10 01:01:54 +00:00
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
scm_newline (port);
|
|
|
|
|
|
scm_puts ("Backtrace:\n", port);
|
2004-09-23 17:51:53 +00:00
|
|
|
|
scm_display_backtrace_with_highlights (the_last_stack,
|
2005-03-02 20:42:01 +00:00
|
|
|
|
port,
|
2004-09-23 17:51:53 +00:00
|
|
|
|
SCM_BOOL_F,
|
|
|
|
|
|
SCM_BOOL_F,
|
|
|
|
|
|
highlights);
|
2005-03-02 20:42:01 +00:00
|
|
|
|
scm_newline (port);
|
2004-07-06 10:59:25 +00:00
|
|
|
|
if (scm_is_false (SCM_VARIABLE_REF (scm_has_shown_backtrace_hint_p_var))
|
1997-02-10 01:01:54 +00:00
|
|
|
|
&& !SCM_BACKTRACE_P)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("Type \"(debug-enable 'backtrace)\" if you would like "
|
|
|
|
|
|
"a backtrace\n"
|
|
|
|
|
|
"automatically if an error occurs in the future.\n",
|
2005-03-02 20:42:01 +00:00
|
|
|
|
port);
|
2001-05-15 14:57:22 +00:00
|
|
|
|
SCM_VARIABLE_SET (scm_has_shown_backtrace_hint_p_var, SCM_BOOL_T);
|
1997-02-10 01:01:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2005-03-02 20:42:01 +00:00
|
|
|
|
scm_puts ("No backtrace available.\n", port);
|
1997-02-10 01:01:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1997-02-10 01:01:54 +00:00
|
|
|
|
|
2004-09-23 17:51:53 +00:00
|
|
|
|
SCM
|
|
|
|
|
|
scm_backtrace (void)
|
|
|
|
|
|
{
|
|
|
|
|
|
return scm_backtrace_with_highlights (SCM_EOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-10-14 03:24:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
scm_init_backtrace ()
|
|
|
|
|
|
{
|
1997-11-29 01:10:21 +00:00
|
|
|
|
SCM f = scm_make_fluid ();
|
2001-05-15 14:57:22 +00:00
|
|
|
|
scm_the_last_stack_fluid_var = scm_c_define ("the-last-stack", f);
|
1997-02-10 01:01:54 +00:00
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/backtrace.x"
|
1996-10-14 03:24:16 +00:00
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|