32 |
/* Maintain each of the builtins implemented in this modules along |
/* Maintain each of the builtins implemented in this modules along |
33 |
with their details in a single table for easy maintenance. |
with their details in a single table for easy maintenance. |
34 |
|
|
35 |
function macros blind */ |
function macros blind minargs maxargs */ |
36 |
#define builtin_functions \ |
#define builtin_functions \ |
37 |
BUILTIN(modules, FALSE, FALSE ) \ |
BUILTIN(modules, FALSE, FALSE, 1, 1 ) \ |
38 |
BUILTIN(load, FALSE, TRUE ) \ |
BUILTIN(load, FALSE, TRUE, 2, 2 ) \ |
39 |
BUILTIN(unload, FALSE, TRUE ) |
BUILTIN(unload, FALSE, TRUE, 2, 2 ) \ |
40 |
|
|
41 |
|
|
42 |
/* Generate prototypes for each builtin handler function. */ |
/* Generate prototypes for each builtin handler function. */ |
43 |
#define BUILTIN(handler, macros, blind) M4BUILTIN(handler) |
#define BUILTIN(handler, macros, blind, min, max) M4BUILTIN(handler) |
44 |
builtin_functions |
builtin_functions |
45 |
#undef BUILTIN |
#undef BUILTIN |
46 |
|
|
48 |
/* Generate a table for mapping m4 symbol names to handler functions. */ |
/* Generate a table for mapping m4 symbol names to handler functions. */ |
49 |
m4_builtin m4_builtin_table[] = |
m4_builtin m4_builtin_table[] = |
50 |
{ |
{ |
51 |
#define BUILTIN(handler, macros, blind) \ |
#define BUILTIN(handler, macros, blind, min, max) \ |
52 |
{ STR(handler), CONC(builtin_, handler), macros, blind }, |
{ STR(handler), CONC(builtin_, handler), macros, blind, min, max }, |
53 |
builtin_functions |
builtin_functions |
54 |
#undef BUILTIN |
#undef BUILTIN |
55 |
|
|
56 |
{ 0, 0, FALSE, FALSE }, |
{ 0, 0, FALSE, FALSE, 0, 0 }, |
57 |
}; |
}; |
58 |
|
|
59 |
|
|
95 |
loaded modules. */ |
loaded modules. */ |
96 |
lt_dlhandle handle = lt_dlhandle_next (NULL); |
lt_dlhandle handle = lt_dlhandle_next (NULL); |
97 |
|
|
|
if (m4_bad_argc (argv[0], argc, 1, 1)) |
|
|
return; |
|
|
|
|
98 |
if (handle) |
if (handle) |
99 |
do |
do |
100 |
{ |
{ |
111 |
**/ |
**/ |
112 |
M4BUILTIN_HANDLER (load) |
M4BUILTIN_HANDLER (load) |
113 |
{ |
{ |
|
if (m4_bad_argc (argv[0], argc, 2, 2)) |
|
|
return; |
|
|
|
|
114 |
/* Load the named module and install the builtins and macros |
/* Load the named module and install the builtins and macros |
115 |
exported by that module. */ |
exported by that module. */ |
116 |
m4_module_load (M4ARG(1), obs); |
m4_module_load (M4ARG(1), obs); |
121 |
**/ |
**/ |
122 |
M4BUILTIN_HANDLER (unload) |
M4BUILTIN_HANDLER (unload) |
123 |
{ |
{ |
|
if (m4_bad_argc (argv[0], argc, 2, 2)) |
|
|
return; |
|
|
|
|
124 |
/* Remove all builtins and macros installed by the named module, |
/* Remove all builtins and macros installed by the named module, |
125 |
and then unload the module from memory entirely. */ |
and then unload the module from memory entirely. */ |
126 |
m4_module_unload (M4ARG(1), obs); |
m4_module_unload (M4ARG(1), obs); |