defsubst
[bpt/guile.git] / libguile / deprecated.c
1 /* This file contains definitions for deprecated features. When you
2 deprecate something, move it here when that is feasible.
3 */
4
5 /* Copyright (C) 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26
27 #define SCM_BUILDING_DEPRECATED_CODE
28
29 #include "libguile/_scm.h"
30 #include "libguile/deprecation.h"
31
32 #if (SCM_ENABLE_DEPRECATED == 1)
33
34 \f
35
36 SCM
37 scm_internal_dynamic_wind (scm_t_guard before,
38 scm_t_inner inner,
39 scm_t_guard after,
40 void *inner_data,
41 void *guard_data)
42 {
43 SCM ans;
44
45 scm_c_issue_deprecation_warning
46 ("`scm_internal_dynamic_wind' is deprecated. "
47 "Use the `scm_dynwind_begin' / `scm_dynwind_end' API instead.");
48
49 scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
50 scm_dynwind_rewind_handler (before, guard_data, SCM_F_WIND_EXPLICITLY);
51 scm_dynwind_unwind_handler (after, guard_data, SCM_F_WIND_EXPLICITLY);
52 ans = inner (inner_data);
53 scm_dynwind_end ();
54 return ans;
55 }
56
57 \f
58
59 SCM
60 scm_immutable_cell (scm_t_bits car, scm_t_bits cdr)
61 {
62 scm_c_issue_deprecation_warning
63 ("scm_immutable_cell is deprecated. Use scm_cell instead.");
64
65 return scm_cell (car, cdr);
66 }
67
68 SCM
69 scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
70 scm_t_bits ccr, scm_t_bits cdr)
71 {
72 scm_c_issue_deprecation_warning
73 ("scm_immutable_double_cell is deprecated. Use scm_double_cell instead.");
74
75 return scm_double_cell (car, cbr, ccr, cdr);
76 }
77
78
79 \f
80
81 SCM_GLOBAL_SYMBOL (scm_memory_alloc_key, "memory-allocation-error");
82 void
83 scm_memory_error (const char *subr)
84 {
85 scm_c_issue_deprecation_warning
86 ("scm_memory_error is deprecated. Use scm_report_out_of_memory to raise "
87 "an exception, or abort() to cause the program to exit.");
88
89 fprintf (stderr, "FATAL: memory error in %s\n", subr);
90 abort ();
91 }
92
93
94 \f
95
96 void
97 scm_i_init_deprecated ()
98 {
99 #include "libguile/deprecated.x"
100 }
101
102 #endif