- Revert r49085 and r49086.

svn path=/trunk/; revision=49087
This commit is contained in:
Eric Kohl 2010-10-09 23:13:57 +00:00
parent c30d993d2e
commit 4ab377fc5e
13 changed files with 653 additions and 426 deletions

View file

@ -22,7 +22,7 @@ When porting a new DLL from Wine to ReactOS, please do the following steps
The following build tools are shared with Wine.
reactos/tools/unicode # Synced to Wine-1_2rc6
reactos/tools/widl # Synced to Wine-1_3_4
reactos/tools/widl # Synced to Wine-1_2rc6
reactos/tools/winebuild # Synced to Wine-1_1_13
reactos/tools/wmc # Synced to Wine-20081105 (~Wine-1.1.7)
reactos/tools/wpp # Synced to Wine-20081105 (~Wine-1.1.7)

View file

@ -513,22 +513,27 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
case EXPR_HEXNUM:
case EXPR_NUM:
case EXPR_TRUEFALSE:
result.is_variable = FALSE;
result.is_temporary = FALSE;
result.type = type_new_int(TYPE_BASIC_INT, 0);
break;
case EXPR_STRLIT:
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
break;
case EXPR_WSTRLIT:
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
break;
case EXPR_CHARCONST:
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_int(TYPE_BASIC_CHAR, 0);
break;
case EXPR_DOUBLE:
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_basic(TYPE_BASIC_DOUBLE);
break;
@ -591,6 +596,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
result.type = e->u.tref;
break;
case EXPR_SIZEOF:
result.is_variable = FALSE;
result.is_temporary = FALSE;
result.type = type_new_int(TYPE_BASIC_INT, 0);
break;
@ -628,6 +634,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
result_right = resolve_expression(expr_loc, cont_type, e->u.ext);
check_scalar_type(expr_loc, cont_type, result_left.type);
check_scalar_type(expr_loc, cont_type, result_right.type);
result.is_variable = FALSE;
result.is_temporary = FALSE;
result.type = type_new_int(TYPE_BASIC_INT, 0);
break;

View file

