80 |
M4_GLOBAL_DATA m4_string ecomm; |
M4_GLOBAL_DATA m4_string ecomm; |
81 |
|
|
82 |
|
|
83 |
/*------------------------------------------------------------------------. |
|
84 |
| Addressable function versions of the macros defined in m4private.h. | |
/* Addressable function versions of the macros defined in m4private.h. |
85 |
| Since they are functions the caller does not need access to the | |
Since they are functions the caller does not need access to the |
86 |
| internal data structure, so they are safe to export for use in | |
internal data structure, so they are safe to export for use in |
87 |
| external modules. | |
external modules. */ |
|
`------------------------------------------------------------------------*/ |
|
88 |
m4_token_data_t |
m4_token_data_t |
89 |
m4_token_data_type (m4_token_data *name) |
m4_token_data_type (m4_token_data *name) |
90 |
{ |
{ |
120 |
} |
} |
121 |
|
|
122 |
|
|
|
/*------------------------------------------------------------------------. |
|
|
| Give friendly warnings if a builtin macro is passed an inappropriate | |
|
|
| number of arguments. NAME is macro name for messages, ARGC is actual | |
|
|
| number of arguments, MIN is the minimum number of acceptable arguments, | |
|
|
| negative if not applicable, MAX is the maximum number, negative if not | |
|
|
| applicable. | |
|
|
`------------------------------------------------------------------------*/ |
|
123 |
|
|
124 |
|
/* Give friendly warnings if a builtin macro is passed an inappropriate |
125 |
|
number of arguments. NAME is macro name for messages, ARGC is actual |
126 |
|
number of arguments, MIN is the minimum number of acceptable arguments, |
127 |
|
negative if not applicable, MAX is the maximum number, negative if not |
128 |
|
applicable. */ |
129 |
boolean |
boolean |
130 |
m4_bad_argc (m4_token_data *name, int argc, int min, int max) |
m4_bad_argc (m4_token_data *name, int argc, int min, int max) |
131 |
{ |
{ |
155 |
return arg; |
return arg; |
156 |
} |
} |
157 |
|
|
158 |
/*--------------------------------------------------------------------------. |
/* The function m4_numeric_arg () converts ARG to an int pointed to by |
159 |
| The function m4_numeric_arg () converts ARG to an int pointed to by | |
VALUEP. If the conversion fails, print error message for macro MACRO. |
160 |
| VALUEP. If the conversion fails, print error message for macro MACRO. | |
Return TRUE iff conversion succeeds. */ |
|
| Return TRUE iff conversion succeeds. | |
|
|
`--------------------------------------------------------------------------*/ |
|
161 |
boolean |
boolean |
162 |
m4_numeric_arg (m4_token_data *macro, const char *arg, int *valuep) |
m4_numeric_arg (m4_token_data *macro, const char *arg, int *valuep) |
163 |
{ |
{ |
175 |
} |
} |
176 |
|
|
177 |
|
|
178 |
/*----------------------------------------------------------------------. |
/* Print ARGC arguments from the table ARGV to obstack OBS, separated by |
179 |
| Print ARGC arguments from the table ARGV to obstack OBS, separated by | |
SEP, and quoted by the current quotes, if QUOTED is TRUE. */ |
|
| SEP, and quoted by the current quotes, if QUOTED is TRUE. | |
|
|
`----------------------------------------------------------------------*/ |
|
|
|
|
180 |
void |
void |
181 |
m4_dump_args (obs, argc, argv, sep, quoted) |
m4_dump_args (obs, argc, argv, sep, quoted) |
182 |
struct obstack *obs; |
struct obstack *obs; |
197 |
} |
} |
198 |
} |
} |
199 |
|
|
200 |
/*------------------------------------------------------------------------. |
/* For "translit", ranges are allowed in the second and third argument. |
201 |
| For "translit", ranges are allowed in the second and third argument. | |
They are expanded in the following function, and the expanded strings, |
202 |
| They are expanded in the following function, and the expanded strings, | |
without any ranges left, are used to translate the characters of the |
203 |
| without any ranges left, are used to translate the characters of the | |
first argument. A single - (dash) can be included in the strings by |
204 |
| first argument. A single - (dash) can be included in the strings by | |
being the first or the last character in the string. If the first |
205 |
| being the first or the last character in the string. If the first | |
character in a range is after the first in the character set, the range |
206 |
| character in a range is after the first in the character set, the range | |
is made backwards, thus 9-0 is the string 9876543210. */ |
|
| is made backwards, thus 9-0 is the string 9876543210. | |
|
|
`------------------------------------------------------------------------*/ |
|
|
|
|
207 |
const char * |
const char * |
208 |
m4_expand_ranges (const char *s, struct obstack *obs) |
m4_expand_ranges (const char *s, struct obstack *obs) |
209 |
{ |
{ |
239 |
return obstack_finish (obs); |
return obstack_finish (obs); |
240 |
} |
} |
241 |
|
|
242 |
/*------------------------------------------------------------------------. |
/* qsort comparison routine, for sorting the table made in m4_dumpdef (). */ |
|
| qsort comparison routine, for sorting the table made in m4_dumpdef (). | |
|
|
`------------------------------------------------------------------------*/ |
|
|
|
|
243 |
static int |
static int |
244 |
dumpdef_cmp (s1, s2) |
dumpdef_cmp (s1, s2) |
245 |
const VOID *s1; |
const VOID *s1; |
249 |
SYMBOL_NAME (* (m4_symbol *const *) s2)); |
SYMBOL_NAME (* (m4_symbol *const *) s2)); |
250 |
} |
} |
251 |
|
|
252 |
/*---------------------------------------------------------------------. |
/* The function dump_symbol () is for use by "dumpdef". It builds up a |
253 |
| The function dump_symbol () is for use by "dumpdef". It builds up a | |
table of all defined, un-shadowed, symbols. */ |
|
| table of all defined, un-shadowed, symbols. | |
|
|
`---------------------------------------------------------------------*/ |
|
|
|
|
254 |
void |
void |
255 |
m4_dump_symbol (symbol, data) |
m4_dump_symbol (symbol, data) |
256 |
m4_symbol *symbol; |
m4_symbol *symbol; |
264 |
} |
} |
265 |
} |
} |
266 |
|
|
267 |
/*------------------------------------------------------------------------. |
/* If there are no arguments, build a sorted list of all defined, |
268 |
| If there are no arguments, build a sorted list of all defined, | |
un-shadowed, symbols, otherwise, only the specified symbols. */ |
|
| un-shadowed, symbols, otherwise, only the specified symbols. | |
|
|
`------------------------------------------------------------------------*/ |
|
|
|
|
269 |
void |
void |
270 |
m4_dump_symbols (data, argc, argv, complain) |
m4_dump_symbols (data, argc, argv, complain) |
271 |
struct m4_dump_symbol_data *data; |
struct m4_dump_symbol_data *data; |
299 |
obstack_finish (data->obs); |
obstack_finish (data->obs); |
300 |
qsort ((char *) data->base, data->size, sizeof (m4_symbol *), dumpdef_cmp); |
qsort ((char *) data->base, data->size, sizeof (m4_symbol *), dumpdef_cmp); |
301 |
} |
} |
|
|
|