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
6f85f989
Commit
6f85f989
authored
Jun 01, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Jun 02, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Only write one procformat string and one typeformat string per file.
parent
bae6d23c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
118 deletions
+150
-118
client.c
tools/widl/client.c
+18
-24
server.c
tools/widl/server.c
+18
-24
typegen.c
tools/widl/typegen.c
+102
-66
typegen.h
tools/widl/typegen.h
+4
-4
widltypes.h
tools/widl/widltypes.h
+8
-0
No files found.
tools/widl/client.c
View file @
6f85f989
...
...
@@ -41,14 +41,6 @@
#include "typelib_struct.h"
#include "typegen.h"
#define END_OF_LIST(list) \
do { \
if (list) { \
while (NEXT_LINK(list)) \
list = NEXT_LINK(list); \
} \
} while(0)
static
FILE
*
client
;
static
int
indent
=
0
;
...
...
@@ -120,15 +112,13 @@ static void check_pointers(const func_t *func)
}
}
static
void
write_function_stubs
(
type_t
*
iface
)
static
void
write_function_stubs
(
type_t
*
iface
,
unsigned
int
*
proc_offset
,
unsigned
int
*
type_offset
)
{
const
func_t
*
func
=
iface
->
funcs
;
const
char
*
implicit_handle
=
get_attrp
(
iface
->
attrs
,
ATTR_IMPLICIT_HANDLE
);
int
explicit_handle
=
is_attr
(
iface
->
attrs
,
ATTR_EXPLICIT_HANDLE
);
var_t
*
var
;
int
method_count
=
0
;
unsigned
int
proc_offset
=
0
;
unsigned
int
type_offset
=
2
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
...
...
@@ -219,7 +209,7 @@ static void write_function_stubs(type_t *iface)
print_message_buffer_size
(
func
);
fprintf
(
client
,
";
\n
"
);
type_offset_func
=
type_offset
;
type_offset_func
=
*
type_offset
;
write_remoting_arguments
(
client
,
indent
,
func
,
&
type_offset_func
,
PASS_IN
,
PHASE_BUFFERSIZE
);
print_client
(
"NdrGetBuffer(
\n
"
);
...
...
@@ -235,7 +225,7 @@ static void write_function_stubs(type_t *iface)
/* make a copy so we don't increment the type offset twice */
type_offset_func
=
type_offset
;
type_offset_func
=
*
type_offset
;
/* marshal arguments */
write_remoting_arguments
(
client
,
indent
,
func
,
&
type_offset_func
,
PASS_IN
,
PHASE_MARSHAL
);
...
...
@@ -262,13 +252,13 @@ static void write_function_stubs(type_t *iface)
print_client
(
"NdrConvert(
\n
"
);
indent
++
;
print_client
(
"(PMIDL_STUB_MESSAGE)&_StubMsg,
\n
"
);
print_client
(
"(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);
\n
"
,
proc_offset
);
print_client
(
"(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);
\n
"
,
*
proc_offset
);
indent
-=
2
;
}
/* unmarshall arguments */
fprintf
(
client
,
"
\n
"
);
write_remoting_arguments
(
client
,
indent
,
func
,
&
type_offset
,
PASS_OUT
,
PHASE_UNMARSHAL
);
write_remoting_arguments
(
client
,
indent
,
func
,
type_offset
,
PASS_OUT
,
PHASE_UNMARSHAL
);
/* unmarshal return value */
if
(
!
is_void
(
def
->
type
,
NULL
))
...
...
@@ -425,13 +415,13 @@ static void write_formatdesc( const char *str )
}
static
void
write_formatstringsdecl
(
type_t
*
iface
)
static
void
write_formatstringsdecl
(
ifref_t
*
ifaces
)
{
print_client
(
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
get_size_typeformatstring
(
iface
));
get_size_typeformatstring
(
iface
s
));
print_client
(
"#define PROC_FORMAT_STRING_SIZE %d
\n
"
,
get_size_procformatstring
(
iface
));
get_size_procformatstring
(
iface
s
));
fprintf
(
client
,
"
\n
"
);
write_formatdesc
(
"TYPE"
);
...
...
@@ -474,6 +464,8 @@ static void init_client(void)
void
write_client
(
ifref_t
*
ifaces
)
{
unsigned
int
proc_offset
=
0
;
unsigned
int
type_offset
=
2
;
ifref_t
*
iface
=
ifaces
;
if
(
!
do_client
)
...
...
@@ -486,6 +478,8 @@ void write_client(ifref_t *ifaces)
if
(
!
client
)
return
;
write_formatstringsdecl
(
ifaces
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
...
...
@@ -500,22 +494,17 @@ void write_client(ifref_t *ifaces)
{
int
expr_eval_routines
;
write_formatstringsdecl
(
iface
->
iface
);
write_implicithandledecl
(
iface
->
iface
);
write_clientinterfacedecl
(
iface
->
iface
);
write_stubdescdecl
(
iface
->
iface
);
write_bindinghandledecl
(
iface
->
iface
);
write_function_stubs
(
iface
->
iface
);
write_function_stubs
(
iface
->
iface
,
&
proc_offset
,
&
type_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_procformatstring
(
client
,
iface
->
iface
);
write_typeformatstring
(
client
,
iface
->
iface
);
fprintf
(
client
,
"
\n
"
);
...
...
@@ -526,5 +515,10 @@ void write_client(ifref_t *ifaces)
}
}
fprintf
(
client
,
"
\n
"
);
write_procformatstring
(
client
,
ifaces
);
write_typeformatstring
(
client
,
ifaces
);
fclose
(
client
);
}
tools/widl/server.c
View file @
6f85f989
...
...
@@ -42,14 +42,6 @@
#include "typelib_struct.h"
#include "typegen.h"
#define END_OF_LIST(list) \
do { \
if (list) { \
while (NEXT_LINK(list)) \
list = NEXT_LINK(list); \
} \
} while(0)
static
FILE
*
server
;
static
int
indent
=
0
;
...
...
@@ -189,15 +181,13 @@ static void assign_out_args(const func_t *func)
}
static
void
write_function_stubs
(
type_t
*
iface
)
static
void
write_function_stubs
(
type_t
*
iface
,
unsigned
int
*
proc_offset
,
unsigned
int
*
type_offset
)
{
char
*
implicit_handle
=
get_attrp
(
iface
->
attrs
,
ATTR_IMPLICIT_HANDLE
);
int
explicit_handle
=
is_attr
(
iface
->
attrs
,
ATTR_EXPLICIT_HANDLE
);
const
func_t
*
func
=
iface
->
funcs
;
const
var_t
*
var
;
const
var_t
*
explicit_handle_var
;
unsigned
int
proc_offset
=
0
;
unsigned
int
type_offset
=
2
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
...
...
@@ -289,7 +279,7 @@ static void write_function_stubs(type_t *iface)
fprintf
(
server
,
"
\n
"
);
/* make a copy so we don't increment the type offset twice */
type_offset_func
=
type_offset
;
type_offset_func
=
*
type_offset
;
/* unmarshall arguments */
write_remoting_arguments
(
server
,
indent
,
func
,
&
type_offset_func
,
PASS_IN
,
PHASE_UNMARSHAL
);
...
...
@@ -377,7 +367,7 @@ static void write_function_stubs(type_t *iface)
fprintf
(
server
,
"
\n
"
);
print_server
(
"_StubMsg.BufferLength = %u;
\n
"
,
buffer_size
);
type_offset_func
=
type_offset
;
type_offset_func
=
*
type_offset
;
write_remoting_arguments
(
server
,
indent
,
func
,
&
type_offset_func
,
PASS_OUT
,
PHASE_BUFFERSIZE
);
print_server
(
"_pRpcMessage->BufferLength = _StubMsg.BufferLength;
\n
"
);
...
...
@@ -392,10 +382,10 @@ static void write_function_stubs(type_t *iface)
fprintf
(
server
,
"
\n
"
);
}
type_offset_func
=
type_offset
;
type_offset_func
=
*
type_offset
;
/* marshall arguments */
write_remoting_arguments
(
server
,
indent
,
func
,
&
type_offset
,
PASS_OUT
,
PHASE_MARSHAL
);
write_remoting_arguments
(
server
,
indent
,
func
,
type_offset
,
PASS_OUT
,
PHASE_MARSHAL
);
/* marshall the return value */
if
(
!
is_void
(
def
->
type
,
NULL
))
...
...
@@ -570,13 +560,13 @@ static void write_formatdesc( const char *str )
}
static
void
write_formatstringsdecl
(
type_t
*
iface
)
static
void
write_formatstringsdecl
(
ifref_t
*
ifaces
)
{
print_server
(
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
get_size_typeformatstring
(
iface
));
get_size_typeformatstring
(
iface
s
));
print_server
(
"#define PROC_FORMAT_STRING_SIZE %d
\n
"
,
get_size_procformatstring
(
iface
));
get_size_procformatstring
(
iface
s
));
fprintf
(
server
,
"
\n
"
);
write_formatdesc
(
"TYPE"
);
...
...
@@ -605,6 +595,8 @@ static void init_server(void)
void
write_server
(
ifref_t
*
ifaces
)
{
unsigned
int
proc_offset
=
0
;
unsigned
int
type_offset
=
2
;
ifref_t
*
iface
=
ifaces
;
if
(
!
do_server
)
...
...
@@ -617,6 +609,8 @@ void write_server(ifref_t *ifaces)
if
(
!
server
)
return
;
write_formatstringsdecl
(
ifaces
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
...
...
@@ -631,19 +625,14 @@ void write_server(ifref_t *ifaces)
{
int
expr_eval_routines
;
write_formatstringsdecl
(
iface
->
iface
);
write_serverinterfacedecl
(
iface
->
iface
);
write_stubdescdecl
(
iface
->
iface
);
write_function_stubs
(
iface
->
iface
);
write_function_stubs
(
iface
->
iface
,
&
proc_offset
,
&
type_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_procformatstring
(
server
,
iface
->
iface
);
write_typeformatstring
(
server
,
iface
->
iface
);
fprintf
(
server
,
"
\n
"
);
...
...
@@ -656,5 +645,10 @@ void write_server(ifref_t *ifaces)
}
}
fprintf
(
server
,
"
\n
"
);
write_procformatstring
(
server
,
ifaces
);
write_typeformatstring
(
server
,
ifaces
);
fclose
(
server
);
}
tools/widl/typegen.c
View file @
6f85f989
...
...
@@ -239,8 +239,9 @@ static size_t write_procformatstring_var(FILE *file, int indent,
return
size
;
}
void
write_procformatstring
(
FILE
*
file
,
type_t
*
iface
)
void
write_procformatstring
(
FILE
*
file
,
const
ifref_t
*
ifaces
)
{
const
ifref_t
*
iface
=
ifaces
;
int
indent
=
0
;
var_t
*
var
;
unsigned
int
type_offset
=
2
;
...
...
@@ -252,36 +253,44 @@ void write_procformatstring(FILE *file, type_t *iface)
print_file
(
file
,
indent
,
"{
\n
"
);
indent
++
;
if
(
iface
->
funcs
)
END_OF_LIST
(
iface
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
func_t
*
func
=
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
for
(;
func
;
func
=
PREV_LINK
(
func
))
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
continue
;
if
(
iface
->
iface
->
funcs
)
{
/* emit argument data */
if
(
func
->
args
)
func_t
*
func
=
iface
->
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
for
(;
func
;
func
=
PREV_LINK
(
func
))
{
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
/* emit argument data */
if
(
func
->
args
)
{
write_procformatstring_var
(
file
,
indent
,
var
,
FALSE
,
&
type_offset
);
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
write_procformatstring_var
(
file
,
indent
,
var
,
FALSE
,
&
type_offset
);
var
=
PREV_LINK
(
var
);
var
=
PREV_LINK
(
var
);
}
}
}
/* emit return value data */
var
=
func
->
def
;
if
(
is_void
(
var
->
type
,
NULL
))
{
print_file
(
file
,
indent
,
"0x5b, /* FC_END */
\n
"
);
print_file
(
file
,
indent
,
"0x5c, /* FC_PAD */
\n
"
);
/* emit return value data */
var
=
func
->
def
;
if
(
is_void
(
var
->
type
,
NULL
))
{
print_file
(
file
,
indent
,
"0x5b, /* FC_END */
\n
"
);
print_file
(
file
,
indent
,
"0x5c, /* FC_PAD */
\n
"
);
}
else
write_procformatstring_var
(
file
,
indent
,
var
,
TRUE
,
&
type_offset
);
}
else
write_procformatstring_var
(
file
,
indent
,
var
,
TRUE
,
&
type_offset
);
}
}
...
...
@@ -1337,11 +1346,12 @@ static size_t write_typeformatstring_var(FILE *file, int indent,
}
void
write_typeformatstring
(
FILE
*
file
,
type_t
*
iface
)
void
write_typeformatstring
(
FILE
*
file
,
const
ifref_t
*
ifaces
)
{
int
indent
=
0
;
var_t
*
var
;
size_t
typeformat_offset
;
const
ifref_t
*
iface
=
ifaces
;
print_file
(
file
,
indent
,
"static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
\n
"
);
print_file
(
file
,
indent
,
"{
\n
"
);
...
...
@@ -1352,22 +1362,30 @@ void write_typeformatstring(FILE *file, type_t *iface)
print_file
(
file
,
indent
,
"NdrFcShort(0x0),
\n
"
);
typeformat_offset
=
2
;
if
(
iface
->
funcs
)
END_OF_LIST
(
iface
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
func_t
*
func
=
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
for
(;
func
;
func
=
PREV_LINK
(
func
))
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
continue
;
if
(
iface
->
iface
->
funcs
)
{
current_func
=
func
;
if
(
func
->
args
)
func_t
*
func
=
iface
->
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
for
(;
func
;
func
=
PREV_LINK
(
func
))
{
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
current_func
=
func
;
if
(
func
->
args
)
{
write_typeformatstring_var
(
file
,
indent
,
var
,
&
typeformat_offset
);
var
=
PREV_LINK
(
var
);
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
write_typeformatstring_var
(
file
,
indent
,
var
,
&
typeformat_offset
);
var
=
PREV_LINK
(
var
);
}
}
}
}
...
...
@@ -1842,63 +1860,81 @@ size_t get_size_typeformatstring_var(const var_t *var)
return
type_offset
;
}
size_t
get_size_procformatstring
(
const
type_t
*
iface
)
size_t
get_size_procformatstring
(
const
ifref_t
*
ifaces
)
{
const
ifref_t
*
iface
=
ifaces
;
size_t
size
=
1
;
func_t
*
func
;
var_t
*
var
;
if
(
iface
->
funcs
)
END_OF_LIST
(
iface
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
func
=
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
continue
;
if
(
iface
->
iface
->
funcs
)
{
/* argument list size */
if
(
func
->
args
)
func
=
iface
->
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
{
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
/* argument list size */
if
(
func
->
args
)
{
size
+=
get_size_procformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
size
+=
get_size_procformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
}
}
}
/* return value size */
size
+=
2
;
/* FIXME: determine real size */
func
=
PREV_LINK
(
func
);
/* return value size */
size
+=
2
;
/* FIXME: determine real size */
func
=
PREV_LINK
(
func
);
}
}
}
return
size
;
}
size_t
get_size_typeformatstring
(
const
type_t
*
iface
)
size_t
get_size_typeformatstring
(
const
ifref_t
*
ifaces
)
{
const
ifref_t
*
iface
=
ifaces
;
size_t
size
=
3
;
func_t
*
func
;
var_t
*
var
;
if
(
iface
->
funcs
)
END_OF_LIST
(
iface
);
for
(;
iface
;
iface
=
PREV_LINK
(
iface
))
{
func
=
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
if
(
is_object
(
iface
->
iface
->
attrs
)
||
is_local
(
iface
->
iface
->
attrs
))
continue
;
if
(
iface
->
iface
->
funcs
)
{
/* argument list size */
if
(
func
->
args
)
func
=
iface
->
iface
->
funcs
;
while
(
NEXT_LINK
(
func
))
func
=
NEXT_LINK
(
func
);
while
(
func
)
{
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
/* argument list size */
if
(
func
->
args
)
{
size
+=
get_size_typeformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
var
=
func
->
args
;
while
(
NEXT_LINK
(
var
))
var
=
NEXT_LINK
(
var
);
while
(
var
)
{
size
+=
get_size_typeformatstring_var
(
var
);
var
=
PREV_LINK
(
var
);
}
}
}
func
=
PREV_LINK
(
func
);
func
=
PREV_LINK
(
func
);
}
}
}
return
size
;
...
...
tools/widl/typegen.h
View file @
6f85f989
...
...
@@ -35,15 +35,15 @@ enum remoting_phase
PHASE_FREE
};
void
write_procformatstring
(
FILE
*
file
,
type_t
*
iface
);
void
write_typeformatstring
(
FILE
*
file
,
type_t
*
iface
);
void
write_procformatstring
(
FILE
*
file
,
const
ifref_t
*
ifaces
);
void
write_typeformatstring
(
FILE
*
file
,
const
ifref_t
*
ifaces
);
size_t
get_type_memsize
(
const
type_t
*
type
);
unsigned
int
get_required_buffer_size
(
const
var_t
*
var
,
unsigned
int
*
alignment
,
enum
pass
pass
);
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
,
unsigned
int
*
type_offset
,
enum
pass
pass
,
enum
remoting_phase
phase
);
size_t
get_size_procformatstring_var
(
const
var_t
*
var
);
size_t
get_size_typeformatstring_var
(
const
var_t
*
var
);
size_t
get_size_procformatstring
(
const
type_t
*
iface
);
size_t
get_size_typeformatstring
(
const
type_t
*
iface
);
size_t
get_size_procformatstring
(
const
ifref_t
*
ifaces
);
size_t
get_size_typeformatstring
(
const
ifref_t
*
ifaces
);
int
write_expr_eval_routines
(
FILE
*
file
,
const
char
*
iface
);
void
write_expr_eval_routine_list
(
FILE
*
file
,
const
char
*
iface
);
tools/widl/widltypes.h
View file @
6f85f989
...
...
@@ -56,6 +56,14 @@ typedef struct _typelib_t typelib_t;
#define NEXT_LINK(x) ((x)->l_next)
#define PREV_LINK(x) ((x)->l_prev)
#define END_OF_LIST(list) \
do { \
if (list) { \
while (NEXT_LINK(list)) \
list = NEXT_LINK(list); \
} \
} while(0)
enum
attr_type
{
ATTR_AGGREGATABLE
,
...
...
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