[WIDL] Sync with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=69902
This commit is contained in:
Amine Khaldi 2015-11-16 21:45:45 +00:00
parent 40beab051e
commit 071b9d445b
20 changed files with 4173 additions and 4206 deletions

View file

@ -16,7 +16,7 @@ wine-patches@winehq.com and ros-dev@reactos.org
The following build tools are shared with Wine.
reactos/tools/unicode # Synced to WineStaging-1.7.47
reactos/tools/widl # Synced to Wine-1.7.17
reactos/tools/widl # Synced to WineStaging-1.7.55
reactos/tools/wpp # Synced to WineStaging-1.7.47
The following libraries are shared with Wine.

View file

@ -571,7 +571,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
error_loc_info(&expr_loc->v->loc_info, "address-of operator applied to non-variable type in expression%s%s\n",
expr_loc->attr ? " for attribute " : "",
expr_loc->attr ? expr_loc->attr : "");
result.is_variable = FALSE;
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, result.type, NULL);
break;

View file

@ -52,6 +52,16 @@ static void indent(FILE *h, int delta)
if (delta > 0) indentation += delta;
}
static void write_line(FILE *f, int delta, const char *fmt, ...)
{
va_list ap;
indent(f, delta);
va_start(ap, fmt);
vfprintf(f, fmt, ap);
va_end(ap);
fprintf(f, "\n");
}
int is_ptrchain_attr(const var_t *var, enum attr_type t)
{
if (is_attr(var->attrs, t))
@ -119,8 +129,9 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const
uuid->Data4[6], uuid->Data4[7]);
}
static void write_uuid_decl(FILE *f, const char *name, const UUID *uuid)
static void write_uuid_decl(FILE *f, type_t *type, const UUID *uuid)
{
char *name = format_namespace(type->namespace, "", "::", type->name);
fprintf(f, "#ifdef __CRT_UUID_DECL\n");
fprintf(f, "__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
"0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
@ -128,6 +139,7 @@ static void write_uuid_decl(FILE *f, const char *name, const UUID *uuid)
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
uuid->Data4[7]);
fprintf(f, "#endif\n");
free(name);
}
static const char *uuid_string(const UUID *uuid)
@ -141,6 +153,30 @@ static const char *uuid_string(const UUID *uuid)
return buf;
}
static void write_namespace_start(FILE *header, struct namespace *namespace)
{
if(is_global_namespace(namespace)) {
if(use_abi_namespace)
write_line(header, 1, "namespace ABI {");
return;
}
write_namespace_start(header, namespace->parent);
write_line(header, 1, "namespace %s {", namespace->name);
}
static void write_namespace_end(FILE *header, struct namespace *namespace)
{
if(is_global_namespace(namespace)) {
if(use_abi_namespace)
write_line(header, -1, "}", namespace->name);
return;
}
write_line(header, -1, "}", namespace->name);
write_namespace_end(header, namespace->parent);
}
const char *get_name(const var_t *v)
{
static char buffer[256];
@ -220,7 +256,7 @@ static void write_fields(FILE *h, var_list_t *fields)
}
}
static void write_enums(FILE *h, var_list_t *enums)
static void write_enums(FILE *h, var_list_t *enums, const char *enum_name)
{
var_t *v;
if (!enums) return;
@ -228,7 +264,10 @@ static void write_enums(FILE *h, var_list_t *enums)
{
if (v->name) {
indent(h, 0);
fprintf(h, "%s", get_name(v));
if(!enum_name)
fprintf(h, "%s", get_name(v));
else
fprintf(h, "%s_%s", enum_name, get_name(v));
if (v->eval) {
fprintf(h, " = ");
write_expr(h, v->eval, 0, 1, NULL, NULL, "");
@ -245,10 +284,14 @@ int needs_space_after(type_t *t)
(!is_ptr(t) && (!is_array(t) || !type_array_is_decl_as_ptr(t) || t->name)));
}
void write_type_left(FILE *h, type_t *t, int declonly)
void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
{
const char *name;
if (!h) return;
name = type_get_name(t, name_type);
if (is_attr(t->attrs, ATTR_CONST) &&
(type_is_alias(t) || !is_ptr(t)))
fprintf(h, "const ");
@ -258,20 +301,20 @@ void write_type_left(FILE *h, type_t *t, int declonly)
switch (type_get_type_detect_alias(t)) {
case TYPE_ENUM:
if (!declonly && t->defined && !t->written) {
if (t->name) fprintf(h, "enum %s {\n", t->name);
if (name) fprintf(h, "enum %s {\n", name);
else fprintf(h, "enum {\n");
t->written = TRUE;
indentation++;
write_enums(h, type_enum_get_values(t));
write_enums(h, type_enum_get_values(t), is_global_namespace(t->namespace) ? NULL : t->name);
indent(h, -1);
fprintf(h, "}");
}
else fprintf(h, "enum %s", t->name ? t->name : "");
else fprintf(h, "enum %s", name ? name : "");
break;
case TYPE_STRUCT:
case TYPE_ENCAPSULATED_UNION:
if (!declonly && t->defined && !t->written) {
if (t->name) fprintf(h, "struct %s {\n", t->name);
if (name) fprintf(h, "struct %s {\n", name);
else fprintf(h, "struct {\n");
t->written = TRUE;
indentation++;
@ -282,7 +325,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
indent(h, -1);
fprintf(h, "}");
}
else fprintf(h, "struct %s", t->name ? t->name : "");
else fprintf(h, "struct %s", name ? name : "");
break;
case TYPE_UNION:
if (!declonly && t->defined && !t->written) {
@ -297,7 +340,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
else fprintf(h, "union %s", t->name ? t->name : "");
break;
case TYPE_POINTER:
write_type_left(h, type_pointer_get_ref(t), declonly);
write_type_left(h, type_pointer_get_ref(t), name_type, declonly);
fprintf(h, "%s*", needs_space_after(type_pointer_get_ref(t)) ? " " : "");
if (is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const ");
break;
@ -306,7 +349,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
fprintf(h, "%s", t->name);
else
{
write_type_left(h, type_array_get_element(t), declonly);
write_type_left(h, type_array_get_element(t), name_type, declonly);
if (type_array_is_decl_as_ptr(t))
fprintf(h, "%s*", needs_space_after(type_array_get_element(t)) ? " " : "");
}
@ -361,7 +404,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
fprintf(h, "void");
break;
case TYPE_BITFIELD:
write_type_left(h, type_bitfield_get_field(t), declonly);
write_type_left(h, type_bitfield_get_field(t), name_type, declonly);
break;
case TYPE_ALIAS:
case TYPE_FUNCTION:
@ -427,14 +470,14 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
if (!callconv && is_object_interface) callconv = "STDMETHODCALLTYPE";
if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
write_type_left(h, type_function_get_rettype(pt), declonly);
write_type_left(h, type_function_get_rettype(pt), NAME_DEFAULT, declonly);
fputc(' ', h);
if (ptr_level) fputc('(', h);
if (callconv) fprintf(h, "%s ", callconv);
for (i = 0; i < ptr_level; i++)
fputc('*', h);
} else
write_type_left(h, t, declonly);
write_type_left(h, t, NAME_DEFAULT, declonly);
}
if (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " : "", name );
@ -460,6 +503,30 @@ static void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *na
write_type_v(f, t, field, FALSE, name);
}
static void write_type_definition(FILE *f, type_t *t)
{
int in_namespace = t->namespace && !is_global_namespace(t->namespace);
int save_written = t->written;
if(in_namespace) {
fprintf(f, "#ifdef __cplusplus\n");
fprintf(f, "} /* extern \"C\" */\n");
write_namespace_start(f, t->namespace);
}
indent(f, 0);
write_type_left(f, t, NAME_DEFAULT, FALSE);
fprintf(f, ";\n");
if(in_namespace) {
t->written = save_written;
write_namespace_end(f, t->namespace);
fprintf(f, "extern \"C\" {\n");
fprintf(f, "#else\n");
write_type_left(f, t, NAME_C, FALSE);
fprintf(f, ";\n");
fprintf(f, "#endif\n\n");
}
}
void write_type_decl(FILE *f, type_t *t, const char *name)
{
write_type_v(f, t, FALSE, TRUE, name);
@ -467,7 +534,7 @@ void write_type_decl(FILE *f, type_t *t, const char *name)
void write_type_decl_left(FILE *f, type_t *t)
{
write_type_left(f, t, TRUE);
write_type_left(f, t, NAME_DEFAULT, TRUE);
}
static int user_type_registered(const char *name)
@ -828,13 +895,56 @@ static int is_inherited_method(const type_t *iface, const var_t *func)
return 0;
}
static void write_method_macro(FILE *header, const type_t *iface, const char *name)
static int is_override_method(const type_t *iface, const type_t *child, const var_t *func)
{
if (iface == child)
return 0;
do
{
const statement_t *stmt;
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(child))
{
const var_t *funccmp = stmt->u.var;
if (!is_callas(func->attrs))
{
char inherit_name[256];
/* compare full name including property prefix */
strcpy(inherit_name, get_name(funccmp));
if (!strcmp(inherit_name, get_name(func))) return 1;
}
}
}
while ((child = type_iface_get_inherit(child)) && child != iface);
return 0;
}
static int is_aggregate_return(const var_t *func)
{
enum type_type type = type_get_type(type_function_get_rettype(func->type));
return type == TYPE_STRUCT || type == TYPE_UNION ||
type == TYPE_COCLASS || type == TYPE_INTERFACE;
}
static char *get_vtbl_entry_name(const type_t *iface, const var_t *func)
{
static char buff[255];
if (is_inherited_method(iface, func))
sprintf(buff, "%s_%s", iface->name, get_name(func));
else
sprintf(buff, "%s", get_name(func));
return buff;
}
static void write_method_macro(FILE *header, const type_t *iface, const type_t *child, const char *name)
{
const statement_t *stmt;
int first_iface = 1;
if (type_iface_get_inherit(iface))
write_method_macro(header, type_iface_get_inherit(iface), name);
write_method_macro(header, type_iface_get_inherit(iface), child, name);
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
{
@ -846,7 +956,10 @@ static void write_method_macro(FILE *header, const type_t *iface, const char *na
first_iface = 0;
}
if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) {
if (is_override_method(iface, child, func))
continue;
if (!is_callas(func->attrs) && !is_aggregate_return(func)) {
const var_t *arg;
fprintf(header, "#define %s_%s(This", name, get_name(func));
@ -855,7 +968,7 @@ static void write_method_macro(FILE *header, const type_t *iface, const char *na
fprintf(header, ",%s", arg->name);
fprintf(header, ") ");
fprintf(header, "(This)->lpVtbl->%s(This", get_name(func));
fprintf(header, "(This)->lpVtbl->%s(This", get_vtbl_entry_name(iface, func));
if (type_get_function_args(func->type))
LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
fprintf(header, ",%s", arg->name);
@ -891,8 +1004,18 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
if (method == 2) {
const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE);
if (expr) {
fprintf(h, " = ");
write_expr( h, expr, 0, 1, NULL, NULL, "" );
const var_t *tail_arg;
/* Output default value only if all following arguments also have default value. */
LIST_FOR_EACH_ENTRY_REV( tail_arg, args, const var_t, entry ) {
if(tail_arg == arg) {
fprintf(h, " = ");
write_expr( h, expr, 0, 1, NULL, NULL, "" );
break;
}
if(!get_attrp(tail_arg->attrs, ATTR_DEFAULTVALUE))
break;
}
}
}
count++;
@ -921,13 +1044,13 @@ static void write_cpp_method_def(FILE *header, const type_t *iface)
}
}
static void write_inline_wrappers(FILE *header, const type_t *iface, const char *name)
static void write_inline_wrappers(FILE *header, const type_t *iface, const type_t *child, const char *name)
{
const statement_t *stmt;
int first_iface = 1;
if (type_iface_get_inherit(iface))
write_inline_wrappers(header, type_iface_get_inherit(iface), name);
write_inline_wrappers(header, type_iface_get_inherit(iface), child, name);
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
{
@ -939,7 +1062,10 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const char
first_iface = 0;
}
if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) {
if (is_override_method(iface, child, func))
continue;
if (!is_callas(func->attrs)) {
const var_t *arg;
fprintf(header, "FORCEINLINE ");
@ -947,12 +1073,24 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const char
fprintf(header, " %s_%s(", name, get_name(func));
write_args(header, type_get_function_args(func->type), name, 1, FALSE);
fprintf(header, ") {\n");
fprintf(header, " %s", is_void(type_function_get_rettype(func->type)) ? "" : "return ");
fprintf(header, "This->lpVtbl->%s(This", get_name(func));
++indentation;
if (!is_aggregate_return(func)) {
indent(header, 0);
fprintf(header, "%sThis->lpVtbl->%s(This",
is_void(type_function_get_rettype(func->type)) ? "" : "return ",
get_vtbl_entry_name(iface, func));
} else {
indent(header, 0);
write_type_decl_left(header, type_function_get_rettype(func->type));
fprintf(header, " __ret;\n");
indent(header, 0);
fprintf(header, "return *This->lpVtbl->%s(This,&__ret", get_vtbl_entry_name(iface, func));
}
if (type_get_function_args(func->type))
LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry )
fprintf(header, ",%s", arg->name);
fprintf(header, ");\n");
--indentation;
fprintf(header, "}\n");
}
}
@ -988,11 +1126,26 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
if (!callconv) callconv = "STDMETHODCALLTYPE";
indent(header, 0);
write_type_decl_left(header, type_function_get_rettype(func->type));
if (is_aggregate_return(func))
fprintf(header, " *");
if (is_inherited_method(iface, func))
fprintf(header, " (%s *%s_%s)(\n", callconv, iface->name, func->name);
else
fprintf(header, " (%s *%s)(\n", callconv, get_name(func));
write_args(header, type_get_function_args(func->type), name, 1, TRUE);
++indentation;
indent(header, 0);
fprintf(header, "%s *This", name);
if (is_aggregate_return(func)) {
fprintf(header, ",\n");
indent(header, 0);
write_type_decl_left(header, type_function_get_rettype(func->type));
fprintf(header, " *__ret");
}
--indentation;
if (type_get_function_args(func->type)) {
fprintf(header, ",\n");
write_args(header, type_get_function_args(func->type), name, 0, TRUE);
}
fprintf(header, ");\n");
fprintf(header, "\n");
}
@ -1001,12 +1154,12 @@ static void do_write_c_method_def(FILE *header, const type_t *iface, const char
static void write_c_method_def(FILE *header, const type_t *iface)
{
do_write_c_method_def(header, iface, iface->name);
do_write_c_method_def(header, iface, iface->c_name);
}
static void write_c_disp_method_def(FILE *header, const type_t *iface)
{
do_write_c_method_def(header, type_iface_get_inherit(iface), iface->name);
do_write_c_method_def(header, type_iface_get_inherit(iface), iface->c_name);
}
static void write_method_proto(FILE *header, const type_t *iface)
@ -1142,9 +1295,14 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t
static void write_forward(FILE *header, type_t *iface)
{
fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->name);
fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->name);
fprintf(header, "typedef interface %s %s;\n", iface->name, iface->name);
fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->c_name);
fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->c_name);
fprintf(header, "typedef interface %s %s;\n", iface->c_name, iface->c_name);
fprintf(header, "#ifdef __cplusplus\n");
write_namespace_start(header, iface->namespace);
write_line(header, 0, "interface %s;", iface->name);
write_namespace_end(header, iface->namespace);
fprintf(header, "#endif /* __cplusplus */\n");
fprintf(header, "#endif\n\n" );
}
@ -1154,74 +1312,78 @@ static void write_com_interface_start(FILE *header, const type_t *iface)
fprintf(header, "/*****************************************************************************\n");
fprintf(header, " * %s %sinterface\n", iface->name, dispinterface ? "disp" : "");
fprintf(header, " */\n");
fprintf(header,"#ifndef __%s_%sINTERFACE_DEFINED__\n", iface->name, dispinterface ? "DISP" : "");
fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->name, dispinterface ? "DISP" : "");
fprintf(header,"#ifndef __%s_%sINTERFACE_DEFINED__\n", iface->c_name, dispinterface ? "DISP" : "");
fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->c_name, dispinterface ? "DISP" : "");
}
static void write_com_interface_end(FILE *header, type_t *iface)
{
int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
type_t *type;
if (uuid)
write_guid(header, dispinterface ? "DIID" : "IID", iface->name, uuid);
write_guid(header, dispinterface ? "DIID" : "IID", iface->c_name, uuid);
/* C++ interface */
fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
if (uuid)
fprintf(header, "MIDL_INTERFACE(\"%s\")\n", uuid_string(uuid));
else
if (!is_global_namespace(iface->namespace)) {
write_line(header, 0, "} /* extern \"C\" */");
write_namespace_start(header, iface->namespace);
}
if (uuid) {
write_line(header, 0, "MIDL_INTERFACE(\"%s\")", uuid_string(uuid));
indent(header, 0);
}else {
indent(header, 0);
fprintf(header, "interface ");
}
if (type_iface_get_inherit(iface))
{
fprintf(header, "%s : public %s\n", iface->name,
type_iface_get_inherit(iface)->name);
fprintf(header, "{\n");
write_line(header, 1, "{");
}
else
{
fprintf(header, "%s\n", iface->name);
fprintf(header, "{\n");
fprintf(header, " BEGIN_INTERFACE\n");
fprintf(header, "\n");
write_line(header, 1, "{\n");
write_line(header, 0, "BEGIN_INTERFACE\n");
}
/* dispinterfaces don't have real functions, so don't write C++ functions for
* them */
if (!dispinterface)
{
indentation++;
write_cpp_method_def(header, iface);
indentation--;
}
if (!type_iface_get_inherit(iface))
fprintf(header, " END_INTERFACE\n");
fprintf(header, "};\n");
write_line(header, 0, "END_INTERFACE\n");
write_line(header, -1, "};");
if (!is_global_namespace(iface->namespace)) {
write_namespace_end(header, iface->namespace);
write_line(header, 0, "extern \"C\" {");
}
if (uuid)
write_uuid_decl(header, iface->name, uuid);
write_uuid_decl(header, iface, uuid);
fprintf(header, "#else\n");
/* C interface */
fprintf(header, "typedef struct %sVtbl {\n", iface->name);
indentation++;
fprintf(header, " BEGIN_INTERFACE\n");
fprintf(header, "\n");
write_line(header, 1, "typedef struct %sVtbl {", iface->c_name);
write_line(header, 0, "BEGIN_INTERFACE\n");
if (dispinterface)
write_c_disp_method_def(header, iface);
else
write_c_method_def(header, iface);
indentation--;
fprintf(header, " END_INTERFACE\n");
fprintf(header, "} %sVtbl;\n", iface->name);
fprintf(header, "interface %s {\n", iface->name);
fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->name);
fprintf(header, "};\n");
fprintf(header, "\n");
write_line(header, 0, "END_INTERFACE");
write_line(header, -1, "} %sVtbl;\n", iface->c_name);
fprintf(header, "interface %s {\n", iface->c_name);
fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->c_name);
fprintf(header, "};\n\n");
fprintf(header, "#ifdef COBJMACROS\n");
/* dispinterfaces don't have real functions, so don't write macros for them,
* only for the interface this interface inherits from, i.e. IDispatch */
fprintf(header, "#ifndef WIDL_C_INLINE_WRAPPERS\n");
write_method_macro(header, dispinterface ? type_iface_get_inherit(iface) : iface, iface->name);
type = dispinterface ? type_iface_get_inherit(iface) : iface;
write_method_macro(header, type, type, iface->c_name);
fprintf(header, "#else\n");
write_inline_wrappers(header, dispinterface ? type_iface_get_inherit(iface) : iface, iface->name);
write_inline_wrappers(header, type, type, iface->c_name);
fprintf(header, "#endif\n");
fprintf(header, "#endif\n");
fprintf(header, "\n");
@ -1229,13 +1391,13 @@ static void write_com_interface_end(FILE *header, type_t *iface)
fprintf(header, "\n");
/* dispinterfaces don't have real functions, so don't write prototypes for
* them */
if (!dispinterface)
if (!dispinterface && !winrt_mode)
{
write_method_proto(header, iface);
write_locals(header, iface, FALSE);
fprintf(header, "\n");
}
fprintf(header,"#endif /* __%s_%sINTERFACE_DEFINED__ */\n\n", iface->name, dispinterface ? "DISP" : "");
fprintf(header,"#endif /* __%s_%sINTERFACE_DEFINED__ */\n\n", iface->c_name, dispinterface ? "DISP" : "");
}
static void write_rpc_interface_start(FILE *header, const type_t *iface)
@ -1286,7 +1448,7 @@ static void write_coclass(FILE *header, type_t *cocl)
if (uuid)
{
fprintf(header, "class DECLSPEC_UUID(\"%s\") %s;\n", uuid_string(uuid), cocl->name);
write_uuid_decl(header, cocl->name, uuid);
write_uuid_decl(header, cocl, uuid);
}
else
{
@ -1417,8 +1579,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
write_coclass(header, stmt->u.type);
else
{
write_type_def_or_decl(header, stmt->u.type, FALSE, NULL);
fprintf(header, ";\n\n");
write_type_definition(header, stmt->u.type);
}
break;
case STMT_TYPEREF:

View file

@ -29,7 +29,7 @@ extern int is_attr(const attr_list_t *list, enum attr_type t);
extern void *get_attrp(const attr_list_t *list, enum attr_type t);
extern unsigned int get_attrv(const attr_list_t *list, enum attr_type 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_left(FILE *h, type_t *t, enum name_type name_type, int declonly);
extern void write_type_right(FILE *h, type_t *t, int is_field);
extern void write_type_decl(FILE *f, type_t *t, const char *name);
extern void write_type_decl_left(FILE *f, type_t *t);

View file

@ -147,6 +147,22 @@ UUID *parse_uuid(const char *u)
input_name = xstrdup(fname);
}
<PP_PRAGMA>midl_echo[^\n]* yyless(9); yy_pop_state(); return tCPPQUOTE;
<PP_PRAGMA>winrt[^\n]* {
if(import_stack_ptr) {
if(!winrt_mode)
error_loc("winrt IDL file imported in non-winrt mode\n");
}else {
const char *ptr = yytext+5;
winrt_mode = TRUE;
while(isspace(*ptr))
ptr++;
if(!strncmp(ptr, "ns_prefix", 9) && (!*(ptr += 9) || isspace(*ptr)))
use_abi_namespace = TRUE;
}
yy_pop_state();
}
<PP_PRAGMA>[^\n]* parser_lval.str = xstrdup(yytext); yy_pop_state(); return aPRAGMA;
<INITIAL,ATTR>\" yy_push_state(QUOTE); cbufidx = 0;
<QUOTE>\" {
@ -419,7 +435,7 @@ static int kw_token(const char *kw)
struct keyword key, *kwp;
key.kw = kw;
kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
if (kwp && (do_rt_extension || kwp->token != tNAMESPACE)) {
if (kwp && (winrt_mode || kwp->token != tNAMESPACE)) {
parser_lval.str = xstrdup(kwp->kw);
return kwp->token;
}

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -26,211 +26,217 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
aIDENTIFIER = 258,
aPRAGMA = 259,
aKNOWNTYPE = 260,
aNUM = 261,
aHEXNUM = 262,
aDOUBLE = 263,
aSTRING = 264,
aWSTRING = 265,
aSQSTRING = 266,
aUUID = 267,
aEOF = 268,
SHL = 269,
SHR = 270,
MEMBERPTR = 271,
EQUALITY = 272,
INEQUALITY = 273,
GREATEREQUAL = 274,
LESSEQUAL = 275,
LOGICALOR = 276,
LOGICALAND = 277,
ELLIPSIS = 278,
tAGGREGATABLE = 279,
tALLOCATE = 280,
tANNOTATION = 281,
tAPPOBJECT = 282,
tASYNC = 283,
tASYNCUUID = 284,
tAUTOHANDLE = 285,
tBINDABLE = 286,
tBOOLEAN = 287,
tBROADCAST = 288,
tBYTE = 289,
tBYTECOUNT = 290,
tCALLAS = 291,
tCALLBACK = 292,
tCASE = 293,
tCDECL = 294,
tCHAR = 295,
tCOCLASS = 296,
tCODE = 297,
tCOMMSTATUS = 298,
tCONST = 299,
tCONTEXTHANDLE = 300,
tCONTEXTHANDLENOSERIALIZE = 301,
tCONTEXTHANDLESERIALIZE = 302,
tCONTROL = 303,
tCPPQUOTE = 304,
tDECODE = 305,
tDEFAULT = 306,
tDEFAULTBIND = 307,
tDEFAULTCOLLELEM = 308,
tDEFAULTVALUE = 309,
tDEFAULTVTABLE = 310,
tDISABLECONSISTENCYCHECK = 311,
tDISPLAYBIND = 312,
tDISPINTERFACE = 313,
tDLLNAME = 314,
tDOUBLE = 315,
tDUAL = 316,
tENABLEALLOCATE = 317,
tENCODE = 318,
tENDPOINT = 319,
tENTRY = 320,
tENUM = 321,
tERRORSTATUST = 322,
tEXPLICITHANDLE = 323,
tEXTERN = 324,
tFALSE = 325,
tFASTCALL = 326,
tFAULTSTATUS = 327,
tFLOAT = 328,
tFORCEALLOCATE = 329,
tHANDLE = 330,
tHANDLET = 331,
tHELPCONTEXT = 332,
tHELPFILE = 333,
tHELPSTRING = 334,
tHELPSTRINGCONTEXT = 335,
tHELPSTRINGDLL = 336,
tHIDDEN = 337,
tHYPER = 338,
tID = 339,
tIDEMPOTENT = 340,
tIGNORE = 341,
tIIDIS = 342,
tIMMEDIATEBIND = 343,
tIMPLICITHANDLE = 344,
tIMPORT = 345,
tIMPORTLIB = 346,
tIN = 347,
tIN_LINE = 348,
tINLINE = 349,
tINPUTSYNC = 350,
tINT = 351,
tINT3264 = 352,
tINT64 = 353,
tINTERFACE = 354,
tLCID = 355,
tLENGTHIS = 356,
tLIBRARY = 357,
tLICENSED = 358,
tLOCAL = 359,
tLONG = 360,
tMAYBE = 361,
tMESSAGE = 362,
tMETHODS = 363,
tMODULE = 364,
tNAMESPACE = 365,
tNOCODE = 366,
tNONBROWSABLE = 367,
tNONCREATABLE = 368,
tNONEXTENSIBLE = 369,
tNOTIFY = 370,
tNOTIFYFLAG = 371,
tNULL = 372,
tOBJECT = 373,
tODL = 374,
tOLEAUTOMATION = 375,
tOPTIMIZE = 376,
tOPTIONAL = 377,
tOUT = 378,
tPARTIALIGNORE = 379,
tPASCAL = 380,
tPOINTERDEFAULT = 381,
tPROGID = 382,
tPROPERTIES = 383,
tPROPGET = 384,
tPROPPUT = 385,
tPROPPUTREF = 386,
tPROXY = 387,
tPTR = 388,
tPUBLIC = 389,
tRANGE = 390,
tREADONLY = 391,
tREF = 392,
tREGISTER = 393,
tREPRESENTAS = 394,
tREQUESTEDIT = 395,
tRESTRICTED = 396,
tRETVAL = 397,
tSAFEARRAY = 398,
tSHORT = 399,
tSIGNED = 400,
tSIZEIS = 401,
tSIZEOF = 402,
tSMALL = 403,
tSOURCE = 404,
tSTATIC = 405,
tSTDCALL = 406,
tSTRICTCONTEXTHANDLE = 407,
tSTRING = 408,
tSTRUCT = 409,
tSWITCH = 410,
tSWITCHIS = 411,
tSWITCHTYPE = 412,
tTHREADING = 413,
tTRANSMITAS = 414,
tTRUE = 415,
tTYPEDEF = 416,
tUIDEFAULT = 417,
tUNION = 418,
tUNIQUE = 419,
tUNSIGNED = 420,
tUSESGETLASTERROR = 421,
tUSERMARSHAL = 422,
tUUID = 423,
tV1ENUM = 424,
tVARARG = 425,
tVERSION = 426,
tVIPROGID = 427,
tVOID = 428,
tWCHAR = 429,
tWIREMARSHAL = 430,
tAPARTMENT = 431,
tNEUTRAL = 432,
tSINGLE = 433,
tFREE = 434,
tBOTH = 435,
ADDRESSOF = 436,
NEG = 437,
POS = 438,
PPTR = 439,
CAST = 440
};
#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
# define YY_PARSER_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int parser_debug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
aIDENTIFIER = 258,
aPRAGMA = 259,
aKNOWNTYPE = 260,
aNUM = 261,
aHEXNUM = 262,
aDOUBLE = 263,
aSTRING = 264,
aWSTRING = 265,
aSQSTRING = 266,
aUUID = 267,
aEOF = 268,
SHL = 269,
SHR = 270,
MEMBERPTR = 271,
EQUALITY = 272,
INEQUALITY = 273,
GREATEREQUAL = 274,
LESSEQUAL = 275,
LOGICALOR = 276,
LOGICALAND = 277,
ELLIPSIS = 278,
tAGGREGATABLE = 279,
tALLOCATE = 280,
tANNOTATION = 281,
tAPPOBJECT = 282,
tASYNC = 283,
tASYNCUUID = 284,
tAUTOHANDLE = 285,
tBINDABLE = 286,
tBOOLEAN = 287,
tBROADCAST = 288,
tBYTE = 289,
tBYTECOUNT = 290,
tCALLAS = 291,
tCALLBACK = 292,
tCASE = 293,
tCDECL = 294,
tCHAR = 295,
tCOCLASS = 296,
tCODE = 297,
tCOMMSTATUS = 298,
tCONST = 299,
tCONTEXTHANDLE = 300,
tCONTEXTHANDLENOSERIALIZE = 301,
tCONTEXTHANDLESERIALIZE = 302,
tCONTROL = 303,
tCPPQUOTE = 304,
tDECODE = 305,
tDEFAULT = 306,
tDEFAULTBIND = 307,
tDEFAULTCOLLELEM = 308,
tDEFAULTVALUE = 309,
tDEFAULTVTABLE = 310,
tDISABLECONSISTENCYCHECK = 311,
tDISPLAYBIND = 312,
tDISPINTERFACE = 313,
tDLLNAME = 314,
tDOUBLE = 315,
tDUAL = 316,
tENABLEALLOCATE = 317,
tENCODE = 318,
tENDPOINT = 319,
tENTRY = 320,
tENUM = 321,
tERRORSTATUST = 322,
tEXPLICITHANDLE = 323,
tEXTERN = 324,
tFALSE = 325,
tFASTCALL = 326,
tFAULTSTATUS = 327,
tFLOAT = 328,
tFORCEALLOCATE = 329,
tHANDLE = 330,
tHANDLET = 331,
tHELPCONTEXT = 332,
tHELPFILE = 333,
tHELPSTRING = 334,
tHELPSTRINGCONTEXT = 335,
tHELPSTRINGDLL = 336,
tHIDDEN = 337,
tHYPER = 338,
tID = 339,
tIDEMPOTENT = 340,
tIGNORE = 341,
tIIDIS = 342,
tIMMEDIATEBIND = 343,
tIMPLICITHANDLE = 344,
tIMPORT = 345,
tIMPORTLIB = 346,
tIN = 347,
tIN_LINE = 348,
tINLINE = 349,
tINPUTSYNC = 350,
tINT = 351,
tINT3264 = 352,
tINT64 = 353,
tINTERFACE = 354,
tLCID = 355,
tLENGTHIS = 356,
tLIBRARY = 357,
tLICENSED = 358,
tLOCAL = 359,
tLONG = 360,
tMAYBE = 361,
tMESSAGE = 362,
tMETHODS = 363,
tMODULE = 364,
tNAMESPACE = 365,
tNOCODE = 366,
tNONBROWSABLE = 367,
tNONCREATABLE = 368,
tNONEXTENSIBLE = 369,
tNOTIFY = 370,
tNOTIFYFLAG = 371,
tNULL = 372,
tOBJECT = 373,
tODL = 374,
tOLEAUTOMATION = 375,
tOPTIMIZE = 376,
tOPTIONAL = 377,
tOUT = 378,
tPARTIALIGNORE = 379,
tPASCAL = 380,
tPOINTERDEFAULT = 381,
tPROGID = 382,
tPROPERTIES = 383,
tPROPGET = 384,
tPROPPUT = 385,
tPROPPUTREF = 386,
tPROXY = 387,
tPTR = 388,
tPUBLIC = 389,
tRANGE = 390,
tREADONLY = 391,
tREF = 392,
tREGISTER = 393,
tREPRESENTAS = 394,
tREQUESTEDIT = 395,
tRESTRICTED = 396,
tRETVAL = 397,
tSAFEARRAY = 398,
tSHORT = 399,
tSIGNED = 400,
tSIZEIS = 401,
tSIZEOF = 402,
tSMALL = 403,
tSOURCE = 404,
tSTATIC = 405,
tSTDCALL = 406,
tSTRICTCONTEXTHANDLE = 407,
tSTRING = 408,
tSTRUCT = 409,
tSWITCH = 410,
tSWITCHIS = 411,
tSWITCHTYPE = 412,
tTHREADING = 413,
tTRANSMITAS = 414,
tTRUE = 415,
tTYPEDEF = 416,
tUIDEFAULT = 417,
tUNION = 418,
tUNIQUE = 419,
tUNSIGNED = 420,
tUSESGETLASTERROR = 421,
tUSERMARSHAL = 422,
tUUID = 423,
tV1ENUM = 424,
tVARARG = 425,
tVERSION = 426,
tVIPROGID = 427,
tVOID = 428,
tWCHAR = 429,
tWIREMARSHAL = 430,
tAPARTMENT = 431,
tNEUTRAL = 432,
tSINGLE = 433,
tFREE = 434,
tBOTH = 435,
CAST = 436,
PPTR = 437,
POS = 438,
NEG = 439,
ADDRESSOF = 440
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 129 "parser.y"
#line 137 "parser.y" /* yacc.c:1909 */
attr_t *attr;
attr_list_t *attr_list;
@ -257,16 +263,15 @@ typedef union YYSTYPE
struct _decl_spec_t *declspec;
enum storage_class stgclass;
/* Line 2068 of yacc.c */
#line 264 "parser.tab.h"
} YYSTYPE;
#line 267 "parser.tab.h" /* yacc.c:1909 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE parser_lval;
int parser_parse (void);
#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */

