Improve web-manual maintainer rule.
[m4.git] / modules / import.c
blob2c9551ad280cf5d837c024a9903eb409ebe83646
1 /* GNU m4 -- A simple macro processor
2 Copyright (C) 2003, 2006, 2007, 2008 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 import_LTX_m4_builtin_table
33 /* function macros blind side minargs maxargs */
34 #define builtin_functions \
35 BUILTIN (import, false, false, false, 0, 1) \
36 BUILTIN (symbol_fail, false, false, false, 0, 1) \
37 BUILTIN (module_fail, false, false, false, 0, 1) \
39 #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler)
40 builtin_functions
41 #undef BUILTIN
43 const m4_builtin m4_builtin_table[] =
45 #define BUILTIN(handler, macros, blind, side, min, max) \
46 M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
48 builtin_functions
49 #undef BUILTIN
51 { NULL, NULL, 0, 0, 0 },
56 typedef bool export_test_func (const char *);
57 typedef bool no_such_func (const char *);
59 /**
60 * import()
61 **/
62 M4BUILTIN_HANDLER (import)
64 M4_MODULE_IMPORT (modtest, export_test);
66 const char *s = "`import'::`import' called.";
68 assert (obs != 0);
69 obstack_grow (obs, s, strlen(s));
71 if (export_test && export_test (M4ARG (1)))
72 fputs ("TRUE\n", stderr);
75 /**
76 * symbol_fail()
77 **/
78 M4BUILTIN_HANDLER (symbol_fail)
80 M4_MODULE_IMPORT (modtest, no_such);
82 const char *s = "`import'::`symbol_fail' called.";
84 assert (obs != 0);
85 obstack_grow (obs, s, strlen(s));
87 if (no_such && no_such (M4ARG (1)))
88 fputs ("TRUE\n", stderr);
91 /**
92 * module_fail()
93 **/
94 M4BUILTIN_HANDLER (module_fail)
96 M4_MODULE_IMPORT (no_such, no_such);
98 const char *s = "`import'::`module_fail' called.";
100 assert (obs != 0);
101 obstack_grow (obs, s, strlen(s));
103 if (no_such && no_such (M4ARG (1)))
104 fputs ("TRUE\n", stderr);