@ -39,13 +39,10 @@
typedef struct _user_type_t generic_handle_t;
static int indentation = 0;
static int is_object_interface = 0;
user_type_list_t user_type_list = LIST_INIT(user_type_list);
static context_handle_list_t context_handle_list = LIST_INIT(context_handle_list);
static struct list generic_handle_list = LIST_INIT(generic_handle_list);
static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name);
static void indent(FILE *h, int delta)
{
int c;
@ -369,12 +366,12 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
int i;
const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
if (!callconv && is_object_interface) callconv = "STDMETHODCALLTYPE";
if (!callconv) callconv = "";
if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
write_type_left(h, type_function_get_rettype(pt), declonly);
fputc(' ', h);
if (ptr_level) fputc('(', h);
if (callconv) fprintf(h, "%s ", callconv);
fprintf(h, "%s ", callconv);
for (i = 0; i < ptr_level; i++)
fputc('*', h);
} else
@ -399,7 +396,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
}
}
static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
{
write_type_v(f, t, field, FALSE, name);
}
@ -788,7 +785,7 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
const var_t *func = stmt->u.var;
if (!is_callas(func->attrs)) {
const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
if (!callconv) callconv = "";
indent(header, 0);
fprintf(header, "virtual ");
write_type_decl_left(header, type_function_get_rettype(func->type));
@ -818,7 +815,7 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
}
if (!is_callas(func->attrs)) {
const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
if (!callconv) callconv = "";
indent(header, 0);
write_type_decl_left(header, type_function_get_rettype(func->type));
fprintf(header, " (%s *%s)(\n", callconv, get_name(func));
@ -849,7 +846,7 @@ static void write_method_proto(FILE *header, const type_t *iface)
if (!is_local(func->attrs)) {
const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
if (!callconv) callconv = "";
/* proxy prototype */
write_type_decl_left(header, type_function_get_rettype(func->type));
fprintf(header, " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(func));
@ -1220,7 +1217,6 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
{
type_t *iface = stmt->u.type;
if (is_object(iface)) is_object_interface++;
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
{
write_com_interface_start(header, iface);
@ -1233,7 +1229,6 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
write_header_stmts(header, type_iface_get_stmts(iface), iface, FALSE);
write_rpc_interface_end(header, iface);
}
if (is_object(iface)) is_object_interface++;
}
else if (type_get_type(stmt->u.type) == TYPE_COCLASS)
write_coclass(header, stmt->u.type);
@ -1309,14 +1304,16 @@ void write_header(const statement_list_t *stmts)
fprintf(header, "#ifndef __WIDL_%s\n", header_token);
fprintf(header, "#define __WIDL_%s\n\n", header_token);
fprintf(header, "/* Forward declarations */\n\n");
write_forward_decls(header, stmts);
start_cplusplus_guard(header);
fprintf(header, "/* Headers for imported files */\n\n");
write_imports(header, stmts);
fprintf(header, "\n");
start_cplusplus_guard(header);
/* FIXME: should be before imported file includes */
fprintf(header, "/* Forward declarations */\n\n");
write_forward_decls(header, stmts);
fprintf(header, "\n");
write_header_stmts(header, stmts, NULL, FALSE);

View file

@ -34,6 +34,7 @@ extern int is_declptr(const type_t *t);
extern const char* get_name(const var_t *v);
extern void write_type_left(FILE *h, type_t *t, int declonly);
extern void write_type_right(FILE *h, type_t *t, int is_field);
extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char *name);
extern void write_type_decl(FILE *f, type_t *t, const char *name);
extern void write_type_decl_left(FILE *f, type_t *t);
extern int needs_space_after(type_t *t);

File diff suppressed because it is too large Load diff

View file

@ -201,7 +201,7 @@ typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 153 "parser.y"
#line 154 "parser.y"
attr_t *attr;
attr_list_t *attr_list;

View file

@ -66,6 +66,7 @@
#define YYERROR_VERBOSE
static unsigned char pointer_default = RPC_FC_UP;
static int is_object_interface = FALSE;
typedef struct list typelist_t;
struct typenode {
@ -805,6 +806,7 @@ dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0)
;
dispinterfacehdr: attributes dispinterface { attr_t *attrs;
is_object_interface = TRUE;
$$ = $2;
check_def($$);
attrs = make_attr(ATTR_DISPINTERFACE);
@ -834,7 +836,7 @@ dispinterfacedef: dispinterfacehdr '{'
;
inherit: { $$ = NULL; }
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); }
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); is_object_interface = 1; }
;
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); }
@ -847,6 +849,7 @@ interfacehdr: attributes interface { $$.interface = $2;
pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
check_def($2);
$2->attrs = check_iface_attrs($2->name, $1);
is_object_interface = is_object($2);
$2->defined = TRUE;
}
;
@ -923,8 +926,7 @@ decl_spec_no_type:
declarator:
'*' m_type_qual_list declarator %prec PPTR
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
| callconv declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
| callconv declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
| direct_declarator
;
@ -942,8 +944,7 @@ direct_declarator:
abstract_declarator:
'*' m_type_qual_list m_abstract_declarator %prec PPTR
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
| callconv m_abstract_declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
| callconv m_abstract_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
| abstract_direct_declarator
;
@ -951,8 +952,7 @@ abstract_declarator:
abstract_declarator_no_direct:
'*' m_type_qual_list m_any_declarator %prec PPTR
{ $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
| callconv m_any_declarator { $$ = $2; if ($$->func_type) $$->func_type->attrs = append_attr($$->func_type->attrs, make_attrp(ATTR_CALLCONV, $1));
else if ($$->type) $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
| callconv m_any_declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
;
/* abstract declarator or empty */
@ -1572,6 +1572,12 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
* function node */
for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t))
ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV);
if (is_object_interface && !is_attr(ft->attrs, ATTR_CALLCONV))
{
static char *stdmethodcalltype;
if (!stdmethodcalltype) stdmethodcalltype = strdup("STDMETHODCALLTYPE");
ft->attrs = append_attr(NULL, make_attrp(ATTR_CALLCONV, stdmethodcalltype));
}
}
else
{
@ -1816,12 +1822,6 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
/* Append the SWITCHTYPE attribute to a union if it does not already have one. */
if (type_get_type_detect_alias(type) == TYPE_UNION &&
is_attr(attrs, ATTR_SWITCHTYPE) &&
!is_attr(type->attrs, ATTR_SWITCHTYPE))
type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
{

View file

@ -16,7 +16,6 @@
#define yytext parser_text
#define yywrap parser_wrap
#line 20 "parser.yy.c"
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
@ -663,7 +662,7 @@ UUID *parse_uuid(const char *u)
* The flexer starts here
**************************************************************************
*/
#line 667 "parser.yy.c"
#line 666 "lex.parser_.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -819,7 +818,7 @@ YY_DECL
#line 127 "parser.l"
#line 823 "parser.yy.c"
#line 822 "lex.parser_.c"
if ( yy_init )
{
@ -1138,7 +1137,7 @@ YY_RULE_SETUP
#line 210 "parser.l"
ECHO;
YY_BREAK
#line 1142 "parser.yy.c"
#line 1141 "lex.parser_.c"
case YY_END_OF_BUFFER:
{

View file

@ -280,7 +280,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx,
int has_ret = !is_void(type_function_get_rettype(func->type));
int has_full_pointer = is_full_pointer_function(func);
const char *callconv = get_attrp(func->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "STDMETHODCALLTYPE";
if (!callconv) callconv = "";
indent = 0;
print_proxy( "static void __finally_%s_%s_Proxy( struct __proxy_frame *__frame )\n",

View file

@ -873,7 +873,7 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n");
print_file(file, indent, "0x01,\n");
print_file(file, indent, "NdrFcShort(0x%hx),\n", (unsigned short)type->typestring_offset);
print_file(file, indent, "NdrFcShort(0x%hx),\n", type->typestring_offset);
size = 4; /* includes param type prefix */
}
return size;
@ -1137,7 +1137,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure,
print_file(file, 2, "0x%x, /* %s */\n", operator_type,
operator_type ? string_of_type(operator_type) : "no operators");
print_file(file, 2, "NdrFcShort(0x%hx),\t/* offset = %d */\n",
(unsigned short)offset, offset);
offset, offset);
}
else
{
@ -1172,7 +1172,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure,
print_file(file, 2, "0x%x, /* Corr desc: %s */\n", conftype, conftype_string);
print_file(file, 2, "0x%x, /* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK");
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)callback_offset, callback_offset);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", callback_offset, callback_offset);
}
return 4;
}
@ -1654,8 +1654,8 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
print_file(file, 2, "0x%x,\t/* Alignment= %d, Flags= %02x */\n",
flags | (ualign - 1), ualign - 1, flags);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Function offset= %hu */\n", funoff, funoff);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)size, size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)usize, usize);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", usize, usize);
*tfsoff += 8;
reloff = absoff - *tfsoff;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff);
@ -1786,8 +1786,8 @@ static int write_pointer_description_offsets(
* note that MSDN states that for pointer layouts in structures,
* this is a negative offset from the end of the structure, but
* this statement is incorrect. all offsets are positive */
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", (unsigned short)*offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", (unsigned short)*offset_in_buffer, *offset_in_buffer);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer);
memsize = type_memsize(type);
*offset_in_memory += memsize;
@ -1940,10 +1940,10 @@ static int write_fixed_array_pointer_descriptions(
print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", RPC_FC_FIXED_REPEAT);
print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Iterations = %d */\n", (unsigned short)type_array_get_dim(type), type_array_get_dim(type));
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)*offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", (unsigned short)pointer_count, pointer_count);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Iterations = %d */\n", type_array_get_dim(type), type_array_get_dim(type));
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count);
*typestring_offset += 10;
pointer_count = write_pointer_description_offsets(
@ -2014,9 +2014,9 @@ static int write_conformant_array_pointer_descriptions(
print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT);
print_file(file, 2, "0x%02x, /* FC_FIXED_OFFSET */\n", RPC_FC_FIXED_OFFSET);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)offset_in_memory, offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", (unsigned short)pointer_count, pointer_count);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", offset_in_memory, offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count);
*typestring_offset += 8;
pointer_count = write_pointer_description_offsets(
@ -2056,9 +2056,9 @@ static int write_varying_array_pointer_descriptions(
print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT);
print_file(file, 2, "0x%02x, /* FC_VARIABLE_OFFSET */\n", RPC_FC_VARIABLE_OFFSET);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)*offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", (unsigned short)pointer_count, pointer_count);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count);
*typestring_offset += 8;
pointer_count = write_pointer_description_offsets(
@ -2221,7 +2221,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD);
*typestring_offset += 2;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)dim, dim);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", dim, dim);
*typestring_offset += 2;
return start_offset;
@ -2298,7 +2298,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
}
else
{
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)size, size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size);
*typestring_offset += 2;
}
@ -2319,11 +2319,11 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
}
else
{
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)dim, dim);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim);
*typestring_offset += 2;
}
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)elsize, elsize);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", elsize, elsize);
*typestring_offset += 2;
}
@ -2349,7 +2349,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
else
{
unsigned int dim = size_is ? 0 : type_array_get_dim(type);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)dim, dim);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim);
*typestring_offset += 2;
*typestring_offset
+= write_conf_or_var_desc(file, current_structure, baseoff,
@ -2487,7 +2487,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
print_start_tfs_comment(file, type, start_offset);
print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)total_size, total_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", total_size, total_size);
*tfsoff += 4;
if (array)
@ -2513,7 +2513,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
int reloff = absoff - *tfsoff;
assert( reloff >= 0 );
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %d (%u) */\n",
(unsigned short)reloff, reloff, absoff);
reloff, reloff, absoff);
*tfsoff += 2;
}
else if ((fc == RPC_FC_PSTRUCT) ||
@ -2713,8 +2713,8 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso
print_file(file, 0, "/* %u */\n", *tfsoff);
}
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)size, size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)nbranch, nbranch);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", size, size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", nbranch, nbranch);
*tfsoff += 4;
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)