View file

@ -90,6 +90,9 @@ static type_t *find_type_or_error2(char *name, int t);
static var_t *reg_const(var_t *var);
static void push_namespace(const char *name);
static void pop_namespace(const char *name);
static char *gen_name(void);
static void check_arg_attrs(const var_t *arg);
static void check_statements(const statement_list_t *stmts, int is_inside_library);
@ -120,11 +123,16 @@ static statement_t *make_statement_importlib(const char *str);
static statement_t *make_statement_module(type_t *type);
static statement_t *make_statement_typedef(var_list_t *names);
static statement_t *make_statement_import(const char *str);
static statement_t *make_statement_typedef(var_list_t *names);
static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt);
static statement_list_t *append_statements(statement_list_t *, statement_list_t *);
static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
static struct namespace global_namespace = {
NULL, NULL, LIST_INIT(global_namespace.entry), LIST_INIT(global_namespace.children)
};
static struct namespace *current_namespace = &global_namespace;
%}
%union {
attr_t *attr;
@ -262,7 +270,7 @@ static attr_list_t *append_attribs(attr_list_t *, attr_list_t *);
%type <type> inherit interface interfacedef interfacedec
%type <type> dispinterface dispinterfacehdr dispinterfacedef
%type <type> module modulehdr moduledef
%type <type> namespacedef
%type <str> namespacedef
%type <type> base_type int_std
%type <type> enumdef structdef uniondef typedecl
%type <type> type
@ -320,15 +328,15 @@ input: gbl_statements { fix_incomplete();
;
gbl_statements: { $$ = NULL; }
| gbl_statements namespacedef '{' gbl_statements '}'
{ $$ = append_statements($1, $4); }
| gbl_statements namespacedef '{' { push_namespace($2); } gbl_statements '}'
{ pop_namespace($2); $$ = append_statements($1, $5); }
| gbl_statements interfacedec { $$ = append_statement($1, make_statement_reference($2)); }
| gbl_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
| gbl_statements coclass ';' { $$ = $1;
reg_type($2, $2->name, 0);
reg_type($2, $2->name, current_namespace, 0);
}
| gbl_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, 0);
reg_type($2, $2->name, current_namespace, 0);
}
| gbl_statements moduledef { $$ = append_statement($1, make_statement_module($2)); }
| gbl_statements librarydef { $$ = append_statement($1, make_statement_library($2)); }
@ -337,12 +345,12 @@ gbl_statements: { $$ = NULL; }
imp_statements: { $$ = NULL; }
| imp_statements interfacedec { $$ = append_statement($1, make_statement_reference($2)); }
| imp_statements namespacedef '{' imp_statements '}'
{ $$ = append_statements($1, $4); }
| imp_statements namespacedef '{' { push_namespace($2); } imp_statements '}'
{ pop_namespace($2); $$ = append_statements($1, $5); }
| imp_statements interfacedef { $$ = append_statement($1, make_statement_type_decl($2)); }
| imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, 0); }
| imp_statements coclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
| imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, 0);
reg_type($2, $2->name, current_namespace, 0);
}
| imp_statements moduledef { $$ = append_statement($1, make_statement_module($2)); }
| imp_statements statement { $$ = append_statement($1, $2); }
@ -369,9 +377,9 @@ statement:
typedecl:
enumdef
| tENUM aIDENTIFIER { $$ = type_new_enum($2, FALSE, NULL); }
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
| structdef
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); }
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
| uniondef
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
| attributes enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); }
@ -624,7 +632,7 @@ enum: ident '=' expr_int_const { $$ = reg_const($1);
}
;
enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, TRUE, $4); }
enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); }
;
m_exprs: m_expr { $$ = append_expr( NULL, $1 ); }
@ -794,7 +802,7 @@ int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); }
;
coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); }
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, 0);
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, NULL, 0);
if (type_get_type_detect_alias($$) != TYPE_COCLASS)
error_loc("%s was not declared a coclass at %s:%d\n",
$2, $$->loc_info.input_name,
@ -812,7 +820,7 @@ coclassdef: coclasshdr '{' coclass_ints '}' semicolon_opt
{ $$ = type_coclass_define($1, $3); }
;
namespacedef: tNAMESPACE aIDENTIFIER { $$ = NULL; }
namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
;
coclass_ints: { $$ = NULL; }
@ -823,8 +831,8 @@ coclass_int:
m_attributes interfacedec { $$ = make_ifref($2); $$->attrs = $1; }
;
dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); }
| tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, 0); }
dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
| tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
;
dispinterfacehdr: attributes dispinterface { attr_t *attrs;
@ -860,8 +868,8 @@ inherit: { $$ = NULL; }
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); }
;
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); }
| tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, 0); }
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
| tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
;
interfacehdr: attributes interface { $$.interface = $2;
@ -1082,16 +1090,16 @@ pointer_type:
| tPTR { $$ = RPC_FC_FP; }
;
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, TRUE, $4); }
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
;
type: tVOID { $$ = type_new_void(); }
| aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
| base_type { $$ = $1; }
| enumdef { $$ = $1; }
| tENUM aIDENTIFIER { $$ = type_new_enum($2, FALSE, NULL); }
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
| structdef { $$ = $1; }
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); }
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
| uniondef { $$ = $1; }
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
@ -1122,12 +1130,12 @@ version:
static void decl_builtin_basic(const char *name, enum type_basic_type type)
{
type_t *t = type_new_basic(type);
reg_type(t, name, 0);
reg_type(t, name, NULL, 0);
}
static void decl_builtin_alias(const char *name, type_t *t)
{
reg_type(type_new_alias(t, name), name, 0);
reg_type(type_new_alias(t, name), name, NULL, 0);
}
void init_types(void)
@ -1731,8 +1739,6 @@ static typelib_t *make_library(const char *name, const attr_list_t *attrs)
return typelib;
}
#define HASHMAX 64
static int hash_ident(const char *name)
{
const char *p = name;
@ -1747,6 +1753,41 @@ static int hash_ident(const char *name)
/***** type repository *****/
static struct namespace *find_sub_namespace(struct namespace *namespace, const char *name)
{
struct namespace *cur;
LIST_FOR_EACH_ENTRY(cur, &namespace->children, struct namespace, entry) {
if(!strcmp(cur->name, name))
return cur;
}
return NULL;
}
static void push_namespace(const char *name)
{
struct namespace *namespace;
namespace = find_sub_namespace(current_namespace, name);
if(!namespace) {
namespace = xmalloc(sizeof(*namespace));
namespace->name = xstrdup(name);
namespace->parent = current_namespace;
list_add_tail(&current_namespace->children, &namespace->entry);
list_init(&namespace->children);
memset(namespace->type_hash, 0, sizeof(namespace->type_hash));
}
current_namespace = namespace;
}
static void pop_namespace(const char *name)
{
assert(!strcmp(current_namespace->name, name) && current_namespace->parent);
current_namespace = current_namespace->parent;
}
struct rtype {
const char *name;
type_t *type;
@ -1754,9 +1795,7 @@ struct rtype {
struct rtype *next;
};
struct rtype *type_hash[HASHMAX];
type_t *reg_type(type_t *type, const char *name, int t)
type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, int t)
{
struct rtype *nt;
int hash;
@ -1764,13 +1803,19 @@ type_t *reg_type(type_t *type, const char *name, int t)
error_loc("registering named type without name\n");
return type;
}
if (!namespace)
namespace = &global_namespace;
hash = hash_ident(name);
nt = xmalloc(sizeof(struct rtype));
nt->name = name;
if (is_global_namespace(namespace))
type->c_name = name;
else
type->c_name = format_namespace(namespace, "__x_", "_C", name);
nt->type = type;
nt->t = t;
nt->next = type_hash[hash];
type_hash[hash] = nt;
nt->next = namespace->type_hash[hash];
namespace->type_hash[hash] = nt;
if ((t == tsSTRUCT || t == tsUNION))
fix_incomplete_types(type);
return type;
@ -1835,28 +1880,32 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
const declarator_t *decl;
type_t *type = decl_spec->type;
if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
/* We must generate names for tagless enum, struct or union.
Typedef-ing a tagless enum, struct or union means we want the typedef
to be included in a library hence the public attribute. */
if ((type_get_type_detect_alias(type) == TYPE_ENUM ||
type_get_type_detect_alias(type) == TYPE_STRUCT ||
type_get_type_detect_alias(type) == TYPE_UNION ||
type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION) &&
!type->name)
if (type_get_type_detect_alias(type) == TYPE_ENUM ||
type_get_type_detect_alias(type) == TYPE_STRUCT ||
type_get_type_detect_alias(type) == TYPE_UNION ||
type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION)
{
if (! is_attr(attrs, ATTR_PUBLIC) && ! is_attr (attrs, ATTR_HIDDEN))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
type->name = gen_name();
}
else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC)
&& !is_attr(attrs, ATTR_HIDDEN))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
if (!type->name)
type->name = gen_name();
/* replace existing attributes when generating a typelib */
if (do_typelib)
type->attrs = attrs;
}
#ifdef __REACTOS__
/* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */
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)));
#endif
LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
{
@ -1865,7 +1914,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
type_t *cur;
var_t *name;
cur = find_type(decl->var->name, 0);
cur = find_type(decl->var->name, current_namespace, 0);
/*
* MIDL allows shadowing types that are declared in imported files.
@ -1887,23 +1936,32 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
if (is_incomplete(cur))
add_incomplete(cur);
reg_type(cur, cur->name, 0);
reg_type(cur, cur->name, current_namespace, 0);
}
}
return type;
}
type_t *find_type(const char *name, int t)
type_t *find_type(const char *name, struct namespace *namespace, int t)
{
struct rtype *cur = type_hash[hash_ident(name)];
while (cur && (cur->t != t || strcmp(cur->name, name)))
cur = cur->next;
return cur ? cur->type : NULL;
struct rtype *cur;
if(namespace && namespace != &global_namespace) {
for(cur = namespace->type_hash[hash_ident(name)]; cur; cur = cur->next) {
if(cur->t == t && !strcmp(cur->name, name))
return cur->type;
}
}
for(cur = global_namespace.type_hash[hash_ident(name)]; cur; cur = cur->next) {
if(cur->t == t && !strcmp(cur->name, name))
return cur->type;
}
return NULL;
}
static type_t *find_type_or_error(const char *name, int t)
{
type_t *type = find_type(name, t);
type_t *type = find_type(name, NULL, t);
if (!type) {
error_loc("type '%s' not found\n", name);
return NULL;
@ -1920,14 +1978,16 @@ static type_t *find_type_or_error2(char *name, int t)
int is_type(const char *name)
{
return find_type(name, 0) != NULL;
return find_type(name, current_namespace, 0) != NULL;
}
type_t *get_type(enum type_type type, char *name, int t)
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t)
{
type_t *tp;
if (!namespace)
namespace = &global_namespace;
if (name) {
tp = find_type(name, t);
tp = find_type(name, namespace, t);
if (tp) {
free(name);
return tp;
@ -1935,8 +1995,9 @@ type_t *get_type(enum type_type type, char *name, int t)
}
tp = make_type(type);
tp->name = name;
tp->namespace = namespace;
if (!name) return tp;
return reg_type(tp, name, t);
return reg_type(tp, name, namespace, t);
}
/***** constant repository *****/
@ -2012,7 +2073,7 @@ struct allowed_attr
unsigned int on_arg : 1;
unsigned int on_type : 1;
unsigned int on_enum : 1;
unsigned int on_struct : 1;
unsigned int on_struct : 2;
unsigned int on_union : 1;
unsigned int on_field : 1;
unsigned int on_library : 1;
@ -2123,7 +2184,7 @@ struct allowed_attr allowed_attr[] =
/* ATTR_UUID */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, "uuid" },
/* ATTR_V1ENUM */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, "v1_enum" },
/* ATTR_VARARG */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "vararg" },
/* ATTR_VERSION */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, "version" },
/* ATTR_VERSION */ { 1, 0, 1, 0, 0, 1, 1, 2, 0, 0, 1, 0, 0, 1, "version" },
/* ATTR_VIPROGID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "vi_progid" },
/* ATTR_WIREMARSHAL */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "wire_marshal" },
};
@ -2213,11 +2274,12 @@ static attr_list_t *check_enum_attrs(attr_list_t *attrs)
static attr_list_t *check_struct_attrs(attr_list_t *attrs)
{
int mask = winrt_mode ? 3 : 1;
const attr_t *attr;
if (!attrs) return attrs;
LIST_FOR_EACH_ENTRY(attr, attrs, const attr_t, entry)
{
if (!allowed_attr[attr->type].on_struct)
if (!(allowed_attr[attr->type].on_struct & mask))
error_loc("inapplicable attribute %s for struct\n",
allowed_attr[attr->type].display_name);
}
@ -2662,10 +2724,26 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
{
if (stmt->type == STMT_LIBRARY)
check_statements(stmt->u.lib->stmts, TRUE);
else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE)
check_functions(stmt->u.type, is_inside_library);
switch(stmt->type) {
case STMT_LIBRARY:
check_statements(stmt->u.lib->stmts, TRUE);
break;
case STMT_TYPE:
switch(type_get_type(stmt->u.type)) {
case TYPE_INTERFACE:
check_functions(stmt->u.type, is_inside_library);
break;
case TYPE_COCLASS:
if(winrt_mode)
error_loc("coclass is not allowed in Windows Runtime mode\n");
break;
default:
break;
}
break;
default:
break;
}
}
}

