92 |
#endif |
#endif |
93 |
|
|
94 |
|
|
95 |
static void include (int argc, m4_symbol **argv, boolean silent); |
static void include (int argc, m4_token_data **argv, |
96 |
|
boolean silent); |
97 |
static int set_trace (const char *name, m4_symbol *symbol, |
static int set_trace (const char *name, m4_symbol *symbol, |
98 |
void *data); |
void *data); |
99 |
static const char *ntoa (number value, int radix); |
static const char *ntoa (number value, int radix); |
151 |
if (m4_bad_argc (argv[0], argc, 2, 3)) |
if (m4_bad_argc (argv[0], argc, 2, 3)) |
152 |
return; |
return; |
153 |
|
|
154 |
if (M4_SYMBOL_TYPE (argv[1]) != M4_TOKEN_TEXT) |
if (M4_TOKEN_DATA_TYPE (argv[1]) != M4_TOKEN_TEXT) |
155 |
return; |
return; |
156 |
|
|
157 |
if (argc == 2) |
if (argc == 2) |
160 |
return; |
return; |
161 |
} |
} |
162 |
|
|
163 |
switch (M4_SYMBOL_TYPE (argv[2])) |
switch (M4_TOKEN_DATA_TYPE (argv[2])) |
164 |
{ |
{ |
165 |
case M4_TOKEN_TEXT: |
case M4_TOKEN_TEXT: |
166 |
m4_macro_define (M4ARG (1), NULL, M4ARG (2)); |
m4_macro_define (M4ARG (1), NULL, M4ARG (2)); |
168 |
|
|
169 |
case M4_TOKEN_FUNC: |
case M4_TOKEN_FUNC: |
170 |
{ |
{ |
171 |
lt_dlhandle handle = M4_SYMBOL_HANDLE (argv[2]); |
lt_dlhandle handle = M4_TOKEN_DATA_HANDLE (argv[2]); |
172 |
const m4_builtin * builtin = 0; |
const m4_builtin *builtin = 0; |
173 |
m4_symbol * symbol = 0; |
m4_symbol *symbol = 0; |
174 |
|
|
175 |
/* If we find a TOKEN_FUNC with no defining module, then |
/* If we find a TOKEN_FUNC with no defining module, then |
176 |
somewhere along the way we have lost the module handle. */ |
somewhere along the way we have lost the module handle. */ |
180 |
and blind_no_args flags? May as well carry these around with |
and blind_no_args flags? May as well carry these around with |
181 |
the traced flag, and save a _lot_ of lookup time. */ |
the traced flag, and save a _lot_ of lookup time. */ |
182 |
builtin = m4_builtin_find_by_func (m4_module_builtins (handle), |
builtin = m4_builtin_find_by_func (m4_module_builtins (handle), |
183 |
M4_SYMBOL_FUNC (argv[2])); |
M4_TOKEN_DATA_FUNC (argv[2])); |
184 |
|
|
185 |
symbol = m4_builtin_define (M4ARG (1), handle, builtin); |
symbol = m4_builtin_define (M4ARG (1), handle, builtin); |
186 |
|
|
187 |
/* Be sure to propogate the flags from the TOKEN_FUNC. */ |
/* Be sure to propogate the flags from the TOKEN_FUNC. */ |
188 |
M4_SYMBOL_TRACED (symbol) = M4_SYMBOL_TRACED (argv[2]); |
M4_SYMBOL_TRACED (symbol) = M4_TOKEN_TRACED (argv[2]); |
189 |
} |
} |
190 |
return; |
return; |
191 |
} |
} |
211 |
if (m4_bad_argc (argv[0], argc, 2, 3)) |
if (m4_bad_argc (argv[0], argc, 2, 3)) |
212 |
return; |
return; |
213 |
|
|
214 |
if (M4_SYMBOL_TYPE (argv[1]) != M4_TOKEN_TEXT) |
if (M4_TOKEN_DATA_TYPE (argv[1]) != M4_TOKEN_TEXT) |
215 |
return; |
return; |
216 |
|
|
217 |
if (argc == 2) |
if (argc == 2) |
220 |
return; |
return; |
221 |
} |
} |
222 |
|
|
223 |
switch (M4_SYMBOL_TYPE (argv[2])) |
switch (M4_TOKEN_DATA_TYPE (argv[2])) |
224 |
{ |
{ |
225 |
case M4_TOKEN_TEXT: |
case M4_TOKEN_TEXT: |
226 |
m4_macro_pushdef (M4ARG (1), NULL, M4ARG (2)); |
m4_macro_pushdef (M4ARG (1), NULL, M4ARG (2)); |
228 |
|
|
229 |
case M4_TOKEN_FUNC: |
case M4_TOKEN_FUNC: |
230 |
{ |
{ |
231 |
lt_dlhandle handle = M4_SYMBOL_HANDLE (argv[2]); |
lt_dlhandle handle = M4_TOKEN_DATA_HANDLE (argv[2]); |
232 |
const m4_builtin * builtin = 0; |
const m4_builtin *builtin = 0; |
233 |
|
|
234 |
/* If we find a TOKEN_FUNC with no defining module, then |
/* If we find a TOKEN_FUNC with no defining module, then |
235 |
somewhere along the way we have lost the module handle. */ |
somewhere along the way we have lost the module handle. */ |
236 |
assert (handle); |
assert (handle); |
237 |
|
|
238 |
builtin = m4_builtin_find_by_func (m4_module_builtins (handle), |
builtin = m4_builtin_find_by_func (m4_module_builtins (handle), |
239 |
M4_SYMBOL_FUNC (argv[2])); |
M4_TOKEN_DATA_FUNC (argv[2])); |
240 |
|
|
241 |
m4_builtin_pushdef (M4ARG (1), handle, builtin); |
m4_builtin_pushdef (M4ARG (1), handle, builtin); |
242 |
} |
} |
536 |
if (m4_bad_argc (argv[0], argc, 1, 3)) |
if (m4_bad_argc (argv[0], argc, 1, 3)) |
537 |
return; |
return; |
538 |
|
|
539 |
m4_set_quotes ((argc >= 2) ? M4_SYMBOL_TEXT (argv[1]) : NULL, |
m4_set_quotes ((argc >= 2) ? M4_TOKEN_DATA_TEXT (argv[1]) : NULL, |
540 |
(argc >= 3) ? M4_SYMBOL_TEXT (argv[2]) : NULL); |
(argc >= 3) ? M4_TOKEN_DATA_TEXT (argv[2]) : NULL); |
541 |
} |
} |
542 |
|
|
543 |
/* Change the current comment delimiters. The function set_comment () |
/* Change the current comment delimiters. The function set_comment () |
550 |
if (argc == 1) |
if (argc == 1) |
551 |
m4_set_comment ("", ""); /* disable comments */ |
m4_set_comment ("", ""); /* disable comments */ |
552 |
else |
else |
553 |
m4_set_comment (M4_SYMBOL_TEXT (argv[1]), |
m4_set_comment (M4_TOKEN_DATA_TEXT (argv[1]), |
554 |
(argc >= 3) ? M4_SYMBOL_TEXT (argv[2]) : NULL); |
(argc >= 3) ? M4_TOKEN_DATA_TEXT (argv[2]) : NULL); |
555 |
} |
} |
556 |
|
|
557 |
|
|
562 |
/* Generic include function. Include the file given by the first argument, |
/* Generic include function. Include the file given by the first argument, |
563 |
if it exists. Complain about inaccesible files iff SILENT is FALSE. */ |
if it exists. Complain about inaccesible files iff SILENT is FALSE. */ |
564 |
static void |
static void |
565 |
include (int argc, m4_symbol **argv, boolean silent) |
include (int argc, m4_token_data **argv, boolean silent) |
566 |
{ |
{ |
567 |
FILE *fp; |
FILE *fp; |
568 |
char *name = NULL; |
char *name = NULL; |