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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
204 additions
and
165 deletions
+204
-165
parser.y
tools/widl/parser.y
+16
-2
proxy.c
tools/widl/proxy.c
+188
-163
No files found.
tools/widl/parser.y
View file @
0e5d9b56
...
@@ -1069,8 +1069,22 @@ static type_t *reg_type(type_t *type, char *name, int t)
...
@@ -1069,8 +1069,22 @@ static type_t *reg_type(type_t *type, char *name, int t)
/* determine pointer type from attrs */
/* determine pointer type from attrs */
static unsigned char get_pointer_type( type_t *type )
static unsigned char get_pointer_type( type_t *type )
{
{
int t = get_attrv( type->attrs, ATTR_POINTERTYPE );
int t;
if( t ) return 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;
return RPC_FC_FP;
}
}
...
...
tools/widl/proxy.c
View file @
0e5d9b56
...
@@ -62,11 +62,13 @@ int print_proxy( char *format, ... )
...
@@ -62,11 +62,13 @@ int print_proxy( char *format, ... )
return
r
;
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_t
*
t
=
arg
->
type
;
type
=
type
->
ref
;
while
(
(
t
->
type
==
0
)
&&
t
->
ref
)
return
type
;
t
=
t
->
ref
;
return
t
;
}
}
static
void
write_stubdescproto
(
void
)
static
void
write_stubdescproto
(
void
)
...
@@ -89,9 +91,12 @@ static void write_stubdesc(void)
...
@@ -89,9 +91,12 @@ static void write_stubdesc(void)
static
void
write_formatdesc
(
char
*
str
)
static
void
write_formatdesc
(
char
*
str
)
{
{
print_proxy
(
"typedef struct _MIDL_%s_FORMAT_STRING {
\n
"
,
str
);
print_proxy
(
"typedef struct _MIDL_%s_FORMAT_STRING
\n
"
,
str
);
print_proxy
(
" short Pad;
\n
"
);
indent
++
;
print_proxy
(
" unsigned char Format[%s_FORMAT_STRING_SIZE];
\n
"
,
str
);
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
(
"} MIDL_%s_FORMAT_STRING;
\n
"
,
str
);
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
}
}
...
@@ -100,9 +105,10 @@ static void write_formatstringsdecl(void)
...
@@ -100,9 +105,10 @@ static void write_formatstringsdecl(void)
{
{
print_proxy
(
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
1
);
/* FIXME */
print_proxy
(
"#define TYPE_FORMAT_STRING_SIZE %d
\n
"
,
1
);
/* FIXME */
print_proxy
(
"#define PROC_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
(
"TYPE"
);
write_formatdesc
(
"PROC"
);
write_formatdesc
(
"PROC"
);
fprintf
(
proxy
,
"
\n
"
);
print_proxy
(
"extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
\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
(
"extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
...
@@ -135,7 +141,7 @@ static void write_formatstring( int proc )
...
@@ -135,7 +141,7 @@ static void write_formatstring( int proc )
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
}
}
static
void
init_proxy
(
void
)
static
void
init_proxy
()
{
{
if
(
proxy
)
return
;
if
(
proxy
)
return
;
proxy
=
fopen
(
proxy_name
,
"w"
);
proxy
=
fopen
(
proxy_name
,
"w"
);
...
@@ -146,7 +152,6 @@ static void init_proxy(void)
...
@@ -146,7 +152,6 @@ static void init_proxy(void)
print_proxy
(
"#endif /* __REDQ_RPCPROXY_H_VERSION__ */
\n
"
);
print_proxy
(
"#endif /* __REDQ_RPCPROXY_H_VERSION__ */
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#include
\"
rpcproxy.h
\"\n
"
);
print_proxy
(
"#include
\"
rpcproxy.h
\"\n
"
);
print_proxy
(
"
\n
"
);
print_proxy
(
"#ifndef __RPCPROXY_H_VERSION__
\n
"
);
print_proxy
(
"#ifndef __RPCPROXY_H_VERSION__
\n
"
);
print_proxy
(
"#error This code needs a newer version of rpcproxy.h
\n
"
);
print_proxy
(
"#error This code needs a newer version of rpcproxy.h
\n
"
);
print_proxy
(
"#endif /* __RPCPROXY_H_VERSION__ */
\n
"
);
print_proxy
(
"#endif /* __RPCPROXY_H_VERSION__ */
\n
"
);
...
@@ -196,15 +201,22 @@ static void proxy_check_pointers( var_t *arg )
...
@@ -196,15 +201,22 @@ static void proxy_check_pointers( var_t *arg )
}
}
}
}
static
void
proxy_gen_marshall_size
(
var_t
*
arg
)
static
void
marshall_size_arg
(
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
;
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
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
)
switch
(
type
->
type
)
{
{
...
@@ -231,31 +243,72 @@ static void proxy_gen_marshall_size( var_t *arg )
...
@@ -231,31 +243,72 @@ static void proxy_gen_marshall_size( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d] );
\n
"
,
index
);
break
;
break
;
case
RPC_FC_FP
:
case
RPC_FC_C_CSTRING
:
case
RPC_FC_C_WSTRING
:
case
RPC_FC_CARRAY
:
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
print_proxy
(
"NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
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
:
case
RPC_FC_IP
:
print_proxy
(
"NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
print_proxy
(
"NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
break
;
default:
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
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
))
{
marshall_size_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
gen_marshall_copydata
(
var_t
*
arg
)
static
void
marshall_copy_arg
(
var_t
*
arg
)
{
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
int
index
=
0
;
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
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
(
"NdrConformantArrayMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
return
;
}
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
...
@@ -279,9 +332,27 @@ static void gen_marshall_copydata( var_t *arg )
...
@@ -279,9 +332,27 @@ static void gen_marshall_copydata( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
break
;
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
:
case
RPC_FC_FP
:
print_proxy
(
"NdrConformantArrayMarshall( &_StubMsg, (unsigned char*)%s, "
,
arg
->
name
);
{
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d]);
\n
"
,
index
);
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
;
break
;
case
RPC_FC_IP
:
case
RPC_FC_IP
:
...
@@ -290,8 +361,18 @@ static void gen_marshall_copydata( var_t *arg )
...
@@ -290,8 +361,18 @@ static void gen_marshall_copydata( var_t *arg )
break
;
break
;
default:
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
}
static
void
gen_marshall_copydata
(
var_t
*
arg
)
{
END_OF_LIST
(
arg
);
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
marshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
}
arg
=
PREV_LINK
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
...
@@ -311,13 +392,19 @@ static void gen_marshall( var_t *arg )
...
@@ -311,13 +392,19 @@ static void gen_marshall( var_t *arg )
print_proxy
(
"
\n
"
);
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
;
int
index
=
0
;
type_t
*
type
=
get_base_type
(
arg
->
type
);
type_t
*
type
=
get_base_type
(
arg
);
expr_t
*
expr
;
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
;
}
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
...
@@ -340,9 +427,29 @@ static void gen_unmarshall( var_t *arg )
...
@@ -340,9 +427,29 @@ static void gen_unmarshall( var_t *arg )
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
break
;
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
:
case
RPC_FC_FP
:
print_proxy
(
"NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)%s, "
,
arg
->
name
);
{
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], 0);
\n
"
,
index
);
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
;
break
;
case
RPC_FC_IP
:
case
RPC_FC_IP
:
...
@@ -351,21 +458,43 @@ static void gen_unmarshall( var_t *arg )
...
@@ -351,21 +458,43 @@ static void gen_unmarshall( var_t *arg )
break
;
break
;
default:
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
print_proxy
(
"/* FIXME: %s code for %s type %d missing */
\n
"
,
__FUNCTION__
,
arg
->
name
,
type
->
type
);
}
}
arg
=
PREV_LINK
(
arg
);
}
}
}
}
static
void
proxy_free_variables
(
var_t
*
arg
)
static
void
gen_unmarshall
(
var_t
*
arg
)
{
{
END_OF_LIST
(
arg
);
END_OF_LIST
(
arg
);
while
(
arg
)
{
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
unmarshall_copy_arg
(
arg
);
fprintf
(
proxy
,
"
\n
"
);
}
arg
=
PREV_LINK
(
arg
);
}
}
static
void
free_variable
(
var_t
*
arg
)
{
var_t
*
constraint
;
var_t
*
constraint
;
int
index
=
0
;
/* FIXME */
int
index
=
0
;
/* FIXME */
type_t
*
type
=
get_base_type
(
arg
->
type
);
type_t
*
type
;
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
(
"NdrClearOutParameters( &_StubMsg, "
);
fprintf
(
proxy
,
"&__MIDL_TypeFormatString.Format[%d], "
,
index
);
fprintf
(
proxy
,
"(void*)%s );
\n
"
,
arg
->
name
);
return
;
}
type
=
get_base_type
(
arg
);
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
case
RPC_FC_BYTE
:
case
RPC_FC_BYTE
:
...
@@ -391,8 +520,18 @@ static void proxy_free_variables( var_t *arg )
...
@@ -391,8 +520,18 @@ static void proxy_free_variables( var_t *arg )
break
;
break
;
default:
default:
printf
(
"FIXME: arg %s has unknown type %d
\n
"
,
arg
->
name
,
type
->
type
);
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
);
arg
=
PREV_LINK
(
arg
);
}
}
...
@@ -518,38 +657,13 @@ static void stub_unmarshall( var_t *arg )
...
@@ -518,38 +657,13 @@ static void stub_unmarshall( var_t *arg )
int
n
=
0
;
int
n
=
0
;
END_OF_LIST
(
arg
);
END_OF_LIST
(
arg
);
while
(
arg
)
{
while
(
arg
)
{
type_t
*
type
=
get_base_type
(
arg
->
type
);
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
if
(
is_attr
(
arg
->
attrs
,
ATTR_IN
))
{
int
index
=
0
;
switch
(
type
->
type
)
{
{
case
RPC_FC_BYTE
:
unmarshall_copy_arg
(
arg
);
case
RPC_FC_CHAR
:
fprintf
(
proxy
,
"
\n
"
);
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
);
}
}
}
else
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
else
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
type_t
*
type
=
get_base_type
(
arg
);
switch
(
type
->
type
)
switch
(
type
->
type
)
{
{
case
RPC_FC_STRUCT
:
case
RPC_FC_STRUCT
:
...
@@ -577,51 +691,8 @@ static void stub_gen_marshall_size( var_t *arg )
...
@@ -577,51 +691,8 @@ static void stub_gen_marshall_size( var_t *arg )
END_OF_LIST
(
arg
);
END_OF_LIST
(
arg
);
while
(
arg
)
{
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
int
index
=
0
;
marshall_size_arg
(
arg
);
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
);
}
}
arg
=
PREV_LINK
(
arg
);
arg
=
PREV_LINK
(
arg
);
}
}
}
}
...
@@ -630,54 +701,8 @@ static void stub_gen_marshall_copydata( var_t *arg )
...
@@ -630,54 +701,8 @@ static void stub_gen_marshall_copydata( var_t *arg )
{
{
END_OF_LIST
(
arg
);
END_OF_LIST
(
arg
);
while
(
arg
)
{
while
(
arg
)
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
{
if
(
is_attr
(
arg
->
attrs
,
ATTR_OUT
))
var_t
*
constraint
;
marshall_copy_arg
(
arg
);
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
);
}
}
arg
=
PREV_LINK
(
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