Sync to wine-1.1.1:

- Alexandre Julliard <julliard@winehq.org> Thu, 26 Jun 2008
widl: [default] is an allowed attribute for union fields.
(Note: This patch was already applied before in order not to break ReactOS.)

- Alexandre Julliard <julliard@winehq.org> Tue, 1 Jul 2008
widl: Add some support for unencapsulated unions that need a conformance descriptor.

- Rob Shearman <robertshearman@gmail.com> Tue, 1 Jul 2008
widl: Increment the buffer offset by 8 for embedded pointers inside varying arrays in varying structures.

The 8 bytes are for the variance and offset and are added just before the array, as seen in the marshalling code in rpcrt4. No offset needs to be added for non-varying structures since the buffer mark is set after the conformance in marshalled or unmarshalled.

- Rob Shearman <robertshearman@gmail.com> Tue, 1 Jul 2008
widl: Check that the structure has been defined in check_remoting_args.

- Dan Hipschman <dsh@linux.ucla.edu> Tue, 1 Jul 2008
widl: Implement type redefinition checks.

This allows widl to catch type redefinitions and report an error, like MIDL. However, this does a better job than MIDL since it also reports the location of the originial definition, like GCC.

- Dan Hipschman <dsh@linux.ucla.edu> Tue, 1 Jul 2008
widl: Factor a small part of the grammar.

- Rob Shearman <robertshearman@gmail.com> Thu, 3 Jul 2008
widl: Consolidate top-level parameter conformance/variance expression writing into a separate function.

Descend through as many pointer types as necessary to find the fundamental type and determine whether it needs a top-level parameter conformance/variance expression to be written. Add support for writing top-level parameter conformance/variance expressions for non-encapsulated unions.

- Rob Shearman <robertshearman@gmail.com> Fri, 4 Jul 2008
widl: Rename find_type_helper, find_type and find_type2 to find_type, find_type_error and find_type_error2 respectively.

- Rob Shearman <robertshearman@gmail.com> Fri, 4 Jul 2008
widl: Remove some unnecessary calls to duptype.

- Alexandre Julliard <julliard@winehq.org> Mon, 7 Jul 2008
widl: Fix a couple of uninitialized variable compiler warnings.

- Alexandre Julliard <julliard@winehq.org> Mon, 7 Jul 2008
Add noinput directive to all lex files to avoid a compiler warning.

