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
0e5d9b56
Commit
0e5d9b56
authored
Sep 20, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the handling of complex data types (strings and structs).
parent
3430bc2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
321 additions
and
282 deletions
+321
-282
parser.y
tools/widl/parser.y
+17
-3
proxy.c
tools/widl/proxy.c
+304
-279
No files found.
tools/widl/parser.y
View file @
0e5d9b56
...
...
@@ -1069,9 +1069,23 @@ static type_t *reg_type(type_t *type, char *name, int t)
/* determine pointer type from attrs */
static unsigned char get_pointer_type( type_t *type )
{
int t = get_attrv( type->attrs, ATTR_POINTERTYPE );
if( t ) return t;
return RPC_FC_FP;
int t;
if (is_attr( type->attrs, ATTR_STRING ))
{
type_t *t = type;
while( t->type == 0 && t->ref )
t = t->ref;
switch( t->type )
{
case RPC_FC_CHAR:
return RPC_FC_C_CSTRING;
case RPC_FC_WCHAR:
return RPC_FC_C_WSTRING;
}
}
t = get_attrv( type->attrs, ATTR_POINTERTYPE );
if (t) return t;
return RPC_FC_FP;
}
static type_t *reg_types(type_t *type, var_t *names, int t)
...
...
tools/widl/proxy.c
View file @
0e5d9b56
...
...
@@ -62,11 +62,13 @@ int print_proxy( char *format, ... )
return
r
;
}
static
type_t
*
get_base_type
(
type_t
*
type
)
static
type_t
*
get_base_type
(
var_t
*
arg
)
{
while
(
(
type
->
type
==
0
)
&&
type
->
ref
)
type
=
type
->
ref
;
return
type
;
type_t
*
t
=
arg
->
type
;
while
(
(
t
->
type
==
0
)
&&
t
->
ref
)
t
=
t
->
ref
;
return
t
;
}
static
void
write_stubdescproto
(
void
)
...
...
@@ -89,9 +91,12 @@ static void write_stubdesc(void)
static
void
write_formatdesc
(
char
*
str
)
{
print_proxy
(
"typedef struct _MIDL_%s_FORMAT_STRING {
\n
"
,
str
);
print_proxy
(
" short Pad;
\n
"
);
print_proxy
(
" unsigned char Format[%s_FORMAT_STRING_SIZE];
\n
"
,
str
);
print_proxy
(
"typedef struct _MIDL_%s_FORMAT_STRING
\n
"
,
str
);
indent
++
;
print_proxy
(
"{
\n
"
);
print_proxy
(
"short Pad;
\n
"
);
print_proxy
(
"unsigned char Format[%s_FORMAT_STRING_SIZE];
\n
"
,
str
);
indent
--
;
print_proxy
(
"} MIDL_%s_FORMAT_STRING;
\n
"
,
str
);
print_proxy
(
"
\n
"
);
}
...
...
@@ -100,9 +105,10 @@ static void write_formatstringsdecl(void)
{
print_proxy
(
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
1
);
/* FIXME */
print_proxy
(
"#define PROC_FORMAT_STRING_SIZE %d
\n
"
,
1
);
/* FIXME */
print_proxy
(
"
\n
"
);
fprintf
(
proxy
,
"
\n
"
);
write_formatdesc
(
"TYPE"
);
write_formatdesc
(
"PROC"
);
fprintf
(
proxy
,
"
\n
"
);
print_proxy
(
"extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
\n
"
);
print_proxy
(
"extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
\n
"
);
print_proxy
(
"
\n
"
);
...
...
@@ -135,7 +141,7 @@ static void write_formatstring( int proc )
print_proxy
(
"
\n
"
);
}
static
void
init_proxy
(
void
)
static
void
init_proxy
()
{
if
(
proxy
)
return
;
proxy
=
fopen
(
proxy_name
,
"w"
);
...
...
@@ -146,7 +152,6 @@ static void init_proxy(void)
print_proxy
(
"#endif /* __REDQ_RPCPROXY_H_VERSION__ */
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#include
\"
rpcproxy.h
\"\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#ifndef __RPCPROXY_H_VERSION__
\n
"
);
print_proxy
(
"#error This code needs a newer version of rpcproxy.h
\n
"
);
print_proxy
(
"#endif /* __RPCPROXY_H_VERSION__ */
\n
"
);
...
...
@@ -196,56 +201,167 @@ static void proxy_check_pointers( var_t *arg )
}
}
static
void
marshall_size_arg
(
var_t
*
arg
)
{
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
);
expr_t
*
expr
;
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_SIZEIS
);
if
(
expr
)
{
print_proxy
(
"_StubMsg.MaxCount = "
,
arg
->
name
);
write_expr
(
proxy
,
expr
);
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
return
;
}
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
1
,
arg
->
name
);
break
;
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
2
,
arg
->
name
);
break
;
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
4
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
print_proxy
(
"NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_BOGUS_STRUCT
:
print_proxy
(
"NdrComplexStructBufferSize(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
case
RPC_FC_FP
:
{
var_t
temp
;
memset
(
&
temp
,
0
,
sizeof
temp
);
temp
.
type
=
type
->
ref
;
temp
.
name
=
arg
->
name
;
/* FIXME */
#if 0
print_proxy( "/* FIXME: %s use the right name for %s\n", __FUNCTION__, arg->name );
#endif
marshall_size_arg
(
&
temp
);
}
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
default:
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
static
void
proxy_gen_marshall_size
(
var_t
*
arg
)
{
print_proxy
(
"_StubMsg.BufferLength = 0U;
\n
"
);
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
1
,
arg
->
name
);
break
;
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
marshall_size_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
arg
=
PREV_LINK
(
arg
);
}
}
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
2
,
arg
->
name
);
break
;
static
void
marshall_copy_arg
(
var_t
*
arg
)
{
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
);
expr_t
*
expr
;
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
4
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
print_proxy
(
"NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
)
;
break
;
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_SIZEIS
);
if
(
expr
)
{
print_proxy
(
"_StubMsg.MaxCount = "
,
arg
->
name
);
write_expr
(
proxy
,
expr
)
;
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrConformantArrayMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
return
;
}
case
RPC_FC_FP
:
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"*(("
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++ = %s;
\n
"
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
/* FIXME: add the format string, and set the index below */
print_proxy
(
"NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
break
;
case
RPC_FC_BOGUS_STRUCT
:
print_proxy
(
"NdrComplexStructMarshall(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
case
RPC_FC_FP
:
{
var_t
temp
;
memset
(
&
temp
,
0
,
sizeof
temp
);
temp
.
type
=
type
->
ref
;
temp
.
name
=
arg
->
name
;
/* FIXME */
#if 0
print_proxy( "/* FIXME: %s use the right name for %s\n", __FUNCTION__, arg->name );
#endif
marshall_copy_arg
(
&
temp
);
}
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerBufferSize
( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerMarshall
( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
}
arg
=
PREV_LINK
(
arg
);
default:
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
...
...
@@ -253,45 +369,10 @@ static void gen_marshall_copydata( var_t *arg )
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"*(("
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++ = %s;
\n
"
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
/* FIXME: add the format string, and set the index below */
print_proxy
(
"NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_FP
:
print_proxy
(
"NdrConformantArrayMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
marshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
arg
=
PREV_LINK
(
arg
);
}
...
...
@@ -311,88 +392,146 @@ static void gen_marshall( var_t *arg )
print_proxy
(
"
\n
"
);
}
static
void
gen_unmarshall
(
var_t
*
arg
)
static
void
unmarshall_copy_arg
(
var_t
*
arg
)
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
);
expr_t
*
expr
;
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"%s = *(("
,
arg
->
name
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++;
\n
"
);
break
;
case
RPC_FC_STRUCT
:
print_proxy
(
"NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_SIZEIS
);
if
(
expr
)
{
print_proxy
(
"NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
return
;
}
case
RPC_FC_FP
:
print_proxy
(
"NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"%s = *(("
,
arg
->
name
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++;
\n
"
);
break
;
case
RPC_FC_STRUCT
:
print_proxy
(
"NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
print_proxy
(
"NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_BOGUS_STRUCT
:
print_proxy
(
"NdrComplexStructUnmarshall(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0 );
\n
"
,
index
);
break
;
case
RPC_FC_FP
:
{
var_t
temp
;
memset
(
&
temp
,
0
,
sizeof
temp
);
temp
.
type
=
type
->
ref
;
temp
.
name
=
arg
->
name
;
/* FIXME */
#if 1
print_proxy
(
"/* FIXME: %s use the right name for %s
\n
"
,
__FUNCTION__
,
arg
->
name
);
#endif
unmarshall_copy_arg
(
&
temp
);
}
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerUnmarshall(&_StubMsg, (unsigned char**)&%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerUnmarshall(&_StubMsg, (unsigned char**)&%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
}
arg
=
PREV_LINK
(
arg
);
default:
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
static
void
proxy_free_variables
(
var_t
*
arg
)
static
void
gen_unmarshall
(
var_t
*
arg
)
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
var_t
*
constraint
;
int
index
=
0
;
/* FIXME */
type_t
*
type
=
get_base_type
(
arg
->
type
);
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
unmarshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
arg
=
PREV_LINK
(
arg
);
}
}
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
case
RPC_FC_STRUCT
:
break
;
static
void
free_variable
(
var_t
*
arg
)
{
var_t
*
constraint
;
int
index
=
0
;
/* FIXME */
type_t
*
type
;
expr_t
*
expr
;
case
RPC_FC_FP
:
case
RPC_FC_IP
:
constraint
=
get_attrp
(
arg
->
attrs
,
ATTR_IIDIS
);
if
(
constraint
)
print_proxy
(
"_StubMsg.MaxCount = (unsigned long) ( %s );
\n
"
,
constraint
->
name
);
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], "
,
index
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
break
;
expr
=
get_attrp
(
arg
->
attrs
,
ATTR_SIZEIS
);
if
(
expr
)
{
print_proxy
(
"_StubMsg.MaxCount = "
,
arg
->
name
);
write_expr
(
proxy
,
expr
);
fprintf
(
proxy
,
";
\n\n
"
);
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], "
,
index
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
return
;
}
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
type
=
get_base_type
(
arg
);
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
case
RPC_FC_STRUCT
:
break
;
case
RPC_FC_FP
:
case
RPC_FC_IP
:
constraint
=
get_attrp
(
arg
->
attrs
,
ATTR_IIDIS
);
if
(
constraint
)
print_proxy
(
"_StubMsg.MaxCount = (unsigned long) ( %s );
\n
"
,
constraint
->
name
);
print_proxy
(
"NdrClearOutParameters( &_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], "
,
index
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
break
;
default:
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
static
void
proxy_free_variables
(
var_t
*
arg
)
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
free_variable
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
arg
=
PREV_LINK
(
arg
);
}
...
...
@@ -518,38 +657,13 @@ static void stub_unmarshall( var_t *arg )
int
n
=
0
;
END_OF_LIST
(
arg
);
while
(
arg
)
{
type_t
*
type
=
get_base_type
(
arg
->
type
);
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
int
index
=
0
;
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"%s = *(("
,
arg
->
name
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++;
\n
"
);
break
;
case
RPC_FC_FP
:
case
RPC_FC_STRUCT
:
/* FIXME: add the format string, and set the index below */
print_proxy
(
"NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)&%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
unmarshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
else
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
type_t
*
type
=
get_base_type
(
arg
);
switch
(
type
->
type
)
{
case
RPC_FC_STRUCT
:
...
...
@@ -577,51 +691,8 @@ static void stub_gen_marshall_size( var_t *arg )
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
int
index
=
0
;
var_t
*
constraint
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
1
,
arg
->
name
);
break
;
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
2
,
arg
->
name
);
break
;
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"_StubMsg.BufferLength += %d; /* %s */
\n
"
,
4
,
arg
->
name
);
break
;
case
RPC_FC_FP
:
print_proxy
(
"/*FIXME %s*/
\n
"
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
print_proxy
(
"NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
case
RPC_FC_IP
:
constraint
=
get_attrp
(
arg
->
attrs
,
ATTR_IIDIS
);
if
(
constraint
)
print_proxy
(
"_StubMsg.MaxCount = (unsigned long) ( %s );
\n
"
,
constraint
->
name
);
print_proxy
(
"NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
}
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
marshall_size_arg
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
...
...
@@ -630,54 +701,8 @@ static void stub_gen_marshall_copydata( var_t *arg )
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
var_t
*
constraint
;
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
if
(
arg
->
array
)
{
fprintf
(
stderr
,
"FIXME: param %s is an array
\n
"
,
arg
->
name
);
}
else
switch
(
type
->
type
)
{
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_ENUM16
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM32
:
print_proxy
(
"*(("
);
write_type
(
proxy
,
arg
->
type
,
arg
,
arg
->
tname
);
fprintf
(
proxy
,
"*)_StubMsg.Buffer)++ = %s;
\n
"
,
arg
->
name
);
break
;
case
RPC_FC_STRUCT
:
/* FIXME: add the format string, and set the index below */
print_proxy
(
"NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_FP
:
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
case
RPC_FC_IP
:
constraint
=
get_attrp
(
arg
->
attrs
,
ATTR_IIDIS
);
if
(
constraint
)
print_proxy
(
"_StubMsg.MaxCount = (unsigned long) ( %s );
\n
"
,
constraint
->
name
);
print_proxy
(
"NdrPointerMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
}
}
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
marshall_copy_arg
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
...
...
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