2018-06-20 19:17:06 +02:00
|
|
|
|
/* Copyright 1995-1998,2000-2001,2004,2006,2010,2012-2014,2018
|
2018-06-20 20:01:49 +02:00
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
|
|
This file is part of Guile.
|
|
|
|
|
|
|
|
|
|
|
|
Guile is free software: you can redistribute it and/or 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.
|
|
|
|
|
|
|
|
|
|
|
|
Guile is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
License along with Guile. If not, see
|
|
|
|
|
|
<https://www.gnu.org/licenses/>. */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2008-09-13 15:35:27 +02:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-03-25 23:54:21 +00:00
|
|
|
|
# include <config.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
* _scm.h: Removed #include <errno.h>.
* error.c, net_db.c, putenv.c, stime.c: Removed declaration of
errno variable (can be a macro on some systems, for example when
using linux libc with threads).
* error.c, filesys.c, gc.c, ioext.c, iselect.c, net_db.c, ports.c,
posix.c, print.c, putenv.c, scmsigs.c, script.c, simpos.c, smob.c,
socket.c, srcprop.c, stime.c, strop.c, unif.c, vports.c: Added
#include <errno.h> in these 20 out of 100 files.
2001-03-10 16:56:09 +00:00
|
|
|
|
#include <errno.h>
|
2018-06-20 18:31:24 +02:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* For Windows... */
|
|
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
|
|
#include <io.h>
|
|
|
|
|
|
#endif
|
* strings.h: don't use SCM_P. don't include <string.h>.
* error.c, gh_data.c, ports.c, script.c, strop.c: include <string.h>.
* strings.c (scm_string_ref): make the 2nd argument compulsory.
previously it defaulted to zero for no good reason that I can see.
use a local variable for SCM_INUM (k). replace
SCM_VALIDATE_INUM_DEF with SCM_VALIDATE_INUM_COPY.
(scm_makfromstr): cosmetic changes.
(scm_string): Accept only chars in the list, not strings, for
conformance to R5RS (particularly for list->string, which is
supposed to be the inverse of string->list.) remove
SCM_DEFER_INTS/SCM_ALLOW_INTS, which is unnecessary since
scm_makstr handles the cell allocation. when reporting wrong-type
arg, don't report the position as 1.
* posix.c (scm_init_posix): intern PIPE_BUF if it's defined.
* boot-9.scm (find-and-link-dynamic-module): pass strings, not symbols,
to string-append.
2000-01-31 18:29:56 +00:00
|
|
|
|
|
2018-06-20 17:19:31 +02:00
|
|
|
|
#include "async.h"
|
|
|
|
|
|
#include "dynwind.h"
|
2018-06-20 18:31:24 +02:00
|
|
|
|
#include "gsubr.h"
|
2018-06-20 17:19:31 +02:00
|
|
|
|
#include "list.h"
|
|
|
|
|
|
#include "modules.h"
|
|
|
|
|
|
#include "numbers.h"
|
|
|
|
|
|
#include "pairs.h"
|
|
|
|
|
|
#include "strings.h"
|
|
|
|
|
|
#include "symbols.h"
|
|
|
|
|
|
#include "throw.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "error.h"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2001-07-03 15:27:56 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* {Errors and Exceptional Conditions}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-08-10 13:37:11 +00:00
|
|
|
|
/* Scheme interface to scm_error_scm. */
|
1996-09-07 20:48:45 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_error (SCM key, const char *subr, const char *message, SCM args, SCM rest)
|
1996-09-07 20:48:45 +00:00
|
|
|
|
{
|
2004-08-10 13:37:11 +00:00
|
|
|
|
scm_error_scm
|
|
|
|
|
|
(key,
|
|
|
|
|
|
(subr == NULL) ? SCM_BOOL_F : scm_from_locale_string (subr),
|
|
|
|
|
|
(message == NULL) ? SCM_BOOL_F : scm_from_locale_string (message),
|
|
|
|
|
|
args, rest);
|
1996-09-07 20:48:45 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2004-08-10 13:37:11 +00:00
|
|
|
|
/* All errors should pass through here. */
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
|
(SCM key, SCM subr, SCM message, SCM args, SCM data),
|
|
|
|
|
|
"Raise an error with key @var{key}. @var{subr} can be a string\n"
|
|
|
|
|
|
"naming the procedure associated with the error, or @code{#f}.\n"
|
|
|
|
|
|
"@var{message} is the error message string, possibly containing\n"
|
|
|
|
|
|
"@code{~S} and @code{~A} escapes. When an error is reported,\n"
|
|
|
|
|
|
"these are replaced by formatting the corresponding members of\n"
|
|
|
|
|
|
"@var{args}: @code{~A} (was @code{%s} in older versions of\n"
|
|
|
|
|
|
"Guile) formats using @code{display} and @code{~S} (was\n"
|
|
|
|
|
|
"@code{%S}) formats using @code{write}. @var{data} is a list or\n"
|
|
|
|
|
|
"@code{#f} depending on @var{key}: if @var{key} is\n"
|
|
|
|
|
|
"@code{system-error} then it should be a list containing the\n"
|
|
|
|
|
|
"Unix @code{errno} value; If @var{key} is @code{signal} then it\n"
|
2004-09-23 17:48:25 +00:00
|
|
|
|
"should be a list containing the Unix signal number; If\n"
|
2013-06-04 00:29:59 +02:00
|
|
|
|
"@var{key} is @code{out-of-range}, @code{wrong-type-arg},\n"
|
|
|
|
|
|
"or @code{keyword-argument-error}, "
|
2004-09-23 17:48:25 +00:00
|
|
|
|
"it is a list containing the bad value; otherwise\n"
|
2001-04-03 13:19:05 +00:00
|
|
|
|
"it will usually be @code{#f}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_error_scm
|
1997-03-13 00:22:20 +00:00
|
|
|
|
{
|
2004-08-10 13:37:11 +00:00
|
|
|
|
scm_ithrow (key, scm_list_4 (subr, message, args, data), 1);
|
|
|
|
|
|
|
|
|
|
|
|
/* No return, but just in case: */
|
|
|
|
|
|
fprintf (stderr, "Guile scm_ithrow returned!\n");
|
2010-08-20 21:08:49 +02:00
|
|
|
|
exit (EXIT_FAILURE);
|
1997-03-13 00:22:20 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1997-03-13 00:22:20 +00:00
|
|
|
|
|
2004-07-31 01:11:15 +00:00
|
|
|
|
/* strerror may not be thread safe, for instance in glibc (version 2.3.2) an
|
|
|
|
|
|
error number not among the known values results in a string like "Unknown
|
|
|
|
|
|
error 9999" formed in a static buffer, which will be overwritten by a
|
|
|
|
|
|
similar call in another thread. A test program running two threads with
|
|
|
|
|
|
different unknown error numbers can trip this fairly quickly.
|
|
|
|
|
|
|
|
|
|
|
|
Some systems don't do what glibc does, instead just giving a single
|
|
|
|
|
|
"Unknown error" for unrecognised numbers. It doesn't seem worth trying
|
|
|
|
|
|
to tell if that's the case, a mutex is reasonably fast, and strerror
|
|
|
|
|
|
isn't needed very often.
|
|
|
|
|
|
|
|
|
|
|
|
strerror_r (when available) could be used, it might be a touch faster
|
|
|
|
|
|
than a frame and a mutex, though there's probably not much
|
|
|
|
|
|
difference. */
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
|
SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM err),
|
2001-04-03 13:19:05 +00:00
|
|
|
|
"Return the Unix error message corresponding to @var{err}, which\n"
|
|
|
|
|
|
"must be an integer value.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_strerror
|
1997-08-23 18:49:35 +00:00
|
|
|
|
{
|
2004-07-31 01:11:15 +00:00
|
|
|
|
SCM ret;
|
2014-11-11 22:30:14 -05:00
|
|
|
|
int errnum = scm_to_int (err); /* Must be done outside of the
|
|
|
|
|
|
critical section below, to avoid a
|
|
|
|
|
|
deadlock on errors. */
|
2006-01-29 00:23:28 +00:00
|
|
|
|
scm_dynwind_begin (0);
|
|
|
|
|
|
scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
|
2004-07-31 01:11:15 +00:00
|
|
|
|
|
2014-11-11 22:30:14 -05:00
|
|
|
|
ret = scm_from_locale_string (strerror (errnum));
|
2004-07-31 01:11:15 +00:00
|
|
|
|
|
2006-01-29 00:23:28 +00:00
|
|
|
|
scm_dynwind_end ();
|
2004-07-31 01:11:15 +00:00
|
|
|
|
return ret;
|
1997-08-23 18:49:35 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1997-08-23 18:49:35 +00:00
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_system_error_key, "system-error");
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_syserror (const char *subr)
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
{
|
2013-03-09 16:39:47 +01:00
|
|
|
|
SCM err = scm_from_int (errno);
|
2010-10-10 11:24:29 +02:00
|
|
|
|
|
|
|
|
|
|
/* It could be that we're getting here because the syscall was
|
|
|
|
|
|
interrupted by a signal. In that case a signal handler might have
|
|
|
|
|
|
been queued to run. The signal handler probably throws an
|
|
|
|
|
|
exception.
|
|
|
|
|
|
|
|
|
|
|
|
If we don't try to run the signal handler now, it will run later,
|
|
|
|
|
|
which would result in two exceptions being thrown: this syserror,
|
|
|
|
|
|
and then at some later time the exception thrown by the async
|
|
|
|
|
|
signal handler.
|
|
|
|
|
|
|
|
|
|
|
|
The problem is that we don't know if handling the signal caused an
|
|
|
|
|
|
async to be queued. By this time scmsigs.c:take_signal will have
|
|
|
|
|
|
written a byte on the fd, but we don't know if the signal-handling
|
|
|
|
|
|
thread has read it off and queued an async.
|
|
|
|
|
|
|
|
|
|
|
|
Ideally we need some API like scm_i_ensure_signals_delivered() to
|
|
|
|
|
|
catch up signal delivery. Barring that, we just cross our digits
|
|
|
|
|
|
and pray; it could be that we handle the signal in time, and just
|
|
|
|
|
|
throw once, or it could be that we miss the deadline and throw
|
|
|
|
|
|
twice.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#ifdef EINTR
|
|
|
|
|
|
if (scm_to_int (err) == EINTR)
|
2016-10-26 22:32:51 +02:00
|
|
|
|
scm_async_tick ();
|
2010-10-10 11:24:29 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_system_error_key,
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
subr,
|
* dynl.c, error.c, eval.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, read.c, socket.c: Update error messages to use ~A for
%s, ~S for %S to work with new `simple-format' format and be
standardized better.
* print.h, print.c (scm_simple_format): Added `simple-format'
primitive. It's the old scm_display_error, with ARGS now a rest
parameter, and the destination first instead of last (and a couple
new capabilities inspired by `format' -- #t as destination means
current-output-port, #f means return the formatted text as a
string.
* gh.h, gh_data.c, ports.h, ports.c: Added some missing const specifications.
* backtrace.c (scm_display_error_message): Rewrote to use
scm_simple_format() procedure.
* __scm.h: Added commented-out #define of GUILE_DEBUG_FREELIST
2000-01-11 18:48:57 +00:00
|
|
|
|
"~A",
|
2004-07-31 01:11:15 +00:00
|
|
|
|
scm_cons (scm_strerror (err), SCM_EOL),
|
|
|
|
|
|
scm_cons (err, SCM_EOL));
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_syserror_msg (const char *subr, const char *message, SCM args, int eno)
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
{
|
2010-10-10 11:24:29 +02:00
|
|
|
|
/* See above note about the EINTR signal handling race. */
|
|
|
|
|
|
#ifdef EINTR
|
|
|
|
|
|
if (eno == EINTR)
|
2016-10-26 22:32:51 +02:00
|
|
|
|
scm_async_tick ();
|
2010-10-10 11:24:29 +02:00
|
|
|
|
#endif
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_system_error_key,
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
subr,
|
|
|
|
|
|
message,
|
|
|
|
|
|
args,
|
2004-07-06 10:59:25 +00:00
|
|
|
|
scm_cons (scm_from_int (eno), SCM_EOL));
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_num_overflow_key, "numerical-overflow");
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_num_overflow (const char *subr)
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
{
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_num_overflow_key,
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
subr,
|
|
|
|
|
|
"Numerical overflow",
|
|
|
|
|
|
SCM_BOOL_F,
|
|
|
|
|
|
SCM_BOOL_F);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_out_of_range_key, "out-of-range");
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_out_of_range (const char *subr, SCM bad_value)
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
{
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_out_of_range_key,
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
subr,
|
2004-09-23 17:48:25 +00:00
|
|
|
|
"Value out of range: ~S",
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
scm_list_1 (bad_value),
|
2004-09-23 17:48:25 +00:00
|
|
|
|
scm_list_1 (bad_value));
|
* debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).
* error.c, error.h (scm_out_of_range): new procedure.
* error.c, error.h (scm_out_of_range_key): new key.
* posix.c (scm_sync): #else was missing.
* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.
* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case. Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
|
|
|
|
}
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
|
2000-01-07 23:53:20 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_out_of_range_pos (const char *subr, SCM bad_value, SCM pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_error (scm_out_of_range_key,
|
|
|
|
|
|
subr,
|
2004-09-23 17:48:25 +00:00
|
|
|
|
"Argument ~A out of range: ~S",
|
2002-07-20 14:08:34 +00:00
|
|
|
|
scm_list_2 (pos, bad_value),
|
2004-09-23 17:48:25 +00:00
|
|
|
|
scm_list_1 (bad_value));
|
2000-01-07 23:53:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_args_number_key, "wrong-number-of-args");
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_wrong_num_args (SCM proc)
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
{
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_args_number_key,
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
NULL,
|
* dynl.c, error.c, eval.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, read.c, socket.c: Update error messages to use ~A for
%s, ~S for %S to work with new `simple-format' format and be
standardized better.
* print.h, print.c (scm_simple_format): Added `simple-format'
primitive. It's the old scm_display_error, with ARGS now a rest
parameter, and the destination first instead of last (and a couple
new capabilities inspired by `format' -- #t as destination means
current-output-port, #f means return the formatted text as a
string.
* gh.h, gh_data.c, ports.h, ports.c: Added some missing const specifications.
* backtrace.c (scm_display_error_message): Rewrote to use
scm_simple_format() procedure.
* __scm.h: Added commented-out #define of GUILE_DEBUG_FREELIST
2000-01-11 18:48:57 +00:00
|
|
|
|
"Wrong number of arguments to ~A",
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
scm_list_1 (proc),
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
SCM_BOOL_F);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2001-03-17 11:32:56 +00:00
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
scm_error_num_args_subr (const char *subr)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_error (scm_args_number_key,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
"Wrong number of arguments to ~A",
|
(scm_memory_error): Do not try to throw, just abort.
Throwing will not work anyway.
* 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:16:49 +00:00
|
|
|
|
scm_list_1 (scm_from_locale_string (subr)),
|
2001-03-17 11:32:56 +00:00
|
|
|
|
SCM_BOOL_F);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_arg_type_key, "wrong-type-arg");
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_wrong_type_arg (const char *subr, int pos, SCM bad_value)
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
{
|
1996-10-12 21:59:40 +00:00
|
|
|
|
scm_error (scm_arg_type_key,
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
subr,
|
2004-10-04 18:52:35 +00:00
|
|
|
|
(pos == 0) ? "Wrong type: ~S"
|
* dynl.c, error.c, eval.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, read.c, socket.c: Update error messages to use ~A for
%s, ~S for %S to work with new `simple-format' format and be
standardized better.
* print.h, print.c (scm_simple_format): Added `simple-format'
primitive. It's the old scm_display_error, with ARGS now a rest
parameter, and the destination first instead of last (and a couple
new capabilities inspired by `format' -- #t as destination means
current-output-port, #f means return the formatted text as a
string.
* gh.h, gh_data.c, ports.h, ports.c: Added some missing const specifications.
* backtrace.c (scm_display_error_message): Rewrote to use
scm_simple_format() procedure.
* __scm.h: Added commented-out #define of GUILE_DEBUG_FREELIST
2000-01-11 18:48:57 +00:00
|
|
|
|
: "Wrong type argument in position ~A: ~S",
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
|
(pos == 0) ? scm_list_1 (bad_value)
|
2004-07-23 15:43:02 +00:00
|
|
|
|
: scm_list_2 (scm_from_int (pos), bad_value),
|
2004-09-23 17:48:25 +00:00
|
|
|
|
scm_list_1 (bad_value));
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-08-20 20:30:12 -07:00
|
|
|
|
void
|
|
|
|
|
|
scm_i_wrong_type_arg_symbol (SCM symbol, int pos, SCM bad_value)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_error_scm (scm_arg_type_key,
|
|
|
|
|
|
scm_symbol_to_string (symbol),
|
|
|
|
|
|
(pos == 0) ? scm_from_locale_string ("Wrong type: ~S")
|
|
|
|
|
|
: scm_from_locale_string ("Wrong type argument in position ~A: ~S"),
|
|
|
|
|
|
(pos == 0) ? scm_list_1 (bad_value)
|
|
|
|
|
|
: scm_list_2 (scm_from_int (pos), bad_value),
|
|
|
|
|
|
scm_list_1 (bad_value));
|
|
|
|
|
|
scm_remember_upto_here_2 (symbol, bad_value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-03-03 00:09:54 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_wrong_type_arg_msg (const char *subr, int pos, SCM bad_value, const char *szMessage)
|
|
|
|
|
|
{
|
(scm_memory_error): Do not try to throw, just abort.
Throwing will not work anyway.
* 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:16:49 +00:00
|
|
|
|
SCM msg = scm_from_locale_string (szMessage);
|
2004-09-23 17:48:25 +00:00
|
|
|
|
if (pos == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_error (scm_arg_type_key,
|
|
|
|
|
|
subr, "Wrong type (expecting ~A): ~S",
|
|
|
|
|
|
scm_list_2 (msg, bad_value),
|
|
|
|
|
|
scm_list_1 (bad_value));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_error (scm_arg_type_key,
|
|
|
|
|
|
subr,
|
|
|
|
|
|
"Wrong type argument in position ~A (expecting ~A): ~S",
|
|
|
|
|
|
scm_list_3 (scm_from_int (pos), msg, bad_value),
|
|
|
|
|
|
scm_list_1 (bad_value));
|
|
|
|
|
|
}
|
2000-03-03 00:09:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-20 08:18:26 +00:00
|
|
|
|
SCM_GLOBAL_SYMBOL (scm_misc_error_key, "misc-error");
|
1996-10-27 02:38:39 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_misc_error (const char *subr, const char *message, SCM args)
|
1996-10-27 02:38:39 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_error (scm_misc_error_key, subr, message, args, SCM_BOOL_F);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
|
|
|
|
|
scm_init_error ()
|
|
|
|
|
|
{
|
2018-06-20 17:19:31 +02:00
|
|
|
|
#include "cpp-E.c"
|
|
|
|
|
|
#include "error.x"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|