Note: Two patches are missing because they implement code to generate MIDL-incompatible SEH support code. Unfortunately I think it is almost time to fork WIDL because later patches implement even more incompatibilities. :-(

svn path=/trunk/; revision=37416
This commit is contained in:
Eric Kohl 2008-11-17 19:07:03 +00:00
parent 17ab0467d9
commit 1bd1e3126a
9 changed files with 1717 additions and 1616 deletions

View file

@ -26,7 +26,7 @@ reactos/tools/wpp # Synced to Wine-20081105 (~Wine-1.1.7)
reactos/tools/winebuild # Synced to Wine-20081105 (~Wine-1.1.7)
reactos/tools/wmc # Synced to Wine-20081105 (~Wine-1.1.7)
reactos/tools/wrc # Synced to Wine-20081105 (~Wine-1.1.7)
reactos/tools/widl # Synced to Wine-1_1_0
reactos/tools/widl # Synced to Wine-1_1_1
The following libraries are shared with Wine.

View file

@ -19,7 +19,7 @@
*/
%option stack
%option nounput noyy_top_state
%option noinput nounput noyy_top_state
%option 8bit never-interactive prefix="parser_"
nl \r?\n

File diff suppressed because it is too large Load diff

View file

@ -335,7 +335,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 177 "parser.y"
#line 179 "parser.y"
typedef union YYSTYPE {
attr_t *attr;
attr_list_t *attr_list;

View file

@ -128,7 +128,8 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
static type_t *reg_type(type_t *type, const char *name, int t);
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
static type_t *find_type2(char *name, int t);
static type_t *find_type_or_error(const char *name, int t);
static type_t *find_type_or_error2(char *name, int t);
static type_t *get_type(unsigned char type, char *name, int t);
static type_t *get_typev(unsigned char type, var_t *name, int t);
static int get_struct_type(var_list_t *fields);
@ -156,6 +157,7 @@ static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(func_t *func);
static void check_def(const type_t *t);
static statement_t *make_statement(enum statement_type type);
static statement_t *make_statement_type_decl(type_t *type);
@ -309,7 +311,7 @@ static func_list_t *append_func_from_statement(func_list_t *list, statement_t *s
%type <type> dispinterface dispinterfacehdr dispinterfacedef
%type <type> module modulehdr moduledef
%type <type> base_type int_std
%type <type> enumdef structdef uniondef
%type <type> enumdef structdef uniondef typedecl
%type <type> type
%type <ifref> coclass_int
%type <ifref_list> coclass_ints
@ -399,7 +401,7 @@ semicolon_opt:
statement:
cppquote { $$ = make_statement_cppquote($1); }
| enumdef ';' { $$ = make_statement_type_decl($1);
| typedecl ';' { $$ = make_statement_type_decl($1);
if (!parse_only && do_header) {
write_type_def_or_decl(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
@ -409,19 +411,13 @@ statement:
if (!parse_only && do_header) write_declaration($1, is_in_interface);
}
| import { $$ = make_statement_import($1); }
| structdef ';' { $$ = make_statement_type_decl($1);
if (!parse_only && do_header) {
write_type_def_or_decl(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
}
}
| typedef ';' { $$ = $1; }
| uniondef ';' { $$ = make_statement_type_decl($1);
if (!parse_only && do_header) {
write_type_def_or_decl(header, $1, FALSE, NULL);
fprintf(header, ";\n\n");
}
}
;
typedecl:
enumdef
| structdef
| uniondef
;
cppquote: tCPPQUOTE '(' aSTRING ')' { $$ = $3; if (!parse_only && do_header) fprintf(header, "%s\n", $3); }
@ -823,7 +819,7 @@ base_type: tBYTE { $$ = make_builtin($<str>1); }
}
| tUNSIGNED { $$ = make_int(-1); }
| tFLOAT { $$ = make_builtin($<str>1); }
| tSINGLE { $$ = duptype(find_type("float", 0), 1); }
| tSINGLE { $$ = find_type("float", 0); }
| tDOUBLE { $$ = make_builtin($<str>1); }
| tBOOLEAN { $$ = make_builtin($<str>1); }
| tERRORSTATUST { $$ = make_builtin($<str>1); }
@ -845,12 +841,15 @@ int_std: tINT { $$ = make_builtin($<str>1); }
coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); }
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, 0);
if ($$->defined) error_loc("multiple definition error\n");
if ($$->kind != TKIND_COCLASS) error_loc("%s was not declared a coclass\n", $2);
if ($$->kind != TKIND_COCLASS)
error_loc("%s was not declared a coclass at %s:%d\n",
$2, $$->loc_info.input_name,
$$->loc_info.line_number);
}
;
coclasshdr: attributes coclass { $$ = $2;
check_def($$);
$$->attrs = check_coclass_attrs($2->name, $1);
if (!parse_only && do_header)
write_coclass($$);
@ -882,7 +881,7 @@ dispinterfacehdr: attributes dispinterface { attr_t *attrs;
is_in_interface = TRUE;
is_object_interface = TRUE;
$$ = $2;
if ($$->defined) error_loc("multiple definition error\n");
check_def($$);
attrs = make_attr(ATTR_DISPINTERFACE);
$$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs );
$$->ref = find_type("IDispatch", 0);
@ -921,7 +920,7 @@ dispinterfacedef: dispinterfacehdr '{'
;
inherit: { $$ = NULL; }
| ':' aKNOWNTYPE { $$ = find_type2($2, 0); }
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); }
;
interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; }
@ -934,7 +933,7 @@ interfacehdr: attributes interface { $$.interface = $2;
pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
is_object_interface = is_object($1);
is_in_interface = TRUE;
if ($2->defined) error_loc("multiple definition error\n");
check_def($2);
$2->attrs = check_iface_attrs($2->name, $1);
$2->defined = TRUE;
if (!parse_only && do_header) write_forward($2);
@ -958,7 +957,7 @@ interfacedef: interfacehdr inherit
| interfacehdr ':' aIDENTIFIER
'{' import int_statements '}'
semicolon_opt { $$ = $1.interface;
$$->ref = find_type2($3, 0);
$$->ref = find_type_or_error2($3, 0);
if (!$$->ref) error_loc("base class '%s' not found in import\n", $3);
$$->funcs = $6;
compute_method_indexes($$);
@ -1060,6 +1059,7 @@ pointer_type:
structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, tsSTRUCT);
/* overwrite RPC_FC_STRUCT with a more exact type */
check_def($$);
$$->type = get_struct_type( $4 );
$$->kind = TKIND_RECORD;
$$->fields_or_args = $4;
@ -1069,15 +1069,15 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, ts
}
;
type: tVOID { $$ = duptype(find_type("void", 0), 1); }
| aKNOWNTYPE { $$ = find_type($1, 0); }
type: tVOID { $$ = find_type_or_error("void", 0); }
| aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
| base_type { $$ = $1; }
| enumdef { $$ = $1; }
| tENUM aIDENTIFIER { $$ = find_type2($2, tsENUM); }
| tENUM aIDENTIFIER { $$ = find_type_or_error2($2, tsENUM); }
| structdef { $$ = $1; }
| tSTRUCT aIDENTIFIER { $$ = get_type(RPC_FC_STRUCT, $2, tsSTRUCT); }
| uniondef { $$ = $1; }
| tUNION aIDENTIFIER { $$ = find_type2($2, tsUNION); }
| tUNION aIDENTIFIER { $$ = find_type_or_error2($2, tsUNION); }
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
;
@ -1089,6 +1089,7 @@ typedef: tTYPEDEF m_attributes decl_spec declarator_list
uniondef: tUNION t_ident '{' ne_union_fields '}'
{ $$ = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, $2, tsUNION);
check_def($$);
$$->kind = TKIND_UNION;
$$->fields_or_args = $4;
$$->defined = TRUE;
@ -1097,6 +1098,7 @@ uniondef: tUNION t_ident '{' ne_union_fields '}'
tSWITCH '(' s_field ')'
m_ident '{' cases '}' { var_t *u = $7;
$$ = get_typev(RPC_FC_ENCAPSULATED_UNION, $2, tsUNION);
check_def($$);
$$->kind = TKIND_UNION;
if (!u) u = make_var( xstrdup("tagged_union") );
u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL);
@ -1126,14 +1128,14 @@ static void decl_builtin(const char *name, unsigned char type)
static type_t *make_builtin(char *name)
{
/* NAME is strdup'd in the lexer */
type_t *t = duptype(find_type(name, 0), 0);
type_t *t = duptype(find_type_or_error(name, 0), 0);
t->name = name;
return t;
}
static type_t *make_int(int sign)
{
type_t *t = duptype(find_type("int", 0), 1);
type_t *t = duptype(find_type_or_error("int", 0), 1);
t->sign = sign;
if (sign < 0)
@ -1390,6 +1392,7 @@ type_t *make_type(unsigned char type, type_t *ref)
t->tfswrite = FALSE;
t->checked = FALSE;
t->typelib_idx = -1;
init_loc_info(&t->loc_info);
return t;
}
@ -1701,9 +1704,7 @@ static var_t *make_var(char *name)
v->attrs = NULL;
v->eval = NULL;
v->stgclass = STG_NONE;
v->loc_info.input_name = input_name ? input_name : "stdin";
v->loc_info.line_number = line_number;
v->loc_info.near_text = parser_text;
init_loc_info(&v->loc_info);
return v;
}
@ -1760,7 +1761,7 @@ static type_t *make_class(char *name)
static type_t *make_safearray(type_t *type)
{
type_t *sa = duptype(find_type("SAFEARRAY", 0), 1);
type_t *sa = find_type_or_error("SAFEARRAY", 0);
sa->ref = type;
return make_type(pointer_default, sa);
}
@ -1894,6 +1895,12 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
if (name->name) {
type_t *cur;
cur = find_type(name->name, 0);
if (cur)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
cur->name, cur->loc_info.input_name,
cur->loc_info.line_number);
/* set the attributes to allow set_type to do some checks on them */
name->attrs = attrs;
set_type(name, decl_spec, decl, 0);
@ -1908,7 +1915,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
return type;
}
static type_t *find_type_helper(const char *name, int t)
type_t *find_type(const char *name, int t)
{
struct rtype *cur = type_hash[hash_ident(name)];
while (cur && (cur->t != t || strcmp(cur->name, name)))
@ -1916,9 +1923,9 @@ static type_t *find_type_helper(const char *name, int t)
return cur ? cur->type : NULL;
}
type_t *find_type(const char *name, int t)
static type_t *find_type_or_error(const char *name, int t)
{
type_t *type = find_type_helper(name, t);
type_t *type = find_type(name, t);
if (!type) {
error_loc("type '%s' not found\n", name);
return NULL;
@ -1926,23 +1933,23 @@ type_t *find_type(const char *name, int t)
return type;
}
static type_t *find_type2(char *name, int t)
static type_t *find_type_or_error2(char *name, int t)
{
type_t *tp = find_type(name, t);
type_t *tp = find_type_or_error(name, t);
free(name);
return tp;
}
int is_type(const char *name)
{
return find_type_helper(name, 0) != NULL;
return find_type(name, 0) != NULL;
}
static type_t *get_type(unsigned char type, char *name, int t)
{
type_t *tp;
if (name) {
tp = find_type_helper(name, t);
tp = find_type(name, t);
if (tp) {
free(name);
return tp;
@ -2611,7 +2618,12 @@ static void check_remoting_fields(const var_t *var, type_t *type)
type->checked = TRUE;
if (is_struct(type->type))
fields = type->fields_or_args;
{
if (type->defined)
fields = type->fields_or_args;
else
error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name);
}
else if (is_union(type->type))
{
if (type->type == RPC_FC_ENCAPSULATED_UNION)
@ -2693,7 +2705,7 @@ static void add_explicit_handle_if_necessary(func_t *func)
* function */
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
idl_handle->type = find_type("handle_t", 0);
idl_handle->type = find_type_or_error("handle_t", 0);
if (!func->def->type->fields_or_args)
{
func->def->type->fields_or_args = xmalloc( sizeof(*func->def->type->fields_or_args) );
@ -2848,7 +2860,7 @@ static statement_t *process_typedefs(declarator_list_t *decls)
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
{
var_t *var = decl->var;
type_t *type = find_type(var->name, 0);
type_t *type = find_type_or_error(var->name, 0);
*type_list = xmalloc(sizeof(type_list_t));
(*type_list)->type = type;
(*type_list)->next = NULL;
@ -2891,3 +2903,17 @@ static func_list_t *append_func_from_statement(func_list_t *list, statement_t *s
}
return list;
}
void init_loc_info(loc_info_t *i)
{
i->input_name = input_name ? input_name : "stdin";
i->line_number = line_number;
i->near_text = parser_text;
}
static void check_def(const type_t *t)
{
if (t->defined)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
t->name, t->loc_info.input_name, t->loc_info.line_number);
}

View file

@ -565,6 +565,7 @@ char *yytext;
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define YY_STACK_USED 1
#define YY_NO_INPUT 1
#define YY_NO_UNPUT 1
#define YY_NO_TOP_STATE 1
#define YY_NEVER_INTERACTIVE 1
@ -645,7 +646,7 @@ UUID *parse_uuid(const char *u)
* The flexer starts here
**************************************************************************
*/
#line 649 "parser.yy.c"
#line 650 "parser.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -801,7 +802,7 @@ YY_DECL
#line 112 "parser.l"
#line 805 "parser.yy.c"
#line 806 "parser.yy.c"
if ( yy_init )
{
@ -1095,7 +1096,7 @@ YY_RULE_SETUP
#line 187 "parser.l"
ECHO;
YY_BREAK
#line 1099 "parser.yy.c"
#line 1100 "parser.yy.c"
case YY_END_OF_BUFFER:
{

View file

@ -984,7 +984,7 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
{
unsigned int start, absoff, flags;
unsigned int align = 0, ualign = 0;
const char *name;
const char *name = NULL;
type_t *utype = get_user_type(type, &name);
size_t usize = user_type_has_variable_size(utype) ? 0 : type_memsize(utype, &ualign);
size_t size = type_memsize(type, &align);
@ -1437,6 +1437,14 @@ static int write_varying_array_pointer_descriptions(
if (offset_in_memory && offset_in_buffer)
{
size_t padding;
if (is_array(v->type) && v->type->length_is)
{
*offset_in_buffer = ROUND_SIZE(*offset_in_buffer, 4);
/* skip over variance and offset in buffer */
*offset_in_buffer += 8;
}
align = 0;
type_memsize(v->type, &align);
padding = ROUNDING(*offset_in_memory, align);
@ -1470,19 +1478,13 @@ static void write_pointer_description(FILE *file, type_t *type,
{
size_t offset_in_buffer;
size_t offset_in_memory;
size_t conformance = 0;
if (type->type == RPC_FC_CVSTRUCT)
conformance = 8;
else if (type->type == RPC_FC_CSTRUCT || type->type == RPC_FC_CPSTRUCT)
conformance = 4;
/* pass 1: search for single instance of a pointer (i.e. don't descend
* into arrays) */
if (!is_array(type))
{
offset_in_memory = 0;
offset_in_buffer = conformance;
offset_in_buffer = 0;
write_no_repeat_pointer_descriptions(
file, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
@ -1490,7 +1492,7 @@ static void write_pointer_description(FILE *file, type_t *type,
/* pass 2: search for pointers in fixed arrays */
offset_in_memory = 0;
offset_in_buffer = conformance;
offset_in_buffer = 0;
write_fixed_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
@ -1512,7 +1514,7 @@ static void write_pointer_description(FILE *file, type_t *type,
/* pass 4: search for pointers in varying arrays */
offset_in_memory = 0;
offset_in_buffer = conformance;
offset_in_buffer = 0;
write_varying_array_pointer_descriptions(
file, NULL, type,
&offset_in_memory, &offset_in_buffer, typestring_offset);
@ -2032,6 +2034,34 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
error("union switch type must be an integer, char, or enum\n");
}
}
else if (is_attr(type->attrs, ATTR_SWITCHTYPE))
{
static const expr_t dummy_expr; /* FIXME */
const type_t *st = get_attrp(type->attrs, ATTR_SWITCHTYPE);
switch (st->type)
{
case RPC_FC_CHAR:
case RPC_FC_SMALL:
case RPC_FC_USMALL:
case RPC_FC_SHORT:
case RPC_FC_USHORT:
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ENUM16:
case RPC_FC_ENUM32:
print_file(file, 2, "0x%x,\t/* %s */\n", type->type, string_of_type(type->type));
print_file(file, 2, "0x%x,\t/* Switch type= %s */\n",
st->type, string_of_type(st->type));
*tfsoff += 2;
break;
default:
error("union switch type must be an integer, char, or enum\n");
}
*tfsoff += write_conf_or_var_desc(file, NULL, *tfsoff, st, &dummy_expr );
}
print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", size, size);
print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", nbranch, nbranch);
*tfsoff += 4;
@ -2427,11 +2457,12 @@ void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred
static unsigned int get_required_buffer_size_type(
const type_t *type, const char *name, unsigned int *alignment)
{
const char *uname;
const type_t *utype;
*alignment = 0;
if (is_user_type(type))
if ((utype = get_user_type(type, &uname)))
{
const char *uname;
const type_t *utype = get_user_type(type, &uname);
return get_required_buffer_size_type(utype, uname, alignment);
}
else
@ -2740,7 +2771,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
/* returns whether the MaxCount, Offset or ActualCount members need to be
* filled in for the specified phase */
static inline int is_size_needed_for_phase(enum remoting_phase phase)
static inline int is_conformance_needed_for_phase(enum remoting_phase phase)
{
return (phase != PHASE_UNMARSHAL);
}
@ -2763,6 +2794,67 @@ expr_t *get_size_is_expr(const type_t *t, const char *name)
return x;
}
static void write_parameter_conf_or_var_exprs(FILE *file, int indent,
enum remoting_phase phase,
const var_t *var)
{
const type_t *type = var->type;
/* get fundamental type for the argument */
for (;;)
{
if (is_attr(type->attrs, ATTR_WIREMARSHAL))
break;
else if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
break;
else if (is_array(type) || is_string_type(var->attrs, type))
{
if (is_conformance_needed_for_phase(phase))
{
if (type->size_is)
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
write_expr(file, type->size_is, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
if (type->length_is)
{
print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
write_expr(file, type->length_is, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
}
break;
}
else if (type->type == RPC_FC_NON_ENCAPSULATED_UNION)
{
if (is_conformance_needed_for_phase(phase))
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
break;
}
else if (type->type == RPC_FC_IP)
{
expr_t *iid;
if (is_conformance_needed_for_phase(phase) && (iid = get_attrp( var->attrs, ATTR_IIDIS )))
{
print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
write_expr( file, iid, 1, 1, NULL, NULL );
fprintf( file, ";\n\n" );
}
break;
}
else if (is_ptr(type))
type = type->ref;
else
break;
}
}
static void write_remoting_arg(FILE *file, int indent, const func_t *func,
enum pass pass, enum remoting_phase phase,
const var_t *var)
@ -2794,6 +2886,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
break;
}
write_parameter_conf_or_var_exprs(file, indent, phase, var);
rtype = type->type;
if (is_context_handle(type))
@ -2849,13 +2942,6 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
print_phase_function(file, indent, "NonConformantString", phase, var, start_offset);
else
{
if (type->size_is && is_size_needed_for_phase(phase))
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
write_expr(file, type->size_is, 1, 1, NULL, NULL);
fprintf(file, ";\n");
}
if (phase == PHASE_FREE || pass == PASS_RETURN || pointer_type == RPC_FC_UP)
print_phase_function(file, indent, "Pointer", phase, var,
start_offset - (type->size_is ? 4 : 2));
@ -2878,43 +2964,14 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
if (tc == RPC_FC_SMVARRAY || tc == RPC_FC_LGVARRAY)
{
if (is_size_needed_for_phase(phase))
{
print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
write_expr(file, type->length_is, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
array_type = "VaryingArray";
}
else if (tc == RPC_FC_CARRAY)
{
if (is_size_needed_for_phase(phase))
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
write_expr(file, type->size_is, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
array_type = "ConformantArray";
}
else if (tc == RPC_FC_CVARRAY || tc == RPC_FC_BOGUS_ARRAY)
{
if (is_size_needed_for_phase(phase))
{
if (type->size_is)
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
write_expr(file, type->size_is, 1, 1, NULL, NULL);
fprintf(file, ";\n");
}
if (type->length_is)
{
print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
write_expr(file, type->length_is, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
}
array_type = (tc == RPC_FC_BOGUS_ARRAY
? "ComplexArray"
: "ConformantVaryingArray");
@ -2999,21 +3056,6 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
}
else
{
expr_t *iid;
expr_t *sx = get_size_is_expr(type, var->name);
if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
{
print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
write_expr( file, iid, 1, 1, NULL, NULL );
fprintf( file, ";\n\n" );
}
else if (sx)
{
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long) ");
write_expr(file, sx, 1, 1, NULL, NULL);
fprintf(file, ";\n\n");
}
if (var->type->ref->type == RPC_FC_IP)
print_phase_function(file, indent, "InterfacePointer", phase, var, start_offset);
else

View file

@ -69,6 +69,7 @@ type_t *alias(type_t *t, const char *name)
a->kind = TKIND_ALIAS;
a->attrs = NULL;
a->declarray = FALSE;
init_loc_info(&a->loc_info);
return a;
}

View file

@ -283,6 +283,7 @@ struct _type_t {
unsigned int typestring_offset;
unsigned int ptrdesc; /* used for complex structs */
int typelib_idx;
loc_info_t loc_info;
unsigned int declarray : 1; /* if declared as an array */
unsigned int ignore : 1;
unsigned int defined : 1;
@ -419,6 +420,8 @@ var_t *find_const(const char *name, int f);
type_t *find_type(const char *name, int t);
type_t *make_type(unsigned char type, type_t *ref);
void init_loc_info(loc_info_t *);
static inline type_t *get_func_return_type(const func_t *func)
{
return func->def->type->ref;