View file

@ -388,8 +388,8 @@ static void yy_fatal_error (yyconst char msg[] );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 39
#define YY_END_OF_BUFFER 40
#define YY_NUM_RULES 40
#define YY_END_OF_BUFFER 41
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@ -397,27 +397,27 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[174] =
static yyconst flex_int16_t yy_accept[180] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 3,
5, 5, 0, 0, 40, 38, 27, 26, 38, 6,
38, 10, 38, 38, 22, 22, 38, 38, 38, 25,
25, 25, 17, 38, 27, 2, 16, 39, 7, 16,
9, 22, 22, 19, 19, 19, 18, 27, 2, 3,
5, 5, 11, 16, 32, 36, 30, 0, 0, 22,
22, 22, 0, 28, 34, 31, 33, 29, 25, 8,
25, 35, 0, 2, 2, 0, 15, 13, 12, 22,
0, 19, 19, 0, 2, 2, 3, 5, 5, 14,
37, 23, 22, 22, 21, 25, 0, 22, 0, 19,
6, 6, 0, 0, 41, 39, 28, 27, 39, 7,
39, 11, 39, 39, 23, 23, 39, 39, 39, 26,
26, 26, 18, 39, 28, 2, 17, 40, 8, 17,
10, 23, 23, 20, 20, 20, 19, 28, 2, 3,
6, 6, 6, 12, 17, 33, 37, 31, 0, 0,
23, 23, 23, 0, 29, 35, 32, 34, 30, 26,
9, 26, 36, 0, 2, 2, 0, 16, 14, 13,
23, 0, 20, 20, 0, 2, 2, 3, 6, 6,
6, 15, 38, 24, 23, 23, 22, 26, 0, 23,
5, 0, 21, 21, 25, 0, 22, 0, 19, 5,
0, 23, 21, 21, 25, 0, 22, 0, 19, 5,
25, 0, 22, 0, 19, 5, 25, 0, 22, 0,
19, 5, 25, 1, 22, 0, 19, 5, 25, 0,
22, 4, 0, 24, 0, 4, 0, 0, 0, 0,
0, 20, 6, 6, 0, 22, 22, 26, 0, 23,
0, 20, 6, 6, 0, 24, 22, 22, 26, 0,
23, 0, 20, 6, 5, 26, 0, 23, 0, 20,
6, 5, 26, 0, 23, 0, 20, 6, 26, 1,
23, 0, 20, 6, 26, 0, 23, 4, 0, 25,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 20, 0
0, 0, 0, 0, 0, 0, 0, 21, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@ -433,9 +433,9 @@ static yyconst flex_int32_t yy_ec[256] =
22, 24, 25, 22, 26, 22, 22, 27, 28, 22,
29, 30, 31, 1, 32, 1, 33, 19, 34, 35,
36, 19, 37, 38, 39, 22, 22, 40, 41, 22,
42, 43, 22, 44, 22, 22, 45, 22, 22, 46,
22, 22, 1, 47, 1, 1, 1, 1, 1, 1,
36, 19, 37, 38, 39, 22, 22, 40, 41, 42,
43, 44, 22, 45, 22, 46, 47, 22, 48, 49,
22, 22, 1, 50, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -452,227 +452,237 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[48] =
static yyconst flex_int32_t yy_meta[51] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 3, 3, 1, 1, 1, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 1, 1,
1, 4, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 1
4, 4, 4, 4, 4, 4, 4, 4, 4, 1
} ;
static yyconst flex_int16_t yy_base[214] =
static yyconst flex_int16_t yy_base[221] =
{ 0,
0, 46, 46, 50, 51, 54, 84, 56, 345, 344,
129, 130, 131, 132, 346, 639, 639, 639, 325, 639,
333, 639, 322, 326, 160, 124, 45, 321, 47, 0,
331, 316, 639, 286, 63, 139, 639, 639, 639, 45,
639, 194, 117, 228, 0, 326, 639, 64, 324, 0,
0, 286, 639, 135, 639, 639, 639, 312, 54, 154,
130, 119, 0, 639, 639, 639, 639, 639, 0, 639,
296, 639, 71, 146, 147, 272, 639, 639, 639, 252,
0, 285, 0, 72, 313, 312, 0, 0, 278, 639,
639, 140, 639, 639, 158, 291, 277, 309, 0, 342,
0, 49, 49, 53, 54, 57, 87, 59, 335, 334,
135, 136, 137, 138, 335, 674, 674, 674, 318, 674,
326, 674, 315, 319, 173, 135, 48, 314, 50, 0,
323, 305, 674, 272, 66, 148, 674, 674, 674, 48,
674, 210, 115, 247, 0, 316, 674, 67, 315, 0,
0, 277, 275, 674, 135, 674, 674, 674, 301, 57,
167, 125, 129, 0, 674, 674, 674, 674, 674, 0,
674, 289, 674, 74, 151, 153, 264, 674, 674, 674,
271, 0, 306, 0, 75, 306, 299, 0, 0, 264,
256, 674, 674, 189, 674, 674, 131, 276, 262, 330,
269, 182, 152, 162, 290, 265, 366, 0, 399, 269,
58, 196, 639, 639, 276, 255, 423, 0, 456, 259,
270, 258, 480, 0, 513, 255, 266, 281, 537, 0,
570, 244, 251, 275, 212, 265, 263, 227, 143, 0,
267, 0, 149, 639, 0, 0, 0, 0, 257, 0,
0, 0, 0, 256, 0, 0, 0, 0, 249, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 639, 639, 606, 610, 614, 616, 620, 622, 626,
630, 256, 255, 253, 252, 251, 250, 248, 247, 634,
242, 241, 240, 234, 233, 230, 228, 221, 219, 216,
0, 365, 253, 243, 149, 144, 133, 269, 249, 389,
0, 424, 247, 232, 61, 191, 674, 674, 253, 235,
448, 0, 483, 239, 0, 250, 240, 507, 0, 542,
238, 0, 253, 268, 566, 0, 601, 231, 236, 261,
289, 251, 247, 213, 192, 0, 348, 0, 206, 674,
0, 0, 0, 0, 244, 0, 0, 0, 0, 243,
0, 0, 0, 0, 242, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 674, 674, 637,
641, 645, 647, 651, 653, 657, 661, 249, 248, 246,
245, 244, 665, 239, 238, 237, 669, 236, 235, 232,
215, 208, 201, 198, 188, 185, 176, 154, 152, 143,
80, 79, 76
231, 229, 223, 218, 216, 215, 214, 213, 209, 207,
203, 195, 186, 185, 171, 163, 141, 83, 82, 79
} ;
static yyconst flex_int16_t yy_def[214] =
static yyconst flex_int16_t yy_def[221] =
{ 0,
173, 1, 174, 174, 174, 174, 173, 7, 175, 175,
176, 176, 174, 174, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 177,
177, 177, 173, 173, 173, 173, 173, 173, 173, 178,
173, 173, 42, 179, 179, 179, 173, 173, 173, 180,
181, 181, 173, 178, 173, 173, 173, 173, 173, 173,
173, 173, 182, 173, 173, 173, 173, 173, 177, 173,
177, 173, 173, 173, 173, 173, 173, 173, 173, 173,
183, 179, 179, 173, 173, 173, 180, 181, 181, 173,
173, 173, 173, 173, 182, 177, 173, 173, 184, 179,
179, 1, 180, 180, 180, 180, 179, 7, 181, 181,
182, 182, 180, 180, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 183,
183, 183, 179, 179, 179, 179, 179, 179, 179, 184,
179, 179, 42, 185, 185, 185, 179, 179, 179, 186,
187, 187, 187, 179, 184, 179, 179, 179, 179, 179,
179, 179, 179, 188, 179, 179, 179, 179, 179, 183,
179, 183, 179, 179, 179, 179, 179, 179, 179, 179,
179, 189, 185, 185, 179, 179, 179, 186, 187, 187,
187, 179, 179, 179, 179, 179, 188, 183, 179, 179,
181, 173, 173, 173, 177, 173, 173, 185, 179, 181,
173, 173, 173, 173, 177, 173, 173, 186, 179, 181,
177, 173, 173, 187, 179, 181, 177, 173, 173, 188,
179, 181, 177, 173, 173, 173, 179, 181, 177, 189,
173, 190, 173, 173, 191, 190, 192, 193, 173, 194,
195, 196, 197, 173, 198, 199, 200, 201, 173, 202,
203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
213, 173, 0, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
190, 185, 187, 187, 179, 179, 179, 183, 179, 179,
191, 185, 187, 187, 179, 179, 179, 179, 183, 179,
179, 192, 185, 187, 193, 183, 179, 179, 194, 185,
187, 193, 183, 179, 179, 195, 185, 187, 183, 179,
179, 179, 185, 187, 183, 196, 179, 197, 179, 179,
198, 197, 199, 200, 179, 201, 202, 203, 204, 179,
205, 206, 207, 208, 179, 209, 210, 211, 212, 213,
214, 215, 216, 217, 218, 219, 220, 179, 0, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179
} ;
static yyconst flex_int16_t yy_nxt[687] =
static yyconst flex_int16_t yy_nxt[725] =
{ 0,
16, 17, 18, 19, 20, 16, 21, 22, 16, 16,
23, 24, 25, 26, 27, 28, 29, 30, 30, 30,
30, 30, 31, 30, 32, 30, 30, 30, 33, 16,
16, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 34, 35, 38, 78,
39, 36, 38, 38, 39, 41, 38, 48, 41, 64,
65, 49, 67, 68, 73, 84, 92, 92, 74, 85,
112, 112, 73, 84, 79, 40, 74, 85, 172, 40,
40, 171, 170, 40, 16, 17, 18, 19, 20, 16,
21, 22, 16, 16, 23, 24, 42, 43, 27, 28,
30, 30, 30, 30, 30, 30, 30, 30, 30, 34,
35, 38, 79, 39, 36, 38, 38, 39, 41, 38,
48, 41, 65, 66, 49, 68, 69, 74, 85, 94,
94, 75, 86, 116, 116, 74, 85, 80, 40, 75,
86, 178, 40, 40, 177, 176, 40, 16, 17, 18,
19, 20, 16, 21, 22, 16, 16, 23, 24, 42,
29, 44, 44, 44, 44, 45, 46, 45, 45, 45,
45, 45, 33, 16, 47, 45, 44, 44, 44, 44,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
34, 38, 38, 38, 38, 59, 60, 60, 53, 53,
75, 94, 90, 173, 143, 169, 61, 75, 75, 62,
143, 144, 92, 92, 168, 93, 167, 144, 94, 102,
54, 54, 173, 61, 79, 59, 60, 60, 62, 52,
52, 59, 60, 60, 93, 102, 61, 113, 166, 62,
103, 76, 61, 104, 114, 62, 63, 165, 76, 76,
164, 111, 111, 61, 112, 112, 113, 103, 62, 61,
43, 27, 28, 29, 44, 44, 44, 44, 45, 46,
45, 45, 45, 45, 45, 33, 16, 47, 45, 44,
44, 44, 44, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 34, 38, 38, 38,
38, 179, 92, 175, 54, 54, 60, 61, 61, 76,
95, 96, 76, 106, 76, 118, 107, 62, 115, 115,
63, 116, 116, 179, 80, 174, 55, 55, 96, 117,
106, 95, 118, 173, 62, 52, 52, 107, 60, 61,
61, 63, 53, 53, 60, 61, 61, 172, 171, 62,
117, 77, 63, 149, 77, 62, 77, 170, 63, 64,
163, 114, 104, 162, 62, 63, 80, 80, 112, 112,
161, 81, 81, 81, 81, 102, 61, 159, 158, 62,
63, 157, 140, 156, 141, 141, 81, 81, 81, 81,
154, 102, 153, 61, 61, 152, 151, 62, 62, 63,
82, 82, 149, 148, 147, 82, 82, 82, 82, 145,
136, 61, 130, 124, 118, 108, 62, 99, 95, 160,
82, 82, 82, 82, 98, 98, 155, 150, 142, 99,
99, 99, 99, 140, 61, 140, 134, 62, 139, 141,
141, 138, 134, 133, 99, 99, 99, 99, 132, 61,
128, 61, 62, 127, 126, 122, 62, 100, 100, 121,
150, 94, 94, 116, 116, 169, 62, 149, 105, 168,
105, 167, 62, 63, 150, 165, 164, 163, 162, 63,
160, 64, 81, 81, 105, 159, 105, 82, 82, 82,
82, 158, 62, 157, 155, 63, 64, 154, 153, 151,
142, 136, 82, 82, 82, 82, 129, 122, 111, 62,
101, 97, 166, 161, 156, 148, 63, 146, 64, 83,
83, 146, 140, 145, 83, 83, 83, 83, 144, 140,
139, 138, 134, 133, 131, 127, 126, 125, 124, 83,
83, 83, 83, 100, 100, 120, 119, 114, 101, 101,
101, 101, 113, 62, 109, 108, 63, 104, 103, 146,
120, 116, 100, 100, 100, 100, 61, 115, 110, 106,
105, 62, 101, 86, 86, 97, 96, 100, 100, 100,
100, 107, 107, 91, 89, 86, 108, 108, 108, 108,
70, 61, 72, 71, 62, 70, 66, 58, 57, 56,
55, 108, 108, 108, 108, 173, 38, 38, 61, 173,
173, 173, 173, 62, 109, 109, 173, 173, 173, 109,
109, 109, 109, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 109, 109, 109, 109, 117, 117,
173, 173, 173, 118, 118, 118, 118, 173, 61, 173,
173, 62, 173, 173, 173, 173, 173, 173, 118, 118,
87, 147, 147, 101, 101, 101, 101, 87, 99, 98,
62, 62, 93, 91, 63, 90, 87, 63, 102, 102,
71, 73, 72, 102, 102, 102, 102, 71, 62, 67,
59, 58, 57, 56, 179, 63, 38, 38, 102, 102,
102, 102, 110, 110, 179, 179, 179, 111, 111, 111,
111, 179, 62, 179, 179, 63, 179, 179, 179, 179,
147, 147, 111, 111, 111, 111, 179, 179, 179, 62,
62, 179, 179, 63, 179, 179, 63, 112, 112, 179,
179, 179, 112, 112, 112, 112, 179, 62, 179, 179,
179, 179, 179, 179, 63, 179, 179, 112, 112, 112,
118, 118, 173, 173, 173, 61, 173, 173, 173, 173,
62, 119, 119, 173, 173, 173, 119, 119, 119, 119,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 119, 119, 119, 119, 123, 123, 173, 173, 173,
124, 124, 124, 124, 173, 61, 173, 173, 62, 173,
173, 173, 173, 173, 173, 124, 124, 124, 124, 173,
173, 173, 61, 173, 173, 173, 173, 62, 125, 125,
173, 173, 173, 125, 125, 125, 125, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 125, 125,
125, 125, 129, 129, 173, 173, 173, 130, 130, 130,
112, 121, 121, 179, 179, 179, 122, 122, 122, 122,
179, 62, 179, 179, 63, 179, 179, 179, 179, 179,
179, 122, 122, 122, 122, 179, 179, 179, 62, 179,
179, 179, 179, 179, 179, 63, 123, 123, 179, 179,
179, 123, 123, 123, 123, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 123, 123, 123, 123,
128, 128, 179, 179, 179, 129, 129, 129, 129, 179,
62, 179, 179, 63, 179, 179, 179, 179, 179, 179,
129, 129, 129, 129, 179, 179, 179, 62, 179, 179,
179, 179, 179, 179, 63, 130, 130, 179, 179, 179,
130, 173, 61, 173, 173, 62, 173, 173, 173, 173,
173, 173, 130, 130, 130, 130, 173, 173, 173, 61,
173, 173, 173, 173, 62, 131, 131, 173, 173, 173,
131, 131, 131, 131, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 131, 131, 131, 131, 135,
135, 173, 173, 173, 136, 136, 136, 136, 173, 61,
173, 173, 62, 173, 173, 173, 173, 173, 173, 136,
136, 136, 136, 173, 173, 173, 61, 173, 173, 173,
173, 62, 137, 137, 173, 173, 173, 137, 137, 137,
137, 173, 173, 173, 173, 173, 173, 173, 173, 173,
130, 130, 130, 130, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 130, 130, 130, 130, 135,
135, 179, 179, 179, 136, 136, 136, 136, 179, 62,
179, 179, 63, 179, 179, 179, 179, 179, 179, 136,
136, 136, 136, 179, 179, 179, 62, 179, 179, 179,
179, 179, 179, 63, 137, 137, 179, 179, 179, 137,
137, 137, 137, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 137, 137, 137, 137, 141, 141,
179, 179, 179, 142, 142, 142, 142, 179, 62, 179,
179, 63, 179, 179, 179, 179, 179, 179, 142, 142,
173, 173, 137, 137, 137, 137, 37, 37, 37, 37,
50, 50, 50, 50, 51, 51, 51, 51, 69, 69,
77, 173, 77, 77, 83, 83, 87, 173, 87, 87,
88, 173, 88, 88, 146, 173, 146, 146, 15, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173
142, 142, 179, 179, 179, 62, 179, 179, 179, 179,
179, 179, 63, 143, 143, 179, 179, 179, 143, 143,
143, 143, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 143, 143, 143, 143, 37, 37, 37,
37, 50, 50, 50, 50, 51, 51, 51, 51, 70,
70, 78, 179, 78, 78, 84, 84, 88, 179, 88,
88, 89, 179, 89, 89, 132, 179, 132, 132, 152,
179, 152, 152, 15, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179
} ;
static yyconst flex_int16_t yy_chk[687] =
static yyconst flex_int16_t yy_chk[725] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 3, 40,
3, 2, 4, 5, 4, 5, 6, 8, 6, 27,
27, 8, 29, 29, 35, 48, 59, 59, 35, 48,
111, 111, 73, 84, 40, 3, 73, 84, 213, 4,
5, 212, 211, 6, 7, 7, 7, 7, 7, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 3, 40, 3, 2, 4, 5, 4, 5, 6,
8, 6, 27, 27, 8, 29, 29, 35, 48, 60,
60, 35, 48, 115, 115, 74, 85, 40, 3, 74,
85, 220, 4, 5, 219, 218, 6, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 11, 12, 13, 14, 26, 26, 26, 13, 14,
36, 62, 54, 43, 139, 210, 26, 74, 75, 26,
143, 139, 92, 92, 209, 61, 208, 143, 62, 92,
13, 14, 43, 26, 54, 60, 60, 60, 26, 11,
12, 25, 25, 25, 61, 92, 60, 103, 207, 60,
95, 36, 25, 95, 104, 25, 25, 206, 74, 75,
205, 102, 102, 60, 102, 102, 103, 95, 60, 25,
7, 7, 7, 7, 7, 7, 7, 11, 12, 13,
14, 43, 55, 217, 13, 14, 26, 26, 26, 36,
62, 63, 75, 97, 76, 107, 97, 26, 105, 105,
26, 105, 105, 43, 55, 216, 13, 14, 63, 106,
97, 62, 107, 215, 26, 11, 12, 97, 61, 61,
61, 26, 11, 12, 25, 25, 25, 214, 213, 61,
106, 36, 61, 145, 75, 25, 76, 212, 25, 25,
204, 104, 95, 203, 25, 25, 42, 42, 112, 112,
202, 42, 42, 42, 42, 112, 42, 201, 200, 42,
42, 199, 135, 198, 135, 135, 42, 42, 42, 42,
197, 112, 196, 42, 135, 195, 194, 135, 42, 42,
44, 44, 193, 192, 191, 44, 44, 44, 44, 189,
188, 135, 187, 186, 185, 184, 135, 183, 182, 159,
44, 44, 44, 44, 80, 80, 154, 149, 138, 80,
80, 80, 80, 137, 80, 136, 134, 80, 133, 141,
141, 132, 128, 127, 80, 80, 80, 80, 126, 141,
122, 80, 141, 121, 120, 116, 80, 82, 82, 115,
145, 94, 94, 116, 116, 211, 61, 149, 94, 210,
116, 209, 25, 61, 149, 208, 207, 206, 205, 25,
204, 25, 42, 42, 94, 203, 116, 42, 42, 42,
42, 202, 42, 201, 200, 42, 42, 199, 198, 196,
195, 194, 42, 42, 42, 42, 192, 191, 190, 42,
189, 188, 165, 160, 155, 144, 42, 143, 42, 44,
44, 142, 140, 139, 44, 44, 44, 44, 138, 134,
133, 131, 127, 126, 124, 120, 119, 114, 113, 44,
44, 44, 44, 81, 81, 109, 108, 104, 81, 81,
81, 81, 103, 81, 99, 98, 81, 91, 90, 141,
110, 106, 82, 82, 82, 82, 141, 105, 101, 97,
96, 141, 89, 86, 85, 76, 71, 82, 82, 82,
82, 98, 98, 58, 52, 49, 98, 98, 98, 98,
46, 98, 34, 32, 98, 31, 28, 24, 23, 21,
19, 98, 98, 98, 98, 15, 10, 9, 98, 0,
0, 0, 0, 98, 100, 100, 0, 0, 0, 100,
100, 100, 100, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 100, 100, 100, 100, 107, 107,
0, 0, 0, 107, 107, 107, 107, 0, 107, 0,
0, 107, 0, 0, 0, 0, 0, 0, 107, 107,
87, 141, 141, 81, 81, 81, 81, 86, 77, 72,
81, 141, 59, 53, 141, 52, 49, 81, 83, 83,
46, 34, 32, 83, 83, 83, 83, 31, 141, 28,
24, 23, 21, 19, 15, 141, 10, 9, 83, 83,
83, 83, 100, 100, 0, 0, 0, 100, 100, 100,
100, 0, 100, 0, 0, 100, 0, 0, 0, 0,
147, 147, 100, 100, 100, 100, 0, 0, 0, 100,
147, 0, 0, 147, 0, 0, 100, 102, 102, 0,
0, 0, 102, 102, 102, 102, 0, 147, 0, 0,
0, 0, 0, 0, 147, 0, 0, 102, 102, 102,
107, 107, 0, 0, 0, 107, 0, 0, 0, 0,
107, 109, 109, 0, 0, 0, 109, 109, 109, 109,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 109, 109, 109, 109, 117, 117, 0, 0, 0,
117, 117, 117, 117, 0, 117, 0, 0, 117, 0,
0, 0, 0, 0, 0, 117, 117, 117, 117, 0,
0, 0, 117, 0, 0, 0, 0, 117, 119, 119,
0, 0, 0, 119, 119, 119, 119, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 119, 119,
119, 119, 123, 123, 0, 0, 0, 123, 123, 123,
102, 110, 110, 0, 0, 0, 110, 110, 110, 110,
0, 110, 0, 0, 110, 0, 0, 0, 0, 0,
0, 110, 110, 110, 110, 0, 0, 0, 110, 0,
0, 0, 0, 0, 0, 110, 112, 112, 0, 0,
0, 112, 112, 112, 112, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 112, 112, 112, 112,
121, 121, 0, 0, 0, 121, 121, 121, 121, 0,
121, 0, 0, 121, 0, 0, 0, 0, 0, 0,
121, 121, 121, 121, 0, 0, 0, 121, 0, 0,
0, 0, 0, 0, 121, 123, 123, 0, 0, 0,
123, 0, 123, 0, 0, 123, 0, 0, 0, 0,
0, 0, 123, 123, 123, 123, 0, 0, 0, 123,
0, 0, 0, 0, 123, 125, 125, 0, 0, 0,
125, 125, 125, 125, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 125, 125, 125, 125, 129,
129, 0, 0, 0, 129, 129, 129, 129, 0, 129,
0, 0, 129, 0, 0, 0, 0, 0, 0, 129,
129, 129, 129, 0, 0, 0, 129, 0, 0, 0,
0, 129, 131, 131, 0, 0, 0, 131, 131, 131,
131, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123, 123, 123, 123, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 123, 123, 123, 123, 128,
128, 0, 0, 0, 128, 128, 128, 128, 0, 128,
0, 0, 128, 0, 0, 0, 0, 0, 0, 128,
128, 128, 128, 0, 0, 0, 128, 0, 0, 0,
0, 0, 0, 128, 130, 130, 0, 0, 0, 130,
130, 130, 130, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 130, 130, 130, 130, 135, 135,
0, 0, 0, 135, 135, 135, 135, 0, 135, 0,
0, 135, 0, 0, 0, 0, 0, 0, 135, 135,
0, 0, 131, 131, 131, 131, 174, 174, 174, 174,
175, 175, 175, 175, 176, 176, 176, 176, 177, 177,
178, 0, 178, 178, 179, 179, 180, 0, 180, 180,
181, 0, 181, 181, 190, 0, 190, 190, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173
135, 135, 0, 0, 0, 135, 0, 0, 0, 0,
0, 0, 135, 137, 137, 0, 0, 0, 137, 137,
137, 137, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 137, 137, 137, 137, 180, 180, 180,
180, 181, 181, 181, 181, 182, 182, 182, 182, 183,
183, 184, 0, 184, 184, 185, 185, 186, 0, 186,
186, 187, 0, 187, 187, 193, 0, 193, 193, 197,
0, 197, 197, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179
} ;
static yy_state_type yy_last_accepting_state;
@ -799,7 +809,7 @@ UUID *parse_uuid(const char *u)
* The flexer starts here
**************************************************************************
*/
#line 803 "parser.yy.c"
#line 813 "parser.yy.c"
#define INITIAL 0
#define QUOTE 1
@ -1003,7 +1013,7 @@ YY_DECL
#line 128 "parser.l"
#line 1007 "parser.yy.c"
#line 1017 "parser.yy.c"
if ( !(yy_init) )
{
@ -1057,13 +1067,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 174 )
if ( yy_current_state >= 180 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 173 );
while ( yy_current_state != 179 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
@ -1123,196 +1133,216 @@ yyless(9); yy_pop_state(); return tCPPQUOTE;
case 5:
YY_RULE_SETUP
#line 150 "parser.l"
parser_lval.str = xstrdup(parser_text); yy_pop_state(); return aPRAGMA;
{
if(import_stack_ptr) {
if(!winrt_mode)
error_loc("winrt IDL file imported in non-winrt mode\n");
}else {
const char *ptr = parser_text+5;
winrt_mode = TRUE;
while(isspace(*ptr))
ptr++;
if(!strncmp(ptr, "ns_prefix", 9) && (!*(ptr += 9) || isspace(*ptr)))
use_abi_namespace = TRUE;
}
yy_pop_state();
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 151 "parser.l"
yy_push_state(QUOTE); cbufidx = 0;
#line 166 "parser.l"
parser_lval.str = xstrdup(parser_text); yy_pop_state(); return aPRAGMA;
YY_BREAK
case 7:
YY_RULE_SETUP
#line 152 "parser.l"
#line 167 "parser.l"
yy_push_state(QUOTE); cbufidx = 0;
YY_BREAK
case 8:
YY_RULE_SETUP
#line 168 "parser.l"
{
yy_pop_state();
parser_lval.str = get_buffered_cstring();
return aSTRING;
}
YY_BREAK
case 8:
YY_RULE_SETUP
#line 157 "parser.l"
yy_push_state(WSTRQUOTE); cbufidx = 0;
YY_BREAK
case 9:
YY_RULE_SETUP
#line 158 "parser.l"
#line 173 "parser.l"
yy_push_state(WSTRQUOTE); cbufidx = 0;
YY_BREAK
case 10:
YY_RULE_SETUP
#line 174 "parser.l"
{
yy_pop_state();
parser_lval.str = get_buffered_cstring();
return aWSTRING;
}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 163 "parser.l"
yy_push_state(SQUOTE); cbufidx = 0;
YY_BREAK
case 11:
YY_RULE_SETUP
#line 164 "parser.l"
#line 179 "parser.l"
yy_push_state(SQUOTE); cbufidx = 0;
YY_BREAK
case 12:
YY_RULE_SETUP
#line 180 "parser.l"
{
yy_pop_state();
parser_lval.str = get_buffered_cstring();
return aSQSTRING;
}
YY_BREAK
case 12:
#line 170 "parser.l"
case 13:
YY_RULE_SETUP
#line 170 "parser.l"
addcchar(parser_text[1]);
YY_BREAK
#line 186 "parser.l"
case 14:
YY_RULE_SETUP
#line 171 "parser.l"
#line 186 "parser.l"
addcchar(parser_text[1]);
YY_BREAK
case 15:
YY_RULE_SETUP
#line 172 "parser.l"
addcchar('\\'); addcchar(parser_text[1]);
#line 187 "parser.l"
addcchar(parser_text[1]);
YY_BREAK
case 16:
YY_RULE_SETUP
#line 173 "parser.l"
addcchar(parser_text[0]);
#line 188 "parser.l"
addcchar('\\'); addcchar(parser_text[1]);
YY_BREAK
case 17:
YY_RULE_SETUP
#line 174 "parser.l"
yy_push_state(ATTR); return '[';
#line 189 "parser.l"
addcchar(parser_text[0]);
YY_BREAK
case 18:
YY_RULE_SETUP
#line 175 "parser.l"
yy_pop_state(); return ']';
#line 190 "parser.l"
yy_push_state(ATTR); return '[';
YY_BREAK
case 19:
YY_RULE_SETUP
#line 176 "parser.l"
return attr_token(parser_text);
#line 191 "parser.l"
yy_pop_state(); return ']';
YY_BREAK
case 20:
YY_RULE_SETUP
#line 177 "parser.l"
#line 192 "parser.l"
return attr_token(parser_text);
YY_BREAK
case 21:
YY_RULE_SETUP
#line 193 "parser.l"
{
parser_lval.uuid = parse_uuid(parser_text);
return aUUID;
}
YY_BREAK
case 21:
case 22:
YY_RULE_SETUP
#line 181 "parser.l"
#line 197 "parser.l"
{
parser_lval.num = xstrtoul(parser_text, NULL, 0);
return aHEXNUM;
}
YY_BREAK
case 22:
case 23:
YY_RULE_SETUP
#line 185 "parser.l"
#line 201 "parser.l"
{
parser_lval.num = xstrtoul(parser_text, NULL, 0);
return aNUM;
}
YY_BREAK
case 23:
case 24:
YY_RULE_SETUP
#line 189 "parser.l"
#line 205 "parser.l"
{
parser_lval.dbl = strtod(parser_text, NULL);
return aDOUBLE;
}
YY_BREAK
case 24:
case 25:
*yy_cp = (yy_hold_char); /* undo effects of setting up parser_text */
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up parser_text again */
YY_RULE_SETUP
#line 193 "parser.l"
#line 209 "parser.l"
return tSAFEARRAY;
YY_BREAK
case 25:
case 26:
YY_RULE_SETUP
#line 194 "parser.l"
#line 210 "parser.l"
return kw_token(parser_text);
YY_BREAK
case 26:
/* rule 26 can match eol */
YY_RULE_SETUP
#line 195 "parser.l"
line_number++;
YY_BREAK
case 27:
/* rule 27 can match eol */
YY_RULE_SETUP
#line 196 "parser.l"
#line 211 "parser.l"
line_number++;
YY_BREAK
case 28:
YY_RULE_SETUP
#line 197 "parser.l"
return SHL;
#line 212 "parser.l"
YY_BREAK
case 29:
YY_RULE_SETUP
#line 198 "parser.l"
return SHR;
#line 213 "parser.l"
return SHL;
YY_BREAK
case 30:
YY_RULE_SETUP
#line 199 "parser.l"
return MEMBERPTR;
#line 214 "parser.l"
return SHR;
YY_BREAK
case 31:
YY_RULE_SETUP
#line 200 "parser.l"
return EQUALITY;
#line 215 "parser.l"
return MEMBERPTR;
YY_BREAK
case 32:
YY_RULE_SETUP
#line 201 "parser.l"
return INEQUALITY;
#line 216 "parser.l"
return EQUALITY;
YY_BREAK
case 33:
YY_RULE_SETUP
#line 202 "parser.l"
return GREATEREQUAL;
#line 217 "parser.l"
return INEQUALITY;
YY_BREAK
case 34:
YY_RULE_SETUP
#line 203 "parser.l"
return LESSEQUAL;
#line 218 "parser.l"
return GREATEREQUAL;
YY_BREAK
case 35:
YY_RULE_SETUP
#line 204 "parser.l"
return LOGICALOR;
#line 219 "parser.l"
return LESSEQUAL;
YY_BREAK
case 36:
YY_RULE_SETUP
#line 205 "parser.l"
return LOGICALAND;
#line 220 "parser.l"
return LOGICALOR;
YY_BREAK
case 37:
YY_RULE_SETUP
#line 206 "parser.l"
return ELLIPSIS;
#line 221 "parser.l"
return LOGICALAND;
YY_BREAK
case 38:
YY_RULE_SETUP
#line 207 "parser.l"
#line 222 "parser.l"
return ELLIPSIS;
YY_BREAK
case 39:
YY_RULE_SETUP
#line 223 "parser.l"
return parser_text[0];
YY_BREAK
case YY_STATE_EOF(INITIAL):
@ -1322,19 +1352,19 @@ case YY_STATE_EOF(ATTR):
case YY_STATE_EOF(PP_LINE):
case YY_STATE_EOF(PP_PRAGMA):
case YY_STATE_EOF(SQUOTE):
#line 208 "parser.l"
#line 224 "parser.l"
{
if (import_stack_ptr)
return aEOF;
else yyterminate();
}
YY_BREAK
case 39:
case 40:
YY_RULE_SETUP
#line 213 "parser.l"
#line 229 "parser.l"
ECHO;
YY_BREAK
#line 1338 "parser.yy.c"
#line 1368 "parser.yy.c"
case YY_END_OF_BUFFER:
{
@ -1626,7 +1656,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 174 )
if ( yy_current_state >= 180 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1654,11 +1684,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 174 )
if ( yy_current_state >= 180 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 173);
yy_is_jam = (yy_current_state == 179);
return yy_is_jam ? 0 : yy_current_state;
}
@ -2333,7 +2363,7 @@ void parser_free (void * ptr )
#define YYTABLES_NAME "yytables"
#line 213 "parser.l"
#line 229 "parser.l"
@ -2544,7 +2574,7 @@ static int kw_token(const char *kw)
struct keyword key, *kwp;
key.kw = kw;
kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
if (kwp && (do_rt_extension || kwp->token != tNAMESPACE)) {
if (kwp && (winrt_mode || kwp->token != tNAMESPACE)) {
parser_lval.str = xstrdup(kwp->kw);
return kwp->token;
}

View file

@ -37,14 +37,6 @@
#include "typegen.h"
#include "expr.h"
#define END_OF_LIST(list) \
do { \
if (list) { \
while (NEXT_LINK(list)) \
list = NEXT_LINK(list); \
} \
} while(0)
static FILE* proxy;
static int indent = 0;

View file

@ -280,6 +280,8 @@ void output_typelib_regscript( const typelib_t *typelib )
const expr_t *lcid_expr = get_attrp( typelib->attrs, ATTR_LIBLCID );
unsigned int version = get_attrv( typelib->attrs, ATTR_VERSION );
unsigned int flags = 0;
char id_part[12] = "";
expr_t *expr;
if (is_attr( typelib->attrs, ATTR_RESTRICTED )) flags |= 1; /* LIBFLAG_FRESTRICTED */
if (is_attr( typelib->attrs, ATTR_CONTROL )) flags |= 2; /* LIBFLAG_FCONTROL */
@ -295,8 +297,11 @@ void output_typelib_regscript( const typelib_t *typelib )
put_str( indent, "'%u.%u' = s '%s'\n",
MAJORVERSION(version), MINORVERSION(version), descr ? descr : typelib->name );
put_str( indent++, "{\n" );
put_str( indent, "'%x' { %s = s '%%MODULE%%' }\n",
lcid_expr ? lcid_expr->cval : 0, typelib_kind == SYS_WIN64 ? "win64" : "win32" );
expr = get_attrp( typelib->attrs, ATTR_ID );
if (expr)
sprintf(id_part, "\\%d", expr->cval);
put_str( indent, "'%x' { %s = s '%%MODULE%%%s' }\n",
lcid_expr ? lcid_expr->cval : 0, typelib_kind == SYS_WIN64 ? "win64" : "win32", id_part );
put_str( indent, "FLAGS = s '%u'\n", flags );
put_str( --indent, "}\n" );
put_str( --indent, "}\n" );

View file

@ -1142,7 +1142,7 @@ static unsigned char get_func_oi2_flags( const var_t *func )
static unsigned int write_new_procformatstring_type(FILE *file, int indent, const var_t *var,
int is_return, unsigned int *stack_offset)
{
char buffer[64];
char buffer[128];
unsigned int stack_size, typestring_offset;
unsigned short flags;
unsigned char fc = get_parameter_fc( var, is_return, &flags, &stack_size, &typestring_offset );
@ -4735,7 +4735,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
{
print_file(file, 2, "%s", "");
write_type_left( file, (type_t *)arg->type, TRUE );
write_type_left( file, (type_t *)arg->type, NAME_DEFAULT, TRUE );
if (needs_space_after( arg->type )) fputc( ' ', file );
if (is_array( arg->type ) && !type_array_is_decl_as_ptr( arg->type )) fputc( '*', file );
@ -4800,9 +4800,9 @@ int write_expr_eval_routines(FILE *file, const char *iface)
else
{
print_file(file, 1, "%s", "");
write_type_left(file, (type_t *)eval->cont_type, TRUE);
write_type_left(file, (type_t *)eval->cont_type, NAME_DEFAULT, TRUE);
fprintf(file, " *%s = (", var_name);
write_type_left(file, (type_t *)eval->cont_type, TRUE);
write_type_left(file, (type_t *)eval->cont_type, NAME_DEFAULT, TRUE);
fprintf(file, " *)(pStubMsg->StackTop - %u);\n", eval->baseoff);
}
print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */

View file

@ -32,9 +32,6 @@
#include <string.h>
#include <ctype.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <typedefs.h>
#include "widl.h"
#include "utils.h"

View file

@ -45,8 +45,10 @@ type_t *make_type(enum type_type type)
{
type_t *t = alloc_type();
t->name = NULL;
t->namespace = NULL;
t->type_type = type;
t->attrs = NULL;
t->c_name = NULL;
t->orig = NULL;
memset(&t->details, 0, sizeof(t->details));
t->typestring_offset = 0;
@ -76,6 +78,56 @@ static const var_t *find_arg(const var_list_t *args, const char *name)
return NULL;
}
const char *type_get_name(const type_t *type, enum name_type name_type)
{
switch(name_type) {
case NAME_DEFAULT:
return type->name;
case NAME_C:
return type->c_name;
}
assert(0);
return NULL;
}
static char *append_namespace(char *ptr, struct namespace *namespace, const char *separator)
{
if(is_global_namespace(namespace)) {
if(!use_abi_namespace)
return ptr;
strcpy(ptr, "ABI");
strcat(ptr, separator);
return ptr + strlen(ptr);
}
ptr = append_namespace(ptr, namespace->parent, separator);
strcpy(ptr, namespace->name);
strcat(ptr, separator);
return ptr + strlen(ptr);
}
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix)
{
unsigned len = strlen(prefix) + strlen(suffix);
unsigned sep_len = strlen(separator);
struct namespace *iter;
char *ret, *ptr;
if(use_abi_namespace && !is_global_namespace(namespace))
len += 3 /* strlen("ABI") */ + sep_len;
for(iter = namespace; !is_global_namespace(iter); iter = iter->parent)
len += strlen(iter->name) + sep_len;
ret = xmalloc(len+1);
strcpy(ret, prefix);
ptr = append_namespace(ret + strlen(ret), namespace, separator);
strcpy(ptr, suffix);
return ret;
}
type_t *type_new_function(var_list_t *args)
{
var_t *arg;
@ -152,7 +204,7 @@ type_t *type_new_alias(type_t *t, const char *name)
type_t *type_new_module(char *name)
{
type_t *type = get_type(TYPE_MODULE, name, 0);
type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
if (type->type_type != TYPE_MODULE || type->defined)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
type->name, type->loc_info.input_name, type->loc_info.line_number);
@ -162,7 +214,7 @@ type_t *type_new_module(char *name)
type_t *type_new_coclass(char *name)
{
type_t *type = get_type(TYPE_COCLASS, name, 0);
type_t *type = get_type(TYPE_COCLASS, name, NULL, 0);
if (type->type_type != TYPE_COCLASS || type->defined)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
type->name, type->loc_info.input_name, type->loc_info.line_number);
@ -219,11 +271,12 @@ type_t *type_new_void(void)
return void_type;
}
type_t *type_new_enum(const char *name, int defined, var_list_t *enums)
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums)
{
type_t *tag_type = name ? find_type(name, tsENUM) : NULL;
type_t *tag_type = name ? find_type(name, namespace, tsENUM) : NULL;
type_t *t = make_type(TYPE_ENUM);
t->name = name;
t->namespace = namespace;
if (tag_type && tag_type->details.enumeration)
t->details.enumeration = tag_type->details.enumeration;
@ -237,18 +290,25 @@ type_t *type_new_enum(const char *name, int defined, var_list_t *enums)
if (name)
{
if (defined)
reg_type(t, name, tsENUM);
reg_type(t, name, namespace, tsENUM);
else
add_incomplete(t);
}
return t;
}
type_t *type_new_struct(char *name, int defined, var_list_t *fields)
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields)
{
type_t *tag_type = name ? find_type(name, tsSTRUCT) : NULL;
type_t *t = make_type(TYPE_STRUCT);
type_t *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL;
type_t *t;
/* avoid creating duplicate typelib type entries */
if (tag_type && do_typelib) return tag_type;
t = make_type(TYPE_STRUCT);
t->name = name;
t->namespace = namespace;
if (tag_type && tag_type->details.structure)
t->details.structure = tag_type->details.structure;
else if (defined)
@ -260,7 +320,7 @@ type_t *type_new_struct(char *name, int defined, var_list_t *fields)
if (name)
{
if (defined)
reg_type(t, name, tsSTRUCT);
reg_type(t, name, namespace, tsSTRUCT);
else
add_incomplete(t);
}
@ -269,7 +329,7 @@ type_t *type_new_struct(char *name, int defined, var_list_t *fields)
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields)
{
type_t *tag_type = name ? find_type(name, tsUNION) : NULL;
type_t *tag_type = name ? find_type(name, NULL, tsUNION) : NULL;
type_t *t = make_type(TYPE_UNION);
t->name = name;
if (tag_type && tag_type->details.structure)
@ -283,7 +343,7 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
if (name)
{
if (defined)
reg_type(t, name, tsUNION);
reg_type(t, name, NULL, tsUNION);
else
add_incomplete(t);
}
@ -292,7 +352,7 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases)
{
type_t *t = get_type(TYPE_ENCAPSULATED_UNION, name, tsUNION);
type_t *t = get_type(TYPE_ENCAPSULATED_UNION, name, NULL, tsUNION);
if (!union_field) union_field = make_var( xstrdup("tagged_union") );
union_field->type = type_new_nonencapsulated_union(NULL, TRUE, cases);
t->details.structure = xmalloc(sizeof(*t->details.structure));
@ -392,7 +452,7 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met
iface->details.iface->disp_props = props;
iface->details.iface->disp_methods = methods;
iface->details.iface->stmts = NULL;
iface->details.iface->inherit = find_type("IDispatch", 0);
iface->details.iface->inherit = find_type("IDispatch", NULL, 0);
if (!iface->details.iface->inherit) error_loc("IDispatch is undefined\n");
iface->defined = TRUE;
compute_method_indexes(iface);

View file

@ -24,6 +24,11 @@
#ifndef WIDL_TYPE_TREE_H
#define WIDL_TYPE_TREE_H
enum name_type {
NAME_DEFAULT,
NAME_C
};
type_t *type_new_function(var_list_t *args);
type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs);
type_t *type_new_alias(type_t *t, const char *name);
@ -35,8 +40,8 @@ type_t *type_new_basic(enum type_basic_type basic_type);
type_t *type_new_int(enum type_basic_type basic_type, int sign);
type_t *type_new_void(void);
type_t *type_new_coclass(char *name);
type_t *type_new_enum(const char *name, int defined, var_list_t *enums);
type_t *type_new_struct(char *name, int defined, var_list_t *fields);
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums);
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields);
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields);
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
@ -46,6 +51,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
int type_is_equal(const type_t *type1, const type_t *type2);
const char *type_get_name(const type_t *type, enum name_type name_type);
/* FIXME: shouldn't need to export this */
type_t *duptype(type_t *t, int dupname);

