Stage 1: convert m4_symbol_value** into new object.
[m4.git] / modules / shadow.c
blob3698b4f0c21dcbf55f34efc997746b9243909668
1 /* GNU m4 -- A simple macro processor
2 Copyright (C) 1999, 2000, 2006, 2007 Free Software Foundation, Inc.
4 This file is part of GNU M4.
6 GNU M4 is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU M4 is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <config.h>
22 /* Build using only the exported interfaces, unless NDEBUG is set, in
23 which case use private symbols to speed things up as much as possible. */
24 #ifndef NDEBUG
25 # include <m4/m4module.h>
26 #else
27 # include "m4private.h"
28 #endif
30 /* Rename exported symbols for dlpreload()ing. */
31 #define m4_builtin_table shadow_LTX_m4_builtin_table
32 #define m4_macro_table shadow_LTX_m4_macro_table
34 /* function macros blind side minargs maxargs */
35 #define builtin_functions \
36 BUILTIN (shadow, false, false, false, 0, -1 ) \
37 BUILTIN (test, false, false, false, 0, -1 ) \
40 #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN(handler)
41 builtin_functions
42 #undef BUILTIN
44 m4_builtin m4_builtin_table[] =
46 #define BUILTIN(handler, macros, blind, side, min, max) \
47 { CONC(builtin_, handler), STR(handler), \
48 ((macros ? M4_BUILTIN_GROKS_MACRO : 0) \
49 | (blind ? M4_BUILTIN_BLIND : 0) \
50 | (side ? M4_BUILTIN_SIDE_EFFECT : 0)), \
51 min, max },
53 builtin_functions
54 #undef BUILTIN
56 { NULL, NULL, 0, 0, 0 },
59 m4_macro m4_macro_table[] =
61 /* name text */
62 { "__test__", "`shadow'" },
63 { NULL, NULL },
68 M4INIT_HANDLER (shadow)
70 const char *s = "Shadow module loaded.";
71 int refcount = m4_module_refcount (module);
73 /* Only display the message on first load. */
74 if (obs && refcount == 1)
75 obstack_grow (obs, s, strlen (s));
80 /**
81 * shadow()
82 **/
83 M4BUILTIN_HANDLER (shadow)
85 const char *s = "Shadow::`shadow' called.";
86 obstack_grow (obs, s, strlen (s));
89 /**
90 * test()
91 **/
92 M4BUILTIN_HANDLER (test)
94 const char *s = "Shadow::`test' called.";
95 obstack_grow (obs, s, strlen (s));