5e3d64a55562fa023e1e23d7c438678eec807057
[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 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
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but 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 02110-1301 USA
21 */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 \f
28
29 #define SCM_ASSYNT(_cond, _msg, _subr) \
30 if (!(_cond)) scm_misc_error (_subr, _msg, SCM_EOL);
31
32 #define SCM_MACRO_TYPE_BITS (3)
33 #define SCM_MACRO_TYPE_MASK ((1<<SCM_MACRO_TYPE_BITS)-1)
34 #define SCM_F_MACRO_EXTENDED (1<<SCM_MACRO_TYPE_BITS)
35
36 #define SCM_MACROP(x) SCM_SMOB_PREDICATE (scm_tc16_macro, (x))
37 #define SCM_MACRO_TYPE(m) (SCM_SMOB_FLAGS (m) & SCM_MACRO_TYPE_MASK)
38 #define SCM_MACRO_IS_EXTENDED(m) (SCM_SMOB_FLAGS (m) & SCM_F_MACRO_EXTENDED)
39 #define SCM_BUILTIN_MACRO_P(x) (SCM_MACROP (x) && SCM_MACRO_TYPE (x) == 3)
40 #define SCM_SYNCASE_MACRO_P(x) (SCM_MACROP (x) && SCM_MACRO_TYPE (x) == 4)
41 #define SCM_MACRO_CODE(m) SCM_SMOB_OBJECT (m)
42
43 SCM_API scm_t_bits scm_tc16_macro;
44
45 SCM_INTERNAL SCM scm_i_makbimacro (SCM code);
46 SCM_API SCM scm_makmmacro (SCM code);
47 SCM_API SCM scm_makacro (SCM code);
48 SCM_API SCM scm_make_syncase_macro (SCM type, SCM binding);
49 SCM_API SCM scm_make_extended_syncase_macro (SCM builtin, SCM type,
50 SCM binding);
51 SCM_API SCM scm_macro_p (SCM obj);
52 SCM_API SCM scm_macro_type (SCM m);
53 SCM_API SCM scm_macro_name (SCM m);
54 SCM_API SCM scm_macro_transformer (SCM m);
55 SCM_API SCM scm_syncase_macro_type (SCM m);
56 SCM_API SCM scm_syncase_macro_binding (SCM m);
57 SCM_API SCM scm_make_synt (const char *name,
58 SCM (*macroizer) (SCM),
59 SCM (*fcn) ());
60 SCM_INTERNAL void scm_init_macros (void);
61
62 #if SCM_ENABLE_DEPRECATED == 1
63 SCM_API SCM scm_makmacro (SCM code);
64 #endif
65
66 #endif /* SCM_MACROS_H */
67
68 /*
69 Local Variables:
70 c-file-style: "gnu"
71 End:
72 */