Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
e81d98ec DH |
3 | #ifndef SCM_ERROR_H |
4 | #define SCM_ERROR_H | |
8c494e99 | 5 | |
6703caf7 | 6 | /* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2006, 2008, 2011 Free Software Foundation, Inc. |
8c494e99 | 7 | * |
73be1d9e | 8 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
9 | * modify it under the terms of the GNU Lesser General Public License |
10 | * as published by the Free Software Foundation; either version 3 of | |
11 | * the License, or (at your option) any later version. | |
8c494e99 | 12 | * |
53befeb7 NJ |
13 | * This library is distributed in the hope that it will be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
8c494e99 | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301 USA | |
73be1d9e | 22 | */ |
8c494e99 | 23 | |
0f2d19dd | 24 | \f |
8c494e99 | 25 | |
b4309c3c | 26 | #include "libguile/__scm.h" |
0f2d19dd JB |
27 | |
28 | \f | |
33b001fd MV |
29 | SCM_API SCM scm_system_error_key; |
30 | SCM_API SCM scm_num_overflow_key; | |
31 | SCM_API SCM scm_out_of_range_key; | |
32 | SCM_API SCM scm_args_number_key; | |
33 | SCM_API SCM scm_arg_type_key; | |
34 | SCM_API SCM scm_memory_alloc_key; | |
35 | SCM_API SCM scm_misc_error_key; | |
a7f54aed | 36 | |
0f2d19dd JB |
37 | \f |
38 | ||
6703caf7 AW |
39 | #define SCM_ASSERT(_cond, _arg, _pos, _subr) \ |
40 | do { if (SCM_UNLIKELY (!(_cond))) \ | |
41 | scm_wrong_type_arg (_subr, _pos, _arg); } while (0) | |
42 | #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \ | |
43 | do { if (SCM_UNLIKELY (!(_cond))) \ | |
44 | scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg); } while (0) | |
45 | ||
46 | ||
47 | \f | |
48 | ||
33b001fd MV |
49 | SCM_API void scm_error (SCM key, const char *subr, const char *message, |
50 | SCM args, SCM rest) SCM_NORETURN; | |
51 | SCM_API SCM scm_error_scm (SCM key, SCM subr, SCM message, | |
52 | SCM args, SCM rest) SCM_NORETURN; | |
53 | SCM_API SCM scm_strerror (SCM err); | |
54 | SCM_API void scm_syserror (const char *subr) SCM_NORETURN; | |
55 | SCM_API void scm_syserror_msg (const char *subr, const char *message, | |
56 | SCM args, int eno) SCM_NORETURN; | |
57 | SCM_API void scm_num_overflow (const char *subr) SCM_NORETURN; | |
58 | SCM_API void scm_out_of_range (const char *subr, SCM bad_value) | |
3eeba8d4 | 59 | SCM_NORETURN; |
33b001fd | 60 | SCM_API void scm_out_of_range_pos (const char *subr, SCM bad_value, SCM pos) |
1e76143f | 61 | SCM_NORETURN; |
33b001fd MV |
62 | SCM_API void scm_wrong_num_args (SCM proc) SCM_NORETURN; |
63 | SCM_API void scm_error_num_args_subr (const char* subr) SCM_NORETURN; | |
64 | SCM_API void scm_wrong_type_arg (const char *subr, int pos, | |
65 | SCM bad_value) SCM_NORETURN; | |
0193377d MG |
66 | SCM_INTERNAL void scm_i_wrong_type_arg_symbol (SCM symbol, int pos, |
67 | SCM bad_value) SCM_NORETURN; | |
33b001fd MV |
68 | SCM_API void scm_wrong_type_arg_msg (const char *subr, int pos, |
69 | SCM bad_value, const char *sz) SCM_NORETURN; | |
70 | SCM_API void scm_memory_error (const char *subr) SCM_NORETURN; | |
71 | SCM_API void scm_misc_error (const char *subr, const char *message, | |
72 | SCM args) SCM_NORETURN; | |
102dbb6f | 73 | SCM_INTERNAL void scm_init_error (void); |
0f2d19dd | 74 | |
e81d98ec | 75 | #endif /* SCM_ERROR_H */ |
89e00824 ML |
76 | |
77 | /* | |
78 | Local Variables: | |
79 | c-file-style: "gnu" | |
80 | End: | |
81 | */ |