View file

@ -72,7 +72,8 @@ static const char usage[] =
" --prefix-client=p Prefix names of client stubs with 'p'\n"
" --prefix-server=p Prefix names of server functions with 'p'\n"
" -r Generate registration script\n"
" --rt Enable WinRT's language extensions for IDL\n"
" --winrt Enable Windows Runtime mode\n"
" --ns_prefix Prefix namespaces with ABI namespace\n"
" -s Generate server stub\n"
" -t Generate typelib\n"
" -u Generate interface identifiers file\n"
@ -114,7 +115,8 @@ int do_win32 = 1;
int do_win64 = 1;
int win32_packing = 8;
int win64_packing = 8;
int do_rt_extension = 0;
int winrt_mode = 0;
int use_abi_namespace = 0;
static enum stub_mode stub_mode = MODE_Os;
char *input_name;
@ -155,6 +157,7 @@ enum {
PREFIX_CLIENT_OPTION,
PREFIX_SERVER_OPTION,
PRINT_HELP,
RT_NS_PREFIX,
RT_OPTION,
WIN32_OPTION,
WIN64_OPTION,
@ -170,12 +173,13 @@ static const struct option long_options[] = {
{ "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
{ "help", 0, NULL, PRINT_HELP },
{ "local-stubs", 1, NULL, LOCAL_STUBS_OPTION },
{ "ns_prefix", 0, NULL, RT_NS_PREFIX },
{ "oldnames", 0, NULL, OLDNAMES_OPTION },
{ "output", 0, NULL, 'o' },
{ "prefix-all", 1, NULL, PREFIX_ALL_OPTION },
{ "prefix-client", 1, NULL, PREFIX_CLIENT_OPTION },
{ "prefix-server", 1, NULL, PREFIX_SERVER_OPTION },
{ "rt", 0, NULL, RT_OPTION },
{ "winrt", 0, NULL, RT_OPTION },
{ "win32", 0, NULL, WIN32_OPTION },
{ "win64", 0, NULL, WIN64_OPTION },
{ "win32-align", 1, NULL, WIN32_ALIGN_OPTION },
@ -590,7 +594,10 @@ int main(int argc,char *argv[])
fprintf(stderr, "%s", usage);
return 0;
case RT_OPTION:
do_rt_extension = 1;
winrt_mode = 1;
break;
case RT_NS_PREFIX:
use_abi_namespace = 1;
break;
case WIN32_OPTION:
do_win32 = 1;

View file

@ -49,7 +49,8 @@ extern int do_win32;
extern int do_win64;
extern int win32_packing;
extern int win64_packing;
extern int do_rt_extension;
extern int winrt_mode;
extern int use_abi_namespace;
extern char *input_name;
extern char *input_idl_name;

View file

@ -1,6 +1,6 @@
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
diff -pudN e:\wine-patched\tools\widl/hash.c e:\reactos-sync-clean\tools\widl/hash.c
--- e:\wine-patched\tools\widl/hash.c 2015-02-22 13:23:48 +0100
+++ e:\reactos-sync-clean\tools\widl/hash.c 2013-10-15 20:06:18 +0100
@@ -21,9 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
@ -8,82 +8,210 @@ diff -u wine-1.3.4/tools/widl/hash.c tools/widl/hash.c
-#include "windef.h"
-#include "winbase.h"
-#include "winnls.h"
+#include <host/nls.h>
+#include <nls.h>
#include "widltypes.h"
#include "hash.h"
diff -u wine-1.3.4/tools/widl/header.c tools/widl/header.c
--- wine-1.3.4/tools/widl/header.c 2010-09-19 17:48:47.640625000 +0200
+++ tools/widl/header.c 2010-10-26 18:30:19.000000000 +0200
@@ -1081,15 +1081,7 @@
{
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
- static int allocate_written = 0;
@@ -539,10 +537,10 @@ unsigned int lhash_val_of_name_sys( sysk
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: case LANG_SCOTTISH_GAELIC: case LANG_NEUTRAL:
+ case LANG_BRETON: case LANG_NEUTRAL:
/* some languages not in all windows versions or ReactOS */
-#ifdef LANG_MANX_GAELIC
- case LANG_MANX_GAELIC:
+#ifdef LANG_GAELIC
+ case LANG_GAELIC:
#endif
#ifdef LANG_TAJIK
case LANG_TAJIK:
diff -pudN e:\wine-patched\tools\widl/header.c e:\reactos-sync-clean\tools\widl/header.c
--- e:\wine-patched\tools\widl/header.c 2015-10-30 18:41:54 +0100
+++ e:\reactos-sync-clean\tools\widl/header.c 2015-11-16 20:04:15 +0100
@@ -1068,7 +1068,7 @@ static void write_inline_wrappers(FILE *
if (!is_callas(func->attrs)) {
const var_t *arg;
- if (!allocate_written)
- {
- allocate_written = 1;
- fprintf(header, "void * __RPC_USER MIDL_user_allocate(SIZE_T);\n");
- fprintf(header, "void __RPC_USER MIDL_user_free(void *);\n\n");
- }
-
fprintf(header, "/*****************************************************************************\n");
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
fprintf(header, " */\n");
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) );
- fprintf(header, "static FORCEINLINE ");
+ fprintf(header, "FORCEINLINE ");
write_type_decl_left(header, type_function_get_rettype(func->type));
fprintf(header, " %s_%s(", name, get_name(func));
write_args(header, type_get_function_args(func->type), name, 1, FALSE);
@@ -1103,6 +1103,15 @@ static void do_write_c_method_def(FILE *
+ /* Append the SWITCHTYPE attribute to a union if it does not already have one. */
if (type_iface_get_inherit(iface))
do_write_c_method_def(header, type_iface_get_inherit(iface), name);
+ else if (type_iface_get_stmts(iface) == NULL)
+ {
+ fprintf(header, "#ifndef __cplusplus\n");
+ indent(header, 0);
+ fprintf(header, "char dummy;\n");
+ fprintf(header, "#endif\n");
+ fprintf(header, "\n");
+ return;
+ }
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
{
@@ -1640,6 +1649,10 @@ void write_header(const statement_list_t
fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
fprintf(header, "#endif\n\n");
+ fprintf(header, "#ifdef __REACTOS__\n");
+ fprintf(header, "#define WIN32_LEAN_AND_MEAN\n");
+ fprintf(header, "#endif\n\n");
+
fprintf(header, "#include <rpc.h>\n" );
fprintf(header, "#include <rpcndr.h>\n\n" );
diff -pudN e:\wine-patched\tools\widl/parser.y e:\reactos-sync-clean\tools\widl/parser.y
--- e:\wine-patched\tools\widl/parser.y 2015-11-15 19:23:32 +0100
+++ e:\reactos-sync-clean\tools\widl/parser.y 2015-11-16 20:04:15 +0100
@@ -1899,6 +1899,14 @@ static type_t *reg_typedefs(decl_spec_t
type->attrs = attrs;
}
+#ifdef __REACTOS__
+ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */
+ 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)));
+#endif
+
LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
{
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
@@ -35,8 +35,7 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
diff -pudN e:\wine-patched\tools\widl/proxy.c e:\reactos-sync-clean\tools\widl/proxy.c
--- e:\wine-patched\tools\widl/proxy.c 2015-02-22 13:23:48 +0100
+++ e:\reactos-sync-clean\tools\widl/proxy.c 2015-11-16 20:04:15 +0100
@@ -87,7 +87,13 @@ static void init_proxy(const statement_l
error("Could not open %s for output\n", proxy_name);
print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
print_proxy( "\n");
- print_proxy( "#define __midl_proxy\n");
+ print_proxy( "#define __midl_proxy\n\n");
+
+ print_proxy( "#ifdef __REACTOS__\n");
+ print_proxy( "#define WIN32_NO_STATUS\n");
+ print_proxy( "#define WIN32_LEAN_AND_MEAN\n");
+ print_proxy( "#endif\n\n");
+
print_proxy( "#include \"objbase.h\"\n");
print_proxy( "\n");
print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
@@ -476,14 +482,15 @@ static const statement_t * get_callas_so
return NULL;
}
-static void write_proxy_procformatstring_offsets( const type_t *iface, int skip )
+static int write_proxy_procformatstring_offsets( const type_t *iface, int skip )
{
const statement_t *stmt;
+ int i = 0;
if (type_iface_get_inherit(iface))
- write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
+ i = write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
else
- return;
+ return 0;
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
{
@@ -503,7 +510,9 @@ static void write_proxy_procformatstring
print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func));
else
print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
+ i++;
}
+ return i;
}
static int write_proxy_methods(type_t *iface, int skip)
@@ -636,7 +645,10 @@ static void write_proxy(type_t *iface, u
print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
print_proxy( "{\n" );
indent++;
- write_proxy_procformatstring_offsets( iface, 0 );
+ if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
+ {
+ print_proxy( "0\n" );
+ }
indent--;
print_proxy( "};\n\n" );
@@ -710,7 +722,10 @@ static void write_proxy(type_t *iface, u
print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
print_proxy( "{\n");
indent++;
- write_stub_methods(iface, FALSE);
+ if (write_stub_methods(iface, FALSE) == 0)
+ {
+ fprintf(proxy, "0");
+ }
fprintf(proxy, "\n");
indent--;
fprintf(proxy, "};\n\n");
diff -pudN e:\wine-patched\tools\widl/typegen.c e:\reactos-sync-clean\tools\widl/typegen.c
--- e:\wine-patched\tools\widl/typegen.c 2015-10-30 18:41:54 +0100
+++ e:\reactos-sync-clean\tools\widl/typegen.c 2015-11-16 20:04:16 +0100
@@ -4747,7 +4747,7 @@ void write_func_param_struct( FILE *file
if (align >= pointer_size)
fprintf( file, "%s;\n", arg->name );
else
- fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
+ fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
}
if (add_retval && !is_void( retval->type ))
{
diff -pudN e:\wine-patched\tools\widl/typelib.c e:\reactos-sync-clean\tools\widl/typelib.c
--- e:\wine-patched\tools\widl/typelib.c 2015-10-30 18:41:54 +0100
+++ e:\reactos-sync-clean\tools\widl/typelib.c 2015-11-16 20:04:16 +0100
@@ -32,9 +32,7 @@
#include <string.h>
#include <ctype.h>
-#include "windef.h"
-#include "winbase.h"
+#include <host/typedefs.h>
-
+#include <typedefs.h>
#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
@@ -302,7 +302,7 @@
*
*/
#include "parser.h"
diff -pudN e:\wine-patched\tools\widl/widl.c e:\reactos-sync-clean\tools\widl/widl.c
--- e:\wine-patched\tools\widl/widl.c 2015-10-30 18:41:54 +0100
+++ e:\reactos-sync-clean\tools\widl/widl.c 2015-11-16 20:04:16 +0100
@@ -364,6 +364,12 @@ static void write_dlldata_list(struct li
fprintf(dlldata, "- Do not edit ***/\n\n");
if (define_proxy_delegation)
fprintf(dlldata, "#define PROXY_DELEGATION\n");
+
+ fprintf(dlldata, "#ifdef __REACTOS__\n");
+ fprintf(dlldata, "#define WIN32_NO_STATUS\n");
+ fprintf(dlldata, "#define WIN32_LEAN_AND_MEAN\n");
+ fprintf(dlldata, "#endif\n\n");
+
fprintf(dlldata, "#include <objbase.h>\n");
fprintf(dlldata, "#include <rpcproxy.h>\n\n");
start_cplusplus_guard(dlldata);
@@ -504,6 +510,12 @@ void write_id_data(const statement_list_
-#include "pshpack1.h"
+#include <host/pshpack1.h>
fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
fprintf(idfile, "from %s - Do not edit ***/\n\n", input_idl_name);
+
+ fprintf(idfile, "#ifdef __REACTOS__\n");
+ fprintf(idfile, "#define WIN32_NO_STATUS\n");
+ fprintf(idfile, "#define WIN32_LEAN_AND_MEAN\n");
+ fprintf(idfile, "#endif\n\n");
+
fprintf(idfile, "#include <rpc.h>\n");
fprintf(idfile, "#include <rpcndr.h>\n\n");
typedef struct {
/*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */
@@ -599,7 +599,7 @@
WORD typeofarray
*/
-#include "poppack.h"
+#include <host/poppack.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
diff -pudN e:\wine-patched\tools\widl/widltypes.h e:\reactos-sync-clean\tools\widl/widltypes.h
--- e:\wine-patched\tools\widl/widltypes.h 2015-10-30 18:41:54 +0100
+++ e:\reactos-sync-clean\tools\widl/widltypes.h 2015-11-16 20:04:16 +0100
@@ -21,6 +21,15 @@
#ifndef __WIDL_WIDLTYPES_H
#define __WIDL_WIDLTYPES_H
@ -100,54 +228,19 @@ diff -u wine-1.3.4/tools/widl/widltypes.h tools/widl/widltypes.h
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
@@ -32,7 +39,9 @@
typedef GUID UUID;
#endif
diff -pudN e:\wine-patched\tools\widl/write_msft.c e:\reactos-sync-clean\tools\widl/write_msft.c
--- e:\wine-patched\tools\widl/write_msft.c 2015-11-15 19:23:32 +0100
+++ e:\reactos-sync-clean\tools\widl/write_msft.c 2015-11-16 20:04:16 +0100
@@ -39,10 +39,8 @@
+#ifndef TRUE
#define TRUE 1
+#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
@@ -40,10 +40,8 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
-#include "winerror.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winnls.h"
+#include <host/typedefs.h>
+#include <host/nls.h>
+#include <typedefs.h>
+#include <nls.h>
#include "widl.h"
#include "typelib.h"
@@ -2023,7 +2023,10 @@
}
if (is_attr(interface->attrs, ATTR_DISPINTERFACE))
- return add_dispinterface_typeinfo(typelib, interface);
+ {
+ add_dispinterface_typeinfo(typelib, interface);
+ return;
+ }
/* midl adds the parent interface first, unless the parent itself
has no parent (i.e. it stops before IUnknown). */
diff -u wine-1.3.4/tools/widl/typegen.c tools/widl/typegen.c
--- wine-1.3.4/tools/widl/typegen.c 2010-09-19 17:51:48.531250000 +0200
+++ tools/widl/typegen.c 2012-08-12 14:19:47.000000000 +0200
@@ -2345,7 +2345,8 @@
return;
}
}
- return write_member_type(file, type, cont_is_complex, NULL, elem, NULL, tfsoff);
+ write_member_type(file, type, cont_is_complex, NULL, elem, NULL, tfsoff);
+ return;
}
static void write_end(FILE *file, unsigned int *tfsoff)

View file

@ -391,6 +391,16 @@ struct bitfield_details
const expr_t *bits;
};
#define HASHMAX 64
struct namespace {
const char *name;
struct namespace *parent;
struct list entry;
struct list children;
struct rtype *type_hash[HASHMAX];
};
enum type_type
{
TYPE_VOID,
@ -411,6 +421,7 @@ enum type_type
struct _type_t {
const char *name;
struct namespace *namespace;
enum type_type type_type;
attr_list_t *attrs;
union
@ -426,6 +437,7 @@ struct _type_t {
struct pointer_details pointer;
struct bitfield_details bitfield;
} details;
const char *c_name;
type_t *orig; /* dup'd types */
unsigned int typestring_offset;
unsigned int ptrdesc; /* used for complex structs */
@ -558,10 +570,10 @@ void clear_all_offsets(void);
#define tsUNION 3
var_t *find_const(const char *name, int f);
type_t *find_type(const char *name, int t);
type_t *find_type(const char *name, struct namespace *namespace, int t);
type_t *make_type(enum type_type type);
type_t *get_type(enum type_type type, char *name, int t);
type_t *reg_type(type_t *type, const char *name, int t);
type_t *get_type(enum type_type type, char *name, struct namespace *namespace, int t);
type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, int t);
void add_incomplete(type_t *t);
var_t *make_var(char *name);
@ -569,6 +581,8 @@ var_list_t *append_var(var_list_t *list, var_t *var);
void init_loc_info(loc_info_t *);
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
static inline var_list_t *type_get_function_args(const type_t *func_type)
{
return func_type->details.function->args;
@ -598,4 +612,9 @@ static inline int statements_has_func(const statement_list_t *stmts)
return has_func;
}
static inline int is_global_namespace(const struct namespace *namespace)
{
return !namespace->name;
}
#endif

View file

@ -38,7 +38,6 @@
#include <time.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <typedefs.h>
#include <nls.h>
@ -493,10 +492,23 @@ static int ctl2_alloc_guid(
MSFT_GuidEntry *guid_space;
int hash_key;
chat("adding uuid {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
guid->guid.Data1, guid->guid.Data2, guid->guid.Data3,
guid->guid.Data4[0], guid->guid.Data4[1], guid->guid.Data4[2], guid->guid.Data4[3],
guid->guid.Data4[4], guid->guid.Data4[5], guid->guid.Data4[6], guid->guid.Data4[7]);
hash_key = ctl2_hash_guid(&guid->guid);
offset = ctl2_find_guid(typelib, hash_key, &guid->guid);
if (offset != -1) return offset;
if (offset != -1)
{
if (pedantic)
warning("duplicate uuid {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
guid->guid.Data1, guid->guid.Data2, guid->guid.Data3,
guid->guid.Data4[0], guid->guid.Data4[1], guid->guid.Data4[2], guid->guid.Data4[3],
guid->guid.Data4[4], guid->guid.Data4[5], guid->guid.Data4[6], guid->guid.Data4[7]);
return -1;
}
offset = ctl2_alloc_segment(typelib, MSFT_SEG_GUID, sizeof(MSFT_GuidEntry), 0);
@ -744,6 +756,7 @@ static importinfo_t *find_importinfo(msft_typelib_t *typelib, const char *name)
static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure);
static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface);
static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration);
static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion);
static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls);
static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface);
@ -992,6 +1005,9 @@ static int encode_type(
case TYPE_ENUM:
add_enum_typeinfo(typelib, type);
break;
case TYPE_UNION:
add_union_typeinfo(typelib, type);
break;
case TYPE_COCLASS:
add_coclass_typeinfo(typelib, type);
break;
@ -1127,9 +1143,12 @@ static int encode_var(
if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) {
int mix_field;
if (target_type & 0x80000000) {
mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF;
} else if (is_array(ref)) {
type_t *element_type = type_alias_get_aliasee(type_array_get_element(ref));
mix_field = get_type_vt(element_type) | VT_ARRAY | VT_BYREF;
} else {
typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][target_type];
mix_field = ((typedata[0] >> 16) == 0x7fff)? 0x7fff: 0x7ffe;
@ -1266,7 +1285,7 @@ static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid,
any default value. */
static int get_defaultvalue_vt(type_t *type)
{
int vt = get_type_vt(type);
int vt;
if (type_get_type(type) == TYPE_ENUM)
vt = VT_I4;
else
@ -1748,6 +1767,10 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
typedata[4] = typeinfo->datawidth;
typeinfo->datawidth += var_datawidth;
break;
case TKIND_UNION:
typedata[4] = typeinfo->datawidth;
typeinfo->datawidth = max(typeinfo->datawidth, var_datawidth);
break;
case TKIND_DISPATCH:
var_kind = 3; /* VAR_DISPATCH */
typeinfo->datawidth = pointer_size;
@ -1832,7 +1855,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
MSFT_TypeInfoBase *typeinfo;
MSFT_GuidEntry guidentry;
chat("create_msft_typeinfo: name %s kind %d\n", name, kind);
chat("create_msft_typeinfo: name %s kind %d index %d\n", name, kind, typelib->typelib_header.nrtypeinfos);
msft_typeinfo = xmalloc(sizeof(*msft_typeinfo));
memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) );
@ -1966,7 +1989,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
static void add_dispatch(msft_typelib_t *typelib)
{
int guid_offset, impfile_offset;
int guid_offset, impfile_offset, hash_key;
MSFT_GuidEntry guidentry;
MSFT_ImpInfo impinfo;
GUID stdole = {0x00020430,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
@ -1977,7 +2000,10 @@ static void add_dispatch(msft_typelib_t *typelib)
guidentry.guid = stdole;
guidentry.hreftype = 2;
guidentry.next_hash = -1;
guid_offset = ctl2_alloc_guid(typelib, &guidentry);
hash_key = ctl2_hash_guid(&guidentry.guid);
guid_offset = ctl2_find_guid(typelib, hash_key, &guidentry.guid);
if (guid_offset == -1)
guid_offset = ctl2_alloc_guid(typelib, &guidentry);
impfile_offset = alloc_importfile(typelib, guid_offset, 2, 0, "stdole2.tlb");
guidentry.guid = iid_idispatch;
@ -1985,7 +2011,11 @@ static void add_dispatch(msft_typelib_t *typelib)
guidentry.next_hash = -1;
impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID;
impinfo.oImpFile = impfile_offset;
impinfo.oGuid = ctl2_alloc_guid(typelib, &guidentry);
hash_key = ctl2_hash_guid(&guidentry.guid);
guid_offset = ctl2_find_guid(typelib, hash_key, &guidentry.guid);
if (guid_offset == -1)
guid_offset = ctl2_alloc_guid(typelib, &guidentry);
impinfo.oGuid = guid_offset;
typelib->typelib_header.dispatchpos = alloc_msft_importinfo(typelib, &impinfo) | 0x01;
}
@ -2066,6 +2096,10 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
add_interface_typeinfo(typelib, inherit);
}
/* check typelib_idx again, it could have been added while resolving the parent interface */
if (-1 < interface->typelib_idx)
return;
interface->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_INTERFACE, interface->name, interface->attrs);
msft_typeinfo->typeinfo->size = pointer_size;
@ -2137,22 +2171,57 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
add_var_desc(msft_typeinfo, idx++, cur);
}
static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion)
{
int idx = 0;
var_t *cur;
msft_typeinfo_t *msft_typeinfo;
if (-1 < tunion->typelib_idx)
return;
tunion->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_UNION, tunion->name, tunion->attrs);
msft_typeinfo->typeinfo->size = 0;
if (type_union_get_cases(tunion))
LIST_FOR_EACH_ENTRY(cur, type_union_get_cases(tunion), var_t, entry)
add_var_desc(msft_typeinfo, idx++, cur);
}
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
{
msft_typeinfo_t *msft_typeinfo;
int alignment;
msft_typeinfo_t *msft_typeinfo = NULL;
int alignment, datatype1, datatype2, size, duplicate = 0;
type_t *type;
if (-1 < tdef->typelib_idx)
return;
tdef->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs);
encode_type(typelib, get_type_vt(type_alias_get_aliasee(tdef)),
type_alias_get_aliasee(tdef),
&msft_typeinfo->typeinfo->datatype1,
&msft_typeinfo->typeinfo->size,
&alignment, &msft_typeinfo->typeinfo->datatype2);
msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
type = type_alias_get_aliasee(tdef);
if (!type->name || strcmp(tdef->name, type->name) != 0)
{
tdef->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs);
}
else
duplicate = 1;
encode_type(typelib, get_type_vt(type), type,
&datatype1, &size, &alignment, &datatype2);
if (msft_typeinfo)
{
msft_typeinfo->typeinfo->datatype1 = datatype1;
msft_typeinfo->typeinfo->size = size;
msft_typeinfo->typeinfo->datatype2 = datatype2;
msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
}
/* avoid adding duplicate type definitions */
if (duplicate)
tdef->typelib_idx = type->typelib_idx;
}
static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
@ -2273,6 +2342,9 @@ static void add_type_typeinfo(msft_typelib_t *typelib, type_t *type)
case TYPE_ENUM:
add_enum_typeinfo(typelib, type);
break;
case TYPE_UNION:
add_union_typeinfo(typelib, type);
break;
case TYPE_COCLASS:
add_coclass_typeinfo(typelib, type);
break;