wpp: Remove some dead code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
506bdf4249
commit
107103e2bd
|
@ -24,7 +24,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
extern void wpp_add_define( const char *name, const char *value );
|
|
||||||
extern void wpp_del_define( const char *name );
|
extern void wpp_del_define( const char *name );
|
||||||
extern void wpp_add_cmdline_define( const char *value );
|
extern void wpp_add_cmdline_define( const char *value );
|
||||||
extern void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug );
|
extern void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug );
|
||||||
|
|
|
@ -210,7 +210,7 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL]
|
||||||
|
|
||||||
typedef struct bufferstackentry {
|
typedef struct bufferstackentry {
|
||||||
YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
|
YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
|
||||||
void *filehandle; /* Handle to be used with wpp_callbacks->read */
|
FILE *file; /* File handle */
|
||||||
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
|
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
|
||||||
int line_number; /* Line that we were handling */
|
int line_number; /* Line that we were handling */
|
||||||
int char_number; /* The current position on that line */
|
int char_number; /* The current position on that line */
|
||||||
|
@ -849,10 +849,6 @@ static void newline(int dowrite)
|
||||||
*
|
*
|
||||||
* FIXME:
|
* FIXME:
|
||||||
* The sizes of resulting 'int' and 'long' are compiler specific.
|
* The sizes of resulting 'int' and 'long' are compiler specific.
|
||||||
* I depend on sizeof(int) > 2 here (although a relatively safe
|
|
||||||
* assumption).
|
|
||||||
* Long longs are not yet implemented because this is very compiler
|
|
||||||
* specific and I don't want to think too much about the problems.
|
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -1223,10 +1219,6 @@ static void expand_macro(macexpstackentry_t *mep)
|
||||||
*/
|
*/
|
||||||
static void new_string(void)
|
static void new_string(void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
if(strbuf_idx)
|
|
||||||
ppy_warning("new_string: strbuf_idx != 0");
|
|
||||||
#endif
|
|
||||||
strbuf_idx = 0;
|
strbuf_idx = 0;
|
||||||
str_startline = pp_status.line_number;
|
str_startline = pp_status.line_number;
|
||||||
}
|
}
|
||||||
|
@ -1259,18 +1251,12 @@ static char *get_string(void)
|
||||||
|
|
||||||
memcpy(str, strbuffer, strbuf_idx);
|
memcpy(str, strbuffer, strbuf_idx);
|
||||||
str[strbuf_idx] = '\0';
|
str[strbuf_idx] = '\0';
|
||||||
#ifdef DEBUG
|
|
||||||
strbuf_idx = 0;
|
|
||||||
#endif
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_string(void)
|
static void put_string(void)
|
||||||
{
|
{
|
||||||
put_buffer(strbuffer, strbuf_idx);
|
put_buffer(strbuffer, strbuf_idx);
|
||||||
#ifdef DEBUG
|
|
||||||
strbuf_idx = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int string_start(void)
|
static int string_start(void)
|
||||||
|
@ -1293,7 +1279,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
|
||||||
|
|
||||||
memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
|
memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
|
||||||
bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
|
bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
|
||||||
bufferstack[bufferstackidx].filehandle = pp_status.file;
|
bufferstack[bufferstackidx].file = pp_status.file;
|
||||||
bufferstack[bufferstackidx].define = ppp;
|
bufferstack[bufferstackidx].define = ppp;
|
||||||
bufferstack[bufferstackidx].line_number = pp_status.line_number;
|
bufferstack[bufferstackidx].line_number = pp_status.line_number;
|
||||||
bufferstack[bufferstackidx].char_number = pp_status.char_number;
|
bufferstack[bufferstackidx].char_number = pp_status.char_number;
|
||||||
|
@ -1383,7 +1369,7 @@ static bufferstackentry_t *pop_buffer(void)
|
||||||
bufferstack[bufferstackidx].filename,
|
bufferstack[bufferstackidx].filename,
|
||||||
bufferstack[bufferstackidx].should_pop);
|
bufferstack[bufferstackidx].should_pop);
|
||||||
|
|
||||||
pp_status.file = bufferstack[bufferstackidx].filehandle;
|
pp_status.file = bufferstack[bufferstackidx].file;
|
||||||
ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
|
ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
|
||||||
|
|
||||||
if(bufferstack[bufferstackidx].should_pop)
|
if(bufferstack[bufferstackidx].should_pop)
|
||||||
|
|
|
@ -108,8 +108,7 @@ static void cast_to_slong(cval_t *v);
|
||||||
static void cast_to_ulong(cval_t *v);
|
static void cast_to_ulong(cval_t *v);
|
||||||
static void cast_to_sll(cval_t *v);
|
static void cast_to_sll(cval_t *v);
|
||||||
static void cast_to_ull(cval_t *v);
|
static void cast_to_ull(cval_t *v);
|
||||||
static marg_t *new_marg(char *str, def_arg_t type);
|
static char *add_new_marg(char *str);
|
||||||
static marg_t *add_new_marg(char *str, def_arg_t type);
|
|
||||||
static int marg_index(char *id);
|
static int marg_index(char *id);
|
||||||
static mtext_t *new_mtext(char *str, int idx, def_exp_t type);
|
static mtext_t *new_mtext(char *str, int idx, def_exp_t type);
|
||||||
static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp);
|
static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp);
|
||||||
|
@ -118,7 +117,7 @@ static char *merge_text(char *s1, char *s2);
|
||||||
/*
|
/*
|
||||||
* Local variables
|
* Local variables
|
||||||
*/
|
*/
|
||||||
static marg_t **macro_args; /* Macro parameters array while parsing */
|
static char **macro_args; /* Macro parameters array while parsing */
|
||||||
static int nmacro_args;
|
static int nmacro_args;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
@ -133,7 +132,7 @@ static int nmacro_args;
|
||||||
int *iptr;
|
int *iptr;
|
||||||
char *cptr;
|
char *cptr;
|
||||||
cval_t cval;
|
cval_t cval;
|
||||||
marg_t *marg;
|
char *marg;
|
||||||
mtext_t *mtext;
|
mtext_t *mtext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,11 +326,11 @@ allmargs: /* Empty */ { $$ = 0; macro_args = NULL; nmacro_args = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
emargs : margs { $$ = $1; }
|
emargs : margs { $$ = $1; }
|
||||||
| margs ',' tELLIPSIS { $$ = add_new_marg(NULL, arg_list); nmacro_args *= -1; }
|
| margs ',' tELLIPSIS { nmacro_args *= -1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
margs : margs ',' tIDENT { $$ = add_new_marg($3, arg_single); }
|
margs : margs ',' tIDENT { $$ = add_new_marg($3); }
|
||||||
| tIDENT { $$ = add_new_marg($1, arg_single); }
|
| tIDENT { $$ = add_new_marg($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_mtexts
|
opt_mtexts
|
||||||
|
@ -543,25 +542,11 @@ static int boolean(cval_t *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static marg_t *new_marg(char *str, def_arg_t type)
|
static char *add_new_marg(char *str)
|
||||||
{
|
{
|
||||||
marg_t *ma = pp_xmalloc(sizeof(marg_t));
|
char *ma;
|
||||||
|
|
||||||
ma->arg = str;
|
|
||||||
ma->type = type;
|
|
||||||
ma->nnl = 0;
|
|
||||||
return ma;
|
|
||||||
}
|
|
||||||
|
|
||||||
static marg_t *add_new_marg(char *str, def_arg_t type)
|
|
||||||
{
|
|
||||||
marg_t *ma;
|
|
||||||
if(!str)
|
|
||||||
return NULL;
|
|
||||||
macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0]));
|
macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0]));
|
||||||
ma = new_marg(str, type);
|
macro_args[nmacro_args++] = ma = pp_xstrdup(str);
|
||||||
macro_args[nmacro_args] = ma;
|
|
||||||
nmacro_args++;
|
|
||||||
return ma;
|
return ma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +557,7 @@ static int marg_index(char *id)
|
||||||
return -1;
|
return -1;
|
||||||
for(t = 0; t < nmacro_args; t++)
|
for(t = 0; t < nmacro_args; t++)
|
||||||
{
|
{
|
||||||
if(!strcmp(id, macro_args[t]->arg))
|
if(!strcmp(id, macro_args[t]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return t < nmacro_args ? t : -1;
|
return t < nmacro_args ? t : -1;
|
||||||
|
|
|
@ -37,38 +37,12 @@ struct pp_status pp_status;
|
||||||
|
|
||||||
#define HASHKEY 2039
|
#define HASHKEY 2039
|
||||||
|
|
||||||
typedef struct pp_def_state
|
static struct list pp_defines[HASHKEY];
|
||||||
{
|
|
||||||
struct list entry;
|
|
||||||
struct list defines[HASHKEY];
|
|
||||||
} pp_def_state_t;
|
|
||||||
|
|
||||||
static struct list pp_states = LIST_INIT( pp_states );
|
|
||||||
static pp_def_state_t *pp_def_state;
|
|
||||||
|
|
||||||
#define MAXIFSTACK 64
|
#define MAXIFSTACK 64
|
||||||
static pp_if_state_t if_stack[MAXIFSTACK];
|
static pp_if_state_t if_stack[MAXIFSTACK];
|
||||||
static int if_stack_idx = 0;
|
static int if_stack_idx = 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
void pp_print_status(void) __attribute__((destructor));
|
|
||||||
void pp_print_status(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int sum;
|
|
||||||
int total = 0;
|
|
||||||
|
|
||||||
fprintf(stderr, "Defines statistics:\n");
|
|
||||||
for(i = 0; i < HASHKEY; i++)
|
|
||||||
{
|
|
||||||
sum = list_count( &pp_def_state->defines[i] );
|
|
||||||
total += sum;
|
|
||||||
if (sum) fprintf(stderr, "%4d, %3d\n", i, sum);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "Total defines: %d\n", total);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void *pp_xmalloc(size_t size)
|
void *pp_xmalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *res;
|
void *res;
|
||||||
|
@ -186,7 +160,7 @@ pp_entry_t *pplookup(const char *ident)
|
||||||
if(!ident)
|
if(!ident)
|
||||||
return NULL;
|
return NULL;
|
||||||
idx = pphash(ident);
|
idx = pphash(ident);
|
||||||
LIST_FOR_EACH_ENTRY( ppp, &pp_def_state->defines[idx], pp_entry_t, entry )
|
LIST_FOR_EACH_ENTRY( ppp, &pp_defines[idx], pp_entry_t, entry )
|
||||||
{
|
{
|
||||||
if(!strcmp(ident, ppp->ident))
|
if(!strcmp(ident, ppp->ident))
|
||||||
return ppp;
|
return ppp;
|
||||||
|
@ -206,27 +180,23 @@ static void free_pp_entry( pp_entry_t *ppp, int idx )
|
||||||
free(ppp);
|
free(ppp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* push a new (empty) define state */
|
/* initialize the define state */
|
||||||
void pp_push_define_state(void)
|
void pp_init_define_state(void)
|
||||||
{
|
{
|
||||||
pp_def_state_t *state = pp_xmalloc( sizeof(*state) );
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < HASHKEY; i++) list_init( &state->defines[i] );
|
for (i = 0; i < HASHKEY; i++) list_init( &pp_defines[i] );
|
||||||
list_add_head( &pp_states, &state->entry );
|
|
||||||
pp_def_state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pop the current define state */
|
/* free the current define state */
|
||||||
void pp_pop_define_state(void)
|
void pp_free_define_state(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
pp_entry_t *ppp, *ppp2;
|
pp_entry_t *ppp, *ppp2;
|
||||||
pp_def_state_t *state = pp_def_state;
|
|
||||||
|
|
||||||
for (i = 0; i < HASHKEY; i++)
|
for (i = 0; i < HASHKEY; i++)
|
||||||
{
|
{
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( ppp, ppp2, &state->defines[i], pp_entry_t, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( ppp, ppp2, &pp_defines[i], pp_entry_t, entry )
|
||||||
{
|
{
|
||||||
free( ppp->ident );
|
free( ppp->ident );
|
||||||
free( ppp->subst.text );
|
free( ppp->subst.text );
|
||||||
|
@ -234,9 +204,6 @@ void pp_pop_define_state(void)
|
||||||
free_pp_entry( ppp, i );
|
free_pp_entry( ppp, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list_remove( &state->entry );
|
|
||||||
free( state );
|
|
||||||
pp_def_state = LIST_ENTRY( list_head( &pp_states ), pp_def_state_t, entry );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pp_del_define(const char *name)
|
void pp_del_define(const char *name)
|
||||||
|
@ -281,7 +248,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
|
||||||
ppp->subst.text = text ? pp_xstrdup(text) : NULL;
|
ppp->subst.text = text ? pp_xstrdup(text) : NULL;
|
||||||
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
||||||
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
||||||
list_add_head( &pp_def_state->defines[idx], &ppp->entry );
|
list_add_head( &pp_defines[idx], &ppp->entry );
|
||||||
if(ppp->subst.text)
|
if(ppp->subst.text)
|
||||||
{
|
{
|
||||||
/* Strip trailing white space from subst text */
|
/* Strip trailing white space from subst text */
|
||||||
|
@ -302,7 +269,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
|
||||||
return ppp;
|
return ppp;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
|
pp_entry_t *pp_add_macro(char *id, char *args[], int nargs, mtext_t *exp)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
pp_entry_t *ppp;
|
pp_entry_t *ppp;
|
||||||
|
@ -323,7 +290,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
|
||||||
ppp->subst.mtext= exp;
|
ppp->subst.mtext= exp;
|
||||||
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
||||||
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
||||||
list_add_head( &pp_def_state->defines[idx], &ppp->entry );
|
list_add_head( &pp_defines[idx], &ppp->entry );
|
||||||
if(pp_status.debug)
|
if(pp_status.debug)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Added macro (%s, %d) <%s(%d)> to <", pp_status.input, pp_status.line_number, ppp->ident, nargs);
|
fprintf(stderr, "Added macro (%s, %d) <%s(%d)> to <", pp_status.input, pp_status.line_number, ppp->ident, nargs);
|
||||||
|
@ -574,26 +541,11 @@ int pp_get_if_depth(void)
|
||||||
return if_stack_idx;
|
return if_stack_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #define WANT_NEAR_INDICATION */
|
|
||||||
|
|
||||||
static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
|
static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s:%d:%d: %s: ", pp_status.input ? pp_status.input : "stdin",
|
fprintf(stderr, "%s:%d:%d: %s: ", pp_status.input ? pp_status.input : "stdin",
|
||||||
pp_status.line_number, pp_status.char_number, t);
|
pp_status.line_number, pp_status.char_number, t);
|
||||||
vfprintf(stderr, s, ap);
|
vfprintf(stderr, s, ap);
|
||||||
#ifdef WANT_NEAR_INDICATION
|
|
||||||
{
|
|
||||||
char *cpy, *p;
|
|
||||||
if(n)
|
|
||||||
{
|
|
||||||
cpy = pp_xstrdup(n);
|
|
||||||
for (p = cpy; *p; p++) if(!isprint(*p)) *p = ' ';
|
|
||||||
fprintf(stderr, " near '%s'", cpy);
|
|
||||||
free(cpy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
#endif
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,6 @@ static void add_cmdline_defines(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void del_cmdline_defines(void)
|
|
||||||
{
|
|
||||||
struct define *def;
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( def, &cmdline_defines, struct define, entry )
|
|
||||||
{
|
|
||||||
if (def->value) pp_del_define( def->name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void add_special_defines(void)
|
static void add_special_defines(void)
|
||||||
{
|
{
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
@ -78,17 +68,8 @@ static void add_special_defines(void)
|
||||||
ppp->type = def_special;
|
ppp->type = def_special;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void del_special_defines(void)
|
|
||||||
{
|
|
||||||
pp_del_define( "__DATE__" );
|
|
||||||
pp_del_define( "__TIME__" );
|
|
||||||
pp_del_define( "__FILE__" );
|
|
||||||
pp_del_define( "__LINE__" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* add a define to the preprocessor list */
|
/* add a define to the preprocessor list */
|
||||||
void wpp_add_define( const char *name, const char *value )
|
static void wpp_add_define( const char *name, const char *value )
|
||||||
{
|
{
|
||||||
struct define *def;
|
struct define *def;
|
||||||
|
|
||||||
|
@ -166,7 +147,7 @@ int wpp_parse( const char *input, FILE *output )
|
||||||
pp_status.line_number = 1;
|
pp_status.line_number = 1;
|
||||||
pp_status.char_number = 1;
|
pp_status.char_number = 1;
|
||||||
|
|
||||||
pp_push_define_state();
|
pp_init_define_state();
|
||||||
add_cmdline_defines();
|
add_cmdline_defines();
|
||||||
add_special_defines();
|
add_special_defines();
|
||||||
|
|
||||||
|
@ -188,8 +169,6 @@ int wpp_parse( const char *input, FILE *output )
|
||||||
}
|
}
|
||||||
/* Clean if_stack, it could remain dirty on errors */
|
/* Clean if_stack, it could remain dirty on errors */
|
||||||
while (pp_get_if_depth()) pp_pop_if();
|
while (pp_get_if_depth()) pp_pop_if();
|
||||||
del_special_defines();
|
pp_free_define_state();
|
||||||
del_cmdline_defines();
|
|
||||||
pp_pop_define_state();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,20 +36,6 @@ typedef struct includelogicentry {
|
||||||
char *filename; /* The filename of the include */
|
char *filename; /* The filename of the include */
|
||||||
} includelogicentry_t;
|
} includelogicentry_t;
|
||||||
|
|
||||||
/*
|
|
||||||
* The arguments of a macrodefinition
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
arg_single,
|
|
||||||
arg_list
|
|
||||||
} def_arg_t;
|
|
||||||
|
|
||||||
typedef struct marg {
|
|
||||||
def_arg_t type; /* Normal or ... argument */
|
|
||||||
char *arg; /* The textual argument */
|
|
||||||
int nnl; /* Number of newlines in the text to subst */
|
|
||||||
} marg_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The expansiontext of a macro
|
* The expansiontext of a macro
|
||||||
*/
|
*/
|
||||||
|
@ -84,7 +70,7 @@ typedef struct pp_entry {
|
||||||
struct list entry;
|
struct list entry;
|
||||||
def_type_t type; /* Define or macro */
|
def_type_t type; /* Define or macro */
|
||||||
char *ident; /* The key */
|
char *ident; /* The key */
|
||||||
marg_t **margs; /* Macro arguments array or NULL if none */
|
char **margs; /* Macro arguments array or NULL if none */
|
||||||
int nargs;
|
int nargs;
|
||||||
union {
|
union {
|
||||||
mtext_t *mtext; /* The substitution sequence or NULL if none */
|
mtext_t *mtext; /* The substitution sequence or NULL if none */
|
||||||
|
@ -131,21 +117,13 @@ typedef struct
|
||||||
int seen_junk; /* Set when junk is seen */
|
int seen_junk; /* Set when junk is seen */
|
||||||
} include_state_t;
|
} include_state_t;
|
||||||
|
|
||||||
#define SIZE_CHAR 1
|
#define SIZE_INT 1
|
||||||
#define SIZE_SHORT 2
|
#define SIZE_LONG 2
|
||||||
#define SIZE_INT 3
|
#define SIZE_LONGLONG 3
|
||||||
#define SIZE_LONG 4
|
|
||||||
#define SIZE_LONGLONG 5
|
|
||||||
#define SIZE_MASK 0x00ff
|
#define SIZE_MASK 0x00ff
|
||||||
#define FLAG_SIGNED 0x0100
|
#define FLAG_SIGNED 0x0100
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
#if 0
|
|
||||||
cv_schar = SIZE_CHAR + FLAG_SIGNED,
|
|
||||||
cv_uchar = SIZE_CHAR,
|
|
||||||
cv_sshort = SIZE_SHORT + FLAG_SIGNED,
|
|
||||||
cv_ushort = SIZE_SHORT,
|
|
||||||
#endif
|
|
||||||
cv_sint = SIZE_INT + FLAG_SIGNED,
|
cv_sint = SIZE_INT + FLAG_SIGNED,
|
||||||
cv_uint = SIZE_INT,
|
cv_uint = SIZE_INT,
|
||||||
cv_slong = SIZE_LONG + FLAG_SIGNED,
|
cv_slong = SIZE_LONG + FLAG_SIGNED,
|
||||||
|
@ -157,12 +135,6 @@ typedef enum {
|
||||||
typedef struct cval {
|
typedef struct cval {
|
||||||
ctype_t type;
|
ctype_t type;
|
||||||
union {
|
union {
|
||||||
#if 0
|
|
||||||
signed char sc; /* Explicitly signed because compilers are stupid */
|
|
||||||
unsigned char uc;
|
|
||||||
short ss;
|
|
||||||
unsigned short us;
|
|
||||||
#endif
|
|
||||||
int si;
|
int si;
|
||||||
unsigned int ui;
|
unsigned int ui;
|
||||||
long sl;
|
long sl;
|
||||||
|
@ -178,10 +150,10 @@ void *pp_xmalloc(size_t);
|
||||||
void *pp_xrealloc(void *, size_t);
|
void *pp_xrealloc(void *, size_t);
|
||||||
char *pp_xstrdup(const char *str);
|
char *pp_xstrdup(const char *str);
|
||||||
pp_entry_t *pplookup(const char *ident);
|
pp_entry_t *pplookup(const char *ident);
|
||||||
void pp_push_define_state(void);
|
void pp_init_define_state(void);
|
||||||
void pp_pop_define_state(void);
|
void pp_free_define_state(void);
|
||||||
pp_entry_t *pp_add_define(const char *def, const char *text);
|
pp_entry_t *pp_add_define(const char *def, const char *text);
|
||||||
pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp);
|
pp_entry_t *pp_add_macro(char *ident, char *args[], int nargs, mtext_t *exp);
|
||||||
void pp_del_define(const char *name);
|
void pp_del_define(const char *name);
|
||||||
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath);
|
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath);
|
||||||
void pp_push_if(pp_if_state_t s);
|
void pp_push_if(pp_if_state_t s);
|
||||||
|
@ -196,8 +168,6 @@ char *wpp_lookup(const char *name, int type, const char *parent_name,
|
||||||
#define __attribute__(x) /*nothing*/
|
#define __attribute__(x) /*nothing*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const struct wpp_callbacks *wpp_callbacks;
|
|
||||||
|
|
||||||
int ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
int ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
int ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
int ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
void pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
|
void pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
|
||||||
|
@ -207,7 +177,7 @@ void pp_internal_error(const char *file, int line, const char *s, ...) __attribu
|
||||||
struct pp_status
|
struct pp_status
|
||||||
{
|
{
|
||||||
char *input; /* current input file name */
|
char *input; /* current input file name */
|
||||||
void *file; /* current input file descriptor */
|
FILE *file; /* current input file descriptor */
|
||||||
int line_number; /* current line number */
|
int line_number; /* current line number */
|
||||||
int char_number; /* current char number in line */
|
int char_number; /* current char number in line */
|
||||||
int pedantic; /* pedantic option */
|
int pedantic; /* pedantic option */
|
||||||
|
|
|
@ -249,6 +249,7 @@ static char *dup_basename_token(const char *name, const char *ext)
|
||||||
|
|
||||||
static void add_widl_version_define(void)
|
static void add_widl_version_define(void)
|
||||||
{
|
{
|
||||||
|
char version_str[32];
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
const char *p = PACKAGE_VERSION;
|
const char *p = PACKAGE_VERSION;
|
||||||
|
|
||||||
|
@ -267,14 +268,8 @@ static void add_widl_version_define(void)
|
||||||
if (p)
|
if (p)
|
||||||
version += atoi(p + 1);
|
version += atoi(p + 1);
|
||||||
|
|
||||||
if (version != 0)
|
snprintf(version_str, sizeof(version_str), "__WIDL__=0x%x", version);
|
||||||
{
|
wpp_add_cmdline_define(version_str);
|
||||||
char version_str[11];
|
|
||||||
snprintf(version_str, sizeof(version_str), "0x%x", version);
|
|
||||||
wpp_add_define("__WIDL__", version_str);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wpp_add_define("__WIDL__", NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the target platform */
|
/* set the target platform */
|
||||||
|
@ -922,7 +917,7 @@ int main(int argc,char *argv[])
|
||||||
if (do_regscript) regscript_token = dup_basename_token(regscript_name,"_r.rgs");
|
if (do_regscript) regscript_token = dup_basename_token(regscript_name,"_r.rgs");
|
||||||
|
|
||||||
add_widl_version_define();
|
add_widl_version_define();
|
||||||
wpp_add_define("_WIN32", NULL);
|
wpp_add_cmdline_define("_WIN32=1");
|
||||||
|
|
||||||
atexit(rm_tempfile);
|
atexit(rm_tempfile);
|
||||||
if (!no_preprocess)
|
if (!no_preprocess)
|
||||||
|
|
Loading…
Reference in New Issue