Merge branch 'bdw-gc-static-alloc'
[bpt/guile.git] / libguile / macros.h
1 /* classes: h_files */
2
3 #ifndef SCM_MACROS_H
4 #define SCM_MACROS_H
5
6 /* Copyright (C) 1998,2000,2001,2002,2003, 2006, 2008, 2009 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
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.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
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
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24 \f
25
26 #include "libguile/__scm.h"
27
28 \f
29
30 #define SCM_ASSYNT(_cond, _msg, _subr) \
31 if (!(_cond)) scm_misc_error (_subr, _msg, SCM_EOL);
32
33 #define SCM_MACRO_TYPE_BITS (3)
34 #define SCM_MACRO_TYPE_MASK ((1<<SCM_MACRO_TYPE_BITS)-1)
35 #define SCM_F_MACRO_EXTENDED (1<<SCM_MACRO_TYPE_BITS)
36
37 #define SCM_MACROP(x) SCM_SMOB_PREDICATE (scm_tc16_macro, (x))
38 #define SCM_MACRO_TYPE(m) (SCM_SMOB_FLAGS (m) & SCM_MACRO_TYPE_MASK)
39 #define SCM_MACRO_IS_EXTENDED(m) (SCM_SMOB_FLAGS (m) & SCM_F_MACRO_EXTENDED)
40 #define SCM_BUILTIN_MACRO_P(x) (SCM_MACROP (x) && SCM_MACRO_TYPE (x) == 3)
41 #define SCM_SYNCASE_MACRO_P(x) (SCM_MACROP (x) && SCM_MACRO_TYPE (x) == 4)
42 #define SCM_MACRO_CODE(m) SCM_SMOB_OBJECT (m)
43
44 SCM_API scm_t_bits scm_tc16_macro;
45
46 SCM_INTERNAL SCM scm_i_makbimacro (SCM code);
47 SCM_API SCM scm_makmmacro (SCM code);
48 SCM_API SCM scm_makacro (SCM code);
49 SCM_API SCM scm_make_syncase_macro (SCM type, SCM binding);
50 SCM_API SCM scm_make_extended_syncase_macro (SCM builtin, SCM type,
51 SCM binding);
52 SCM_API SCM scm_macro_p (SCM obj);
53 SCM_API SCM scm_macro_type (SCM m);
54 SCM_API SCM scm_macro_name (SCM m);
55 SCM_API SCM scm_macro_transformer (SCM m);
56 SCM_API SCM scm_syncase_macro_type (SCM m);
57 SCM_API SCM scm_syncase_macro_binding (SCM m);
58 SCM_API SCM scm_make_synt (const char *name,
59 SCM (*macroizer) (SCM),
60 SCM (*fcn) ());
61 SCM_INTERNAL void scm_init_macros (void);
62
63 #if SCM_ENABLE_DEPRECATED == 1
64 SCM_DEPRECATED SCM scm_makmacro (SCM code);
65 #endif
66
67 #endif /* SCM_MACROS_H */
68
69 /*
70 Local Variables:
71 c-file-style: "gnu"
72 End:
73 */