#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "wine/wpp.h"
#include "wpp_private.h"
Go to the source code of this file.
|
void * | pp_xmalloc (size_t size) |
|
void * | pp_xrealloc (void *p, size_t size) |
|
char * | pp_xstrdup (const char *str) |
|
static char * | wpp_default_lookup (const char *name, int type, const char *parent_name, char **include_path, int include_path_count) |
|
static void * | wpp_default_open (const char *filename, int type) |
|
static void | wpp_default_close (void *file) |
|
static int | wpp_default_read (void *file, char *buffer, unsigned int len) |
|
static void | wpp_default_write (const char *buffer, unsigned int len) |
|
static int | pphash (const char *str) |
|
pp_entry_t * | pplookup (const char *ident) |
|
static void | free_pp_entry (pp_entry_t *ppp, int idx) |
|
int | pp_push_define_state (void) |
|
void | pp_pop_define_state (void) |
|
void | pp_del_define (const char *name) |
|
pp_entry_t * | pp_add_define (const char *def, const char *text) |
|
pp_entry_t * | pp_add_macro (char *id, marg_t *args[], int nargs, mtext_t *exp) |
|
int | wpp_add_include_path (const char *path) |
|
char * | wpp_find_include (const char *name, const char *parent_name) |
|
void * | pp_open_include (const char *name, int type, const char *parent_name, char **newpath) |
|
void | pp_push_if (pp_if_state_t s) |
|
pp_if_state_t | pp_pop_if (void) |
|
pp_if_state_t | pp_if_state (void) |
|
void | pp_next_if_state (int i) |
|
int | pp_get_if_depth (void) |
|
static void | generic_msg (const char *s, const char *t, const char *n, va_list ap) |
|
static void | wpp_default_error (const char *file, int line, int col, const char *near, const char *msg, va_list ap) |
|
static void | wpp_default_warning (const char *file, int line, int col, const char *near, const char *msg, va_list ap) |
|
int | ppy_error (const char *s,...) |
|
int | ppy_warning (const char *s,...) |
|
void | pp_internal_error (const char *file, int line, const char *s,...) |
|
◆ HASHKEY
◆ INCLUDESEPARATOR
◆ MAXIFSTACK
◆ pp_def_state_t
◆ free_pp_entry()
Definition at line 237 of file preproc.c.
pp_entry_t * defines[HASHKEY]
includelogicentry_t * pp_includelogiclist
struct includelogicentry * prev
struct includelogicentry * next
includelogicentry_t * iep
Referenced by pp_del_define().
◆ generic_msg()
Definition at line 688 of file preproc.c.
693 #ifdef WANT_NEAR_INDICATION
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char * pp_xstrdup(const char *str)
void int int ULONGLONG int va_list * ap
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
Referenced by wpp_default_error(), and wpp_default_warning().
◆ pp_add_define()
Definition at line 323 of file preproc.c.
342 memset( ppp, 0,
sizeof(*ppp) );
357 ppp->
next->prev = ppp;
pp_entry_t * defines[HASHKEY]
#define memmove(s1, s2, n)
ACPI_SIZE strlen(const char *String)
char * pp_xstrdup(const char *str)
void pp_del_define(const char *name)
union pp_entry::@233 subst
pp_entry_t * pplookup(const char *ident)
char * strchr(const char *String, int ch)
void * pp_xmalloc(size_t size)
◆ pp_add_macro()
Definition at line 384 of file preproc.c.
401 memset( ppp, 0,
sizeof(*ppp) );
417 ppp->
next->prev = ppp;
pp_entry_t * defines[HASHKEY]
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char * pp_xstrdup(const char *str)
void pp_del_define(const char *name)
union pp_entry::@233 subst
pp_entry_t * pplookup(const char *ident)
void * pp_xmalloc(size_t size)
◆ pp_del_define()
Definition at line 302 of file preproc.c.
union pp_entry::@233 subst
pp_entry_t * pplookup(const char *ident)
◆ pp_get_if_depth()
◆ pp_if_state()
◆ pp_internal_error()
Definition at line 754 of file preproc.c.
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void int int ULONGLONG int va_list * ap
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
◆ pp_next_if_state()
Definition at line 662 of file preproc.c.
void WINAPIV pp_internal_error(const char *file, int line, const char *s,...)
void pp_push_if(pp_if_state_t s)
pp_if_state_t pp_if_state(void)
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
◆ pp_open_include()
Definition at line 514 of file preproc.c.
527 if (newpath) *newpath =
path;
void *(* open)(const char *filename, int type)
GLsizei const GLchar ** path
GLuint GLuint GLsizei GLenum type
char *(* lookup)(const char *filename, int type, const char *parent_name, char **include_path, int include_path_count)
◆ pp_pop_define_state()
Definition at line 287 of file preproc.c.
pp_entry_t * defines[HASHKEY]
void pp_del_define(const char *name)
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
◆ pp_pop_if()
Definition at line 618 of file preproc.c.
622 ppy_error(
"#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)");
void WINAPIV pp_internal_error(const char *file, int line, const char *s,...)
pp_if_state_t pp_if_state(void)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void pp_pop_ignore_state(void)
◆ pp_push_define_state()
Definition at line 274 of file preproc.c.
void * pp_xmalloc(size_t size)
◆ pp_push_if()
Definition at line 592 of file preproc.c.
void WINAPIV pp_internal_error(const char *file, int line, const char *s,...)
pp_if_state_t pp_if_state(void)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void pp_push_ignore_state(void)
◆ pp_xmalloc()
◆ pp_xrealloc()
◆ pp_xstrdup()
Definition at line 105 of file preproc.c.
ACPI_SIZE strlen(const char *String)
#define memcpy(s1, s2, n)
void * pp_xmalloc(size_t size)
◆ pphash()
◆ pplookup()
Definition at line 221 of file preproc.c.
pp_entry_t * defines[HASHKEY]
_In_ ULONG _In_ ULONG_PTR ident
int strcmp(const char *String1, const char *String2)
◆ ppy_error()
Definition at line 735 of file preproc.c.
void(* error)(const char *file, int line, int col, const char *near, const char *msg, va_list ap)
void int int ULONGLONG int va_list * ap
Referenced by pp_pop_if().
◆ ppy_warning()
◆ wpp_add_include_path()
Definition at line 460 of file preproc.c.
481 for(cptr =
dir; *cptr; cptr++)
ACPI_SIZE strlen(const char *String)
void * pp_xrealloc(void *p, size_t size)
char * pp_xstrdup(const char *str)
char * strtok(char *String, const char *Delimiters)
Referenced by main().
◆ wpp_default_close()
static void wpp_default_close |
( |
void * |
file | ) |
|
|
static |
Definition at line 200 of file preproc.c.
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
◆ wpp_default_error()
Definition at line 711 of file preproc.c.
void int int ULONGLONG int va_list * ap
◆ wpp_default_lookup()
Definition at line 118 of file preproc.c.
132 for(ccptr =
name; *ccptr; ccptr++)
147 if(
type && parent_name)
152 if ((
p =
strrchr( parent_name,
'/' )))
p++;
153 else p = parent_name;
172 for(
i = 0;
i < include_path_count;
i++)
char * strcat(char *DstString, const char *SrcString)
ACPI_SIZE strlen(const char *String)
GLsizei const GLchar ** path
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define memcpy(s1, s2, n)
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
void * pp_xmalloc(size_t size)
char * strcpy(char *DstString, const char *SrcString)
GLuint GLuint GLsizei GLenum type
Referenced by wpp_find_include().
◆ wpp_default_open()
Definition at line 196 of file preproc.c.
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
◆ wpp_default_read()
Definition at line 204 of file preproc.c.
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
◆ wpp_default_warning()
Definition at line 717 of file preproc.c.
void int int ULONGLONG int va_list * ap
◆ wpp_default_write()
Definition at line 208 of file preproc.c.
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
◆ wpp_find_include()
◆ default_callbacks
◆ if_stack
◆ if_stack_idx
◆ includepath
◆ nincludepath
◆ pp_def_state
◆ pp_if_state_str
Initial value:= {
"if_false",
"if_true",
"if_elif",
"if_elsefalse",
"if_elsetrue",
"if_ignore"
}
Definition at line 583 of file preproc.c.
Referenced by pp_pop_if(), and pp_push_if().
◆ pp_status
◆ wpp_callbacks