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
eed74e4e
Commit
eed74e4e
authored
Jan 22, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Convert variable lists to standard Wine lists.
parent
58827d02
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
270 additions
and
331 deletions
+270
-331
client.c
tools/widl/client.c
+6
-18
header.c
tools/widl/header.c
+30
-57
header.h
tools/widl/header.h
+1
-1
parser.y
tools/widl/parser.y
+65
-48
proxy.c
tools/widl/proxy.c
+75
-60
server.c
tools/widl/server.c
+8
-33
typegen.c
tools/widl/typegen.c
+49
-81
widltypes.h
tools/widl/widltypes.h
+7
-6
write_msft.c
tools/widl/write_msft.c
+29
-27
No files found.
tools/widl/client.c
View file @
eed74e4e
...
@@ -65,16 +65,13 @@ static void print_message_buffer_size(const func_t *func)
...
@@ -65,16 +65,13 @@ static void print_message_buffer_size(const func_t *func)
if
(
func
->
args
)
if
(
func
->
args
)
{
{
const
var_t
*
var
=
func
->
args
;
const
var_t
*
var
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
var
)
{
{
unsigned
int
alignment
;
unsigned
int
alignment
;
total_size
+=
get_required_buffer_size
(
var
,
&
alignment
,
PASS_IN
);
total_size
+=
get_required_buffer_size
(
var
,
&
alignment
,
PASS_IN
);
total_size
+=
alignment
;
total_size
+=
alignment
;
var
=
PREV_LINK
(
var
);
}
}
}
}
fprintf
(
client
,
" %u"
,
total_size
);
fprintf
(
client
,
" %u"
,
total_size
);
...
@@ -82,14 +79,12 @@ static void print_message_buffer_size(const func_t *func)
...
@@ -82,14 +79,12 @@ static void print_message_buffer_size(const func_t *func)
static
void
check_pointers
(
const
func_t
*
func
)
static
void
check_pointers
(
const
func_t
*
func
)
{
{
var_t
*
var
;
const
var_t
*
var
;
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
;
return
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
{
if
(
is_var_ptr
(
var
)
&&
cant_be_null
(
var
))
if
(
is_var_ptr
(
var
)
&&
cant_be_null
(
var
))
{
{
...
@@ -100,8 +95,6 @@ static void check_pointers(const func_t *func)
...
@@ -100,8 +95,6 @@ static void check_pointers(const func_t *func)
indent
--
;
indent
--
;
print_client
(
"}
\n\n
"
);
print_client
(
"}
\n\n
"
);
}
}
var
=
PREV_LINK
(
var
);
}
}
}
}
...
@@ -110,7 +103,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -110,7 +103,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
const
func_t
*
func
;
const
func_t
*
func
;
const
char
*
implicit_handle
=
get_attrp
(
iface
->
attrs
,
ATTR_IMPLICIT_HANDLE
);
const
char
*
implicit_handle
=
get_attrp
(
iface
->
attrs
,
ATTR_IMPLICIT_HANDLE
);
int
explicit_handle
=
is_attr
(
iface
->
attrs
,
ATTR_EXPLICIT_HANDLE
);
int
explicit_handle
=
is_attr
(
iface
->
attrs
,
ATTR_EXPLICIT_HANDLE
);
var_t
*
var
;
const
var_t
*
var
;
int
method_count
=
0
;
int
method_count
=
0
;
if
(
iface
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
funcs
,
const
func_t
,
entry
)
if
(
iface
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
iface
->
funcs
,
const
func_t
,
entry
)
...
@@ -259,13 +252,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -259,13 +252,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
/* update proc_offset */
/* update proc_offset */
if
(
func
->
args
)
if
(
func
->
args
)
{
{
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
*
proc_offset
+=
get_size_procformatstring_var
(
var
);
*
proc_offset
+=
get_size_procformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
}
}
}
if
(
!
is_void
(
def
->
type
,
NULL
))
if
(
!
is_void
(
def
->
type
,
NULL
))
*
proc_offset
+=
get_size_procformatstring_var
(
def
);
*
proc_offset
+=
get_size_procformatstring_var
(
def
);
...
...
tools/widl/header.c
View file @
eed74e4e
...
@@ -164,23 +164,19 @@ static void write_field(FILE *h, var_t *v)
...
@@ -164,23 +164,19 @@ static void write_field(FILE *h, var_t *v)
}
}
}
}
static
void
write_fields
(
FILE
*
h
,
var_
t
*
v
)
static
void
write_fields
(
FILE
*
h
,
var_
list_t
*
fields
)
{
{
var_t
*
first
=
v
;
var_t
*
v
;
if
(
!
v
)
return
;
if
(
!
fields
)
return
;
while
(
NEXT_LINK
(
v
))
v
=
NEXT_LINK
(
v
);
LIST_FOR_EACH_ENTRY
(
v
,
fields
,
var_t
,
entry
)
write_field
(
h
,
v
);
while
(
v
)
{
write_field
(
h
,
v
);
if
(
v
==
first
)
break
;
v
=
PREV_LINK
(
v
);
}
}
}
static
void
write_enums
(
FILE
*
h
,
var_
t
*
v
)
static
void
write_enums
(
FILE
*
h
,
var_
list_t
*
enums
)
{
{
if
(
!
v
)
return
;
var_t
*
v
;
while
(
NEXT_LINK
(
v
))
v
=
NEXT_LINK
(
v
);
if
(
!
enums
)
return
;
while
(
v
)
{
LIST_FOR_EACH_ENTRY
(
v
,
enums
,
var_t
,
entry
)
{
if
(
get_name
(
v
))
{
if
(
get_name
(
v
))
{
indent
(
h
,
0
);
indent
(
h
,
0
);
write_name
(
h
,
v
);
write_name
(
h
,
v
);
...
@@ -189,9 +185,7 @@ static void write_enums(FILE *h, var_t *v)
...
@@ -189,9 +185,7 @@ static void write_enums(FILE *h, var_t *v)
write_expr
(
h
,
v
->
eval
,
0
);
write_expr
(
h
,
v
->
eval
,
0
);
}
}
}
}
if
(
PREV_LINK
(
v
))
if
(
list_next
(
enums
,
&
v
->
entry
))
fprintf
(
h
,
",
\n
"
);
fprintf
(
h
,
",
\n
"
);
v
=
PREV_LINK
(
v
);
}
}
fprintf
(
h
,
"
\n
"
);
fprintf
(
h
,
"
\n
"
);
}
}
...
@@ -292,9 +286,13 @@ static int user_type_registered(const char *name)
...
@@ -292,9 +286,13 @@ static int user_type_registered(const char *name)
return
0
;
return
0
;
}
}
static
void
check_for_user_types
(
const
var_
t
*
v
)
static
void
check_for_user_types
(
const
var_
list_t
*
list
)
{
{
while
(
v
)
{
const
var_t
*
v
;
if
(
!
list
)
return
;
LIST_FOR_EACH_ENTRY
(
v
,
list
,
const
var_t
,
entry
)
{
type_t
*
type
;
type_t
*
type
;
for
(
type
=
v
->
type
;
type
;
type
=
type
->
kind
==
TKIND_ALIAS
?
type
->
orig
:
type
->
ref
)
{
for
(
type
=
v
->
type
;
type
;
type
=
type
->
kind
==
TKIND_ALIAS
?
type
->
orig
:
type
->
ref
)
{
const
char
*
name
=
type
->
name
;
const
char
*
name
=
type
->
name
;
...
@@ -312,14 +310,11 @@ static void check_for_user_types(const var_t *v)
...
@@ -312,14 +310,11 @@ static void check_for_user_types(const var_t *v)
* using a wire marshaled type */
* using a wire marshaled type */
break
;
break
;
}
}
else
if
(
type
->
fields
)
else
{
{
const
var_t
*
fields
=
type
->
fields
;
check_for_user_types
(
type
->
fields
);
while
(
NEXT_LINK
(
fields
))
fields
=
NEXT_LINK
(
fields
);
check_for_user_types
(
fields
);
}
}
}
}
v
=
PREV_LINK
(
v
);
}
}
}
}
...
@@ -456,22 +451,16 @@ const var_t* get_explicit_handle_var(const func_t* func)
...
@@ -456,22 +451,16 @@ const var_t* get_explicit_handle_var(const func_t* func)
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
NULL
;
return
NULL
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
if
(
var
->
type
->
type
==
RPC_FC_BIND_PRIMITIVE
)
if
(
var
->
type
->
type
==
RPC_FC_BIND_PRIMITIVE
)
return
var
;
return
var
;
var
=
PREV_LINK
(
var
);
}
return
NULL
;
return
NULL
;
}
}
int
has_out_arg_or_return
(
const
func_t
*
func
)
int
has_out_arg_or_return
(
const
func_t
*
func
)
{
{
var_t
*
var
;
const
var_t
*
var
;
if
(
!
is_void
(
func
->
def
->
type
,
NULL
))
if
(
!
is_void
(
func
->
def
->
type
,
NULL
))
return
1
;
return
1
;
...
@@ -479,15 +468,10 @@ int has_out_arg_or_return(const func_t *func)
...
@@ -479,15 +468,10 @@ int has_out_arg_or_return(const func_t *func)
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
0
;
return
0
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
if
(
is_attr
(
var
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
var
->
attrs
,
ATTR_OUT
))
return
1
;
return
1
;
var
=
PREV_LINK
(
var
);
}
return
0
;
return
0
;
}
}
...
@@ -525,13 +509,11 @@ static void write_method_macro(const type_t *iface, const char *name)
...
@@ -525,13 +509,11 @@ static void write_method_macro(const type_t *iface, const char *name)
{
{
var_t
*
def
=
cur
->
def
;
var_t
*
def
=
cur
->
def
;
if
(
!
is_callas
(
def
->
attrs
))
{
if
(
!
is_callas
(
def
->
attrs
))
{
var_t
*
arg
=
cur
->
args
;
const
var_t
*
arg
;
int
argc
=
0
;
int
argc
=
0
;
int
c
;
int
c
;
while
(
arg
)
{
arg
=
NEXT_LINK
(
arg
);
if
(
cur
->
args
)
LIST_FOR_EACH_ENTRY
(
arg
,
cur
->
args
,
const
var_t
,
entry
)
argc
++
;
argc
++
;
}
fprintf
(
header
,
"#define %s_"
,
name
);
fprintf
(
header
,
"#define %s_"
,
name
);
write_name
(
header
,
def
);
write_name
(
header
,
def
);
...
@@ -550,13 +532,11 @@ static void write_method_macro(const type_t *iface, const char *name)
...
@@ -550,13 +532,11 @@ static void write_method_macro(const type_t *iface, const char *name)
}
}
}
}
void
write_args
(
FILE
*
h
,
var_t
*
arg
,
const
char
*
name
,
int
method
,
int
do_indent
)
void
write_args
(
FILE
*
h
,
const
var_list_t
*
args
,
const
char
*
name
,
int
method
,
int
do_indent
)
{
{
const
var_t
*
arg
;
int
count
=
0
;
int
count
=
0
;
if
(
arg
)
{
while
(
NEXT_LINK
(
arg
))
arg
=
NEXT_LINK
(
arg
);
}
if
(
do_indent
)
if
(
do_indent
)
{
{
indentation
++
;
indentation
++
;
...
@@ -566,7 +546,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
...
@@ -566,7 +546,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
fprintf
(
h
,
"%s* This"
,
name
);
fprintf
(
h
,
"%s* This"
,
name
);
count
++
;
count
++
;
}
}
while
(
arg
)
{
if
(
args
)
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
count
)
{
if
(
count
)
{
if
(
do_indent
)
if
(
do_indent
)
{
{
...
@@ -591,7 +571,6 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
...
@@ -591,7 +571,6 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
write_name
(
h
,
arg
);
write_name
(
h
,
arg
);
}
}
write_array
(
h
,
arg
->
array
,
0
);
write_array
(
h
,
arg
->
array
,
0
);
arg
=
PREV_LINK
(
arg
);
count
++
;
count
++
;
}
}
if
(
do_indent
)
indentation
--
;
if
(
do_indent
)
indentation
--
;
...
@@ -664,7 +643,7 @@ static void write_method_proto(const type_t *iface)
...
@@ -664,7 +643,7 @@ static void write_method_proto(const type_t *iface)
{
{
const
var_t
*
def
=
cur
->
def
;
const
var_t
*
def
=
cur
->
def
;
const
var_t
*
cas
=
is_callas
(
def
->
attrs
);
const
var_t
*
cas
=
is_callas
(
def
->
attrs
);
const
var_t
*
args
;
if
(
!
is_local
(
def
->
attrs
))
{
if
(
!
is_local
(
def
->
attrs
))
{
/* proxy prototype */
/* proxy prototype */
write_type
(
header
,
def
->
type
,
def
,
def
->
tname
);
write_type
(
header
,
def
->
type
,
def
,
def
->
tname
);
...
@@ -681,13 +660,7 @@ static void write_method_proto(const type_t *iface)
...
@@ -681,13 +660,7 @@ static void write_method_proto(const type_t *iface)
fprintf
(
header
,
" IRpcChannelBuffer* pRpcChannelBuffer,
\n
"
);
fprintf
(
header
,
" IRpcChannelBuffer* pRpcChannelBuffer,
\n
"
);
fprintf
(
header
,
" PRPC_MESSAGE pRpcMessage,
\n
"
);
fprintf
(
header
,
" PRPC_MESSAGE pRpcMessage,
\n
"
);
fprintf
(
header
,
" DWORD* pdwStubPhase);
\n
"
);
fprintf
(
header
,
" DWORD* pdwStubPhase);
\n
"
);
check_for_user_types
(
cur
->
args
);
args
=
cur
->
args
;
if
(
args
)
{
while
(
NEXT_LINK
(
args
))
args
=
NEXT_LINK
(
args
);
}
check_for_user_types
(
args
);
}
}
if
(
cas
)
{
if
(
cas
)
{
const
func_t
*
m
;
const
func_t
*
m
;
...
...
tools/widl/header.h
View file @
eed74e4e
...
@@ -31,7 +31,7 @@ extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
...
@@ -31,7 +31,7 @@ extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
extern
int
is_object
(
const
attr_list_t
*
list
);
extern
int
is_object
(
const
attr_list_t
*
list
);
extern
int
is_local
(
const
attr_list_t
*
list
);
extern
int
is_local
(
const
attr_list_t
*
list
);
extern
const
var_t
*
is_callas
(
const
attr_list_t
*
list
);
extern
const
var_t
*
is_callas
(
const
attr_list_t
*
list
);
extern
void
write_args
(
FILE
*
h
,
var
_t
*
arg
,
const
char
*
name
,
int
obj
,
int
do_indent
);
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
,
const
expr_t
*
v
,
int
field
);
extern
void
write_array
(
FILE
*
h
,
const
expr_t
*
v
,
int
field
);
extern
void
write_forward
(
type_t
*
iface
);
extern
void
write_forward
(
type_t
*
iface
);
extern
void
write_interface
(
type_t
*
iface
);
extern
void
write_interface
(
type_t
*
iface
);
...
...
tools/widl/parser.y
View file @
eed74e4e
This diff is collapsed.
Click to expand it.
tools/widl/proxy.c
View file @
eed74e4e
...
@@ -106,26 +106,28 @@ static void init_proxy(ifref_list_t *ifaces)
...
@@ -106,26 +106,28 @@ static void init_proxy(ifref_list_t *ifaces)
write_stubdescproto
();
write_stubdescproto
();
}
}
static
void
clear_output_vars
(
var_t
*
arg
)
static
void
clear_output_vars
(
const
var_list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
)
&&
!
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
)
&&
!
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
print_proxy
(
"if(%s)
\n
"
,
arg
->
name
);
print_proxy
(
"if(%s)
\n
"
,
arg
->
name
);
indent
++
;
indent
++
;
print_proxy
(
"MIDL_memset( %s, 0, sizeof( *%s ));
\n
"
,
arg
->
name
,
arg
->
name
);
print_proxy
(
"MIDL_memset( %s, 0, sizeof( *%s ));
\n
"
,
arg
->
name
,
arg
->
name
);
indent
--
;
indent
--
;
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
int
is_var_ptr
(
var_t
*
v
)
int
is_var_ptr
(
const
var_t
*
v
)
{
{
return
v
->
ptr_level
||
is_ptr
(
v
->
type
);
return
v
->
ptr_level
||
is_ptr
(
v
->
type
);
}
}
int
cant_be_null
(
var_t
*
v
)
int
cant_be_null
(
const
var_t
*
v
)
{
{
/* Search backwards for the most recent pointer attribute. */
/* Search backwards for the most recent pointer attribute. */
const
attr_list_t
*
attrs
=
v
->
attrs
;
const
attr_list_t
*
attrs
=
v
->
attrs
;
...
@@ -159,7 +161,7 @@ int cant_be_null(var_t *v)
...
@@ -159,7 +161,7 @@ int cant_be_null(var_t *v)
return
1
;
/* Default is RPC_FC_RP. */
return
1
;
/* Default is RPC_FC_RP. */
}
}
static
int
is_user_derived
(
var_t
*
v
)
static
int
is_user_derived
(
const
var_t
*
v
)
{
{
const
attr_list_t
*
attrs
=
v
->
attrs
;
const
attr_list_t
*
attrs
=
v
->
attrs
;
const
type_t
*
type
=
v
->
type
;
const
type_t
*
type
=
v
->
type
;
...
@@ -187,21 +189,23 @@ static int is_user_derived(var_t *v)
...
@@ -187,21 +189,23 @@ static int is_user_derived(var_t *v)
return
0
;
return
0
;
}
}
static
void
proxy_check_pointers
(
var_t
*
arg
)
static
void
proxy_check_pointers
(
const
var_list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_var_ptr
(
arg
)
&&
cant_be_null
(
arg
))
{
if
(
is_var_ptr
(
arg
)
&&
cant_be_null
(
arg
))
{
print_proxy
(
"if(!%s)
\n
"
,
arg
->
name
);
print_proxy
(
"if(!%s)
\n
"
,
arg
->
name
);
indent
++
;
indent
++
;
print_proxy
(
"RpcRaiseException(RPC_X_NULL_REF_POINTER);
\n
"
);
print_proxy
(
"RpcRaiseException(RPC_X_NULL_REF_POINTER);
\n
"
);
indent
--
;
indent
--
;
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
marshall_size_arg
(
var_t
*
arg
)
static
void
marshall_size_arg
(
const
var_t
*
arg
)
{
{
int
index
=
0
;
int
index
=
0
;
const
type_t
*
type
=
arg
->
type
;
const
type_t
*
type
=
arg
->
type
;
...
@@ -289,22 +293,23 @@ static void marshall_size_arg( var_t *arg )
...
@@ -289,22 +293,23 @@ static void marshall_size_arg( var_t *arg )
}
}
}
}
static
void
proxy_gen_marshall_size
(
var_t
*
arg
)
static
void
proxy_gen_marshall_size
(
const
var_list_t
*
args
)
{
{
print_proxy
(
"_StubMsg.BufferLength = 0U;
\n
"
)
;
const
var_t
*
arg
;
END_OF_LIST
(
arg
);
print_proxy
(
"_StubMsg.BufferLength = 0U;
\n
"
);
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
{
marshall_size_arg
(
arg
);
marshall_size_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
marshall_copy_arg
(
var_t
*
arg
)
static
void
marshall_copy_arg
(
const
var_t
*
arg
)
{
{
int
index
=
0
;
int
index
=
0
;
type_t
*
type
=
arg
->
type
;
type_t
*
type
=
arg
->
type
;
...
@@ -390,34 +395,36 @@ static void marshall_copy_arg( var_t *arg )
...
@@ -390,34 +395,36 @@ static void marshall_copy_arg( var_t *arg )
}
}
}
}
static
void
gen_marshall_copydata
(
var_t
*
arg
)
static
void
gen_marshall_copydata
(
const
var_list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
{
marshall_copy_arg
(
arg
);
marshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
gen_marshall
(
var_t
*
arg
)
static
void
gen_marshall
(
const
var_list_t
*
args
)
{
{
/* generated code to determine the size of the buffer required */
/* generated code to determine the size of the buffer required */
proxy_gen_marshall_size
(
arg
);
proxy_gen_marshall_size
(
arg
s
);
/* generated code to allocate the buffer */
/* generated code to allocate the buffer */
print_proxy
(
"NdrProxyGetBuffer(This, &_StubMsg);
\n
"
);
print_proxy
(
"NdrProxyGetBuffer(This, &_StubMsg);
\n
"
);
/* generated code to copy the args into the buffer */
/* generated code to copy the args into the buffer */
gen_marshall_copydata
(
arg
);
gen_marshall_copydata
(
arg
s
);
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
}
}
static
void
unmarshall_copy_arg
(
var_t
*
arg
)
static
void
unmarshall_copy_arg
(
const
var_t
*
arg
)
{
{
int
index
=
0
;
int
index
=
0
;
type_t
*
type
=
arg
->
type
;
type_t
*
type
=
arg
->
type
;
...
@@ -501,20 +508,22 @@ static void unmarshall_copy_arg( var_t *arg )
...
@@ -501,20 +508,22 @@ static void unmarshall_copy_arg( var_t *arg )
}
}
}
}
static
void
gen_unmarshall
(
var_
t
*
arg
)
static
void
gen_unmarshall
(
var_
list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
{
unmarshall_copy_arg
(
arg
);
unmarshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
free_variable
(
var_t
*
arg
)
static
void
free_variable
(
const
var_t
*
arg
)
{
{
var_t
*
constraint
;
var_t
*
constraint
;
int
index
=
0
;
/* FIXME */
int
index
=
0
;
/* FIXME */
...
@@ -563,16 +572,18 @@ static void free_variable( var_t *arg )
...
@@ -563,16 +572,18 @@ static void free_variable( var_t *arg )
}
}
}
}
static
void
proxy_free_variables
(
var_
t
*
arg
)
static
void
proxy_free_variables
(
var_
list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
{
free_variable
(
arg
);
free_variable
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
...
@@ -670,11 +681,14 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx)
...
@@ -670,11 +681,14 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx)
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
}
}
static
void
stub_write_locals
(
var_
t
*
arg
)
static
void
stub_write_locals
(
var_
list_t
*
args
)
{
{
int
n
=
0
;
int
n
=
0
;
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
int
outptr
=
is_attr
(
arg
->
attrs
,
ATTR_OUT
)
int
outptr
=
is_attr
(
arg
->
attrs
,
ATTR_OUT
)
&&
!
is_attr
(
arg
->
attrs
,
ATTR_IN
);
&&
!
is_attr
(
arg
->
attrs
,
ATTR_IN
);
...
@@ -692,15 +706,17 @@ static void stub_write_locals( var_t *arg )
...
@@ -692,15 +706,17 @@ static void stub_write_locals( var_t *arg )
fprintf
(
proxy
,
" "
);
fprintf
(
proxy
,
" "
);
write_name
(
proxy
,
arg
);
write_name
(
proxy
,
arg
);
fprintf
(
proxy
,
";
\n
"
);
fprintf
(
proxy
,
";
\n
"
);
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
stub_unmarshall
(
var_t
*
arg
)
static
void
stub_unmarshall
(
const
var_list_t
*
args
)
{
{
int
n
=
0
;
int
n
=
0
;
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
{
unmarshall_copy_arg
(
arg
);
unmarshall_copy_arg
(
arg
);
...
@@ -726,33 +742,32 @@ static void stub_unmarshall( var_t *arg )
...
@@ -726,33 +742,32 @@ static void stub_unmarshall( var_t *arg )
break
;
break
;
}
}
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
stub_gen_marshall_size
(
var_t
*
arg
)
static
void
stub_gen_marshall_size
(
const
var_list_t
*
args
)
{
{
const
var_t
*
arg
;
print_proxy
(
"_StubMsg.BufferLength = 0U;
\n
"
);
print_proxy
(
"_StubMsg.BufferLength = 0U;
\n
"
);
END_OF_LIST
(
arg
)
;
if
(
!
args
)
return
;
while
(
arg
)
{
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
marshall_size_arg
(
arg
);
marshall_size_arg
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
}
static
void
stub_gen_marshall_copydata
(
var_t
*
arg
)
static
void
stub_gen_marshall_copydata
(
const
var_list_t
*
args
)
{
{
END_OF_LIST
(
arg
);
const
var_t
*
arg
;
while
(
arg
)
{
if
(
!
args
)
return
;
LIST_FOR_EACH_ENTRY
(
arg
,
args
,
const
var_t
,
entry
)
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
marshall_copy_arg
(
arg
);
marshall_copy_arg
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
}
static
void
stub_genmarshall
(
var
_t
*
args
)
static
void
stub_genmarshall
(
const
var_list
_t
*
args
)
{
{
/* FIXME: size buffer */
/* FIXME: size buffer */
stub_gen_marshall_size
(
args
);
stub_gen_marshall_size
(
args
);
...
@@ -765,7 +780,7 @@ static void stub_genmarshall( var_t *args )
...
@@ -765,7 +780,7 @@ static void stub_genmarshall( var_t *args )
static
void
gen_stub
(
type_t
*
iface
,
const
func_t
*
cur
,
const
char
*
cas
)
static
void
gen_stub
(
type_t
*
iface
,
const
func_t
*
cur
,
const
char
*
cas
)
{
{
var_t
*
def
=
cur
->
def
;
var_t
*
def
=
cur
->
def
;
var_t
*
arg
;
const
var_t
*
arg
;
int
has_ret
=
!
is_void
(
def
->
type
,
def
);
int
has_ret
=
!
is_void
(
def
->
type
,
def
);
indent
=
0
;
indent
=
0
;
...
@@ -816,13 +831,13 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
...
@@ -816,13 +831,13 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
if
(
cas
)
fprintf
(
proxy
,
"%s_Stub"
,
cas
);
if
(
cas
)
fprintf
(
proxy
,
"%s_Stub"
,
cas
);
else
write_name
(
proxy
,
def
);
else
write_name
(
proxy
,
def
);
fprintf
(
proxy
,
"(_This"
);
fprintf
(
proxy
,
"(_This"
);
arg
=
cur
->
args
;
if
(
arg
)
{
if
(
cur
->
args
)
END_OF_LIST
(
arg
);
{
while
(
arg
)
{
LIST_FOR_EACH_ENTRY
(
arg
,
cur
->
args
,
const
var_t
,
entry
)
{
fprintf
(
proxy
,
", "
);
fprintf
(
proxy
,
", "
);
write_name
(
proxy
,
arg
);
write_name
(
proxy
,
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
}
}
fprintf
(
proxy
,
");
\n
"
);
fprintf
(
proxy
,
");
\n
"
);
...
...
tools/widl/server.c
View file @
eed74e4e
...
@@ -68,15 +68,10 @@ static void write_parameters_init(const func_t *func)
...
@@ -68,15 +68,10 @@ static void write_parameters_init(const func_t *func)
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
;
return
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
if
(
var
->
type
->
type
!=
RPC_FC_BIND_PRIMITIVE
)
if
(
var
->
type
->
type
!=
RPC_FC_BIND_PRIMITIVE
)
print_server
(
"%s = 0;
\n
"
,
var
->
name
);
print_server
(
"%s = 0;
\n
"
,
var
->
name
);
var
=
PREV_LINK
(
var
);
}
fprintf
(
server
,
"
\n
"
);
fprintf
(
server
,
"
\n
"
);
}
}
...
@@ -85,14 +80,12 @@ static void declare_args(const func_t *func)
...
@@ -85,14 +80,12 @@ static void declare_args(const func_t *func)
{
{
int
in_attr
,
out_attr
;
int
in_attr
,
out_attr
;
int
i
=
0
;
int
i
=
0
;
var_t
*
var
;
const
var_t
*
var
;
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
;
return
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
{
const
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
const
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
...
@@ -119,8 +112,6 @@ static void declare_args(const func_t *func)
...
@@ -119,8 +112,6 @@ static void declare_args(const func_t *func)
write_name
(
server
,
var
);
write_name
(
server
,
var
);
write_array
(
server
,
var
->
array
,
0
);
write_array
(
server
,
var
->
array
,
0
);
fprintf
(
server
,
";
\n
"
);
fprintf
(
server
,
";
\n
"
);
var
=
PREV_LINK
(
var
);
}
}
}
}
...
@@ -129,16 +120,14 @@ static void assign_out_args(const func_t *func)
...
@@ -129,16 +120,14 @@ static void assign_out_args(const func_t *func)
{
{
int
in_attr
,
out_attr
;
int
in_attr
,
out_attr
;
int
i
=
0
,
sep
=
0
;
int
i
=
0
,
sep
=
0
;
var_t
*
var
;
const
var_t
*
var
;
const
expr_t
*
size_is
;
const
expr_t
*
size_is
;
int
has_size
;
int
has_size
;
if
(
!
func
->
args
)
if
(
!
func
->
args
)
return
;
return
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
{
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
...
@@ -173,8 +162,6 @@ static void assign_out_args(const func_t *func)
...
@@ -173,8 +162,6 @@ static void assign_out_args(const func_t *func)
sep
=
1
;
sep
=
1
;
}
}
var
=
PREV_LINK
(
var
);
}
}
if
(
sep
)
if
(
sep
)
...
@@ -319,9 +306,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -319,9 +306,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf
(
server
,
"(
\n
"
);
fprintf
(
server
,
"(
\n
"
);
indent
++
;
indent
++
;
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
{
if
(
first_arg
)
if
(
first_arg
)
first_arg
=
0
;
first_arg
=
0
;
...
@@ -329,7 +314,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -329,7 +314,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
fprintf
(
server
,
",
\n
"
);
fprintf
(
server
,
",
\n
"
);
print_server
(
""
);
print_server
(
""
);
write_name
(
server
,
var
);
write_name
(
server
,
var
);
var
=
PREV_LINK
(
var
);
}
}
fprintf
(
server
,
");
\n
"
);
fprintf
(
server
,
");
\n
"
);
indent
--
;
indent
--
;
...
@@ -341,9 +325,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -341,9 +325,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
if
(
func
->
args
)
if
(
func
->
args
)
{
{
const
var_t
*
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
{
if
(
is_attr
(
var
->
attrs
,
ATTR_OUT
))
if
(
is_attr
(
var
->
attrs
,
ATTR_OUT
))
{
{
...
@@ -351,8 +333,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -351,8 +333,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
buffer_size
+=
get_required_buffer_size
(
var
,
&
alignment
,
PASS_OUT
);
buffer_size
+=
get_required_buffer_size
(
var
,
&
alignment
,
PASS_OUT
);
buffer_size
+=
alignment
;
buffer_size
+=
alignment
;
}
}
var
=
PREV_LINK
(
var
);
}
}
}
}
...
@@ -417,13 +397,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
...
@@ -417,13 +397,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
/* update proc_offset */
/* update proc_offset */
if
(
func
->
args
)
if
(
func
->
args
)
{
{
var
=
func
->
args
;
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
*
proc_offset
+=
get_size_procformatstring_var
(
var
);
*
proc_offset
+=
get_size_procformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
}
}
}
if
(
!
is_void
(
def
->
type
,
NULL
))
if
(
!
is_void
(
def
->
type
,
NULL
))
*
proc_offset
+=
get_size_procformatstring_var
(
def
);
*
proc_offset
+=
get_size_procformatstring_var
(
def
);
...
...
tools/widl/typegen.c
View file @
eed74e4e
This diff is collapsed.
Click to expand it.
tools/widl/widltypes.h
View file @
eed74e4e
...
@@ -48,6 +48,7 @@ typedef struct _typelib_t typelib_t;
...
@@ -48,6 +48,7 @@ typedef struct _typelib_t typelib_t;
typedef
struct
list
attr_list_t
;
typedef
struct
list
attr_list_t
;
typedef
struct
list
func_list_t
;
typedef
struct
list
func_list_t
;
typedef
struct
list
var_list_t
;
typedef
struct
list
ifref_list_t
;
typedef
struct
list
ifref_list_t
;
#define DECL_LINK(type) \
#define DECL_LINK(type) \
...
@@ -210,7 +211,7 @@ struct _type_t {
...
@@ -210,7 +211,7 @@ struct _type_t {
struct
_type_t
*
ref
;
struct
_type_t
*
ref
;
const
attr_list_t
*
attrs
;
const
attr_list_t
*
attrs
;
func_list_t
*
funcs
;
/* interfaces and modules */
func_list_t
*
funcs
;
/* interfaces and modules */
var_
t
*
fields
;
/* interfaces, structures and enumerations */
var_
list_t
*
fields
;
/* interfaces, structures and enumerations */
ifref_list_t
*
ifaces
;
/* coclasses */
ifref_list_t
*
ifaces
;
/* coclasses */
type_t
*
orig
;
/* dup'd types */
type_t
*
orig
;
/* dup'd types */
int
ignore
,
is_const
,
sign
;
int
ignore
,
is_const
,
sign
;
...
@@ -231,18 +232,18 @@ struct _var_t {
...
@@ -231,18 +232,18 @@ struct _var_t {
int
ptr_level
;
int
ptr_level
;
expr_t
*
array
;
expr_t
*
array
;
type_t
*
type
;
type_t
*
type
;
var_t
*
args
;
/* for function pointers */
var_
list_
t
*
args
;
/* for function pointers */
const
char
*
tname
;
const
char
*
tname
;
attr_list_t
*
attrs
;
attr_list_t
*
attrs
;
expr_t
*
eval
;
expr_t
*
eval
;
/* parser-internal */
/* parser-internal */
DECL_LINK
(
var_t
)
;
struct
list
entry
;
};
};
struct
_func_t
{
struct
_func_t
{
var_t
*
def
;
var_t
*
def
;
var_t
*
args
;
var_
list_
t
*
args
;
int
ignore
,
idx
;
int
ignore
,
idx
;
/* parser-internal */
/* parser-internal */
...
@@ -301,7 +302,7 @@ type_t *duptype(type_t *t, int dupname);
...
@@ -301,7 +302,7 @@ type_t *duptype(type_t *t, int dupname);
type_t
*
alias
(
type_t
*
t
,
const
char
*
name
);
type_t
*
alias
(
type_t
*
t
,
const
char
*
name
);
int
is_ptr
(
const
type_t
*
t
);
int
is_ptr
(
const
type_t
*
t
);
int
is_var_ptr
(
var_t
*
v
);
int
is_var_ptr
(
const
var_t
*
v
);
int
cant_be_null
(
var_t
*
v
);
int
cant_be_null
(
const
var_t
*
v
);
#endif
#endif
tools/widl/write_msft.c
View file @
eed74e4e
...
@@ -1250,7 +1250,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
...
@@ -1250,7 +1250,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
int
i
,
id
,
next_idx
;
int
i
,
id
,
next_idx
;
int
decoded_size
,
extra_attr
=
0
;
int
decoded_size
,
extra_attr
=
0
;
int
num_params
=
0
,
num_defaults
=
0
;
int
num_params
=
0
,
num_defaults
=
0
;
var_t
*
arg
,
*
last_arg
=
NULL
;
var_t
*
arg
;
char
*
namedata
;
char
*
namedata
;
const
attr_t
*
attr
;
const
attr_t
*
attr
;
unsigned
int
funcflags
=
0
,
callconv
=
4
/* CC_STDCALL */
;
unsigned
int
funcflags
=
0
,
callconv
=
4
/* CC_STDCALL */
;
...
@@ -1279,8 +1279,9 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
...
@@ -1279,8 +1279,9 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
return
S_FALSE
;
return
S_FALSE
;
}
}
for
(
arg
=
func
->
args
;
arg
;
arg
=
NEXT_LINK
(
arg
))
{
if
(
func
->
args
)
last_arg
=
arg
;
LIST_FOR_EACH_ENTRY
(
arg
,
func
->
args
,
var_t
,
entry
)
{
num_params
++
;
num_params
++
;
if
(
arg
->
attrs
)
LIST_FOR_EACH_ENTRY
(
attr
,
arg
->
attrs
,
const
attr_t
,
entry
)
{
if
(
arg
->
attrs
)
LIST_FOR_EACH_ENTRY
(
attr
,
arg
->
attrs
,
const
attr_t
,
entry
)
{
if
(
attr
->
type
==
ATTR_DEFAULTVALUE_EXPR
||
attr
->
type
==
ATTR_DEFAULTVALUE_STRING
)
{
if
(
attr
->
type
==
ATTR_DEFAULTVALUE_EXPR
||
attr
->
type
==
ATTR_DEFAULTVALUE_STRING
)
{
...
@@ -1433,7 +1434,11 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
...
@@ -1433,7 +1434,11 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
warning
(
"unknown number of optional attrs
\n
"
);
warning
(
"unknown number of optional attrs
\n
"
);
}
}
for
(
arg
=
last_arg
,
i
=
0
;
arg
;
arg
=
PREV_LINK
(
arg
),
i
++
)
{
if
(
func
->
args
)
{
i
=
0
;
LIST_FOR_EACH_ENTRY
(
arg
,
func
->
args
,
var_t
,
entry
)
{
const
attr_t
*
attr
;
const
attr_t
*
attr
;
int
paramflags
=
0
;
int
paramflags
=
0
;
int
*
paramdata
=
typedata
+
6
+
extra_attr
+
(
num_defaults
?
num_params
:
0
)
+
i
*
3
;
int
*
paramdata
=
typedata
+
6
+
extra_attr
+
(
num_defaults
?
num_params
:
0
)
+
i
*
3
;
...
@@ -1491,6 +1496,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
...
@@ -1491,6 +1496,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
paramdata
[
1
]
=
-
1
;
paramdata
[
1
]
=
-
1
;
paramdata
[
2
]
=
paramflags
;
paramdata
[
2
]
=
paramflags
;
typedata
[
3
]
+=
decoded_size
<<
16
;
typedata
[
3
]
+=
decoded_size
<<
16
;
i
++
;
}
}
}
if
(
typeinfo
->
funcs_allocated
==
0
)
{
if
(
typeinfo
->
funcs_allocated
==
0
)
{
...
@@ -1541,10 +1548,16 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
...
@@ -1541,10 +1548,16 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
if
(
invokekind
!=
0x4
/* INVOKE_PROPERTYPUT */
&&
invokekind
!=
0x8
/* INVOKE_PROPERTYPUTREF */
)
{
if
(
invokekind
!=
0x4
/* INVOKE_PROPERTYPUT */
&&
invokekind
!=
0x8
/* INVOKE_PROPERTYPUTREF */
)
{
/* don't give the arg of a [propput*] func a name */
/* don't give the arg of a [propput*] func a name */
for
(
arg
=
last_arg
,
i
=
0
;
arg
;
arg
=
PREV_LINK
(
arg
),
i
++
)
{
if
(
func
->
args
)
{
i
=
0
;
LIST_FOR_EACH_ENTRY
(
arg
,
func
->
args
,
var_t
,
entry
)
{
int
*
paramdata
=
typedata
+
6
+
extra_attr
+
(
num_defaults
?
num_params
:
0
)
+
i
*
3
;
int
*
paramdata
=
typedata
+
6
+
extra_attr
+
(
num_defaults
?
num_params
:
0
)
+
i
*
3
;
offset
=
ctl2_alloc_name
(
typeinfo
->
typelib
,
arg
->
name
);
offset
=
ctl2_alloc_name
(
typeinfo
->
typelib
,
arg
->
name
);
paramdata
[
1
]
=
offset
;
paramdata
[
1
]
=
offset
;
i
++
;
}
}
}
}
}
return
S_OK
;
return
S_OK
;
...
@@ -1919,14 +1932,9 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
...
@@ -1919,14 +1932,9 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
if
(
dispinterface
->
funcs
)
if
(
dispinterface
->
funcs
)
LIST_FOR_EACH_ENTRY
(
func
,
dispinterface
->
funcs
,
const
func_t
,
entry
)
idx
++
;
LIST_FOR_EACH_ENTRY
(
func
,
dispinterface
->
funcs
,
const
func_t
,
entry
)
idx
++
;
if
((
var
=
dispinterface
->
fields
))
{
if
(
dispinterface
->
fields
)
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
LIST_FOR_EACH_ENTRY
(
var
,
dispinterface
->
fields
,
var_t
,
entry
)
while
(
var
)
{
add_var_desc
(
msft_typeinfo
,
idx
++
,
var
);
add_var_desc
(
msft_typeinfo
,
idx
,
var
);
idx
++
;
var
=
PREV_LINK
(
var
);
}
}
if
(
dispinterface
->
funcs
)
if
(
dispinterface
->
funcs
)
{
{
...
@@ -1998,7 +2006,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
...
@@ -1998,7 +2006,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
static
void
add_structure_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
structure
)
static
void
add_structure_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
structure
)
{
{
int
idx
=
0
;
int
idx
=
0
;
var_t
*
cur
=
structure
->
fields
;
var_t
*
cur
;
msft_typeinfo_t
*
msft_typeinfo
;
msft_typeinfo_t
*
msft_typeinfo
;
if
(
-
1
<
structure
->
typelib_idx
)
if
(
-
1
<
structure
->
typelib_idx
)
...
@@ -2008,30 +2016,24 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
...
@@ -2008,30 +2016,24 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_RECORD
,
structure
->
name
,
structure
->
attrs
);
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_RECORD
,
structure
->
name
,
structure
->
attrs
);
msft_typeinfo
->
typeinfo
->
size
=
0
;
msft_typeinfo
->
typeinfo
->
size
=
0
;
while
(
NEXT_LINK
(
cur
))
cur
=
NEXT_LINK
(
cur
);
if
(
structure
->
fields
)
while
(
cur
)
{
LIST_FOR_EACH_ENTRY
(
cur
,
structure
->
fields
,
var_t
,
entry
)
add_var_desc
(
msft_typeinfo
,
idx
,
cur
);
add_var_desc
(
msft_typeinfo
,
idx
++
,
cur
);
idx
++
;
cur
=
PREV_LINK
(
cur
);
}
}
}
static
void
add_enum_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
enumeration
)
static
void
add_enum_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
enumeration
)
{
{
int
idx
=
0
;
int
idx
=
0
;
var_t
*
cur
=
enumeration
->
fields
;
var_t
*
cur
;
msft_typeinfo_t
*
msft_typeinfo
;
msft_typeinfo_t
*
msft_typeinfo
;
enumeration
->
typelib_idx
=
typelib
->
typelib_header
.
nrtypeinfos
;
enumeration
->
typelib_idx
=
typelib
->
typelib_header
.
nrtypeinfos
;
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_ENUM
,
enumeration
->
name
,
enumeration
->
attrs
);
msft_typeinfo
=
create_msft_typeinfo
(
typelib
,
TKIND_ENUM
,
enumeration
->
name
,
enumeration
->
attrs
);
msft_typeinfo
->
typeinfo
->
size
=
0
;
msft_typeinfo
->
typeinfo
->
size
=
0
;
while
(
NEXT_LINK
(
cur
))
cur
=
NEXT_LINK
(
cur
);
if
(
enumeration
->
fields
)
while
(
cur
)
{
LIST_FOR_EACH_ENTRY
(
cur
,
enumeration
->
fields
,
var_t
,
entry
)
add_var_desc
(
msft_typeinfo
,
idx
,
cur
);
add_var_desc
(
msft_typeinfo
,
idx
++
,
cur
);
idx
++
;
cur
=
PREV_LINK
(
cur
);
}
}
}
static
void
add_typedef_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
tdef
)
static
void
add_typedef_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
tdef
)
...
...
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