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
df0e38c0
Commit
df0e38c0
authored
Apr 24, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Apr 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Create a list of statements in the whole IDL file, instead of just a list of interfaces.
parent
58be8923
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
301 additions
and
182 deletions
+301
-182
client.c
tools/widl/client.c
+43
-32
header.c
tools/widl/header.c
+3
-3
header.h
tools/widl/header.h
+3
-3
parser.y
tools/widl/parser.y
+0
-0
proxy.c
tools/widl/proxy.c
+85
-45
server.c
tools/widl/server.c
+42
-31
typegen.c
tools/widl/typegen.c
+75
-42
typegen.h
tools/widl/typegen.h
+5
-5
typelib.c
tools/widl/typelib.c
+3
-11
typelib.h
tools/widl/typelib.h
+1
-1
widl.c
tools/widl/widl.c
+2
-2
widl.h
tools/widl/widl.h
+4
-4
widltypes.h
tools/widl/widltypes.h
+31
-0
write_msft.c
tools/widl/write_msft.c
+4
-3
No files found.
tools/widl/client.c
View file @
df0e38c0
...
...
@@ -431,58 +431,69 @@ static void init_client(void)
}
void
write_client
(
ifref_list_t
*
ifaces
)
static
void
write_client_ifaces
(
const
statement_list_t
*
stmts
,
int
expr_eval_routines
,
unsigned
int
*
proc_offset
)
{
unsigned
int
proc_offset
=
0
;
int
expr_eval_routines
;
ifref_t
*
iface
;
if
(
!
do_client
)
return
;
if
(
do_everything
&&
!
need_stub_files
(
ifaces
))
return
;
init_client
();
if
(
!
client
)
return
;
write_formatstringsdecl
(
client
,
indent
,
ifaces
,
need_stub
);
expr_eval_routines
=
write_expr_eval_routines
(
client
,
client_token
);
if
(
expr_eval_routines
)
write_expr_eval_routine_list
(
client
,
client_token
);
write_user_quad_list
(
client
);
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
iface
,
ifaces
,
ifref_t
,
entry
)
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
if
(
!
need_stub
(
iface
->
iface
))
continue
;
type_t
*
iface
=
stmt
->
u
.
type
;
if
(
!
need_stub
(
iface
))
return
;
fprintf
(
client
,
"/*****************************************************************************
\n
"
);
fprintf
(
client
,
" * %s interface
\n
"
,
iface
->
iface
->
name
);
fprintf
(
client
,
" * %s interface
\n
"
,
iface
->
name
);
fprintf
(
client
,
" */
\n
"
);
fprintf
(
client
,
"
\n
"
);
if
(
iface
->
iface
->
funcs
)
if
(
iface
->
funcs
)
{
write_implicithandledecl
(
iface
->
iface
);
write_implicithandledecl
(
iface
);
write_clientinterfacedecl
(
iface
->
iface
);
write_stubdescdecl
(
iface
->
iface
);
write_function_stubs
(
iface
->
iface
,
&
proc_offset
);
write_clientinterfacedecl
(
iface
);
write_stubdescdecl
(
iface
);
write_function_stubs
(
iface
,
proc_offset
);
print_client
(
"#if !defined(__RPC_WIN32__)
\n
"
);
print_client
(
"#error Invalid build platform for this stub.
\n
"
);
print_client
(
"#endif
\n
"
);
fprintf
(
client
,
"
\n
"
);
write_stubdescriptor
(
iface
->
iface
,
expr_eval_routines
);
write_stubdescriptor
(
iface
,
expr_eval_routines
);
}
}
else
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_client_ifaces
(
stmt
->
u
.
lib
->
stmts
,
expr_eval_routines
,
proc_offset
);
}
}
void
write_client
(
const
statement_list_t
*
stmts
)
{
unsigned
int
proc_offset
=
0
;
int
expr_eval_routines
;
if
(
!
do_client
)
return
;
if
(
do_everything
&&
!
need_stub_files
(
stmts
))
return
;
init_client
();
if
(
!
client
)
return
;
write_formatstringsdecl
(
client
,
indent
,
stmts
,
need_stub
);
expr_eval_routines
=
write_expr_eval_routines
(
client
,
client_token
);
if
(
expr_eval_routines
)
write_expr_eval_routine_list
(
client
,
client_token
);
write_user_quad_list
(
client
);
write_client_ifaces
(
stmts
,
expr_eval_routines
,
&
proc_offset
);
fprintf
(
client
,
"
\n
"
);
write_procformatstring
(
client
,
iface
s
,
need_stub
);
write_typeformatstring
(
client
,
iface
s
,
need_stub
);
write_procformatstring
(
client
,
stmt
s
,
need_stub
);
write_typeformatstring
(
client
,
stmt
s
,
need_stub
);
fclose
(
client
);
}
tools/widl/header.c
View file @
df0e38c0
...
...
@@ -487,11 +487,11 @@ void write_externdef(const var_t *v)
fprintf
(
header
,
";
\n\n
"
);
}
void
write_library
(
const
char
*
name
,
const
attr_list_t
*
attr
)
void
write_library
(
const
typelib_t
*
typelib
)
{
const
UUID
*
uuid
=
get_attrp
(
attr
,
ATTR_UUID
);
const
UUID
*
uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
fprintf
(
header
,
"
\n
"
);
write_guid
(
header
,
"LIBID"
,
name
,
uuid
);
write_guid
(
header
,
"LIBID"
,
typelib
->
name
,
uuid
);
fprintf
(
header
,
"
\n
"
);
}
...
...
tools/widl/header.h
View file @
df0e38c0
...
...
@@ -44,8 +44,8 @@ extern int is_object(const attr_list_t *list);
extern
int
is_local
(
const
attr_list_t
*
list
);
extern
int
need_stub
(
const
type_t
*
iface
);
extern
int
need_proxy
(
const
type_t
*
iface
);
extern
int
need_stub_files
(
const
ifref_list_t
*
iface
s
);
extern
int
need_proxy_file
(
const
ifref_list_t
*
iface
s
);
extern
int
need_stub_files
(
const
statement_list_t
*
stmt
s
);
extern
int
need_proxy_file
(
const
statement_list_t
*
stmt
s
);
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
);
...
...
@@ -58,7 +58,7 @@ extern void write_coclass_forward(type_t *cocl);
extern
void
write_typedef
(
type_t
*
type
);
extern
void
write_constdef
(
const
var_t
*
v
);
extern
void
write_externdef
(
const
var_t
*
v
);
extern
void
write_library
(
const
char
*
name
,
const
attr_list_t
*
attr
);
extern
void
write_library
(
const
typelib_t
*
typelib
);
extern
void
write_user_types
(
void
);
extern
void
write_context_handle_rundowns
(
void
);
extern
void
write_generic_handle_routines
(
void
);
...
...
tools/widl/parser.y
View file @
df0e38c0
This diff is collapsed.
Click to expand it.
tools/widl/proxy.c
View file @
df0e38c0
...
...
@@ -89,7 +89,7 @@ static void write_stubdesc(int expr_eval_routines)
print_proxy
(
"
\n
"
);
}
static
void
init_proxy
(
ifref_list_t
*
iface
s
)
static
void
init_proxy
(
const
statement_list_t
*
stmt
s
)
{
if
(
proxy
)
return
;
if
(
!
(
proxy
=
fopen
(
proxy_name
,
"w"
)))
...
...
@@ -109,7 +109,7 @@ static void init_proxy(ifref_list_t *ifaces)
print_proxy
(
"
\n
"
);
print_proxy
(
"#include
\"
%s
\"\n
"
,
header_name
);
print_proxy
(
"
\n
"
);
write_formatstringsdecl
(
proxy
,
indent
,
iface
s
,
need_proxy
);
write_formatstringsdecl
(
proxy
,
indent
,
stmt
s
,
need_proxy
);
write_stubdescproto
();
}
...
...
@@ -592,14 +592,24 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
print_proxy
(
"
\n
"
);
}
static
int
does_any_iface
(
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
static
int
does_any_iface
(
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
ifref_t
*
ir
;
const
statement_t
*
stmt
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
ir
,
ifaces
,
ifref_t
,
entry
)
if
(
pred
(
ir
->
iface
))
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_LIBRARY
)
{
if
(
does_any_iface
(
stmt
->
u
.
lib
->
stmts
,
pred
))
return
TRUE
;
}
else
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
if
(
pred
(
stmt
->
u
.
type
))
return
TRUE
;
}
}
return
FALSE
;
}
...
...
@@ -614,34 +624,84 @@ int need_stub(const type_t *iface)
return
!
is_object
(
iface
->
attrs
)
&&
!
is_local
(
iface
->
attrs
);
}
int
need_proxy_file
(
const
ifref_list_t
*
ifaces
)
int
need_proxy_file
(
const
statement_list_t
*
stmts
)
{
return
does_any_iface
(
stmts
,
need_proxy
);
}
int
need_stub_files
(
const
statement_list_t
*
stmts
)
{
return
does_any_iface
(
ifaces
,
need_proxy
);
return
does_any_iface
(
stmts
,
need_stub
);
}
int
need_stub_files
(
const
ifref_list_t
*
ifaces
)
static
void
write_proxy_stmts
(
const
statement_list_t
*
stmts
,
unsigned
int
*
proc_offset
)
{
return
does_any_iface
(
ifaces
,
need_stub
);
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_proxy_stmts
(
stmt
->
u
.
lib
->
stmts
,
proc_offset
);
else
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
if
(
need_proxy
(
stmt
->
u
.
type
))
write_proxy
(
stmt
->
u
.
type
,
proc_offset
);
}
}
}
void
write_proxies
(
ifref_list_t
*
ifaces
)
static
void
write_proxy_iface_name_format
(
const
statement_list_t
*
stmts
,
const
char
*
format
)
{
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_proxy_iface_name_format
(
stmt
->
u
.
lib
->
stmts
,
format
);
else
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
type_t
*
iface
=
stmt
->
u
.
type
;
if
(
iface
->
ref
&&
iface
->
funcs
&&
need_proxy
(
iface
))
fprintf
(
proxy
,
format
,
iface
->
name
);
}
}
}
static
void
write_iid_lookup
(
const
statement_list_t
*
stmts
,
const
char
*
file_id
,
int
*
c
)
{
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_iid_lookup
(
stmt
->
u
.
lib
->
stmts
,
file_id
,
c
);
else
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
type_t
*
iface
=
stmt
->
u
.
type
;
if
(
iface
->
ref
&&
iface
->
funcs
&&
need_proxy
(
iface
))
{
fprintf
(
proxy
,
" if (!_%s_CHECK_IID(%d))
\n
"
,
file_id
,
*
c
);
fprintf
(
proxy
,
" {
\n
"
);
fprintf
(
proxy
,
" *pIndex = %d;
\n
"
,
*
c
);
fprintf
(
proxy
,
" return 1;
\n
"
);
fprintf
(
proxy
,
" }
\n
"
);
(
*
c
)
++
;
}
}
}
}
void
write_proxies
(
const
statement_list_t
*
stmts
)
{
ifref_t
*
cur
;
int
expr_eval_routines
;
char
*
file_id
=
proxy_token
;
int
c
;
unsigned
int
proc_offset
=
0
;
if
(
!
do_proxies
)
return
;
if
(
do_everything
&&
!
need_proxy_file
(
iface
s
))
return
;
if
(
do_everything
&&
!
need_proxy_file
(
stmt
s
))
return
;
init_proxy
(
iface
s
);
init_proxy
(
stmt
s
);
if
(
!
proxy
)
return
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
cur
,
ifaces
,
ifref_t
,
entry
)
if
(
need_proxy
(
cur
->
iface
))
write_proxy
(
cur
->
iface
,
&
proc_offset
);
write_proxy_stmts
(
stmts
,
&
proc_offset
);
expr_eval_routines
=
write_expr_eval_routines
(
proxy
,
proxy_token
);
if
(
expr_eval_routines
)
...
...
@@ -653,36 +713,26 @@ void write_proxies(ifref_list_t *ifaces)
print_proxy
(
"#error Currently only Wine and WIN32 are supported.
\n
"
);
print_proxy
(
"#endif
\n
"
);
print_proxy
(
"
\n
"
);
write_procformatstring
(
proxy
,
iface
s
,
need_proxy
);
write_typeformatstring
(
proxy
,
iface
s
,
need_proxy
);
write_procformatstring
(
proxy
,
stmt
s
,
need_proxy
);
write_typeformatstring
(
proxy
,
stmt
s
,
need_proxy
);
fprintf
(
proxy
,
"static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =
\n
"
,
file_id
);
fprintf
(
proxy
,
"{
\n
"
);
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
cur
,
ifaces
,
ifref_t
,
entry
)
if
(
cur
->
iface
->
ref
&&
cur
->
iface
->
funcs
&&
need_proxy
(
cur
->
iface
))
fprintf
(
proxy
,
" (const CInterfaceProxyVtbl*)&_%sProxyVtbl,
\n
"
,
cur
->
iface
->
name
);
write_proxy_iface_name_format
(
stmts
,
" (const CInterfaceProxyVtbl*)&_%sProxyVtbl,
\n
"
);
fprintf
(
proxy
,
" 0
\n
"
);
fprintf
(
proxy
,
"};
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"static const CInterfaceStubVtbl* const _%s_StubVtblList[] =
\n
"
,
file_id
);
fprintf
(
proxy
,
"{
\n
"
);
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
cur
,
ifaces
,
ifref_t
,
entry
)
if
(
cur
->
iface
->
ref
&&
cur
->
iface
->
funcs
&&
need_proxy
(
cur
->
iface
))
fprintf
(
proxy
,
" (const CInterfaceStubVtbl*)&_%sStubVtbl,
\n
"
,
cur
->
iface
->
name
);
write_proxy_iface_name_format
(
stmts
,
" (const CInterfaceStubVtbl*)&_%sStubVtbl,
\n
"
);
fprintf
(
proxy
,
" 0
\n
"
);
fprintf
(
proxy
,
"};
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"static PCInterfaceName const _%s_InterfaceNamesList[] =
\n
"
,
file_id
);
fprintf
(
proxy
,
"{
\n
"
);
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
cur
,
ifaces
,
ifref_t
,
entry
)
if
(
cur
->
iface
->
ref
&&
cur
->
iface
->
funcs
&&
need_proxy
(
cur
->
iface
))
fprintf
(
proxy
,
"
\"
%s
\"
,
\n
"
,
cur
->
iface
->
name
);
write_proxy_iface_name_format
(
stmts
,
"
\"
%s
\"
,
\n
"
);
fprintf
(
proxy
,
" 0
\n
"
);
fprintf
(
proxy
,
"};
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
...
...
@@ -692,17 +742,7 @@ void write_proxies(ifref_list_t *ifaces)
fprintf
(
proxy
,
"int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)
\n
"
,
file_id
);
fprintf
(
proxy
,
"{
\n
"
);
c
=
0
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
cur
,
ifaces
,
ifref_t
,
entry
)
if
(
cur
->
iface
->
ref
&&
cur
->
iface
->
funcs
&&
need_proxy
(
cur
->
iface
))
{
fprintf
(
proxy
,
" if (!_%s_CHECK_IID(%d))
\n
"
,
file_id
,
c
);
fprintf
(
proxy
,
" {
\n
"
);
fprintf
(
proxy
,
" *pIndex = %d;
\n
"
,
c
);
fprintf
(
proxy
,
" return 1;
\n
"
);
fprintf
(
proxy
,
" }
\n
"
);
c
++
;
}
write_iid_lookup
(
stmts
,
file_id
,
&
c
);
fprintf
(
proxy
,
" return 0;
\n
"
);
fprintf
(
proxy
,
"}
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
...
...
tools/widl/server.c
View file @
df0e38c0
...
...
@@ -386,58 +386,69 @@ static void init_server(void)
}
void
write_server
(
ifref_list_t
*
ifaces
)
static
void
write_server_stmts
(
const
statement_list_t
*
stmts
,
int
expr_eval_routines
,
unsigned
int
*
proc_offset
)
{
unsigned
int
proc_offset
=
0
;
int
expr_eval_routines
;
ifref_t
*
iface
;
if
(
!
do_server
)
return
;
if
(
do_everything
&&
!
need_stub_files
(
ifaces
))
return
;
init_server
();
if
(
!
server
)
return
;
write_formatstringsdecl
(
server
,
indent
,
ifaces
,
need_stub
);
expr_eval_routines
=
write_expr_eval_routines
(
server
,
server_token
);
if
(
expr_eval_routines
)
write_expr_eval_routine_list
(
server
,
server_token
);
write_user_quad_list
(
server
);
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
iface
,
ifaces
,
ifref_t
,
entry
)
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_server_stmts
(
stmt
->
u
.
lib
->
stmts
,
expr_eval_routines
,
proc_offset
);
else
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
if
(
!
need_stub
(
iface
->
iface
))
type_t
*
iface
=
stmt
->
u
.
type
;
if
(
!
need_stub
(
iface
))
continue
;
fprintf
(
server
,
"/*****************************************************************************
\n
"
);
fprintf
(
server
,
" * %s interface
\n
"
,
iface
->
iface
->
name
);
fprintf
(
server
,
" * %s interface
\n
"
,
iface
->
name
);
fprintf
(
server
,
" */
\n
"
);
fprintf
(
server
,
"
\n
"
);
if
(
iface
->
iface
->
funcs
)
if
(
iface
->
funcs
)
{
write_serverinterfacedecl
(
iface
->
iface
);
write_stubdescdecl
(
iface
->
iface
);
write_serverinterfacedecl
(
iface
);
write_stubdescdecl
(
iface
);
write_function_stubs
(
iface
->
iface
,
&
proc_offset
);
write_function_stubs
(
iface
,
proc_offset
);
print_server
(
"#if !defined(__RPC_WIN32__)
\n
"
);
print_server
(
"#error Invalid build platform for this stub.
\n
"
);
print_server
(
"#endif
\n
"
);
fprintf
(
server
,
"
\n
"
);
write_stubdescriptor
(
iface
->
iface
,
expr_eval_routines
);
write_dispatchtable
(
iface
->
iface
);
write_stubdescriptor
(
iface
,
expr_eval_routines
);
write_dispatchtable
(
iface
);
}
}
}
}
void
write_server
(
const
statement_list_t
*
stmts
)
{
unsigned
int
proc_offset
=
0
;
int
expr_eval_routines
;
if
(
!
do_server
)
return
;
if
(
do_everything
&&
!
need_stub_files
(
stmts
))
return
;
init_server
();
if
(
!
server
)
return
;
write_formatstringsdecl
(
server
,
indent
,
stmts
,
need_stub
);
expr_eval_routines
=
write_expr_eval_routines
(
server
,
server_token
);
if
(
expr_eval_routines
)
write_expr_eval_routine_list
(
server
,
server_token
);
write_user_quad_list
(
server
);
write_server_stmts
(
stmts
,
expr_eval_routines
,
&
proc_offset
);
fprintf
(
server
,
"
\n
"
);
write_procformatstring
(
server
,
iface
s
,
need_stub
);
write_typeformatstring
(
server
,
iface
s
,
need_stub
);
write_procformatstring
(
server
,
stmt
s
,
need_stub
);
write_typeformatstring
(
server
,
stmt
s
,
need_stub
);
fclose
(
server
);
}
tools/widl/typegen.c
View file @
df0e38c0
...
...
@@ -43,7 +43,7 @@
static
const
func_t
*
current_func
;
static
const
type_t
*
current_structure
;
static
const
ifref
_t
*
current_iface
;
static
const
type
_t
*
current_iface
;
static
struct
list
expr_eval_routines
=
LIST_INIT
(
expr_eval_routines
);
struct
expr_eval_routine
...
...
@@ -370,13 +370,13 @@ static void write_formatdesc(FILE *f, int indent, const char *str)
print_file
(
f
,
indent
,
"
\n
"
);
}
void
write_formatstringsdecl
(
FILE
*
f
,
int
indent
,
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
void
write_formatstringsdecl
(
FILE
*
f
,
int
indent
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
print_file
(
f
,
indent
,
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
get_size_typeformatstring
(
iface
s
,
pred
));
get_size_typeformatstring
(
stmt
s
,
pred
));
print_file
(
f
,
indent
,
"#define PROC_FORMAT_STRING_SIZE %d
\n
"
,
get_size_procformatstring
(
iface
s
,
pred
));
get_size_procformatstring
(
stmt
s
,
pred
));
fprintf
(
f
,
"
\n
"
);
write_formatdesc
(
f
,
indent
,
"TYPE"
);
...
...
@@ -477,33 +477,23 @@ static size_t write_procformatstring_type(FILE *file, int indent,
return
size
;
}
void
write_procformatstring
(
FILE
*
file
,
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
static
void
write_procformatstring_stmts
(
FILE
*
file
,
int
indent
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
const
ifref_t
*
iface
;
int
indent
=
0
;
const
var_t
*
var
;
print_file
(
file
,
indent
,
"static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
indent
++
;
print_file
(
file
,
indent
,
"0,
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
indent
++
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
iface
,
ifaces
,
const
ifref_t
,
entry
)
const
statement_t
*
stmt
;
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement_t
,
entry
)
{
if
(
!
pred
(
iface
->
iface
))
continue
;
if
(
iface
->
iface
->
funcs
)
if
(
stmt
->
type
==
STMT_TYPE
&&
stmt
->
u
.
type
->
type
==
RPC_FC_IP
)
{
const
func_t
*
func
;
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
iface
->
funcs
,
const
func_t
,
entry
)
if
(
!
pred
(
stmt
->
u
.
type
))
continue
;
if
(
stmt
->
u
.
type
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
stmt
->
u
.
type
->
funcs
,
const
func_t
,
entry
)
{
if
(
is_local
(
func
->
def
->
attrs
))
continue
;
/* emit argument data */
if
(
func
->
args
)
{
const
var_t
*
var
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
write_procformatstring_type
(
file
,
indent
,
var
->
name
,
var
->
type
,
var
->
attrs
,
FALSE
);
}
...
...
@@ -518,7 +508,23 @@ void write_procformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t
write_procformatstring_type
(
file
,
indent
,
"return value"
,
get_func_return_type
(
func
),
NULL
,
TRUE
);
}
}
else
if
(
stmt
->
type
==
STMT_LIBRARY
)
write_procformatstring_stmts
(
file
,
indent
,
stmt
->
u
.
lib
->
stmts
,
pred
);
}
}
void
write_procformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
)
{
int
indent
=
0
;
print_file
(
file
,
indent
,
"static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
indent
++
;
print_file
(
file
,
indent
,
"0,
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
indent
++
;
write_procformatstring_stmts
(
file
,
indent
,
stmts
,
pred
);
print_file
(
file
,
indent
,
"0x0
\n
"
);
indent
--
;
...
...
@@ -2261,22 +2267,32 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty
return
retmask
;
}
static
size_t
process_tfs
(
FILE
*
file
,
const
ifref_list_t
*
ifaces
,
type_pred_t
pred
)
static
size_t
process_tfs_stmts
(
FILE
*
file
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
,
unsigned
int
*
typeformat_offset
)
{
const
var_t
*
var
;
const
ifref_t
*
iface
;
unsigned
int
typeformat_offset
=
2
;
const
statement_t
*
stmt
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
iface
,
ifaces
,
const
ifref
_t
,
entry
)
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement
_t
,
entry
)
{
if
(
!
pred
(
iface
->
iface
))
const
type_t
*
iface
;
if
(
stmt
->
type
==
STMT_LIBRARY
)
{
process_tfs_stmts
(
file
,
stmt
->
u
.
lib
->
stmts
,
pred
,
typeformat_offset
);
continue
;
}
else
if
(
stmt
->
type
!=
STMT_TYPE
||
stmt
->
u
.
type
->
type
!=
RPC_FC_IP
)
continue
;
iface
=
stmt
->
u
.
type
;
if
(
!
pred
(
iface
))
continue
;
if
(
iface
->
iface
->
funcs
)
if
(
iface
->
funcs
)
{
const
func_t
*
func
;
current_iface
=
iface
;
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
iface
->
funcs
,
const
func_t
,
entry
)
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
funcs
,
const
func_t
,
entry
)
{
if
(
is_local
(
func
->
def
->
attrs
))
continue
;
...
...
@@ -2287,7 +2303,7 @@ static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pr
update_tfsoff
(
get_func_return_type
(
func
),
write_typeformatstring_var
(
file
,
2
,
NULL
,
get_func_return_type
(
func
),
&
v
,
&
typeformat_offset
),
&
v
,
typeformat_offset
),
file
);
}
...
...
@@ -2298,17 +2314,24 @@ static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pr
var
->
type
,
write_typeformatstring_var
(
file
,
2
,
func
,
var
->
type
,
var
,
&
typeformat_offset
),
typeformat_offset
),
file
);
}
}
}
return
typeformat_offset
+
1
;
return
*
typeformat_offset
+
1
;
}
static
size_t
process_tfs
(
FILE
*
file
,
const
statement_list_t
*
stmts
,
type_pred_t
pred
)
{
unsigned
int
typeformat_offset
=
2
;
return
process_tfs_stmts
(
file
,
stmts
,
pred
,
&
typeformat_offset
);
}
void
write_typeformatstring
(
FILE
*
file
,
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
void
write_typeformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
int
indent
=
0
;
...
...
@@ -2321,7 +2344,7 @@ void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t
print_file
(
file
,
indent
,
"NdrFcShort(0x0),
\n
"
);
set_all_tfswrite
(
TRUE
);
process_tfs
(
file
,
iface
s
,
pred
);
process_tfs
(
file
,
stmt
s
,
pred
);
print_file
(
file
,
indent
,
"0x0
\n
"
);
indent
--
;
...
...
@@ -2984,29 +3007,39 @@ size_t get_size_procformatstring_func(const func_t *func)
return
size
;
}
size_t
get_size_procformatstring
(
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
size_t
get_size_procformatstring
(
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
const
ifref_t
*
iface
;
const
statement_t
*
stmt
;
size_t
size
=
1
;
const
func_t
*
func
;
if
(
ifaces
)
LIST_FOR_EACH_ENTRY
(
iface
,
ifaces
,
const
ifref
_t
,
entry
)
if
(
stmts
)
LIST_FOR_EACH_ENTRY
(
stmt
,
stmts
,
const
statement
_t
,
entry
)
{
if
(
!
pred
(
iface
->
iface
))
const
type_t
*
iface
;
if
(
stmt
->
type
==
STMT_LIBRARY
)
{
size
+=
get_size_procformatstring
(
stmt
->
u
.
lib
->
stmts
,
pred
)
-
1
;
continue
;
}
else
if
(
stmt
->
type
!=
STMT_TYPE
&&
stmt
->
u
.
type
->
type
!=
RPC_FC_IP
)
continue
;
iface
=
stmt
->
u
.
type
;
if
(
!
pred
(
iface
))
continue
;
if
(
iface
->
iface
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
iface
->
funcs
,
const
func_t
,
entry
)
if
(
iface
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
funcs
,
const
func_t
,
entry
)
if
(
!
is_local
(
func
->
def
->
attrs
))
size
+=
get_size_procformatstring_func
(
func
);
}
return
size
;
}
size_t
get_size_typeformatstring
(
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
)
size_t
get_size_typeformatstring
(
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
)
{
set_all_tfswrite
(
FALSE
);
return
process_tfs
(
NULL
,
iface
s
,
pred
);
return
process_tfs
(
NULL
,
stmt
s
,
pred
);
}
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
)
...
...
tools/widl/typegen.h
View file @
df0e38c0
...
...
@@ -38,15 +38,15 @@ enum remoting_phase
typedef
int
(
*
type_pred_t
)(
const
type_t
*
);
void
write_formatstringsdecl
(
FILE
*
f
,
int
indent
,
ifref_list_t
*
iface
s
,
type_pred_t
pred
);
void
write_procformatstring
(
FILE
*
file
,
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
);
void
write_typeformatstring
(
FILE
*
file
,
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
);
void
write_formatstringsdecl
(
FILE
*
f
,
int
indent
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
);
void
write_procformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
);
void
write_typeformatstring
(
FILE
*
file
,
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
);
void
print_phase_basetype
(
FILE
*
file
,
int
indent
,
enum
remoting_phase
phase
,
enum
pass
pass
,
const
var_t
*
var
,
const
char
*
varname
);
void
write_remoting_arguments
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
,
enum
pass
pass
,
enum
remoting_phase
phase
);
size_t
get_size_procformatstring_type
(
const
char
*
name
,
const
type_t
*
type
,
const
attr_list_t
*
attrs
);
size_t
get_size_procformatstring_func
(
const
func_t
*
func
);
size_t
get_size_procformatstring
(
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
);
size_t
get_size_typeformatstring
(
const
ifref_list_t
*
iface
s
,
type_pred_t
pred
);
size_t
get_size_procformatstring
(
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
);
size_t
get_size_typeformatstring
(
const
statement_list_t
*
stmt
s
,
type_pred_t
pred
);
void
assign_stub_out_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
void
declare_stub_args
(
FILE
*
file
,
int
indent
,
const
func_t
*
func
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
...
...
tools/widl/typelib.c
View file @
df0e38c0
...
...
@@ -232,6 +232,7 @@ unsigned short get_type_vt(type_t *t)
case
RPC_FC_CPSTRUCT
:
case
RPC_FC_CVSTRUCT
:
case
RPC_FC_BOGUS_STRUCT
:
case
RPC_FC_COCLASS
:
return
VT_USERDEFINED
;
case
0
:
return
t
->
kind
==
TKIND_PRIMITIVE
?
VT_VOID
:
VT_USERDEFINED
;
...
...
@@ -241,20 +242,13 @@ unsigned short get_type_vt(type_t *t)
return
0
;
}
void
start_typelib
(
char
*
name
,
const
attr_list_t
*
attrs
)
void
start_typelib
(
typelib_t
*
typelib_type
)
{
in_typelib
++
;
if
(
!
do_typelib
)
return
;
typelib
=
xmalloc
(
sizeof
(
*
typelib
));
typelib
->
name
=
xstrdup
(
name
);
typelib
=
typelib_type
;
typelib
->
filename
=
xstrdup
(
typelib_name
);
typelib
->
attrs
=
attrs
;
list_init
(
&
typelib
->
entries
);
list_init
(
&
typelib
->
importlibs
);
if
(
is_attr
(
attrs
,
ATTR_POINTERDEFAULT
))
pointer_default
=
get_attrv
(
attrs
,
ATTR_POINTERDEFAULT
);
}
void
end_typelib
(
void
)
...
...
@@ -263,8 +257,6 @@ void end_typelib(void)
if
(
!
typelib
)
return
;
create_msft_typelib
(
typelib
);
pointer_default
=
RPC_FC_UP
;
return
;
}
void
add_typelib_entry
(
type_t
*
t
)
...
...
tools/widl/typelib.h
View file @
df0e38c0
...
...
@@ -22,7 +22,7 @@
#define __WIDL_TYPELIB_H
extern
int
in_typelib
;
extern
void
start_typelib
(
char
*
name
,
const
attr_list_t
*
attrs
);
extern
void
start_typelib
(
typelib_t
*
typelib_type
);
extern
void
end_typelib
(
void
);
extern
void
add_typelib_entry
(
type_t
*
t
);
extern
void
add_importlib
(
const
char
*
name
);
...
...
tools/widl/widl.c
View file @
df0e38c0
...
...
@@ -279,13 +279,13 @@ static char *eat_space(char *s)
return
s
;
}
void
write_dlldata
(
ifref_list_t
*
iface
s
)
void
write_dlldata
(
const
statement_list_t
*
stmt
s
)
{
struct
list
filenames
=
LIST_INIT
(
filenames
);
filename_node_t
*
node
;
FILE
*
dlldata
;
if
(
!
do_dlldata
||
!
need_proxy_file
(
iface
s
))
if
(
!
do_dlldata
||
!
need_proxy_file
(
stmt
s
))
return
;
dlldata
=
fopen
(
dlldata_name
,
"r"
);
...
...
tools/widl/widl.h
View file @
df0e38c0
...
...
@@ -68,9 +68,9 @@ extern FILE* header;
extern
FILE
*
local_stubs
;
extern
FILE
*
idfile
;
extern
void
write_proxies
(
ifref_list_t
*
iface
s
);
extern
void
write_client
(
ifref_list_t
*
iface
s
);
extern
void
write_server
(
ifref_list_t
*
iface
s
);
extern
void
write_dlldata
(
ifref_list_t
*
iface
s
);
extern
void
write_proxies
(
const
statement_list_t
*
stmt
s
);
extern
void
write_client
(
const
statement_list_t
*
stmt
s
);
extern
void
write_server
(
const
statement_list_t
*
stmt
s
);
extern
void
write_dlldata
(
const
statement_list_t
*
stmt
s
);
#endif
tools/widl/widltypes.h
View file @
df0e38c0
...
...
@@ -34,6 +34,7 @@ typedef GUID UUID;
#define TRUE 1
#define FALSE 0
#define RPC_FC_COCLASS 0xfd
#define RPC_FC_FUNCTION 0xfe
typedef
struct
_loc_info_t
loc_info_t
;
...
...
@@ -51,6 +52,7 @@ typedef struct _importinfo_t importinfo_t;
typedef
struct
_typelib_t
typelib_t
;
typedef
struct
_user_type_t
user_type_t
;
typedef
struct
_user_type_t
context_handle_t
;
typedef
struct
_statement_t
statement_t
;
typedef
struct
list
attr_list_t
;
typedef
struct
list
str_list_t
;
...
...
@@ -62,6 +64,7 @@ typedef struct list ifref_list_t;
typedef
struct
list
array_dims_t
;
typedef
struct
list
user_type_list_t
;
typedef
struct
list
context_handle_list_t
;
typedef
struct
list
statement_list_t
;
enum
attr_type
{
...
...
@@ -192,6 +195,20 @@ enum type_kind
TKIND_MAX
};
enum
statement_type
{
STMT_LIBRARY
,
STMT_INITDECL
,
STMT_EXTERN
,
STMT_TYPE
,
STMT_TYPEREF
,
STMT_MODULE
,
STMT_TYPEDEF
,
STMT_IMPORT
,
STMT_IMPORTLIB
,
STMT_CPPQUOTE
};
struct
_loc_info_t
{
const
char
*
input_name
;
...
...
@@ -332,6 +349,7 @@ struct _typelib_t {
const
attr_list_t
*
attrs
;
struct
list
entries
;
struct
list
importlibs
;
statement_list_t
*
stmts
;
};
struct
_user_type_t
{
...
...
@@ -339,6 +357,19 @@ struct _user_type_t {
const
char
*
name
;
};
struct
_statement_t
{
struct
list
entry
;
enum
statement_type
type
;
union
{
ifref_t
iface
;
type_t
*
type
;
const
char
*
str
;
var_t
*
var
;
typelib_t
*
lib
;
}
u
;
};
extern
unsigned
char
pointer_default
;
extern
user_type_list_t
user_type_list
;
...
...
tools/widl/write_msft.c
View file @
df0e38c0
...
...
@@ -986,10 +986,11 @@ static int encode_type(
case
RPC_FC_ENUM16
:
add_enum_typeinfo
(
typelib
,
type
);
break
;
case
0
:
if
(
type
->
kind
==
TKIND_COCLASS
)
case
RPC_FC_COCLASS
:
add_coclass_typeinfo
(
typelib
,
type
);
else
if
(
type
->
kind
==
TKIND_DISPATCH
)
break
;
case
0
:
if
(
type
->
kind
==
TKIND_DISPATCH
)
add_dispinterface_typeinfo
(
typelib
,
type
);
else
error
(
"encode_type: VT_USERDEFINED - can't yet add typedef's on the fly
\n
"
);
...
...
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