ReactOS 0.4.16-dev-1948-gd260c1d
wpp_private.h File Reference
#include <stdio.h>
#include <string.h>
#include "wine/list.h"
Include dependency graph for wpp_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  includelogicentry
 
struct  mtext
 
struct  pp_entry
 
struct  include_state_t
 
struct  cval
 
struct  pp_status
 

Macros

#define MAXIFSTACK   64 /* If this isn't enough you should alter the source... */
 
#define SIZE_INT   1
 
#define SIZE_LONG   2
 
#define SIZE_LONGLONG   3
 
#define SIZE_MASK   0x00ff
 
#define FLAG_SIGNED   0x0100
 

Typedefs

typedef struct includelogicentry includelogicentry_t
 
typedef struct mtext mtext_t
 
typedef struct pp_entry pp_entry_t
 
typedef struct cval cval_t
 

Enumerations

enum  def_exp_t {
  exp_text , exp_concat , exp_stringize , exp_subst ,
  exp_text , exp_concat , exp_stringize , exp_subst
}
 
enum  def_type_t {
  def_none , def_define , def_macro , def_special ,
  def_none , def_define , def_macro , def_special
}
 
enum  pp_if_state_t {
  if_false , if_true , if_elif , if_elsefalse ,
  if_elsetrue , if_ignore , if_error , if_false ,
  if_true , if_elif , if_elsefalse , if_elsetrue ,
  if_ignore , if_error
}
 
enum  ctype_t {
  cv_sint = SIZE_INT + FLAG_SIGNED , cv_uint = SIZE_INT , cv_slong = SIZE_LONG + FLAG_SIGNED , cv_ulong = SIZE_LONG ,
  cv_sll = SIZE_LONGLONG + FLAG_SIGNED , cv_ull = SIZE_LONGLONG , cv_sint = SIZE_INT + FLAG_SIGNED , cv_uint = SIZE_INT ,
  cv_slong = SIZE_LONG + FLAG_SIGNED , cv_ulong = SIZE_LONG , cv_sll = SIZE_LONGLONG + FLAG_SIGNED , cv_ull = SIZE_LONGLONG
}
 

Functions

void wpp_del_define (const char *name)
 
void wpp_add_cmdline_define (const char *value)
 
void wpp_set_debug (int lex_debug, int parser_debug, int msg_debug)
 
void wpp_add_include_path (const char *path)
 
charwpp_find_include (const char *name, const char *parent_name)
 
int wpp_parse (const char *input, FILE *output)
 
pp_entry_tpplookup (const char *ident)
 
pp_entry_tpp_add_define (const char *def, const char *text)
 
pp_entry_tpp_add_macro (char *ident, char *args[], int nargs, int variadic, mtext_t *exp)
 
void pp_del_define (const char *name)
 
voidpp_open_include (const char *name, int type, const char *parent_name, char **newpath)
 
void pp_push_if (pp_if_state_t s)
 
void pp_next_if_state (int)
 
pp_if_state_t pp_pop_if (void)
 
pp_if_state_t pp_if_state (void)
 
int pp_get_if_depth (void)
 
