Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
66fa9a71
Commit
66fa9a71
authored
Apr 25, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Apr 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Create a statement object for import statements.
Move the writing of include directives into the generated header into header.c.
parent
33c891e6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
18 deletions
+42
-18
header.c
tools/widl/header.c
+12
-0
header.h
tools/widl/header.h
+1
-0
parser.l
tools/widl/parser.l
+1
-10
parser.y
tools/widl/parser.y
+28
-8
No files found.
tools/widl/header.c
View file @
66fa9a71
...
...
@@ -1039,3 +1039,15 @@ void write_coclass_forward(type_t *cocl)
fprintf
(
header
,
"typedef struct %s %s;
\n
"
,
cocl
->
name
,
cocl
->
name
);
fprintf
(
header
,
"#endif /* defined __%s_FWD_DEFINED__ */
\n\n
"
,
cocl
->
name
);
}
void
write_import
(
const
char
*
fname
)
{
char
*
hname
,
*
p
;
hname
=
dup_basename
(
fname
,
".idl"
);
p
=
hname
+
strlen
(
hname
)
-
2
;
if
(
p
<=
hname
||
strcmp
(
p
,
".h"
))
strcat
(
hname
,
".h"
);
fprintf
(
header
,
"#include <%s>
\n
"
,
hname
);
free
(
hname
);
}
tools/widl/header.h
View file @
66fa9a71
...
...
@@ -49,6 +49,7 @@ extern int need_proxy_file(const statement_list_t *stmts);
extern
const
var_t
*
is_callas
(
const
attr_list_t
*
list
);
extern
void
write_args
(
FILE
*
h
,
const
var_list_t
*
arg
,
const
char
*
name
,
int
obj
,
int
do_indent
);
extern
void
write_array
(
FILE
*
h
,
array_dims_t
*
v
,
int
field
);
extern
void
write_import
(
const
char
*
fname
);
extern
void
write_forward
(
type_t
*
iface
);
extern
void
write_interface
(
type_t
*
iface
);
extern
void
write_dispinterface
(
type_t
*
iface
);
...
...
tools/widl/parser.l
View file @
66fa9a71
...
...
@@ -411,20 +411,11 @@ struct imports {
int do_import(char *fname)
{
FILE *f;
char *
hname, *path, *p
;
char *
path
;
struct imports *import;
int ptr = import_stack_ptr;
int ret;
if (!parse_only && do_header) {
hname = dup_basename(fname, ".idl");
p = hname + strlen(hname) - 2;
if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
fprintf(header, "#include <%s>\n", hname);
free(hname);
}
import = first_import;
while (import && strcmp(import->name, fname))
import = import->next;
...
...
tools/widl/parser.y
View file @
66fa9a71
...
...
@@ -78,6 +78,12 @@ struct typenode {
struct list entry;
};
struct _import_t
{
char *name;
int import_performed;
};
typelist_t incomplete_types = LIST_INIT(incomplete_types);
static void add_incomplete(type_t *t);
...
...
@@ -150,6 +156,7 @@ static statement_t *make_statement_library(typelib_t *typelib);
static statement_t *make_statement_cppquote(const char *str);
static statement_t *make_statement_importlib(const char *str);
static statement_t *make_statement_module(type_t *type);
static statement_t *make_statement_import(const char *str);
static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
#define tsENUM 1
...
...
@@ -180,7 +187,8 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
unsigned int num;
double dbl;
interface_info_t ifinfo;
typelib_t *typelib;
typelib_t *typelib;
struct _import_t *import;
}
%token <str> aIDENTIFIER
...
...
@@ -298,9 +306,9 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
%type <func_list> int_statements dispint_meths
%type <type> coclass coclasshdr coclassdef
%type <num> pointer_type version
%type <str> libraryhdr callconv cppquote importlib
%type <str> libraryhdr callconv cppquote importlib
import
%type <uuid> uuid_string
%type <
num
> import_start
%type <
import
> import_start
%type <typelib> library_start librarydef
%type <statement> statement typedef
%type <stmt_list> gbl_statements imp_statements
...
...
@@ -387,7 +395,7 @@ statement: constdef ';' { $$ = make_statement_init_decl($1);
| externdef ';' { $$ = make_statement_extern($1);
if (!parse_only && do_header) write_externdef($1);
}
| import { $$ =
NULL
; }
| import { $$ =
make_statement_import($1)
; }
| structdef ';' { $$ = make_statement_type_decl($1);
if (!parse_only && do_header) {
write_type_def_or_decl(header, $1, FALSE, NULL);
...
...
@@ -406,13 +414,18 @@ statement: constdef ';' { $$ = make_statement_init_decl($1);
cppquote: tCPPQUOTE '(' aSTRING ')' { $$ = $3; if (!parse_only && do_header) fprintf(header, "%s\n", $3); }
;
import_start: tIMPORT aSTRING ';' { assert(yychar == YYEMPTY);
$$ = do_import($2);
if (!$$) yychar = aEOF;
$$ = xmalloc(sizeof(struct _import_t));
$$->name = $2;
$$->import_performed = do_import($2);
if (!$$->import_performed) yychar = aEOF;
}
;
import: import_start imp_statements aEOF
{ if ($1) pop_import(); }
import: import_start imp_statements aEOF { $$ = $1->name;
if ($1->import_performed) pop_import();
free($1);
if (!parse_only && do_header) write_import($$);
}
;
importlib: tIMPORTLIB '(' aSTRING ')'
...
...
@@ -2607,6 +2620,13 @@ static statement_t *make_statement_importlib(const char *str)
return stmt;
}
static statement_t *make_statement_import(const char *str)
{
statement_t *stmt = make_statement(STMT_IMPORT);
stmt->u.str = str;
return stmt;
}
static statement_t *make_statement_module(type_t *type)
{
statement_t *stmt = make_statement(STMT_MODULE);
...
...
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