View file

@ -694,7 +694,6 @@ int main(int argc,char *argv[])
if (do_server) server_token = dup_basename_token(server_name,"_s.c");
add_widl_version_define();
wpp_add_define("_WIN32", NULL);
atexit(rm_tempfile);
if (!no_preprocess)

View file

@ -1,6 +1,16 @@
diff -u wine-1.3.4/tools/widl/hash.c tools/widl/hash.c
--- wine-1.3.4/tools/widl/hash.c 2010-09-19 17:48:47.640625000 +0200
+++ tools/widl/hash.c 2010-09-19 19:17:19.000000000 +0200
--- client.c 2008-09-27 21:56:02.000000000 +0200
+++ client.c 2008-09-27 20:49:05.000000000 +0200
@@ -113,7 +113,7 @@
}
if (explicit_handle)
{
- if (!explicit_handle_var || !explicit_generic_handle_var || !context_handle_var)
+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
--- hash.c 2008-09-27 21:56:02.000000000 +0200
+++ hash.c 2008-09-22 00:14:35.703125000 +0200
@@ -21,9 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
@ -10,27 +20,202 @@ diff -u wine-1.3.4/tools/widl/hash.c tools/widl/hash.c
-#include "winnls.h"
+#include <host/nls.h>
#include "widltypes.h"
#include "hash.h"
diff -u wine-1.3.4/tools/widl/parser.y tools/widl/parser.y
--- wine-1.3.4/tools/widl/parser.y 2010-09-19 17:49:40.578125000 +0200
+++ tools/widl/parser.y 2010-10-03 16:44:18.781250000 +0200
@@ -1816,6 +1816,12 @@
else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
+ /* Append the SWITCHTYPE attribute to a union if it does not already have one. */
+ if (type_get_type_detect_alias(type) == TYPE_UNION &&
+ is_attr(attrs, ATTR_SWITCHTYPE) &&
+ !is_attr(type->attrs, ATTR_SWITCHTYPE))
+ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
@@ -535,6 +533,7 @@
case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
+#ifndef __REACTOS__
case LANG_VIETNAMESE: case LANG_GAELIC: case LANG_MALTESE:
case LANG_TAJIK: case LANG_ROMANSH: case LANG_IRISH:
case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
@@ -542,6 +541,12 @@
case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
case LANG_BRETON:
+#else
+ case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH:
+ case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA:
+ case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH:
+ case LANG_BRETON:
+#endif
nOffset = 16;
pnLookup = Lookup_16;
break;
--- header.c 2008-09-27 21:56:02.000000000 +0200
+++ header.c 2008-09-27 20:49:05.000000000 +0200
@@ -891,6 +891,8 @@
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
const var_t* explicit_handle_var;
+ const var_t* explicit_generic_handle_var = NULL;
+ const var_t* context_handle_var = NULL;
const func_t *cur;
int prefixes_differ = strcmp(prefix_client, prefix_server);
@@ -901,8 +903,14 @@
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(cur);
+ if (!explicit_handle_var)
+ {
+ explicit_generic_handle_var = get_explicit_generic_handle_var(cur);
+ if (!explicit_generic_handle_var)
+ context_handle_var = get_context_handle_var(cur);
+ }
if (explicit_handle) {
- if (!explicit_handle_var) {
+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var) {
error("%s() does not define an explicit binding handle!\n", def->name);
return;
}
--- header.h 2008-09-27 21:56:02.000000000 +0200
+++ header.h 2008-09-23 21:14:50.781250000 +0200
@@ -66,6 +66,7 @@
extern const var_t* get_explicit_handle_var(const func_t* func);
extern const type_t* get_explicit_generic_handle_type(const var_t* var);
extern const var_t* get_explicit_generic_handle_var(const func_t* func);
+extern const var_t* get_context_handle_var(const func_t* func);
extern int has_out_arg_or_return(const func_t *func);
extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
const UUID *uuid);
@@ -88,11 +89,19 @@
static inline int is_context_handle(const type_t *type)
{
- const type_t *t;
- for (t = type; is_ptr(t); t = t->ref)
- if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
+ if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
+ return 1;
+
LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
{
+ for (;;)
+ {
+ if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
return 1;
- return 0;
+ else if (type->kind == TKIND_ALIAS)
+ type = type->orig;
+ else if (is_ptr(type))
+ type = type->ref;
+ else return 0;
+ }
}
diff -u wine-1.3.4/tools/widl/typelib.c tools/widl/typelib.c
--- wine-1.3.4/tools/widl/typelib.c 2010-09-19 17:50:24.000000000 +0200
+++ tools/widl/typelib.c 2010-09-26 20:23:47.000000000 +0200
#endif
--- proxy.c 2008-09-27 21:56:02.000000000 +0200
+++ proxy.c 2008-09-27 20:49:05.000000000 +0200
@@ -463,41 +463,45 @@
print_proxy("\n");
}
-static int write_proxy_methods(type_t *iface)
+static int write_proxy_methods(type_t *iface, int skip)
{
const func_t *cur;
int i = 0;
- if (iface->ref) i = write_proxy_methods(iface->ref);
+ if (iface->ref) i = write_proxy_methods(iface->ref, iface->ref->ref != NULL);
if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
var_t *def = cur->def;
if (!is_callas(def->attrs)) {
if (i) fprintf(proxy, ",\n");
- print_proxy( "%s_", iface->name);
+ print_proxy( "%s%s_", skip ? "0\t/* " : "", iface->name);
write_name(proxy, def);
- fprintf(proxy, "_Proxy");
+ fprintf(proxy, "_Proxy%s", skip ? " */" : "");
i++;
}
}
return i;
}
-static int write_stub_methods(type_t *iface)
+static int write_stub_methods(type_t *iface, int skip)
{
const func_t *cur;
int i = 0;
- if (iface->ref) i = write_stub_methods(iface->ref);
+ if (iface->ref) i = write_stub_methods(iface->ref, TRUE);
else return i; /* skip IUnknown */
if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
var_t *def = cur->def;
if (!is_local(def->attrs)) {
- if (i) fprintf(proxy,",\n");
- print_proxy( "%s_", iface->name);
- write_name(proxy, def);
- fprintf(proxy, "_Stub");
- i++;
+ if (skip)
+ print_proxy("STUB_FORWARDING_FUNCTION,\n");
+ else {
+ if (i) fprintf(proxy,",\n");
+ print_proxy( "%s_", iface->name);
+ write_name(proxy, def);
+ fprintf(proxy, "_Stub");
+ i++;
+ }
}
}
return i;
@@ -551,7 +555,7 @@
print_proxy( "},\n");
print_proxy( "{\n");
indent++;
- write_proxy_methods(iface);
+ write_proxy_methods(iface, FALSE);
fprintf(proxy, "\n");
indent--;
print_proxy( "}\n");
@@ -563,7 +567,7 @@
print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
print_proxy( "{\n");
indent++;
- stubs = write_stub_methods(iface);
+ stubs = write_stub_methods(iface, FALSE);
fprintf(proxy, "\n");
indent--;
fprintf(proxy, "};\n");
--- server.c 2008-09-27 21:56:02.000000000 +0200
+++ server.c 2008-09-27 20:49:05.000000000 +0200
@@ -60,13 +60,21 @@
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
{
const var_t *def = func->def;
+ const var_t* context_handle_var = NULL;
+ const var_t* explicit_generic_handle_var = NULL;
int has_full_pointer = is_full_pointer_function(func);
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
+ if (!explicit_handle_var)
+ {
+ explicit_generic_handle_var = get_explicit_generic_handle_var(func);
+ if (!explicit_generic_handle_var)
+ context_handle_var = get_context_handle_var(func);
+ }
if (explicit_handle)
{
- if (!explicit_handle_var)
+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
{
error("%s() does not define an explicit binding handle!\n", def->name);
return;
@@ -399,6 +407,7 @@
print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
print_server("#include <string.h>\n");
fprintf(server, "\n");
+ print_server("#define _SEH_NO_NATIVE_NLG\n");
print_server("#include \"%s\"\n", header_name);
fprintf(server, "\n");
}
--- typelib.c 2008-09-27 21:56:02.000000000 +0200
+++ typelib.c 2008-09-27 20:49:05.000000000 +0200
@@ -35,8 +35,7 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
@ -41,9 +226,21 @@ diff -u wine-1.3.4/tools/widl/typelib.c tools/widl/typelib.c
#include "widl.h"
#include "utils.h"
diff -u wine-1.3.4/tools/widl/typelib_struct.h tools/widl/typelib_struct.h
--- wine-1.3.4/tools/widl/typelib_struct.h 2010-09-19 17:50:40.953125000 +0200
+++ tools/widl/typelib_struct.h 2010-10-10 00:50:32.921875000 +0200
@@ -360,10 +359,10 @@
file_name = wpp_find_include(importlib->name, NULL);
if(file_name) {
- fd = open(file_name, O_RDONLY);
+ fd = open(file_name, O_RDONLY | O_BINARY);
free(file_name);
}else {
- fd = open(importlib->name, O_RDONLY);
+ fd = open(importlib->name, O_RDONLY | O_BINARY);
}
if(fd < 0)
--- typelib_struct.h 2008-09-27 21:56:02.000000000 +0200
+++ typelib_struct.h 2008-09-22 00:14:35.703125000 +0200
@@ -302,7 +302,7 @@
*
*/
@ -62,9 +259,39 @@ diff -u wine-1.3.4/tools/widl/typelib_struct.h tools/widl/typelib_struct.h
/*---------------------------END--------------------------------------------*/
#endif
diff -u wine-1.3.4/tools/widl/widltypes.h tools/widl/widltypes.h
--- wine-1.3.4/tools/widl/widltypes.h 2010-09-19 17:51:38.890625000 +0200
+++ tools/widl/widltypes.h 2010-09-19 19:17:19.656250000 +0200
--- widl.c 2008-09-27 21:56:02.000000000 +0200
+++ widl.c 2008-09-27 20:49:05.000000000 +0200
@@ -174,7 +174,7 @@
token = xstrdup(name);
for (i=0; token[i]; i++) {
if (!isalnum(token[i])) token[i] = '_';
- else token[i] = toupper(token[i]);
+ else token[i] = tolower(token[i]);
}
return token;
}
@@ -561,8 +561,8 @@
fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
fprintf(header, "#include <rpc.h>\n" );
fprintf(header, "#include <rpcndr.h>\n\n" );
- fprintf(header, "#ifndef __WIDL_%s\n", header_token);
- fprintf(header, "#define __WIDL_%s\n", header_token);
+ fprintf(header, "#ifndef __%s__\n", header_token);
+ fprintf(header, "#define __%s__\n", header_token);
start_cplusplus_guard(header);
}
@@ -607,7 +607,7 @@
fprintf(header, "/* End additional prototypes */\n");
fprintf(header, "\n");
end_cplusplus_guard(header);
- fprintf(header, "#endif /* __WIDL_%s */\n", header_token);
+ fprintf(header, "#endif /* __%s__ */\n", header_token);
fclose(header);
}
--- widltypes.h 2008-09-27 21:56:02.000000000 +0200
+++ widltypes.h 2008-09-26 19:42:52.859375000 +0200
@@ -21,6 +21,13 @@
#ifndef __WIDL_WIDLTYPES_H
#define __WIDL_WIDLTYPES_H
@ -77,9 +304,9 @@ diff -u wine-1.3.4/tools/widl/widltypes.h tools/widl/widltypes.h
+#define max(a, b) ((a) > (b) ? a : b)
+
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
@@ -32,7 +39,9 @@
#include "wine/rpcfc.h"
@@ -31,7 +38,9 @@
typedef GUID UUID;
#endif
@ -88,10 +315,9 @@ diff -u wine-1.3.4/tools/widl/widltypes.h tools/widl/widltypes.h
+#endif
#define FALSE 0
typedef struct _loc_info_t loc_info_t;
diff -u wine-1.3.4/tools/widl/write_msft.c tools/widl/write_msft.c
--- wine-1.3.4/tools/widl/write_msft.c 2010-09-19 17:51:48.531250000 +0200
+++ tools/widl/write_msft.c 2010-09-26 20:23:47.000000000 +0200
#define RPC_FC_FUNCTION 0xfe
--- write_msft.c 2008-09-27 21:56:02.000000000 +0200
+++ write_msft.c 2008-09-27 20:49:05.000000000 +0200
@@ -40,10 +40,8 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
@ -103,5 +329,5 @@ diff -u wine-1.3.4/tools/widl/write_msft.c tools/widl/write_msft.c
+#include <host/typedefs.h>
+#include <host/nls.h>
#include "widl.h"
#include "widltypes.h"
#include "typelib.h"

View file

@ -21,9 +21,9 @@
#ifndef __WIDL_WIDLTYPES_H
#define __WIDL_WIDLTYPES_H
#define S_OK 0
#define S_FALSE 1
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define S_OK 0
#define S_FALSE 1
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
#define max(a, b) ((a) > (b) ? a : b)
@ -39,9 +39,7 @@
typedef GUID UUID;
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define FALSE 0
typedef struct _loc_info_t loc_info_t;