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
4a7c0479
Commit
4a7c0479
authored
Jan 24, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Jan 24, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Start implementing writing of conformance/variance descriptors.
parent
21a90850
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
8 deletions
+94
-8
typegen.c
tools/widl/typegen.c
+94
-8
No files found.
tools/widl/typegen.c
View file @
4a7c0479
...
...
@@ -42,6 +42,8 @@
#include "widl.h"
#include "typegen.h"
static
const
func_t
*
current_func
;
static
int
print_file
(
FILE
*
file
,
int
indent
,
const
char
*
format
,
...)
{
va_list
va
;
...
...
@@ -212,6 +214,86 @@ void write_procformatstring(FILE *file, type_t *iface)
print_file
(
file
,
indent
,
"
\n
"
);
}
/* write conformance / variance descriptor */
/* FIXME: only works for top-level variables at the moment */
static
size_t
write_conf_or_var_desc
(
FILE
*
file
,
const
func_t
*
func
,
const
expr_t
*
expr
)
{
if
(
!
file
)
return
4
;
/* optimisation for sizing pass */
if
(
expr
->
type
==
EXPR_IDENTIFIER
)
{
if
(
func
)
{
size_t
stack_offset
;
const
var_t
*
var
=
func
->
args
;
unsigned
char
param_type
=
0
;
const
char
*
param_type_string
=
NULL
;
const
type_t
*
conformance_type
=
NULL
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
for
(
stack_offset
=
0
;
var
;
stack_offset
+=
sizeof
(
void
*
),
var
=
PREV_LINK
(
var
))
{
if
(
!
strcmp
(
var
->
name
,
expr
->
u
.
sval
))
{
conformance_type
=
var
->
type
;
break
;
}
}
if
(
!
conformance_type
)
error
(
"write_conf_or_var_desc: couldn't find variable %s
\n
"
,
expr
->
u
.
sval
);
while
(
type_has_ref
(
conformance_type
))
conformance_type
=
conformance_type
->
ref
;
switch
(
conformance_type
->
type
)
{
case
RPC_FC_CHAR
:
case
RPC_FC_SMALL
:
param_type
=
RPC_FC_SMALL
;
param_type_string
=
"FC_SMALL"
;
break
;
case
RPC_FC_BYTE
:
case
RPC_FC_USMALL
:
param_type
=
RPC_FC_USMALL
;
param_type_string
=
"FC_USMALL"
;
break
;
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
param_type
=
RPC_FC_SHORT
;
param_type_string
=
"FC_SHORT"
;
break
;
case
RPC_FC_USHORT
:
param_type
=
RPC_FC_USHORT
;
param_type_string
=
"FC_USHORT"
;
break
;
case
RPC_FC_LONG
:
param_type
=
RPC_FC_LONG
;
param_type_string
=
"FC_LONG"
;
break
;
case
RPC_FC_ULONG
:
param_type
=
RPC_FC_ULONG
;
param_type_string
=
"FC_ULONG"
;
break
;
default:
error
(
"write_conf_or_var_desc: conformance variable type not supported 0x%x
\n
"
,
conformance_type
->
type
);
}
print_file
(
file
,
2
,
"0x%x, /* Corr desc: parameter, %s */
\n
"
,
RPC_FC_TOP_LEVEL_CONFORMANCE
|
param_type
,
param_type_string
);
print_file
(
file
,
2
,
"0x0, /* no operators */
\n
"
);
print_file
(
file
,
2
,
"0x%x, /* x86 stack size / offset = %d */
\n
"
,
stack_offset
,
stack_offset
);
}
else
error
(
"write_conf_or_var_desc: not supported for non-functions yet
\n
"
);
}
else
error
(
"write_conf_or_var_desc: expression type %d
\n
"
,
expr
->
type
);
return
4
;
}
static
size_t
type_memsize
(
const
type_t
*
t
,
int
ptr_level
,
const
expr_t
*
array
);
static
size_t
fields_memsize
(
const
var_t
*
v
)
...
...
@@ -322,9 +404,11 @@ static size_t write_string_tfs(FILE *file, const attr_t *attrs,
print_file
(
file
,
2
,
"0x%x, /* FC_C_CSTRING */
\n
"
,
RPC_FC_C_CSTRING
);
else
print_file
(
file
,
2
,
"0x%x, /* FC_C_WSTRING */
\n
"
,
RPC_FC_C_WSTRING
);
print_file
(
file
,
2
,
"0x%x, /* FC_
PAD */
\n
"
,
RPC_FC_PA
D
);
print_file
(
file
,
2
,
"0x%x, /* FC_
STRING_SIZED */
\n
"
,
RPC_FC_STRING_SIZE
D
);
typestring_size
=
2
;
typestring_size
+=
write_conf_or_var_desc
(
file
,
current_func
,
size_is
);
return
typestring_size
;
}
else
...
...
@@ -335,11 +419,9 @@ static size_t write_string_tfs(FILE *file, const attr_t *attrs,
print_file
(
file
,
2
,
"0x%x, /* FC_C_CSTRING */
\n
"
,
RPC_FC_C_CSTRING
);
else
print_file
(
file
,
2
,
"0x%x, /* FC_C_WSTRING */
\n
"
,
RPC_FC_C_WSTRING
);
print_file
(
file
,
2
,
"0x%x, /* FC_
STRING_SIZED */
\n
"
,
RPC_FC_STRING_SIZE
D
);
print_file
(
file
,
2
,
"0x%x, /* FC_
PAD */
\n
"
,
RPC_FC_PA
D
);
typestring_size
=
2
;
/* FIXME: write out conformance descriptor */
return
typestring_size
;
}
}
...
...
@@ -428,7 +510,8 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs,
print_file
(
file
,
2
,
"NdrFcShort(0x%x), /* %d */
\n
"
,
element_size
,
element_size
);
typestring_size
+=
2
;
/* FIXME: write out variance descriptor */
typestring_size
+=
write_conf_or_var_desc
(
file
,
current_func
,
length_is
);
/* FIXME: write out pointer descriptor if necessary */
print_file
(
file
,
2
,
"0x0, /* FIXME: write out conversion data */
\n
"
);
...
...
@@ -450,7 +533,8 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs,
print_file
(
file
,
2
,
"NdrFcShort(0x%x), /* %d */
\n
"
,
element_size
,
element_size
);
typestring_size
=
4
;
/* FIXME: write out conformance descriptor */
typestring_size
+=
write_conf_or_var_desc
(
file
,
current_func
,
size_is
);
/* FIXME: write out pointer descriptor if necessary */
print_file
(
file
,
2
,
"0x0, /* FIXME: write out conversion data */
\n
"
);
...
...
@@ -472,8 +556,9 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs,
print_file
(
file
,
2
,
"NdrFcShort(0x%x), /* %d */
\n
"
,
element_size
,
element_size
);
typestring_size
=
4
;
/* FIXME: write out conformance descriptor */
/* FIXME: write out variance descriptor */
typestring_size
+=
write_conf_or_var_desc
(
file
,
current_func
,
size_is
);
typestring_size
+=
write_conf_or_var_desc
(
file
,
current_func
,
length_is
);
/* FIXME: write out pointer descriptor if necessary */
print_file
(
file
,
2
,
"0x0, /* FIXME: write out conversion data */
\n
"
);
...
...
@@ -570,6 +655,7 @@ void write_typeformatstring(FILE *file, type_t *iface)
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
for
(;
func
;
func
=
PREV_LINK
(
func
))
{
current_func
=
func
;
if
(
func
->
args
)
{
var
=
func
->
args
;
...
...
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