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
2edd194a
Commit
2edd194a
authored
Mar 21, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Move diagnostic and location functions to parser.l.
parent
be1e3082
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
62 deletions
+62
-62
parser.h
tools/widl/parser.h
+6
-3
parser.l
tools/widl/parser.l
+51
-0
parser.y
tools/widl/parser.y
+2
-8
utils.c
tools/widl/utils.c
+2
-43
utils.h
tools/widl/utils.h
+1
-1
widl.c
tools/widl/widl.c
+0
-2
widl.h
tools/widl/widl.h
+0
-3
widltypes.h
tools/widl/widltypes.h
+0
-2
No files found.
tools/widl/parser.h
View file @
2edd194a
...
@@ -21,16 +21,19 @@
...
@@ -21,16 +21,19 @@
#ifndef __WIDL_PARSER_H
#ifndef __WIDL_PARSER_H
#define __WIDL_PARSER_H
#define __WIDL_PARSER_H
#include "widltypes.h"
int
parser_parse
(
void
);
int
parser_parse
(
void
);
extern
void
generic_msg
(
const
struct
location
*
where
,
const
char
*
s
,
const
char
*
t
,
va_list
ap
);
extern
void
parser_error
(
const
char
*
message
);
extern
void
init_location
(
struct
location
*
where
);
extern
FILE
*
parser_in
;
extern
FILE
*
parser_in
;
extern
char
*
parser_text
;
extern
int
parser_debug
;
extern
int
parser_debug
;
extern
int
yy_flex_debug
;
extern
int
yy_flex_debug
;
extern
int
parse_only
;
extern
int
parse_only
;
void
push_import
(
char
*
import_name
);
void
pop_import
(
void
);
int
is_type
(
const
char
*
name
);
int
is_type
(
const
char
*
name
);
...
...
tools/widl/parser.l
View file @
2edd194a
...
@@ -78,6 +78,7 @@ struct import
...
@@ -78,6 +78,7 @@ struct import
struct list entry;
struct list entry;
};
};
static struct list imports = LIST_INIT( imports );
static struct list imports = LIST_INIT( imports );
static int line_number = 1;
/* converts an integer in string form to an unsigned long and prints an error
/* converts an integer in string form to an unsigned long and prints an error
* on overflow */
* on overflow */
...
@@ -511,6 +512,56 @@ static void switch_to_acf(void)
...
@@ -511,6 +512,56 @@ static void switch_to_acf(void)
yy_switch_to_buffer( yy_create_buffer( file, YY_BUF_SIZE ) );
yy_switch_to_buffer( yy_create_buffer( file, YY_BUF_SIZE ) );
}
}
#define CURRENT_LOCATION { input_name ? input_name : "stdin", parser_text, line_number, 0, line_number, 0 }
static const int want_near_indication = 0;
static void make_print(char *str)
{
while(*str)
{
if(!isprint(*str))
*str = ' ';
str++;
}
}
void init_location( struct location *where )
{
where->input_name = input_name ? input_name : "stdin";
where->near_text = parser_text;
where->first_line = line_number;
where->last_line = line_number;
}
void generic_msg( const struct location *where, const char *s, const char *t, va_list ap )
{
struct location cur_loc = CURRENT_LOCATION;
if (!where) where = &cur_loc;
fprintf( stderr, "%s:%d: %s: ", where->input_name, where->first_line, t );
vfprintf( stderr, s, ap );
if (want_near_indication)
{
char *cpy;
if (where->near_text)
{
cpy = xstrdup( where->near_text );
make_print( cpy );
fprintf( stderr, " near '%s'", cpy );
free( cpy );
}
}
}
/* yyerror: yacc assumes this is not newline terminated. */
void parser_error( const char *message )
{
error_loc( "%s\n", message );
}
static void warning_disable(int warning)
static void warning_disable(int warning)
{
{
warning_t *warning_entry;
warning_t *warning_entry;
...
...
tools/widl/parser.y
View file @
2edd194a
...
@@ -125,6 +125,8 @@ static typelib_t *current_typelib;
...
@@ -125,6 +125,8 @@ static typelib_t *current_typelib;
{
{
int parser_lex( PARSER_STYPE *yylval );
int parser_lex( PARSER_STYPE *yylval );
void push_import( char *input_name );
void pop_import(void);
}
}
...
@@ -3389,14 +3391,6 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
...
@@ -3389,14 +3391,6 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
return list;
return list;
}
}
void init_location( struct location *where )
{
where->input_name = input_name ? input_name : "stdin";
where->near_text = parser_text;
where->first_line = line_number;
where->last_line = line_number;
}
type_t *find_parameterized_type(type_t *type, typeref_list_t *params)
type_t *find_parameterized_type(type_t *type, typeref_list_t *params)
{
{
char *name = format_parameterized_type_name(type, params);
char *name = format_parameterized_type_name(type, params);
...
...
tools/widl/utils.c
View file @
2edd194a
...
@@ -32,51 +32,11 @@
...
@@ -32,51 +32,11 @@
#include "utils.h"
#include "utils.h"
#include "parser.h"
#include "parser.h"
#define CURRENT_LOCATION { input_name ? input_name : "stdin", parser_text, line_number, 0, line_number, 0 }
static
const
int
want_near_indication
=
0
;
static
void
make_print
(
char
*
str
)
{
while
(
*
str
)
{
if
(
!
isprint
(
*
str
))
*
str
=
' '
;
str
++
;
}
}
static
void
generic_msg
(
const
struct
location
*
where
,
const
char
*
s
,
const
char
*
t
,
va_list
ap
)
{
fprintf
(
stderr
,
"%s:%d: %s: "
,
where
->
input_name
,
where
->
first_line
,
t
);
vfprintf
(
stderr
,
s
,
ap
);
if
(
want_near_indication
)
{
char
*
cpy
;
if
(
where
->
near_text
)
{
cpy
=
xstrdup
(
where
->
near_text
);
make_print
(
cpy
);
fprintf
(
stderr
,
" near '%s'"
,
cpy
);
free
(
cpy
);
}
}
}
/* yyerror: yacc assumes this is not newline terminated. */
void
parser_error
(
const
char
*
s
)
{
error_loc
(
"%s
\n
"
,
s
);
}
void
error_at
(
const
struct
location
*
where
,
const
char
*
s
,
...
)
void
error_at
(
const
struct
location
*
where
,
const
char
*
s
,
...
)
{
{
struct
location
cur_loc
=
CURRENT_LOCATION
;
va_list
ap
;
va_list
ap
;
va_start
(
ap
,
s
);
va_start
(
ap
,
s
);
generic_msg
(
where
?
where
:
&
cur_loc
,
s
,
"error"
,
ap
);
generic_msg
(
where
,
s
,
"error"
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -102,10 +62,9 @@ void warning(const char *s, ...)
...
@@ -102,10 +62,9 @@ void warning(const char *s, ...)
void
warning_at
(
const
struct
location
*
where
,
const
char
*
s
,
...
)
void
warning_at
(
const
struct
location
*
where
,
const
char
*
s
,
...
)
{
{
struct
location
cur_loc
=
CURRENT_LOCATION
;
va_list
ap
;
va_list
ap
;
va_start
(
ap
,
s
);
va_start
(
ap
,
s
);
generic_msg
(
where
?
where
:
&
cur_loc
,
s
,
"warning"
,
ap
);
generic_msg
(
where
,
s
,
"warning"
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
}
}
...
...
tools/widl/utils.h
View file @
2edd194a
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
#define __WIDL_UTILS_H
#define __WIDL_UTILS_H
#include "widltypes.h"
#include "widltypes.h"
#include "parser.h"
void
parser_error
(
const
char
*
s
)
__attribute__
((
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)))
__attribute__
((
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)))
__attribute__
((
noreturn
));
void
error_at
(
const
struct
location
*
,
const
char
*
s
,
...
)
__attribute__
((
format
(
printf
,
2
,
3
)))
__attribute__
((
noreturn
));
void
error_at
(
const
struct
location
*
,
const
char
*
s
,
...
)
__attribute__
((
format
(
printf
,
2
,
3
)))
__attribute__
((
noreturn
));
#define error_loc( ... ) error_at( NULL, ## __VA_ARGS__ )
#define error_loc( ... ) error_at( NULL, ## __VA_ARGS__ )
...
...
tools/widl/widl.c
View file @
2edd194a
...
@@ -140,8 +140,6 @@ static struct strarray dlldirs;
...
@@ -140,8 +140,6 @@ static struct strarray dlldirs;
static
char
*
output_name
;
static
char
*
output_name
;
static
const
char
*
sysroot
=
""
;
static
const
char
*
sysroot
=
""
;
int
line_number
=
1
;
static
FILE
*
idfile
;
static
FILE
*
idfile
;
unsigned
int
pointer_size
=
0
;
unsigned
int
pointer_size
=
0
;
...
...
tools/widl/widl.h
View file @
2edd194a
...
@@ -72,9 +72,6 @@ extern const char *prefix_server;
...
@@ -72,9 +72,6 @@ extern const char *prefix_server;
extern
unsigned
int
pointer_size
;
extern
unsigned
int
pointer_size
;
extern
time_t
now
;
extern
time_t
now
;
extern
int
line_number
;
extern
int
char_number
;
enum
stub_mode
enum
stub_mode
{
{
MODE_Os
,
/* inline stubs */
MODE_Os
,
/* inline stubs */
...
...
tools/widl/widltypes.h
View file @
2edd194a
...
@@ -656,8 +656,6 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
...
@@ -656,8 +656,6 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
var_t
*
make_var
(
char
*
name
);
var_t
*
make_var
(
char
*
name
);
var_list_t
*
append_var
(
var_list_t
*
list
,
var_t
*
var
);
var_list_t
*
append_var
(
var_list_t
*
list
,
var_t
*
var
);
void
init_location
(
struct
location
*
);
char
*
format_namespace
(
struct
namespace
*
namespace
,
const
char
*
prefix
,
const
char
*
separator
,
const
char
*
suffix
,
char
*
format_namespace
(
struct
namespace
*
namespace
,
const
char
*
prefix
,
const
char
*
separator
,
const
char
*
suffix
,
const
char
*
abi_prefix
);
const
char
*
abi_prefix
);
char
*
format_parameterized_type_name
(
type_t
*
type
,
typeref_list_t
*
params
);
char
*
format_parameterized_type_name
(
type_t
*
type
,
typeref_list_t
*
params
);
...
...
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