Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
91872318
Commit
91872318
authored
Jul 02, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Get rid of the no longer needed callbacks.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c8d34ef0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
87 deletions
+16
-87
wpp.h
include/wine/wpp.h
+0
-25
ppl.l
libs/wpp/ppl.l
+4
-4
preproc.c
libs/wpp/preproc.c
+8
-50
wpp.c
libs/wpp/wpp.c
+2
-8
wpp_private.h
libs/wpp/wpp_private.h
+2
-0
No files found.
include/wine/wpp.h
View file @
91872318
...
@@ -24,30 +24,6 @@
...
@@ -24,30 +24,6 @@
#include <stdio.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdarg.h>
struct
wpp_callbacks
{
/* I/O callbacks */
/* Looks for a file to include, returning the path where it is found */
/* The type param is true for local (#include "filename.h") includes */
/* parent_name is the directory of the parent source file, includepath
* is an array of additional include paths */
char
*
(
*
lookup
)(
const
char
*
filename
,
int
type
,
const
char
*
parent_name
,
char
**
include_path
,
int
include_path_count
);
/* Opens an include file */
void
*
(
*
open
)(
const
char
*
filename
,
int
type
);
/* Closes a previously opened file */
void
(
*
close
)(
void
*
file
);
/* Reads buffer from the input */
int
(
*
read
)(
void
*
file
,
char
*
buffer
,
unsigned
int
len
);
/* Writes buffer to the output */
void
(
*
write
)(
const
char
*
buffer
,
unsigned
int
len
);
/* Error callbacks */
void
(
*
error
)(
const
char
*
file
,
int
line
,
int
col
,
const
char
*
near
,
const
char
*
msg
,
va_list
ap
);
void
(
*
warning
)(
const
char
*
file
,
int
line
,
int
col
,
const
char
*
near
,
const
char
*
msg
,
va_list
ap
);
};
/* Return value == 0 means successful execution */
/* Return value == 0 means successful execution */
extern
int
wpp_add_define
(
const
char
*
name
,
const
char
*
value
);
extern
int
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
);
...
@@ -57,6 +33,5 @@ extern void wpp_set_pedantic( int on );
...
@@ -57,6 +33,5 @@ extern void wpp_set_pedantic( int on );
extern
int
wpp_add_include_path
(
const
char
*
path
);
extern
int
wpp_add_include_path
(
const
char
*
path
);
extern
char
*
wpp_find_include
(
const
char
*
name
,
const
char
*
parent_name
);
extern
char
*
wpp_find_include
(
const
char
*
name
,
const
char
*
parent_name
);
extern
int
wpp_parse
(
const
char
*
input
,
FILE
*
output
);
extern
int
wpp_parse
(
const
char
*
input
,
FILE
*
output
);
extern
void
wpp_set_callbacks
(
const
struct
wpp_callbacks
*
callbacks
);
#endif
/* __WINE_WPP_H */
#endif
/* __WINE_WPP_H */
libs/wpp/ppl.l
View file @
91872318
...
@@ -306,7 +306,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
...
@@ -306,7 +306,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
#define YY_INPUT(buf,result,max_size) \
#define YY_INPUT(buf,result,max_size) \
{ \
{ \
result =
wpp_callbacks->read(pp_status.file, buf, max_size);
\
result =
fread(buf, 1, max_size, pp_status.file);
\
}
}
#define BUFFERINITIALCAPACITY 256
#define BUFFERINITIALCAPACITY 256
...
@@ -353,7 +353,7 @@ void pp_writestring(const char *format, ...)
...
@@ -353,7 +353,7 @@ void pp_writestring(const char *format, ...)
va_end(valist);
va_end(valist);
}
}
wpp_callbacks->write(buffer, len
);
fwrite(buffer, 1, len, ppy_out
);
}
}
%}
%}
...
@@ -1340,7 +1340,7 @@ static bufferstackentry_t *pop_buffer(void)
...
@@ -1340,7 +1340,7 @@ static bufferstackentry_t *pop_buffer(void)
if(!bufferstack[bufferstackidx].should_pop)
if(!bufferstack[bufferstackidx].should_pop)
{
{
wpp_callbacks->
close(pp_status.file);
f
close(pp_status.file);
pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename);
pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename);
/* We have EOF, check the include logic */
/* We have EOF, check the include logic */
...
@@ -1561,7 +1561,7 @@ static void put_buffer(const char *s, int len)
...
@@ -1561,7 +1561,7 @@ static void put_buffer(const char *s, int len)
if(top_macro())
if(top_macro())
add_text_to_macro(s, len);
add_text_to_macro(s, len);
else
else
wpp_callbacks->write(s, len
);
fwrite(s, 1, len, ppy_out
);
}
}
...
...
libs/wpp/preproc.c
View file @
91872318
...
@@ -112,8 +112,8 @@ char *pp_xstrdup(const char *str)
...
@@ -112,8 +112,8 @@ char *pp_xstrdup(const char *str)
return
memcpy
(
s
,
str
,
len
);
return
memcpy
(
s
,
str
,
len
);
}
}
static
char
*
wpp_default
_lookup
(
const
char
*
name
,
int
type
,
const
char
*
parent_name
,
char
*
wpp
_lookup
(
const
char
*
name
,
int
type
,
const
char
*
parent_name
,
char
**
include_path
,
int
include_path_count
)
char
**
include_path
,
int
include_path_count
)
{
{
char
*
cpy
;
char
*
cpy
;
char
*
cptr
;
char
*
cptr
;
...
@@ -190,22 +190,6 @@ static char *wpp_default_lookup(const char *name, int type, const char *parent_n
...
@@ -190,22 +190,6 @@ static char *wpp_default_lookup(const char *name, int type, const char *parent_n
return
NULL
;
return
NULL
;
}
}
static
void
*
wpp_default_open
(
const
char
*
filename
,
int
type
)
{
return
fopen
(
filename
,
"rt"
);
}
static
void
wpp_default_close
(
void
*
file
)
{
fclose
(
file
);
}
static
int
wpp_default_read
(
void
*
file
,
char
*
buffer
,
unsigned
int
len
){
return
fread
(
buffer
,
1
,
len
,
file
);
}
static
void
wpp_default_write
(
const
char
*
buffer
,
unsigned
int
len
)
{
fwrite
(
buffer
,
1
,
len
,
ppy_out
);
}
/* Don't comment on the hash, it's primitive but functional... */
/* Don't comment on the hash, it's primitive but functional... */
static
int
pphash
(
const
char
*
str
)
static
int
pphash
(
const
char
*
str
)
{
{
...
@@ -505,7 +489,7 @@ int wpp_add_include_path(const char *path)
...
@@ -505,7 +489,7 @@ int wpp_add_include_path(const char *path)
char
*
wpp_find_include
(
const
char
*
name
,
const
char
*
parent_name
)
char
*
wpp_find_include
(
const
char
*
name
,
const
char
*
parent_name
)
{
{
return
wpp_
default_
lookup
(
name
,
!!
parent_name
,
parent_name
,
includepath
,
nincludepath
);
return
wpp_lookup
(
name
,
!!
parent_name
,
parent_name
,
includepath
,
nincludepath
);
}
}
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
)
...
@@ -513,9 +497,8 @@ void *pp_open_include(const char *name, int type, const char *parent_name, char
...
@@ -513,9 +497,8 @@ void *pp_open_include(const char *name, int type, const char *parent_name, char
char
*
path
;
char
*
path
;
void
*
fp
;
void
*
fp
;
if
(
!
(
path
=
wpp_callbacks
->
lookup
(
name
,
type
,
parent_name
,
includepath
,
if
(
!
(
path
=
wpp_lookup
(
name
,
type
,
parent_name
,
includepath
,
nincludepath
)))
return
NULL
;
nincludepath
)))
return
NULL
;
fp
=
fopen
(
path
,
"rt"
);
fp
=
wpp_callbacks
->
open
(
path
,
type
);
if
(
fp
)
if
(
fp
)
{
{
...
@@ -705,45 +688,20 @@ end:
...
@@ -705,45 +688,20 @@ end:
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
}
}
static
void
wpp_default_error
(
const
char
*
file
,
int
line
,
int
col
,
const
char
*
near
,
const
char
*
msg
,
va_list
ap
)
{
generic_msg
(
msg
,
"Error"
,
near
,
ap
);
exit
(
1
);
}
static
void
wpp_default_warning
(
const
char
*
file
,
int
line
,
int
col
,
const
char
*
near
,
const
char
*
msg
,
va_list
ap
)
{
generic_msg
(
msg
,
"Warning"
,
near
,
ap
);
}
static
const
struct
wpp_callbacks
default_callbacks
=
{
wpp_default_lookup
,
wpp_default_open
,
wpp_default_close
,
wpp_default_read
,
wpp_default_write
,
wpp_default_error
,
wpp_default_warning
,
};
const
struct
wpp_callbacks
*
wpp_callbacks
=
&
default_callbacks
;
int
ppy_error
(
const
char
*
s
,
...)
int
ppy_error
(
const
char
*
s
,
...)
{
{
va_list
ap
;
va_list
ap
;
va_start
(
ap
,
s
);
va_start
(
ap
,
s
);
wpp_callbacks
->
error
(
pp_status
.
input
,
pp_status
.
line_number
,
pp_status
.
char_number
,
ppy_text
,
s
,
ap
);
generic_msg
(
s
,
"Error"
,
ppy_text
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
pp_status
.
state
=
1
;
exit
(
1
);
return
1
;
}
}
int
ppy_warning
(
const
char
*
s
,
...)
int
ppy_warning
(
const
char
*
s
,
...)
{
{
va_list
ap
;
va_list
ap
;
va_start
(
ap
,
s
);
va_start
(
ap
,
s
);
wpp_callbacks
->
warning
(
pp_status
.
input
,
pp_status
.
line_number
,
pp_status
.
char_number
,
ppy_text
,
s
,
ap
);
generic_msg
(
s
,
"Warning"
,
ppy_text
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
return
0
;
return
0
;
}
}
...
...
libs/wpp/wpp.c
View file @
91872318
...
@@ -197,7 +197,7 @@ int wpp_parse( const char *input, FILE *output )
...
@@ -197,7 +197,7 @@ int wpp_parse( const char *input, FILE *output )
add_special_defines
();
add_special_defines
();
if
(
!
input
)
pp_status
.
file
=
stdin
;
if
(
!
input
)
pp_status
.
file
=
stdin
;
else
if
(
!
(
pp_status
.
file
=
wpp_callbacks
->
open
(
input
,
1
)))
else
if
(
!
(
pp_status
.
file
=
fopen
(
input
,
"rt"
)))
{
{
ppy_error
(
"Could not open %s
\n
"
,
input
);
ppy_error
(
"Could not open %s
\n
"
,
input
);
del_special_defines
();
del_special_defines
();
...
@@ -217,7 +217,7 @@ int wpp_parse( const char *input, FILE *output )
...
@@ -217,7 +217,7 @@ int wpp_parse( const char *input, FILE *output )
if
(
input
)
if
(
input
)
{
{
wpp_callbacks
->
close
(
pp_status
.
file
);
f
close
(
pp_status
.
file
);
free
(
pp_status
.
input
);
free
(
pp_status
.
input
);
}
}
/* Clean if_stack, it could remain dirty on errors */
/* Clean if_stack, it could remain dirty on errors */
...
@@ -227,9 +227,3 @@ int wpp_parse( const char *input, FILE *output )
...
@@ -227,9 +227,3 @@ int wpp_parse( const char *input, FILE *output )
pp_pop_define_state
();
pp_pop_define_state
();
return
ret
;
return
ret
;
}
}
void
wpp_set_callbacks
(
const
struct
wpp_callbacks
*
callbacks
)
{
wpp_callbacks
=
callbacks
;
}
libs/wpp/wpp_private.h
View file @
91872318
...
@@ -190,6 +190,8 @@ void pp_next_if_state(int);
...
@@ -190,6 +190,8 @@ void pp_next_if_state(int);
pp_if_state_t
pp_pop_if
(
void
);
pp_if_state_t
pp_pop_if
(
void
);
pp_if_state_t
pp_if_state
(
void
);
pp_if_state_t
pp_if_state
(
void
);
int
pp_get_if_depth
(
void
);
int
pp_get_if_depth
(
void
);
char
*
wpp_lookup
(
const
char
*
name
,
int
type
,
const
char
*
parent_name
,
char
**
include_path
,
int
include_path_count
);
#ifndef __GNUC__
#ifndef __GNUC__
#define __attribute__(x)
/*nothing*/
#define __attribute__(x)
/*nothing*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment