1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
guile/libguile/error.h
Andy Wingo bf15afa6bf Move subr snarfing macros to gsubr.h.
* libguile/snarf.h: Remove gsubr include and subr snarfers.
* libguile/gsubr.h (SCM_DEFINE_GSUBR, SCM_DEFINE, SCM_PRIMITIVE_GENERIC):
  (SCM_DEFINE_PUBLIC, SCM_PROC, SCM_REGISTER_PROC, SCM_GPROC): Move
  here.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/async.c:
* libguile/atomic.c:
* libguile/backtrace.c:
* libguile/bitvectors.c:
* libguile/boolean.c:
* libguile/bytevectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/debug-malloc.c:
* libguile/debug.c:
* libguile/deprecation.c:
* libguile/dynl.c:
* libguile/eq.c:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/evalext.c:
* libguile/expand.c:
* libguile/extensions.c:
* libguile/fdes-finalizers.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/finalizers.c:
* libguile/fluids.c:
* libguile/foreign-object.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/gc.c:
* libguile/generalized-arrays.c:
* libguile/generalized-vectors.c:
* libguile/gettext.c:
* libguile/guardians.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/ioext.c:
* libguile/keywords.c:
* libguile/list.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/net_db.c:
* libguile/numbers.c:
* libguile/objprop.c:
* libguile/pairs.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/promises.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/simpos.c:
* libguile/smob.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srcprop.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/srfi-4.c:
* libguile/srfi-60.c:
* libguile/stackchk.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/strorder.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/syntax.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/unicode.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/version.c:
* libguile/vm.c:
* libguile/vports.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Add gsubr includes.
2018-06-20 09:04:55 +02:00

115 lines
3.8 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* classes: h_files */
#ifndef SCM_ERROR_H
#define SCM_ERROR_H
/* Copyright (C) 1995-1998,2000-2002,2006,2008,2011,2014,2018
* Free Software Foundation, Inc.
*
* This library 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.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "libguile/__scm.h"
SCM_API SCM scm_system_error_key;
SCM_API SCM scm_num_overflow_key;
SCM_API SCM scm_out_of_range_key;
SCM_API SCM scm_args_number_key;
SCM_API SCM scm_arg_type_key;
SCM_API SCM scm_misc_error_key;
/* Snarfing for docs may override SCM_ASSERT; see snarf.h. */
#ifndef SCM_ASSERT
#define SCM_ASSERT(_cond, _arg, _pos, _subr) \
do { if (SCM_UNLIKELY (!(_cond))) \
scm_wrong_type_arg (_subr, _pos, _arg); } while (0)
#endif
#define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \
do { if (SCM_UNLIKELY (!(_cond))) \
scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg); } while (0)
SCM_API void scm_error (SCM key, const char *subr, const char *message,
SCM args, SCM rest) SCM_NORETURN;
SCM_API SCM scm_error_scm (SCM key, SCM subr, SCM message,
SCM args, SCM rest) SCM_NORETURN;
SCM_API SCM scm_strerror (SCM err);
SCM_API void scm_syserror (const char *subr) SCM_NORETURN;
SCM_API void scm_syserror_msg (const char *subr, const char *message,
SCM args, int eno) SCM_NORETURN;
SCM_API void scm_num_overflow (const char *subr) SCM_NORETURN;
SCM_API void scm_out_of_range (const char *subr, SCM bad_value)
SCM_NORETURN;
SCM_API void scm_out_of_range_pos (const char *subr, SCM bad_value, SCM pos)
SCM_NORETURN;
SCM_API void scm_wrong_num_args (SCM proc) SCM_NORETURN;
SCM_API void scm_error_num_args_subr (const char* subr) SCM_NORETURN;
SCM_API void scm_wrong_type_arg (const char *subr, int pos,
SCM bad_value) SCM_NORETURN;
SCM_INTERNAL void scm_i_wrong_type_arg_symbol (SCM symbol, int pos,
SCM bad_value) SCM_NORETURN;
SCM_API void scm_wrong_type_arg_msg (const char *subr, int pos,
SCM bad_value, const char *sz) SCM_NORETURN;
SCM_API void scm_misc_error (const char *subr, const char *message,
SCM args) SCM_NORETURN;
SCM_INTERNAL void scm_init_error (void);
#define SCM_MAKE_VALIDATE(pos, var, pred) \
do { \
SCM_ASSERT_TYPE (SCM_ ## pred (var), var, pos, FUNC_NAME, #pred); \
} while (0)
#define SCM_I_MAKE_VALIDATE_MSG2(pos, var, pred, msg) \
do { \
SCM_ASSERT_TYPE (pred (var), var, pos, FUNC_NAME, msg); \
} while (0)
#define SCM_MAKE_VALIDATE_MSG(pos, var, pred, msg) \
SCM_I_MAKE_VALIDATE_MSG2 (pos, var, SCM_ ## pred, msg)
#define SCM_SYSERROR do { scm_syserror (FUNC_NAME); } while (0)
#define SCM_MEMORY_ERROR do { scm_memory_error (FUNC_NAME); } while (0)
#define SCM_SYSERROR_MSG(str, args, val) \
do { scm_syserror_msg (FUNC_NAME, (str), (args), (val)); } while (0)
#define SCM_MISC_ERROR(str, args) \
do { scm_misc_error (FUNC_NAME, str, args); } while (0)
#define SCM_WRONG_NUM_ARGS() \
do { scm_error_num_args_subr (FUNC_NAME); } while (0)
#define SCM_WRONG_TYPE_ARG(pos, obj) \
do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
#endif /* SCM_ERROR_H */
/*
Local Variables:
c-file-style: "gnu"
End:
*/