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
3c2a9f5d
Commit
3c2a9f5d
authored
Feb 06, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: size_is and length_is are expression lists now.
parent
3bfa88dc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
30 deletions
+59
-30
header.c
tools/widl/header.c
+10
-0
header.h
tools/widl/header.h
+1
-0
proxy.c
tools/widl/proxy.c
+3
-2
typegen.c
tools/widl/typegen.c
+45
-28
No files found.
tools/widl/header.c
View file @
3c2a9f5d
...
...
@@ -85,6 +85,16 @@ int is_conformant_array( const array_dims_t *array )
return
!
dim
->
is_const
;
}
int
is_non_void
(
const
expr_list_t
*
list
)
{
const
expr_t
*
expr
;
if
(
list
)
LIST_FOR_EACH_ENTRY
(
expr
,
list
,
const
expr_t
,
entry
)
if
(
expr
->
type
!=
EXPR_VOID
)
return
1
;
return
0
;
}
void
write_guid
(
FILE
*
f
,
const
char
*
guid_prefix
,
const
char
*
name
,
const
UUID
*
uuid
)
{
if
(
!
uuid
)
return
;
...
...
tools/widl/header.h
View file @
3c2a9f5d
...
...
@@ -26,6 +26,7 @@ extern void *get_attrp(const attr_list_t *list, enum attr_type t);
extern
unsigned
long
get_attrv
(
const
attr_list_t
*
list
,
enum
attr_type
t
);
extern
int
is_void
(
const
type_t
*
t
,
const
var_t
*
v
);
extern
int
is_conformant_array
(
const
array_dims_t
*
array
);
extern
int
is_non_void
(
const
expr_list_t
*
list
);
extern
void
write_name
(
FILE
*
h
,
const
var_t
*
v
);
extern
const
char
*
get_name
(
const
var_t
*
v
);
extern
void
write_type
(
FILE
*
h
,
type_t
*
t
,
const
var_t
*
v
,
const
char
*
n
);
...
...
tools/widl/proxy.c
View file @
3c2a9f5d
...
...
@@ -196,13 +196,14 @@ static void free_variable( const var_t *arg )
var_t
*
constraint
;
int
index
=
0
;
/* FIXME */
type_t
*
type
;
expr_t
*
expr
;
expr_
list_
t
*
expr
;
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_SIZEIS
);
if
(
expr
)
{
const
expr_t
*
size
=
LIST_ENTRY
(
list_head
(
expr
),
const
expr_t
,
entry
);
print_proxy
(
"_StubMsg.MaxCount = "
,
arg
->
name
);
write_expr
(
proxy
,
expr
,
0
);
write_expr
(
proxy
,
size
,
0
);
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], "
,
index
);
...
...
tools/widl/typegen.c
View file @
3c2a9f5d
...
...
@@ -359,15 +359,20 @@ static int write_base_type(FILE *file, const type_t *type, unsigned int *typestr
}
/* write conformance / variance descriptor */
static
size_t
write_conf_or_var_desc
(
FILE
*
file
,
const
func_t
*
func
,
const
type_t
*
structure
,
const
expr_
t
*
expr
)
static
size_t
write_conf_or_var_desc
(
FILE
*
file
,
const
func_t
*
func
,
const
type_t
*
structure
,
const
expr_
list_t
*
expr_list
)
{
unsigned
char
operator_type
=
0
;
const
char
*
operator_string
=
"no operators"
;
const
expr_t
*
subexpr
=
expr
;
const
expr_t
*
expr
,
*
sub
expr
;
unsigned
char
correlation_type
;
if
(
!
file
)
return
4
;
/* optimisation for sizing pass */
if
(
list_count
(
expr_list
)
>
1
)
error
(
"write_conf_or_var_desc: multi-dimensional arrays not supported yet
\n
"
);
expr
=
subexpr
=
LIST_ENTRY
(
list_head
(
expr_list
),
const
expr_t
,
entry
);
if
(
expr
->
is_const
)
{
if
(
expr
->
cval
>
UCHAR_MAX
*
(
USHRT_MAX
+
1
)
+
USHRT_MAX
)
...
...
@@ -762,8 +767,8 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs,
const
type_t
*
type
,
const
array_dims_t
*
array
,
const
char
*
name
,
unsigned
int
*
typestring_offset
)
{
const
expr_t
*
size_is
=
get_attrp
(
attrs
,
ATTR_SIZEIS
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
const
expr_
list_
t
*
size_is
=
get_attrp
(
attrs
,
ATTR_SIZEIS
);
int
has_size
=
is_non_void
(
size_is
);
size_t
start_offset
=
*
typestring_offset
;
unsigned
char
flags
=
0
;
int
pointer_type
;
...
...
@@ -853,10 +858,10 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs,
const
type_t
*
type
,
const
array_dims_t
*
array
,
const
char
*
name
,
unsigned
int
*
typestring_offset
)
{
const
expr_t
*
length_is
=
get_attrp
(
attrs
,
ATTR_LENGTHIS
);
const
expr_t
*
size_is
=
get_attrp
(
attrs
,
ATTR_SIZEIS
);
int
has_length
=
length_is
&&
(
length_is
->
type
!=
EXPR_VOID
);
int
has_size
=
(
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
)
)
||
is_conformant_array
(
array
);
const
expr_
list_
t
*
length_is
=
get_attrp
(
attrs
,
ATTR_LENGTHIS
);
const
expr_
list_
t
*
size_is
=
get_attrp
(
attrs
,
ATTR_SIZEIS
);
int
has_length
=
is_non_void
(
length_is
);
int
has_size
=
is_non_void
(
size_is
)
||
is_conformant_array
(
array
);
size_t
start_offset
;
int
pointer_type
=
get_attrv
(
attrs
,
ATTR_POINTERTYPE
);
if
(
!
pointer_type
)
...
...
@@ -1003,7 +1008,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs,
*
typestring_offset
+=
write_conf_or_var_desc
(
file
,
current_func
,
current_structure
,
size_is
?
size_is
:
dim
);
size_is
?
size_is
:
array
);
if
(
has_pointer
)
{
...
...
@@ -1041,7 +1046,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs,
*
typestring_offset
+=
write_conf_or_var_desc
(
file
,
current_func
,
current_structure
,
size_is
?
size_is
:
dim
);
size_is
?
size_is
:
array
);
*
typestring_offset
+=
write_conf_or_var_desc
(
file
,
current_func
,
current_structure
,
length_is
);
...
...
@@ -1613,8 +1618,8 @@ static unsigned int get_required_buffer_size_type(
static
unsigned
int
get_required_buffer_size
(
const
var_t
*
var
,
unsigned
int
*
alignment
,
enum
pass
pass
)
{
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
(
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
)
);
expr_
list_
t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
is_non_void
(
size_is
);
int
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
int
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
...
...
@@ -1841,8 +1846,8 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
unsigned
int
*
type_offset
,
enum
pass
pass
,
enum
remoting_phase
phase
)
{
const
expr_t
*
length_is
;
const
expr_t
*
size_is
;
const
expr_
list_
t
*
length_is
;
const
expr_
list_
t
*
size_is
;
int
in_attr
,
out_attr
,
has_length
,
has_size
,
pointer_type
;
const
var_t
*
var
;
...
...
@@ -1862,8 +1867,8 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
length_is
=
get_attrp
(
var
->
attrs
,
ATTR_LENGTHIS
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
has_length
=
length_is
&&
(
length_is
->
type
!=
EXPR_VOID
);
has_size
=
(
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
)
)
||
(
var
->
array
&&
is_conformant_array
(
var
->
array
));
has_length
=
is_non_void
(
length_is
);
has_size
=
is_non_void
(
size_is
)
||
(
var
->
array
&&
is_conformant_array
(
var
->
array
));
pointer_type
=
get_attrv
(
var
->
attrs
,
ATTR_POINTERTYPE
);
if
(
!
pointer_type
)
...
...
@@ -1900,8 +1905,9 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
{
if
(
size_is
&&
is_size_needed_for_phase
(
phase
))
{
const
expr_t
*
size
=
LIST_ENTRY
(
list_head
(
size_is
),
const
expr_t
,
entry
);
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
size
_is
,
1
);
write_expr
(
file
,
size
,
1
);
fprintf
(
file
,
";
\n
"
);
}
...
...
@@ -1920,16 +1926,16 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
array_type
=
"ComplexArray"
;
else
{
const
expr_t
*
dim
=
LIST_ENTRY
(
list_head
(
var
->
array
),
expr_t
,
entry
);
if
(
!
has_length
&&
!
has_size
)
array_type
=
"FixedArray"
;
else
if
(
has_length
&&
!
has_size
)
{
if
(
is_size_needed_for_phase
(
phase
))
{
const
expr_t
*
length
=
LIST_ENTRY
(
list_head
(
length_is
),
const
expr_t
,
entry
);
print_file
(
file
,
indent
,
"_StubMsg.Offset = (unsigned long)0;
\n
"
);
/* FIXME */
print_file
(
file
,
indent
,
"_StubMsg.ActualCount = (unsigned long)"
);
write_expr
(
file
,
length
_is
,
1
);
write_expr
(
file
,
length
,
1
);
fprintf
(
file
,
";
\n\n
"
);
}
array_type
=
"VaryingArray"
;
...
...
@@ -1938,8 +1944,10 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
{
if
(
is_size_needed_for_phase
(
phase
)
&&
phase
!=
PHASE_FREE
)
{
const
expr_t
*
size
=
LIST_ENTRY
(
list_head
(
size_is
?
size_is
:
var
->
array
),
const
expr_t
,
entry
);
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
size
_is
?
size_is
:
dim
,
1
);
write_expr
(
file
,
size
,
1
);
fprintf
(
file
,
";
\n\n
"
);
}
array_type
=
"ConformantArray"
;
...
...
@@ -1948,12 +1956,15 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
{
if
(
is_size_needed_for_phase
(
phase
))
{
const
expr_t
*
length
=
LIST_ENTRY
(
list_head
(
length_is
),
const
expr_t
,
entry
);
const
expr_t
*
size
=
LIST_ENTRY
(
list_head
(
size_is
?
size_is
:
var
->
array
),
const
expr_t
,
entry
);
print_file
(
file
,
indent
,
"_StubMsg.MaxCount = (unsigned long)"
);
write_expr
(
file
,
size
_is
?
size_is
:
dim
,
1
);
write_expr
(
file
,
size
,
1
);
fprintf
(
file
,
";
\n
"
);
print_file
(
file
,
indent
,
"_StubMsg.Offset = (unsigned long)0;
\n
"
);
/* FIXME */
print_file
(
file
,
indent
,
"_StubMsg.ActualCount = (unsigned long)"
);
write_expr
(
file
,
length
_is
,
1
);
write_expr
(
file
,
length
,
1
);
fprintf
(
file
,
";
\n\n
"
);
}
array_type
=
"ConformantVaryingArray"
;
...
...
@@ -2234,8 +2245,8 @@ void declare_stub_args( FILE *file, int indent, const func_t *func )
LIST_FOR_EACH_ENTRY
(
var
,
func
->
args
,
const
var_t
,
entry
)
{
const
expr_t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
const
expr_
list_
t
*
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
int
has_size
=
is_non_void
(
size_is
);
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
...
...
@@ -2268,7 +2279,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
int
in_attr
,
out_attr
;
int
i
=
0
,
sep
=
0
;
const
var_t
*
var
;
const
expr_t
*
size_is
;
const
expr_
list_
t
*
size_is
;
int
has_size
;
if
(
!
func
->
args
)
...
...
@@ -2278,7 +2289,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
{
int
is_string
=
is_attr
(
var
->
attrs
,
ATTR_STRING
);
size_is
=
get_attrp
(
var
->
attrs
,
ATTR_SIZEIS
);
has_size
=
size_is
&&
(
size_is
->
type
!=
EXPR_VOID
);
has_size
=
is_non_void
(
size_is
);
in_attr
=
is_attr
(
var
->
attrs
,
ATTR_IN
);
out_attr
=
is_attr
(
var
->
attrs
,
ATTR_OUT
);
if
(
!
out_attr
&&
!
in_attr
)
...
...
@@ -2291,13 +2302,19 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
if
(
has_size
)
{
const
expr_t
*
expr
;
unsigned
int
size
,
align
=
0
;
type_t
*
type
=
var
->
type
;
fprintf
(
file
,
" = NdrAllocate(&_StubMsg, "
);
write_expr
(
file
,
size_is
,
1
);
LIST_FOR_EACH_ENTRY
(
expr
,
size_is
,
const
expr_t
,
entry
)
{
if
(
expr
->
type
==
EXPR_VOID
)
continue
;
write_expr
(
file
,
expr
,
1
);
fprintf
(
file
,
" * "
);
}
size
=
type_memsize
(
type
,
0
,
NULL
,
&
align
);
fprintf
(
file
,
"
*
%u);
\n
"
,
size
);
fprintf
(
file
,
"%u);
\n
"
,
size
);
}
else
if
(
!
is_string
)
{
...
...
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