[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: 30-gary-refactor-macro-api.patch
From: |
Gary V. Vaughan |
Subject: |
FYI: 30-gary-refactor-macro-api.patch |
Date: |
Wed, 23 Jul 2003 17:23:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030718 |
Applied to HEAD.
--
())_. Gary V. Vaughan gary@(oranda.demon.co.uk|gnu.org)
( '/ Research Scientist http://www.oranda.demon.co.uk ,_())____
/ )= GNU Hacker http://www.gnu.org/software/libtool \' `&
`(_~)_ Tech' Author http://sources.redhat.com/autobook =`---d__/
Index: ChangeLog
from Gary V. Vaughan <address@hidden>
* m4/m4module.h: Reformatting and rearranging lines a bit.
(m4_obstack): Save typing by typedefing `struct obstack'. Changed
all users.
(m4_call_macro, m4_expand_input): Renamed...
(m4_macro_call, m4_macro_expand_input): ...to these. Changed all
callers.
(m4_expansion_level, m4_process_macro): Moved...
* m4/macro.c (expansion_level, process_macro): ...to here, and
made static.
Index: m4/input.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/input.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 input.c
--- m4/input.c 23 Jul 2003 11:51:26 -0000 1.33
+++ m4/input.c 23 Jul 2003 16:20:10 -0000
@@ -144,16 +144,16 @@ const char *m4_current_file;
int m4_current_line;
/* Obstack for storing individual tokens. */
-static struct obstack token_stack;
+static m4_obstack token_stack;
/* Normal input stack. */
-static struct obstack input_stack;
+static m4_obstack input_stack;
/* Wrapup input stack. */
-static struct obstack wrapup_stack;
+static m4_obstack wrapup_stack;
/* Input or wrapup. */
-static struct obstack *current_input;
+static m4_obstack *current_input;
/* Bottom of token_stack, for obstack_free. */
static char *token_bottom;
@@ -408,7 +408,7 @@ static struct input_funcs string_funcs =
string_peek, string_read, string_unget, NULL
};
-struct obstack *
+m4_obstack *
m4_push_string_init (m4 *context)
{
if (next != NULL)
@@ -640,7 +640,7 @@ match_input (m4 *context, const unsigned
int n; /* number of characters matched */
int ch; /* input character */
const unsigned char *t;
- struct obstack *st;
+ m4_obstack *st;
ch = m4_peek_input (context);
if (ch != *s)
Index: m4/m4module.h
===================================================================
RCS file: /cvsroot/m4/m4/m4/m4module.h,v
retrieving revision 1.57
diff -u -p -u -r1.57 m4module.h
--- m4/m4module.h 23 Jul 2003 14:03:16 -0000 1.57
+++ m4/m4module.h 23 Jul 2003 16:20:10 -0000
@@ -34,13 +34,9 @@ BEGIN_C_DECLS
/* Various declarations. */
typedef struct m4 m4;
+typedef struct obstack m4_obstack;
typedef struct m4_symbol_value m4_symbol_value;
-typedef void m4_builtin_func (m4 *, struct obstack *, int, m4_symbol_value **);
-
-typedef struct {
- const char *name;
- const char *value;
-} m4_macro;
+typedef void m4_builtin_func (m4 *, m4_obstack *, int, m4_symbol_value **);
typedef struct {
const char * name;
@@ -49,29 +45,49 @@ typedef struct {
int min_args, max_args;
} m4_builtin;
+typedef struct {
+ const char *name;
+ const char *value;
+} m4_macro;
+
+typedef struct {
+ unsigned char *string; /* characters of the string */
+ size_t length; /* length of the string */
+} m4_string;
+
#define M4BUILTIN(name) \
static void CONC(builtin_, name) \
- (m4 *context, struct obstack *obs, int argc, m4_symbol_value **argv);
+ (m4 *context, m4_obstack *obs, int argc, m4_symbol_value **argv);
#define M4BUILTIN_HANDLER(name) \
static void CONC(builtin_, name) \
- (m4 *context, struct obstack *obs, int argc, m4_symbol_value **argv)
+ (m4 *context, m4_obstack *obs, int argc, m4_symbol_value **argv)
#define M4INIT_HANDLER(name) \
void CONC(name, CONC(_LTX_, m4_init_module)) \
- (m4 *context, lt_dlhandle handle, struct obstack *obs); \
+ (m4 *context, lt_dlhandle handle, m4_obstack *obs); \
void CONC(name, CONC(_LTX_, m4_init_module)) \
- (m4 *context, lt_dlhandle handle, struct obstack *obs)
+ (m4 *context, lt_dlhandle handle, m4_obstack *obs)
#define M4FINISH_HANDLER(name) \
void CONC(name, CONC(_LTX_, m4_finish_module)) \
- (m4 *context, lt_dlhandle handle, struct obstack *obs); \
+ (m4 *context, lt_dlhandle handle, m4_obstack *obs); \
void CONC(name, CONC(_LTX_, m4_finish_module)) \
- (m4 *context, lt_dlhandle handle, struct obstack *obs)
+ (m4 *context, lt_dlhandle handle, m4_obstack *obs)
#define M4ARG(i) (argc > (i) ? m4_get_symbol_value_text (argv[i]) : "")
+extern boolean m4_bad_argc (m4 *, int, m4_symbol_value **,
+ int, int);
+extern const char * m4_skip_space (m4 *, const char *);
+extern boolean m4_numeric_arg (m4 *, int, m4_symbol_value **,
+ int, int *);
+extern void m4_dump_args (m4 *, m4_obstack *, int,
+ m4_symbol_value **, const char *,
+ boolean);
+extern const char * m4_expand_ranges (const char *, m4_obstack *);
+
/* Error handling. */
#define M4ERROR(Arglist) (error Arglist)
#define M4WARN(Arglist) M4_STMT_START { \
@@ -93,7 +109,7 @@ extern void m4_delete (m4 *);
M4FIELD(m4_symbol_table *, symbol_table, symtab) \
M4FIELD(m4_syntax_table *, syntax_table, syntax) \
M4FIELD(FILE *, debug_file, debug_file) \
- M4FIELD(struct obstack, trace_messages, trace_messages) \
+ M4FIELD(m4_obstack, trace_messages, trace_messages) \
M4FIELD(int, warning_status_opt, warning_status) \
M4FIELD(boolean, no_gnu_extensions_opt, no_gnu_extensions) \
M4FIELD(int, nesting_limit_opt, nesting_limit) \
@@ -129,11 +145,11 @@ m4_context_opt_bit_table
/* --- MODULE MANAGEMENT --- */
-typedef void m4_module_init_func (m4 *, lt_dlhandle, struct obstack*);
-typedef void m4_module_finish_func (m4 *, lt_dlhandle, struct obstack*);
+typedef void m4_module_init_func (m4 *, lt_dlhandle, m4_obstack*);
+typedef void m4_module_finish_func (m4 *, lt_dlhandle, m4_obstack*);
-extern lt_dlhandle m4_module_load (m4 *, const char*, struct obstack*);
-extern void m4_module_unload (m4 *, const char*, struct obstack*);
+extern lt_dlhandle m4_module_load (m4 *, const char*, m4_obstack*);
+extern void m4_module_unload (m4 *, const char*, m4_obstack*);
extern const char *m4_get_module_name (lt_dlhandle);
extern m4_builtin *m4_get_module_builtin_table (lt_dlhandle);
@@ -149,11 +165,14 @@ typedef void *m4_symtab_apply_func (m4_s
extern m4_symbol_table *m4_symtab_create (size_t, boolean *);
extern void m4_symtab_delete (m4_symbol_table*);
-extern void * m4_symtab_apply (m4_symbol_table*, m4_symtab_apply_func*,
void*);
+extern void * m4_symtab_apply (m4_symbol_table*, m4_symtab_apply_func*,
+ void*);
extern m4_symbol *m4_symbol_lookup (m4_symbol_table*, const char *);
-extern m4_symbol *m4_symbol_pushdef (m4_symbol_table*, const char *,
m4_symbol_value *);
-extern m4_symbol *m4_symbol_define (m4_symbol_table*, const char *,
m4_symbol_value *);
+extern m4_symbol *m4_symbol_pushdef (m4_symbol_table*,
+ const char *, m4_symbol_value *);
+extern m4_symbol *m4_symbol_define (m4_symbol_table*,
+ const char *, m4_symbol_value *);
extern void m4_symbol_popdef (m4_symbol_table*, const char *);
extern void m4_symbol_delete (m4_symbol_table*, const char *);
@@ -164,7 +183,8 @@ extern void m4_symbol_delete (m4_
extern m4_symbol_value *m4_get_symbol_value (m4_symbol*);
extern boolean m4_get_symbol_traced (m4_symbol*);
extern boolean m4_set_symbol_traced (m4_symbol*, boolean);
-extern boolean m4_set_symbol_name_traced (m4_symbol_table*, const char
*);
+extern boolean m4_set_symbol_name_traced (m4_symbol_table*,
+ const char *);
#define m4_is_symbol_text(symbol) \
(m4_is_symbol_value_text (m4_get_symbol_value (symbol)))
@@ -189,25 +209,20 @@ extern void m4_set_symbol_value_func (
-/* --- MACRO (and builtin) MANAGEMENT --- */
+/* --- BUILTIN MANAGEMENT --- */
extern const m4_builtin *m4_builtin_find_by_name (
const m4_builtin *, const char *);
extern const m4_builtin *m4_builtin_find_by_func (
const m4_builtin *, m4_builtin_func *);
-/* left and right quote, begin and end comment */
-typedef struct {
- unsigned char *string; /* characters of the string */
- size_t length; /* length of the string */
-} m4_string;
-extern boolean m4_bad_argc (m4 *, int, m4_symbol_value **, int, int);
-extern const char *m4_skip_space (m4 *, const char *);
-extern boolean m4_numeric_arg (m4 *, int, m4_symbol_value **, int, int *);
-extern void m4_shipout_int (struct obstack *, int);
-extern void m4_shipout_string (m4 *, struct obstack*, const char*, int,
boolean);
-extern void m4_dump_args (m4 *, struct obstack *obs, int argc, m4_symbol_value
**argv, const char *sep, boolean quoted);
+
+/* --- MACRO MANAGEMENT --- */
+
+extern void m4_macro_expand_input (m4 *);
+extern void m4_macro_call (m4 *, m4_symbol *, m4_obstack *,
+ int, m4_symbol_value **);
@@ -244,6 +259,13 @@ enum {
#define M4_DEBUG_TRACE_DEFAULT \
(M4_DEBUG_TRACE_ARGS|M4_DEBUG_TRACE_EXPANSION|M4_DEBUG_TRACE_QUOTE)
+#define m4_is_debug_bit(C,B) (BIT_TEST (m4_get_debug_level_opt (C), (B)))
+
+extern int m4_debug_decode (m4 *, const char *);
+extern void m4_debug_flush_files (m4 *);
+extern boolean m4_debug_set_output (m4 *, const char *);
+extern void m4_debug_message_prefix (m4 *);
+
#define M4_DEBUG_PRINT1(C, Fmt, Arg1) M4_STMT_START { \
if (m4_get_debug_file (C) != NULL) \
fprintf (m4_get_debug_file (C), Fmt, Arg1); } M4_STMT_END
@@ -280,26 +302,9 @@ enum {
putc ('\n', m4_get_debug_file (C)); \
} } M4_STMT_END
-#define m4_is_debug_bit(C,B) (BIT_TEST (m4_get_debug_level_opt (C), (B)))
-
-extern int m4_debug_decode (m4 *context, const char *);
-extern void m4_debug_flush_files (m4 *context);
-extern boolean m4_debug_set_output (m4 *context, const char *);
-extern void m4_debug_message_prefix (m4 *context);
-
/* Exit code from last "syscmd" command. */
extern int m4_sysval;
-extern int m4_expansion_level;
-
-extern const char *m4_expand_ranges (const char *s, struct obstack *obs);
-extern void m4_expand_input (m4 *context);
-extern void m4_call_macro (m4 *context, m4_symbol *symbol,
- struct obstack *obs, int argc,
- m4_symbol_value **argv);
-extern void m4_process_macro (m4 *context, m4_symbol *symbol,
- struct obstack *obs, int argc,
- m4_symbol_value **argv);
@@ -351,9 +356,13 @@ enum {
#define m4_has_syntax(S,C,T) ((m4_syntab((S),(C)) & (T)) > 0)
#define m4_is_syntax(S,C,T) ((m4_syntab((S),(C)) & M4_SYNTAX_VALUE) == (T))
+extern void m4_set_quotes (m4_syntax_table*, const char*, const char*);
+extern void m4_set_comment (m4_syntax_table*, const char*, const char*);
+extern int m4_set_syntax (m4_syntax_table*, char, const unsigned char*);
+
-/* --- TOKENISATION AND INPUT --- */
+/* --- INPUT TOKENISATION --- */
/* current input file, and line */
extern const char *m4_current_file;
@@ -369,31 +378,35 @@ extern void m4_skip_line (m4 *context);
extern void m4_push_file (m4 *context, FILE *, const char *);
extern void m4_push_single (int ch);
extern void m4_push_builtin (m4_symbol_value *);
-extern struct obstack *m4_push_string_init (m4 *context);
+extern m4_obstack *m4_push_string_init (m4 *context);
extern const char *m4_push_string_finish (void);
extern void m4_push_wrapup (const char *);
extern boolean m4_pop_wrapup (void);
-extern void m4_set_quotes (m4_syntax_table *, const char *, const char *);
-extern void m4_set_comment (m4_syntax_table *, const char *, const char *);
-extern int m4_set_syntax (m4_syntax_table *, char, const unsigned char
*);
+
+
+/* --- OUTPUT MANAGEMENT --- */
extern int m4_current_diversion;
extern int m4_output_current_line;
-extern void m4_output_init (void);
-extern void m4_output_exit (void);
-extern void m4_shipout_text (m4 *, struct obstack *, const char *, int);
-extern void m4_make_diversion (int);
-extern void m4_insert_diversion (int);
-extern void m4_insert_file (FILE *);
-extern void m4_freeze_diversions (FILE *);
-extern void m4_undivert_all (void);
-
-extern void m4_include_init (void);
-extern void m4_include_env_init (m4 *context);
-extern void m4_add_include_directory (m4 *context, const char *);
-extern FILE *m4_path_search (m4 *context, const char *, char **);
+extern void m4_output_init (void);
+extern void m4_output_exit (void);
+extern void m4_shipout_text (m4 *, m4_obstack *, const char *, int);
+extern void m4_shipout_int (m4_obstack *, int);
+extern void m4_shipout_string (m4 *, m4_obstack *, const char *,
+ int, boolean);
+
+extern void m4_make_diversion (int);
+extern void m4_insert_diversion (int);
+extern void m4_insert_file (FILE *);
+extern void m4_freeze_diversions (FILE *);
+extern void m4_undivert_all (void);
+
+extern void m4_include_init (void);
+extern void m4_include_env_init (m4 *);
+extern void m4_add_include_directory (m4 *, const char *);
+extern FILE * m4_path_search (m4 *, const char *, char **);
/* These are for other search paths */
@@ -423,7 +436,7 @@ extern void m4_search_path_add (struct m
struct m4_dump_symbol_data
{
- struct obstack *obs; /* obstack for table */
+ m4_obstack *obs; /* obstack for table */
const char **base; /* base of table */
int size; /* size of table */
};
Index: m4/m4private.h
===================================================================
RCS file: /cvsroot/m4/m4/m4/m4private.h,v
retrieving revision 1.29
diff -u -p -u -r1.29 m4private.h
--- m4/m4private.h 23 Jul 2003 11:51:26 -0000 1.29
+++ m4/m4private.h 23 Jul 2003 16:20:10 -0000
@@ -46,7 +46,7 @@ struct m4 {
m4_syntax_table *syntax;
FILE * debug_file; /* File for debugging output. */
- struct obstack trace_messages;
+ m4_obstack trace_messages;
/* Option flags (set in src/main.c). */
int warning_status; /* -E */
@@ -101,7 +101,7 @@ struct m4 {
extern void m4__module_init (m4 *context);
extern lt_dlhandle m4__module_open (m4 *context, const char *name,
- struct obstack *obs);
+ m4_obstack *obs);
extern void m4__module_exit (m4 *context);
Index: m4/macro.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/macro.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 macro.c
--- m4/macro.c 23 Jul 2003 11:51:26 -0000 1.35
+++ m4/macro.c 23 Jul 2003 16:20:10 -0000
@@ -27,41 +27,45 @@
#include "m4private.h"
static void collect_arguments (m4 *context, const char *name,
- m4_symbol *symbol, struct obstack *argptr,
- struct obstack *arguments);
+ m4_symbol *symbol, m4_obstack *argptr,
+ m4_obstack *arguments);
static void expand_macro (m4 *context, const char *name,
m4_symbol *symbol);
-static void expand_token (m4 *context, struct obstack *obs,
+static void expand_token (m4 *context, m4_obstack *obs,
m4__token_type type, m4_symbol_value *token);
-static boolean expand_argument (m4 *context, struct obstack *obs,
+static boolean expand_argument (m4 *context, m4_obstack *obs,
m4_symbol_value *argp);
+static void process_macro (m4 *context, m4_symbol *symbol,
+ m4_obstack *expansion, int argc,
+ m4_symbol_value **argv);
+
static void trace_prepre (m4 *context, const char *, int);
static void trace_pre (m4 *context, const char *, int, int,
m4_symbol_value **);
static void trace_post (m4 *context, const char *, int, int,
m4_symbol_value **, const char *);
-static void trace_format (m4 *, const char *, ...)
+static void trace_format (m4 *context, const char *fmt, ...)
M4_GNUC_PRINTF(2, 3);
static void trace_header (m4 *, int);
static void trace_flush (m4 *);
/* Current recursion level in expand_macro (). */
-int m4_expansion_level = 0;
+static int expansion_level = 0;
/* The number of the current call of expand_macro (). */
static int macro_call_id = 0;
/* This function reads all input, and expands each token, one at a time. */
void
-m4_expand_input (m4 *context)
+m4_macro_expand_input (m4 *context)
{
m4__token_type type;
m4_symbol_value token;
while ((type = m4__next_token (context, &token)) != M4_TOKEN_EOF)
- expand_token (context, (struct obstack *) NULL, type, &token);
+ expand_token (context, (m4_obstack *) NULL, type, &token);
}
@@ -70,7 +74,7 @@ m4_expand_input (m4 *context)
macro definition. If they have, they are expanded as macros, otherwise
the text are just copied to the output. */
static void
-expand_token (m4 *context, struct obstack *obs,
+expand_token (m4 *context, m4_obstack *obs,
m4__token_type type, m4_symbol_value *token)
{
m4_symbol *symbol;
@@ -129,7 +133,7 @@ expand_token (m4 *context, struct obstac
the last for the active macro call. The arguments are built on the
obstack OBS, indirectly through expand_token (). */
static boolean
-expand_argument (m4 *context, struct obstack *obs, m4_symbol_value *argp)
+expand_argument (m4 *context, m4_obstack *obs, m4_symbol_value *argp)
{
m4__token_type type;
m4_symbol_value token;
@@ -213,17 +217,17 @@ expand_argument (m4 *context, struct obs
static void
expand_macro (m4 *context, const char *name, m4_symbol *symbol)
{
- struct obstack arguments;
- struct obstack argptr;
+ m4_obstack arguments;
+ m4_obstack argptr;
m4_symbol_value **argv;
int argc;
- struct obstack *expansion;
+ m4_obstack *expansion;
const char *expanded;
boolean traced;
int my_call_id;
- m4_expansion_level++;
- if (m4_expansion_level > m4_get_nesting_limit_opt (context))
+ expansion_level++;
+ if (expansion_level > m4_get_nesting_limit_opt (context))
M4ERROR ((EXIT_FAILURE, 0, _("\
ERROR: Recursion limit of %d exceeded, use -L<N> to change it"),
m4_get_nesting_limit_opt (context)));
@@ -251,13 +255,13 @@ ERROR: Recursion limit of %d exceeded, u
expansion = m4_push_string_init (context);
if (!m4_bad_argc (context, argc, argv,
SYMBOL_MIN_ARGS (symbol), SYMBOL_MAX_ARGS (symbol)))
- m4_call_macro (context, symbol, expansion, argc, argv);
+ m4_macro_call (context, symbol, expansion, argc, argv);
expanded = m4_push_string_finish ();
if (traced)
trace_post (context, name, my_call_id, argc, argv, expanded);
- --m4_expansion_level;
+ --expansion_level;
obstack_free (&arguments, NULL);
obstack_free (&argptr, NULL);
@@ -268,7 +272,7 @@ ERROR: Recursion limit of %d exceeded, u
to the arguments on the obstack ARGPTR. */
static void
collect_arguments (m4 *context, const char *name, m4_symbol *symbol,
- struct obstack *argptr, struct obstack *arguments)
+ m4_obstack *argptr, m4_obstack *arguments)
{
int ch; /* lookahead for ( */
m4_symbol_value token;
@@ -304,19 +308,19 @@ collect_arguments (m4 *context, const ch
}
-/* The actual call of a macro is handled by m4_call_macro ().
- m4_call_macro () is passed a SYMBOL, whose type is used to
+/* The actual call of a macro is handled by m4_macro_call ().
+ m4_macro_call () is passed a SYMBOL, whose type is used to
call either a builtin function, or the user macro expansion
- function m4_process_macro (). There are ARGC arguments to
+ function process_macro (). There are ARGC arguments to
the call, stored in the ARGV table. The expansion is left on
the obstack EXPANSION. Macro tracing is also handled here. */
void
-m4_call_macro (m4 *context, m4_symbol *symbol, struct obstack *expansion,
+m4_macro_call (m4 *context, m4_symbol *symbol, m4_obstack *expansion,
int argc, m4_symbol_value **argv)
{
if (m4_is_symbol_text (symbol))
{
- m4_process_macro (context, symbol, expansion, argc, argv);
+ process_macro (context, symbol, expansion, argc, argv);
}
else if (m4_is_symbol_func (symbol))
{
@@ -335,9 +339,9 @@ m4_call_macro (m4 *context, m4_symbol *s
will be placed, as an unfinished object. SYMBOL points to the macro
definition, giving the expansion text. ARGC and ARGV are the arguments,
as usual. */
-void
-m4_process_macro (m4 *context, m4_symbol *symbol, struct obstack *obs,
- int argc, m4_symbol_value **argv)
+static void
+process_macro (m4 *context, m4_symbol *symbol, m4_obstack *obs,
+ int argc, m4_symbol_value **argv)
{
const unsigned char *text;
int i;
@@ -522,7 +526,7 @@ trace_header (m4 *context, int id)
trace_format (context, "%s:", m4_current_file);
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_LINE))
trace_format (context, "%d:", m4_current_line);
- trace_format (context, " -%d- ", m4_expansion_level);
+ trace_format (context, " -%d- ", expansion_level);
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_CALLID))
trace_format (context, "id %d: ", id);
}
Index: m4/module.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/module.c,v
retrieving revision 1.25
diff -u -p -u -r1.25 module.c
--- m4/module.c 26 Jun 2003 14:40:37 -0000 1.25
+++ m4/module.c 23 Jul 2003 16:20:10 -0000
@@ -86,9 +86,9 @@ typedef struct {
static const char* module_dlerror (void);
static int module_remove (m4 *context, lt_dlhandle handle,
- struct obstack *obs);
+ m4_obstack *obs);
static void module_close (m4 *context, lt_dlhandle handle,
- struct obstack *obs);
+ m4_obstack *obs);
static void set_module_macro_table (m4*, lt_dlhandle, const m4_macro*);
static void set_module_builtin_table (m4*, lt_dlhandle, const m4_builtin*);
@@ -197,7 +197,7 @@ set_module_macro_table (m4 *context, lt_
}
lt_dlhandle
-m4_module_load (m4 *context, const char *name, struct obstack *obs)
+m4_module_load (m4 *context, const char *name, m4_obstack *obs)
{
const lt_dlhandle handle = m4__module_open (context, name, obs);
@@ -249,7 +249,7 @@ m4_module_load (m4 *context, const char
/* Unload a module. */
void
-m4_module_unload (m4 *context, const char *name, struct obstack *obs)
+m4_module_unload (m4 *context, const char *name, m4_obstack *obs)
{
lt_dlhandle handle = 0;
int errors = 0;
@@ -355,7 +355,7 @@ m4__module_init (m4 *context)
it is searched for in the module path. The module is unloaded in
case of error. */
lt_dlhandle
-m4__module_open (m4 *context, const char *name, struct obstack *obs)
+m4__module_open (m4 *context, const char *name, m4_obstack *obs)
{
lt_dlhandle handle = lt_dlopenext (name);
m4_module_init_func *init_func = 0;
@@ -493,7 +493,7 @@ module_dlerror (void)
}
static void
-module_close (m4 *context, lt_dlhandle handle, struct obstack *obs)
+module_close (m4 *context, lt_dlhandle handle, m4_obstack *obs)
{
m4_module_finish_func *finish_func;
const char *name;
@@ -554,7 +554,7 @@ module_close (m4 *context, lt_dlhandle h
}
static int
-module_remove (m4 *context, lt_dlhandle handle, struct obstack *obs)
+module_remove (m4 *context, lt_dlhandle handle, m4_obstack *obs)
{
const lt_dlinfo *info;
int errors = 0;
Index: m4/output.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/output.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 output.c
--- m4/output.c 26 Jun 2003 14:57:32 -0000 1.12
+++ m4/output.c 23 Jul 2003 16:20:11 -0000
@@ -392,7 +392,7 @@ output_text (const char *text, int lengt
sync lines are output whenever a single input lines generates several
output lines, or when several input lines does not generate any output. */
void
-m4_shipout_text (m4 *context, struct obstack *obs,
+m4_shipout_text (m4 *context, m4_obstack *obs,
const char *text, int length)
{
static boolean start_of_output_line = TRUE;
@@ -479,7 +479,7 @@ m4_shipout_text (m4 *context, struct obs
/* Format an int VAL, and stuff it into an obstack OBS. Used for macros
expanding to numbers. */
void
-m4_shipout_int (struct obstack *obs, int val)
+m4_shipout_int (m4_obstack *obs, int val)
{
char buf[128];
@@ -488,7 +488,7 @@ m4_shipout_int (struct obstack *obs, int
}
void
-m4_shipout_string (m4 *context, struct obstack *obs, const char *s, int len,
+m4_shipout_string (m4 *context, m4_obstack *obs, const char *s, int len,
boolean quoted)
{
if (s == NULL)
Index: m4/utility.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/utility.c,v
retrieving revision 1.30
diff -u -p -u -r1.30 utility.c
--- m4/utility.c 17 Jul 2003 19:57:06 -0000 1.30
+++ m4/utility.c 23 Jul 2003 16:20:11 -0000
@@ -91,7 +91,7 @@ m4_numeric_arg (m4 *context, int argc, m
/* Print ARGC arguments from the table ARGV to obstack OBS, separated by
SEP, and quoted by the current quotes, if QUOTED is TRUE. */
void
-m4_dump_args (m4 *context, struct obstack *obs, int argc,
+m4_dump_args (m4 *context, m4_obstack *obs, int argc,
m4_symbol_value **argv, const char *sep, boolean quoted)
{
int i;
@@ -114,7 +114,7 @@ m4_dump_args (m4 *context, struct obstac
character in a range is after the first in the character set, the range
is made backwards, thus 9-0 is the string 9876543210. */
const char *
-m4_expand_ranges (const char *s, struct obstack *obs)
+m4_expand_ranges (const char *s, m4_obstack *obs)
{
char from;
char to;
Index: modules/evalparse.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/evalparse.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 evalparse.c
--- modules/evalparse.c 20 Jun 2003 15:43:20 -0000 1.9
+++ modules/evalparse.c 23 Jul 2003 16:20:11 -0000
@@ -770,7 +770,7 @@ simple_term (m4 *context, eval_token et,
/* Main entry point, called from "eval" and "mpeval" builtins. */
void
-m4_evaluate (m4 *context, struct obstack *obs, int argc, m4_symbol_value
**argv)
+m4_evaluate (m4 *context, m4_obstack *obs, int argc, m4_symbol_value **argv)
{
int radix = 10;
int min = 1;
Index: modules/format.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/format.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 format.c
--- modules/format.c 18 Jun 2003 16:21:55 -0000 1.14
+++ modules/format.c 23 Jul 2003 16:20:11 -0000
@@ -50,10 +50,10 @@
/* The main formatting function. Output is placed on the obstack OBS, the
first argument in ARGV is the formatting string, and the rest is
arguments for the string. */
-void format (struct obstack *obs, int argc, m4_symbol_value **argv);
+void format (m4_obstack *obs, int argc, m4_symbol_value **argv);
void
-format (struct obstack *obs, int argc, m4_symbol_value **argv)
+format (m4_obstack *obs, int argc, m4_symbol_value **argv)
{
char *fmt; /* format control string */
const char *fstart; /* beginning of current format spec */
Index: modules/gnu.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/gnu.c,v
retrieving revision 1.25
diff -u -p -u -r1.25 gnu.c
--- modules/gnu.c 23 Jul 2003 11:51:27 -0000 1.25
+++ modules/gnu.c 23 Jul 2003 16:20:11 -0000
@@ -121,9 +121,9 @@ m4_macro m4_macro_table[] =
{ 0, 0 },
};
-static void substitute (m4 *context, struct obstack *obs, const char *victim,
+static void substitute (m4 *context, m4_obstack *obs, const char *victim,
const char *repl, struct re_registers *regs);
-static void m4_patsubst_do (m4 *context, struct obstack *obs, int argc,
+static void m4_patsubst_do (m4 *context, m4_obstack *obs, int argc,
m4_symbol_value **argv, int syntax);
@@ -159,15 +159,14 @@ M4BUILTIN_HANDLER (builtin)
**/
M4BUILTIN_HANDLER (indir)
{
- m4_symbol *symbol;
- const char *name = M4ARG (1);
+ const char * name = M4ARG (1);
+ m4_symbol * symbol = m4_symbol_lookup (M4SYMTAB, name);
- symbol = m4_symbol_lookup (M4SYMTAB, name);
if (symbol == NULL)
M4ERROR ((m4_get_warning_status_opt (context), 0,
_("Undefined name `%s'"), name));
else
- m4_call_macro (context, symbol, obs, argc - 1, argv + 1);
+ m4_macro_call (context, symbol, obs, argc - 1, argv + 1);
}
/* Change the current input syntax. The function set_syntax () lives
@@ -307,7 +306,7 @@ m4_regexp_compile (m4 *context, const ch
**/
static void
-m4_regexp_do (m4 *context, struct obstack *obs, int argc,
+m4_regexp_do (m4 *context, m4_obstack *obs, int argc,
m4_symbol_value **argv, int syntax)
{
const char *victim; /* first argument */
@@ -372,7 +371,7 @@ M4BUILTIN_HANDLER (eregexp)
* patsubst(STRING, REGEXP, [REPLACEMENT])
**/
static void
-m4_patsubst_do (m4 *context, struct obstack *obs, int argc,
+m4_patsubst_do (m4 *context, m4_obstack *obs, int argc,
m4_symbol_value **argv, int syntax)
{
const char *victim; /* first argument */
@@ -461,7 +460,7 @@ M4BUILTIN_HANDLER (epatsubst)
M4BUILTIN_HANDLER (symbols)
{
struct m4_dump_symbol_data data;
- struct obstack data_obs;
+ m4_obstack data_obs;
obstack_init (&data_obs);
data.obs = &data_obs;
@@ -563,7 +562,7 @@ M4BUILTIN_HANDLER (__line__)
static int substitute_warned = 0;
static void
-substitute (m4 *context, struct obstack *obs, const char *victim,
+substitute (m4 *context, m4_obstack *obs, const char *victim,
const char *repl, struct re_registers *regs)
{
register unsigned int ch;
Index: modules/m4.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/m4.c,v
retrieving revision 1.47
diff -u -p -u -r1.47 m4.c
--- modules/m4.c 23 Jul 2003 11:51:27 -0000 1.47
+++ modules/m4.c 23 Jul 2003 16:20:11 -0000
@@ -101,7 +101,7 @@ static void include (m4 *context, int a
static void * set_trace_CB (m4_symbol_table *symtab, const char *ignored,
m4_symbol *symbol, void *userdata);
static const char *ntoa (number value, int radix);
-static void numb_obstack (struct obstack *obs, const number value,
+static void numb_obstack (m4_obstack *obs, const number value,
const int radix, int min);
@@ -143,7 +143,7 @@ M4INIT_HANDLER (m4)
/* The rest of this file is code for builtins and expansion of user
defined macros. All the functions for builtins have a prototype as:
- void builtin_MACRONAME (struct obstack *obs, int argc, char *argv[]);
+ void builtin_MACRONAME (m4_obstack *obs, int argc, char *argv[]);
The function are expected to leave their expansion on the obstack OBS,
as an unfinished object. ARGV is a table of ARGC pointers to the
@@ -803,7 +803,7 @@ ntoa (number value, int radix)
}
static void
-numb_obstack(struct obstack *obs, const number value,
+numb_obstack(m4_obstack *obs, const number value,
const int radix, int min)
{
const char *s = ntoa (value, radix);
Index: modules/mpeval.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/mpeval.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 mpeval.c
--- modules/mpeval.c 20 Jun 2003 15:43:20 -0000 1.12
+++ modules/mpeval.c 23 Jul 2003 16:20:11 -0000
@@ -109,7 +109,7 @@ m4_macro m4_macro_table[] =
typedef mpq_t number;
static void numb_initialise (void);
-static void numb_obstack (struct obstack *obs, const number value,
+static void numb_obstack (m4_obstack *obs, const number value,
const int radix, int min);
static void mpq2mpz (m4 *context, mpz_t z, const number q, const char
*noisily);
static void mpz2mpq (number q, const mpz_t z);
@@ -144,7 +144,7 @@ numb_initialise (void)
}
static void
-numb_obstack (struct obstack *obs, const number value, const int radix,
+numb_obstack (m4_obstack *obs, const number value, const int radix,
int min)
{
const char *s;
Index: modules/time.c
===================================================================
RCS file: /cvsroot/m4/m4/modules/time.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 time.c
--- modules/time.c 20 Jun 2003 15:43:20 -0000 1.9
+++ modules/time.c 23 Jul 2003 16:20:11 -0000
@@ -105,7 +105,7 @@ M4BUILTIN_HANDLER (ctime)
}
static void
-format_tm (struct obstack *obs, struct tm *tm)
+format_tm (m4_obstack *obs, struct tm *tm)
{
m4_shipout_int (obs, tm->tm_sec);
obstack_1grow (obs, ',');
Index: src/main.c
===================================================================
RCS file: /cvsroot/m4/m4/src/main.c,v
retrieving revision 1.46
diff -u -p -u -r1.46 main.c
--- src/main.c 23 Jul 2003 14:03:16 -0000 1.46
+++ src/main.c 23 Jul 2003 16:20:11 -0000
@@ -503,7 +503,7 @@ warranty; not even for MERCHANTABILITY o
if (optind == argc)
{
m4_push_file (context, stdin, "stdin");
- m4_expand_input (context);
+ m4_macro_expand_input (context);
}
else
for (; optind < argc; optind++)
@@ -525,14 +525,14 @@ warranty; not even for MERCHANTABILITY o
xfree (filename);
}
}
- m4_expand_input (context);
+ m4_macro_expand_input (context);
}
#undef NEXTARG
/* Now handle wrapup text. */
while (m4_pop_wrapup ())
- m4_expand_input (context);
+ m4_macro_expand_input (context);
if (frozen_file_to_write)
produce_frozen_state (context, frozen_file_to_write);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: 30-gary-refactor-macro-api.patch,
Gary V. Vaughan <=