preproc: Move Preproc type to preproc_ops structure

There is no need to hide this structure into a type.
The former preproc_ops is a way more descriptive.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2011-07-01 10:38:25 +04:00
parent 0ad6a7b293
commit 86b2ad05f8
3 changed files with 13 additions and 11 deletions

10
nasm.c
View file

@ -122,7 +122,8 @@ static struct RAA *offsets;
static struct SAA *forwrefs; /* keep track of forward references */
static const struct forwrefinfo *forwref;
static Preproc *preproc;
static struct preproc_ops *preproc;
enum op_type {
op_normal, /* Preprocess and assemble */
op_preprocess, /* Preprocess only */
@ -168,10 +169,11 @@ static const struct warning {
* not preprocess their source file.
*/
static void no_pp_reset(char *, int, ListGen *, StrList **);
static void no_pp_reset(char *file, int pass, ListGen *listgen, StrList **deplist);
static char *no_pp_getline(void);
static void no_pp_cleanup(int);
static Preproc no_pp = {
static void no_pp_cleanup(int pass);
static struct preproc_ops no_pp = {
no_pp_reset,
no_pp_getline,
no_pp_cleanup

12
nasm.h
View file

@ -352,28 +352,28 @@ typedef struct string_list {
/*
* preprocessors ought to look like this:
*/
typedef struct preproc_ops {
struct preproc_ops {
/*
* Called at the start of a pass; given a file name, the number
* of the pass, an error reporting function, an evaluator
* function, and a listing generator to talk to.
*/
void (*reset) (char *, int, ListGen *, StrList **);
void (*reset)(char *file, int pass, ListGen *listgen, StrList **deplist);
/*
* Called to fetch a line of preprocessed source. The line
* returned has been malloc'ed, and so should be freed after
* use.
*/
char *(*getline) (void);
char *(*getline)(void);
/*
* Called at the end of a pass.
*/
void (*cleanup) (int);
} Preproc;
void (*cleanup)(int pass);
};
extern Preproc nasmpp;
extern struct preproc_ops nasmpp;
/*
* ----------------------------------------------------------------

View file

@ -5505,7 +5505,7 @@ static void make_tok_num(Token * tok, int64_t val)
tok->type = TOK_NUMBER;
}
Preproc nasmpp = {
struct preproc_ops nasmpp = {
pp_reset,
pp_getline,
pp_cleanup