int ppy_error (const char *s,...) __attribute__((format(printf
 
int int ppy_warning (const char *s,...) __attribute__((format(printf
 
int ppy_lex (void)
 
void pp_do_include (char *fname, int type)
 
void pp_push_ignore_state (void)
 
void pp_pop_ignore_state (void)
 
int ppy_parse (void)
 

Variables

struct pp_status pp_status
 
include_state_t pp_incl_state
 
int pedantic
 
FILEppy_in
 
FILEppy_out
 
charppy_text
 
int pp_flex_debug
 
int ppy_debug
 

Macro Definition Documentation

◆ FLAG_SIGNED

#define FLAG_SIGNED   0x0100

Definition at line 133 of file wpp_private.h.

◆ MAXIFSTACK

#define MAXIFSTACK   64 /* If this isn't enough you should alter the source... */

Definition at line 98 of file wpp_private.h.

◆ SIZE_INT

#define SIZE_INT   1

Definition at line 129 of file wpp_private.h.

◆ SIZE_LONG

#define SIZE_LONG   2

Definition at line 130 of file wpp_private.h.

◆ SIZE_LONGLONG

#define SIZE_LONGLONG   3

Definition at line 131 of file wpp_private.h.

◆ SIZE_MASK

#define SIZE_MASK   0x00ff

Definition at line 132 of file wpp_private.h.

Typedef Documentation

◆ cval_t

typedef struct cval cval_t

◆ includelogicentry_t

◆ mtext_t

typedef struct mtext mtext_t

◆ pp_entry_t

Enumeration Type Documentation

◆ ctype_t

Enumerator
cv_sint 
cv_uint 
cv_slong 
cv_ulong 
cv_sll 
cv_ull 
cv_sint 
cv_uint 
cv_slong 
cv_ulong 
cv_sll 
cv_ull 

Definition at line 135 of file wpp_private.h.

135 {
142} ctype_t;
#define FLAG_SIGNED
Definition: wpp_private.h:153
#define SIZE_LONGLONG
Definition: wpp_private.h:151
#define SIZE_INT
Definition: wpp_private.h:149
#define SIZE_LONG
Definition: wpp_private.h:150
ctype_t
Definition: wpp_private.h:155
@ cv_sint
Definition: wpp_private.h:162
@ cv_uint
Definition: wpp_private.h:163
@ cv_ulong
Definition: wpp_private.h:165
@ cv_sll
Definition: wpp_private.h:166
@ cv_slong
Definition: wpp_private.h:164
@ cv_ull
Definition: wpp_private.h:167

◆ def_exp_t

Enumerator
exp_text 
exp_concat 
exp_stringize 
exp_subst 
exp_text 
exp_concat 
exp_stringize 
exp_subst 

Definition at line 50 of file wpp_private.h.

50 {
51 exp_text, /* Simple text substitution */
52 exp_concat, /* Concat (##) operator requested */
53 exp_stringize, /* Stringize (#) operator requested */
54 exp_subst /* Substitute argument */
55} def_exp_t;
def_exp_t
Definition: wpp_private.h:68
@ exp_stringize
Definition: wpp_private.h:71
@ exp_text
Definition: wpp_private.h:69
@ exp_subst
Definition: wpp_private.h:72
@ exp_concat
Definition: wpp_private.h:70

◆ def_type_t

Enumerator
def_none 
def_define 
def_macro 
def_special 
def_none 
def_define 
def_macro 
def_special 

Definition at line 70 of file wpp_private.h.

70 {
71 def_none, /* Not-a-define; used as return value */
72 def_define, /* Simple defines */
73 def_macro, /* Macro defines */
74 def_special /* Special expansions like __LINE__ and __FILE__ */
def_type_t
Definition: wpp_private.h:88
@ def_none
Definition: wpp_private.h:89
@ def_define
Definition: wpp_private.h:90
@ def_macro
Definition: wpp_private.h:91
@ def_special
Definition: wpp_private.h:92

◆ pp_if_state_t

Enumerator
if_false 
if_true 
if_elif 
if_elsefalse 
if_elsetrue 
if_ignore 
if_error 
if_false 
if_true 
if_elif 
if_elsefalse 
if_elsetrue 
if_ignore 
if_error 

Definition at line 100 of file wpp_private.h.

100 {
101 if_false,
102 if_true,
103 if_elif,
106 if_ignore,
pp_if_state_t
Definition: wpp_private.h:118
@ if_true
Definition: wpp_private.h:120
@ if_elif
Definition: wpp_private.h:121
@ if_elsefalse
Definition: wpp_private.h:122
@ if_elsetrue
Definition: wpp_private.h:123
@ if_error
Definition: wpp_private.h:125
@ if_false
Definition: wpp_private.h:119
@ if_ignore
Definition: wpp_private.h:124

Function Documentation

◆ pp_add_define()

pp_entry_t * pp_add_define ( const char def,
const char text 
)

Definition at line 194 of file preproc.c.

195{
196 int len;
197 char *cptr;
198 int idx;
199 pp_entry_t *ppp;
200
201 if(!def)
202 return NULL;
203 idx = pphash(def);
204 if((ppp = pplookup(def)) != NULL)
205 {
207 ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber);
208 pp_del_define(def);
209 }
210 ppp = pp_xmalloc(sizeof(pp_entry_t));
211 if(!ppp)
212 return NULL;
213 memset( ppp, 0, sizeof(*ppp) );
214 ppp->ident = pp_xstrdup(def);
215 if(!ppp->ident)
216 goto error;
217 ppp->type = def_define;
218 ppp->subst.text = text ? pp_xstrdup(text) : NULL;
219 if(text && !ppp->subst.text)
220 goto error;
221 ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
222 if(!ppp->filename)
223 goto error;
225 ppp->next = pp_def_state->defines[idx];
226 pp_def_state->defines[idx] = ppp;
227 if(ppp->next)
228 ppp->next->prev = ppp;
229 if(ppp->subst.text)
230 {
231 /* Strip trailing white space from subst text */
232 len = strlen(ppp->subst.text);
233 while(len && strchr(" \t\r\n", ppp->subst.text[len-1]))
234 {
235 ppp->subst.text[--len] = '\0';
236 }
237 /* Strip leading white space from subst text */
238 for(cptr = ppp->subst.text; *cptr && strchr(" \t\r", *cptr); cptr++)
239 ;
240 if(ppp->subst.text != cptr)
241 memmove(ppp->subst.text, cptr, strlen(cptr)+1);
242 }
243 return ppp;
244
245error:
246 free(ppp->ident);
247 free(ppp->subst.text);
248 free(ppp);
249 return NULL;
250}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
int WINAPIV ppy_warning(const char *msg,...)
Definition: compiler.c:149
#define free
Definition: debug_ros.c:5
char * pp_xstrdup(const char *str)
Definition: preproc.c:73
void * pp_xmalloc(size_t size)
Definition: preproc.c:45
static int pphash(const char *str)
Definition: preproc.c:87
pp_entry_t * pplookup(const char *ident)
Definition: preproc.c:95
void pp_del_define(const char *name)
Definition: preproc.c:176
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
const WCHAR * text
Definition: package.c:1794
GLenum GLsizei len
Definition: glext.h:6722
#define error(str)
Definition: mkdosfs.c:1605
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define memset(x, y, z)
Definition: compat.h:39
pp_entry_t * defines[HASHKEY]
Definition: preproc.c:36
Definition: wpp_private.h:95
int linenumber
Definition: wpp_private.h:108
char * text
Definition: wpp_private.h:104
union pp_entry::@276 subst
struct pp_entry * next
Definition: wpp_private.h:96
char * filename
Definition: wpp_private.h:107
def_type_t type
Definition: wpp_private.h:98
char * ident
Definition: wpp_private.h:99
int pedantic
Definition: wpp_private.h:225
char * input
Definition: wpp_private.h:220
int line_number
Definition: wpp_private.h:222

Referenced by add_cmdline_defines(), and add_special_defines().

◆ pp_add_macro()

pp_entry_t * pp_add_macro ( char ident,
char args[],
int  nargs,
int  variadic,
mtext_t exp 
)

Definition at line 242 of file wpp.c.

243{
244 int idx;
245 pp_entry_t *ppp;
246
247 idx = pphash(id);
248 if((ppp = pplookup(id)) != NULL)
249 {
250 if(pedantic)
251 ppy_warning("Redefinition of %s\n%s:%d: note: previous definition was here",
252 id, ppp->filename, ppp->linenumber);
253 pp_del_define(id);
254 }
255 ppp = xmalloc(sizeof(pp_entry_t));
256 memset( ppp, 0, sizeof(*ppp) );
257 ppp->ident = id;
258 ppp->type = def_macro;
259 ppp->margs = args;
260 ppp->nargs = nargs;
261 ppp->variadic = variadic;
262 ppp->subst.mtext= exp;
263 ppp->filename = xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
265 list_add_head( &pp_defines[idx], &ppp->entry );
266 if(pp_status.debug)
267 {
268 fprintf(stderr, "Added macro (%s, %d) <%s(%d%s)> to <", pp_status.input, pp_status.line_number, ppp->ident, nargs, variadic ? ",va" : "");
269 for(; exp; exp = exp->next)
270 {
271 switch(exp->type)
272 {
273 case exp_text:
274 fprintf(stderr, " \"%s\" ", exp->subst.text);
275 break;
276 case exp_stringize:
277 fprintf(stderr, " #(%d) ", exp->subst.argidx);
278 break;
279 case exp_concat:
280 fprintf(stderr, "##");
281 break;
282 case exp_subst:
283 fprintf(stderr, " <%d> ", exp->subst.argidx);
284 break;
285 }
286 }
287 fprintf(stderr, ">\n");
288 }
289 return ppp;
290}
char * xstrdup(const char *s)
Definition: uimain.c:768
void * xmalloc(int size)
Definition: uimain.c:747
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
GLuint id
Definition: glext.h:5910
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
DWORD exp
Definition: msg.c:16058
#define args
Definition: format.c:66
int variadic
Definition: wpp_private.h:83
mtext_t * mtext
Definition: wpp_private.h:103
struct list entry
Definition: wpp_private.h:78
int nargs
Definition: wpp_private.h:101
marg_t ** margs
Definition: wpp_private.h:100
int pedantic
Definition: widl.c:97
int ppy_warning(const char *s,...)
Definition: wpp.c:508
static int pphash(const char *str)
Definition: wpp.c:116
pp_entry_t * pplookup(const char *ident)
Definition: wpp.c:124
static struct list pp_defines[HASHKEY]
Definition: wpp.c:41
void pp_del_define(const char *name)
Definition: wpp.c:178

◆ pp_del_define()

void pp_del_define ( const char name)

Definition at line 176 of file preproc.c.

177{
178 pp_entry_t *ppp;
179 int idx = pphash(name);
180
181 if((ppp = pplookup(name)) == NULL)
182 {
184 ppy_warning("%s was not defined", name);
185 return;
186 }
187
188 free( ppp->ident );
189 free( ppp->subst.text );
190 free( ppp->filename );
191 free_pp_entry( ppp, idx );
192}
static void free_pp_entry(pp_entry_t *ppp, int idx)
Definition: preproc.c:111
Definition: name.c:39

Referenced by del_cmdline_defines(), del_special_defines(), pp_add_define(), pp_add_macro(), and pp_pop_define_state().

◆ pp_do_include()

void pp_do_include ( char fname,
int  type 
)

◆ pp_get_if_depth()

int pp_get_if_depth ( void  )

Definition at line 433 of file preproc.c.

434{
435 return if_stack_idx;
436}
static int if_stack_idx
Definition: preproc.c:43

Referenced by wpp_parse().

◆ pp_if_state()

pp_if_state_t pp_if_state ( void  )

Definition at line 405 of file preproc.c.

406{
407 if(!if_stack_idx)
408 return if_true;
409 else
410 return if_stack[if_stack_idx-1];
411}
static pp_if_state_t if_stack[MAXIFSTACK]
Definition: preproc.c:42

Referenced by pp_next_if_state(), pp_pop_if(), and pp_push_if().

◆ pp_next_if_state()

void pp_next_if_state ( int  i)

Definition at line 414 of file preproc.c.

415{
416 switch(pp_if_state())
417 {
418 case if_true:
419 case if_elsetrue:
421 break;
422 case if_false:
423 case if_elsefalse:
424 case if_elif:
425 case if_ignore:
427 break;
428 default:
429 pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #{if,ifdef,ifndef} directive", (int)pp_if_state());
430 }
431}
pp_if_state_t pp_if_state(void)
Definition: preproc.c:405
void pp_push_if(pp_if_state_t s)
Definition: preproc.c:357
void WINAPIV pp_internal_error(const char *file, int line, const char *s,...)
Definition: preproc.c:438
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ pp_open_include()

void * pp_open_include ( const char name,
int  type,
const char parent_name,
char **  newpath 
)

Definition at line 290 of file preproc.c.

291{
292 char *path;
293 void *fp;
294
295 if (!(path = wpp_lookup(name, type, parent_name))) return NULL;
296 fp = wpp_open(path, type);
297
298 if (fp)
299 {
300 if (newpath) *newpath = path;
301 else free( path );
302 return fp;
303 }
304 free( path );
305 return NULL;
306}
void * wpp_open(const char *filename, int type)
Definition: compiler.c:195
char * wpp_lookup(const char *filename, int type, const char *parent_name)
Definition: compiler.c:162
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ pp_pop_if()

pp_if_state_t pp_pop_if ( void  )

Definition at line 380 of file preproc.c.

381{
382 if(if_stack_idx <= 0)
383 {
384 ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)");
385 return if_error;
386 }
387
388 switch(pp_if_state())
389 {
390 case if_true:
391 case if_elsetrue:
392 break;
393 case if_false:
394 case if_elsefalse:
395 case if_elif:
396 case if_ignore:
398 break;
399 default:
400 pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state());
401 }
402 return if_stack[--if_stack_idx];
403}
int WINAPIV ppy_error(const char *msg,...)
Definition: compiler.c:135
void pp_pop_ignore_state(void)

Referenced by wpp_parse().

◆ pp_pop_ignore_state()

void pp_pop_ignore_state ( void  )

◆ pp_push_if()

void pp_push_if ( pp_if_state_t  s)

Definition at line 357 of file preproc.c.

358{
360 pp_internal_error(__FILE__, __LINE__, "#if-stack overflow; #{if,ifdef,ifndef} nested too deeply (> %d)", MAXIFSTACK);
361
363
364 switch(s)
365 {
366 case if_true:
367 case if_elsetrue:
368 break;
369 case if_false:
370 case if_elsefalse:
371 case if_elif:
372 case if_ignore:
374 break;
375 default:
376 pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state());
377 }
378}
#define MAXIFSTACK
Definition: preproc.c:41
void pp_push_ignore_state(void)
GLdouble s
Definition: gl.h:2039

Referenced by pp_next_if_state().

◆ pp_push_ignore_state()

void pp_push_ignore_state ( void  )

◆ pplookup()

pp_entry_t * pplookup ( const char ident)

Definition at line 95 of file preproc.c.

96{
97 int idx;
98 pp_entry_t *ppp;
99
100 if(!ident)
101 return NULL;
102 idx = pphash(ident);
103 for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next)
104 {
105 if(!strcmp(ident, ppp->ident))
106 return ppp;
107 }
108 return NULL;
109}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
_In_ ULONG _In_ ULONG_PTR ident
Definition: winddi.h:3994

Referenced by pp_add_define(), pp_add_macro(), and pp_del_define().

◆ ppy_error()

int ppy_error ( const char s,
  ... 
)

◆ ppy_lex()

int ppy_lex ( void  )

◆ ppy_parse()

int ppy_parse ( void  )

◆ ppy_warning()

int int ppy_warning ( const char s,
  ... 
)

◆ wpp_add_cmdline_define()

void wpp_add_cmdline_define ( const char value)

Definition at line 588 of file wpp.c.

589{
590 char *p;
591 char *str = xstrdup(value);
592
593 p = strchr( str, '=' );
594 if (p) *p++ = 0;
595 wpp_add_define( str, p );
596 free( str );
597}
GLfloat GLfloat p
Definition: glext.h:8902
const WCHAR * str
Definition: pdh_main.c:96
static void wpp_add_define(const char *name, const char *value)
Definition: wpp.c:547

◆ wpp_add_include_path()

void wpp_add_include_path ( const char path)

Definition at line 298 of file wpp.c.

299{
300 char *dir = xstrdup(path);
301 char *cptr;
302
303 for(cptr = dir; *cptr; cptr++)
304 {
305 /* Convert to forward slash */
306 if(*cptr == '\\')
307 *cptr = '/';
308 }
309 /* Kill eventual trailing '/' */
310 if(*(cptr = dir + strlen(dir)-1) == '/') *cptr = '\0';
311
313}
unsigned int dir
Definition: maze.c:112
static void strarray_add(struct strarray *array, const char *str)
Definition: tools.h:183
static struct strarray includes
Definition: wpp.c:57

◆ wpp_del_define()

void wpp_del_define ( const char name)

Definition at line 420 of file compiler.c.

421{
422 struct define *def;
423
424 for (def = cmdline_defines; def; def = def->next)
425 {
426 if (!strcmp( def->name, name ))
427 {
428 free( def->value );
429 def->value = NULL;
430 return;
431 }
432 }
433}
static struct define * cmdline_defines
Definition: compiler.c:70
char * value
Definition: compiler.c:67
char * name
Definition: compiler.c:66
struct define * next
Definition: compiler.c:65

Referenced by preprocess_shader().

◆ wpp_find_include()

char * wpp_find_include ( const char name,
const char parent_name 
)

Definition at line 315 of file wpp.c.

316{
317 return wpp_lookup(name, !!parent_name, parent_name);
318}
static char * wpp_lookup(const char *name, int type, const char *parent_name)
Definition: wpp.c:59

◆ wpp_parse()

int wpp_parse ( const char input,
FILE output 
)

Definition at line 437 of file compiler.c.

438{
439 int ret;
440
444 pp_status.state = 0;
445
447 if(ret)
448 return ret;
451
452 if (!input) pp_status.file = stdin;
453 else if (!(pp_status.file = wpp_open(input, 1)))
454 {
455 ppy_error("Could not open %s\n", input);
459 return 2;
460 }
461
463
464 ppy_out = output;
465 pp_writestring("# 1 \"%s\" 1\n", input ? input : "");
466
467 ret = ppy_parse();
468 /* If there were errors during processing, return an error code */
470
471 if (input)
472 {
475 }
476 /* Clean if_stack, it could remain dirty on errors */
477 while (pp_get_if_depth()) pp_pop_if();
481 return ret;
482}
static void del_special_defines(void)
Definition: compiler.c:367
static void add_special_defines(void)
Definition: compiler.c:346
void wpp_close(void *file)
Definition: compiler.c:258
static void add_cmdline_defines(void)
Definition: compiler.c:326
static void del_cmdline_defines(void)
Definition: compiler.c:336
int pp_get_if_depth(void)
Definition: preproc.c:433
int pp_push_define_state(void)
Definition: preproc.c:148
void pp_pop_define_state(void)
Definition: preproc.c:161
pp_if_state_t pp_pop_if(void)
Definition: preproc.c:380
void WINAPIV int ppy_parse(void)
FILE * ppy_out
void WINAPIV pp_writestring(const char *format,...) __attribute__((format(printf
return ret
Definition: mutex.c:146
GLenum GLenum GLenum input
Definition: glext.h:9031
#define stdin
Definition: stdio.h:98
void * file
Definition: wpp_private.h:221
int char_number
Definition: wpp_private.h:223

Referenced by main(), open_input_file(), and preprocess_shader().

◆ wpp_set_debug()

void wpp_set_debug ( int  lex_debug,
int  parser_debug,
int  msg_debug 
)

Definition at line 601 of file wpp.c.

602{
603 pp_flex_debug = lex_debug;
605 pp_status.debug = msg_debug;
606}
int parser_debug
Definition: widl.c:95
int pp_flex_debug
Definition: wpp.c:47
int ppy_debug
Definition: wpp.c:47

Variable Documentation

◆ pedantic

int pedantic
extern

Definition at line 97 of file widl.c.

Referenced by option_callback(), pp_add_define(), pp_add_macro(), pp_del_define(), and tt_loader_init().

◆ pp_flex_debug

int pp_flex_debug
extern

Definition at line 47 of file wpp.c.

Referenced by pp_pop_if(), pp_push_if(), and wpp_set_debug().

◆ pp_incl_state

include_state_t pp_incl_state
extern

◆ pp_status

Definition at line 29 of file preproc.c.

◆ ppy_debug

int ppy_debug
extern

Definition at line 47 of file wpp.c.

Referenced by wpp_set_debug().

◆ ppy_in

FILE* ppy_in
extern

◆ ppy_out

FILE* ppy_out
extern

◆ ppy_text

char* ppy_text
extern