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
29af4f9f
Commit
29af4f9f
authored
Sep 29, 2009
by
Matteo Bruni
Committed by
Alexandre Julliard
Oct 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Add error management callbacks.
parent
28fb6a24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
wpp.h
include/wine/wpp.h
+9
-0
preproc.c
libs/wpp/preproc.c
+22
-3
wpp.c
libs/wpp/wpp.c
+5
-0
wpp_private.h
libs/wpp/wpp_private.h
+2
-0
No files found.
include/wine/wpp.h
View file @
29af4f9f
...
...
@@ -22,6 +22,14 @@
#define __WINE_WPP_H
#include <stdio.h>
#include <stdarg.h>
struct
wpp_callbacks
{
/* 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 */
extern
int
wpp_add_define
(
const
char
*
name
,
const
char
*
value
);
...
...
@@ -33,5 +41,6 @@ extern int wpp_add_include_path( const char *path );
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_temp
(
const
char
*
input
,
const
char
*
output_base
,
char
**
output_name
);
extern
void
wpp_set_callbacks
(
const
struct
wpp_callbacks
*
callbacks
);
#endif
/* __WINE_WPP_H */
libs/wpp/preproc.c
View file @
29af4f9f
...
...
@@ -674,13 +674,32 @@ end:
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_error
,
wpp_default_warning
,
};
const
struct
wpp_callbacks
*
wpp_callbacks
=
&
default_callbacks
;
int
ppy_error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Error"
,
ppy_text
,
ap
);
wpp_callbacks
->
error
(
pp_status
.
input
,
pp_status
.
line_number
,
pp_status
.
char_number
,
ppy_text
,
s
,
ap
);
va_end
(
ap
);
exit
(
1
)
;
pp_status
.
state
=
1
;
return
1
;
}
...
...
@@ -688,7 +707,7 @@ int ppy_warning(const char *s, ...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Warning"
,
ppy_text
,
ap
);
wpp_callbacks
->
warning
(
pp_status
.
input
,
pp_status
.
line_number
,
pp_status
.
char_number
,
ppy_text
,
s
,
ap
);
va_end
(
ap
);
return
0
;
}
...
...
libs/wpp/wpp.c
View file @
29af4f9f
...
...
@@ -230,3 +230,8 @@ int wpp_parse_temp( const char *input, const char *output_base, char **output_na
fclose
(
output
);
return
ret
;
}
void
wpp_set_callbacks
(
const
struct
wpp_callbacks
*
callbacks
)
{
wpp_callbacks
=
callbacks
;
}
libs/wpp/wpp_private.h
View file @
29af4f9f
...
...
@@ -218,6 +218,8 @@ int pp_get_if_depth(void);
#define __attribute__(x)
/*nothing*/
#endif
extern
const
struct
wpp_callbacks
*
wpp_callbacks
;
int
ppy_error
(
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
)));
...
...
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