mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:56:05 +00:00
Sync to wine-0.9.61:
- Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Stop looping in check_remoting_args when a context_handle or wire_marshal type is found as they are in effect fundamental types. - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Check that fields in structures and unions referenced by non-local functions can be marshalled and that their attributes are consistent. -Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: The implicit_handle attribute is allowed with a handle explicitly specified in the function parameters. In that case, that handle is used instead of the implicit handle. Fix the check for the explicit_handle attribute being specified without a handle being specified in the function parameters, even though issuing an error is wrong. (Thanks to Marcus Meissner & Coverity for spotting that the check didn't do what it was supposed to do.) - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Automatically add "handle_t IDL_handle" parameter to functions with no explicit handle specified whose containing interface has the explicit_handle attribute. - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Issue an error instead of crashing for dividing by zero in a constant expression. - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Add support for "->" and "." operators in expressions. - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Add support for arrays in expressions. - Rob Shearman <rob@codeweavers.com> Sun, 20 Apr 2008 widl: Add support for '%' operator in expressions. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Fix operator precedence in expressions. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Require a constant expression for case statements. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Add support for comparison, exclusive or, logical not and positive operators in expressions. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Remove EXPR_MEMBERPTR and implement it using EXPR_PPTR and EXPR_MEMBER instead. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Don't free input_name in pop_import as we keep pointers to it in the var_t type now. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Pass the actual type into check_remoting_fields and check_field_common instead of the type name. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Check that expressions resolve so that expressions in generated code will compile. Also check that expressions return the correct type for the attribute. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Move expression functions to a new file, expr.c. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Use expr_resolve_type to get the type of the identifier in write_conf_or_var_desc. Remove the conversion of pointer types into base types as this was only needed due to lack of proper type resolving. - Rob Shearman <rob@codeweavers.com> Tue, 22 Apr 2008 widl: Remove duplicated code in the form of the write_struct_expr function by enhancing write_expr to allow toplevel identifiers to be prefixed by a string, if specified. - Rob Shearman <rob@codeweavers.com> Thu, 24 Apr 2008 widl: Implement lcid property on library declarations. - Rob Shearman <rob@codeweavers.com> Thu, 24 Apr 2008 widl: Construct the pointer chain while parsing pointers, rather than storing a ptr_level. This method is more flexible and somewhat simpler. - Rob Shearman <rob@codeweavers.com> Thu, 24 Apr 2008 widl: Allow NULL to be used in expressions. - Rob Shearman <rob@codeweavers.com> Thu, 24 Apr 2008 widl: Create a list of statements in the whole IDL file, instead of just a list of interfaces. - Rob Shearman <rob@codeweavers.com> Thu, 24 Apr 2008 widl: Add typedef statements to the statement lists. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Consolidate most of the inner loop of reg_typedefs into set_type. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Rename pident to declarator and parse the array declarations as part of declarators. This allows arrays to be used in typedefs and const statements. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Make the rules for parsing fields in structures, encapsulated unions and non-encapsulated unions more strict. Move the rules in fields that handle empty union cases into separate union rules so that they can't erroneously be accepted for structures or other types of unions. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Add support for declaring multiple fields of a structure in one statement. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Add support for string literals and wide-string literals in expressions. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Create a statement object for import statements. Move the writing of include directives into the generated header into header.c. - Rob Shearman <rob@codeweavers.com> Fri, 25 Apr 2008 widl: Move the func_declarator rule entirely into direct_declarator. - Rob Shearman <rob@codeweavers.com> Sat, 26 Apr 2008 widl: Add typedefs to typelibs which have the public or uuid attributes, not any other attribute. - Rob Shearman <rob@codeweavers.com> Sat, 26 Apr 2008 widl: Support hex digits that use an uppercase 0X prefix. - Rob Shearman <rob@codeweavers.com> Sun, 27 Apr 2008 widl: Accept integer constant suffixes in the lexer. - Rob Shearman <rob@codeweavers.com> Tue, 29 Apr 2008 widl: Keep const attributes applied to pointers when writing out the type. Use an attribute to store the const qualifier for the pointer and type. Allow multiple type-qualifiers to be applied to a type by adding a declaration-specifier rule that encompasses type-qualifiers and types. - Rob Shearman <rob@codeweavers.com> Tue, 29 Apr 2008 widl: Add support for "inline" on function definitions. Fix applying calling convention to function type. - Rob Shearman <rob@codeweavers.com> Tue, 29 Apr 2008 widl: Make constdef and externdef take a declarator instead of an ident so that functions and arrays can be defined using the statements. - Rob Shearman <rob@codeweavers.com> Tue, 29 Apr 2008 widl: Allow pointer attributes to be applied to function pointers. - Rob Shearman <rob@codeweavers.com> Tue, 29 Apr 2008 widl: callback, code, comm_status and in_line are attribute names, not keywords. - Rob Shearman <rob@codeweavers.com> Wed, 30 Apr 2008 widl: Prepare for supporting storage classes in declaration statements. Return a decl_spec_t structure from decl_spec rules so that the storage class and type qualifiers can both be returned. - Rob Shearman <rob@codeweavers.com> Wed, 30 Apr 2008 widl: Add the parsing of storage classes into declaration-specifiers. Support the static and register keywords. This consolidates externdef and constdef rules into one declaration rule. - Rob Shearman <rob@codeweavers.com> Thu, 1 May 2008 widl: Consolidate writing of COM and dispatch interfaces into one function to remove duplicated code. Split up the writing into start and end to eventually support the style MIDL uses where it writes declared types, etc. between the start and end of the interface. Make internal header functions take the file pointer to print to. Don't write interface IDs for non-object interfaces and always write handle declarations even if the interface has no methods, like MIDL does. - Gerald Pfeifer <gerald@pfeifer.com> Fri, 2 May 2008 widl: Fix syntax to also work with older versions of bison. svn path=/trunk/; revision=37313
This commit is contained in:
parent
f4ea27302a
commit
a591ac9fa5
20 changed files with 4852 additions and 3660 deletions
|
@ -26,7 +26,7 @@ reactos/tools/wpp # Synced to Wine-20081105 (~Wine-1.1.7)
|
|||
reactos/tools/winebuild # Synced to Wine-20081105 (~Wine-1.1.7)
|
||||
reactos/tools/wmc # Synced to Wine-20081105 (~Wine-1.1.7)
|
||||
reactos/tools/wrc # Synced to Wine-20081105 (~Wine-1.1.7)
|
||||
reactos/tools/widl # Synced to Wine-0_9_60
|
||||
reactos/tools/widl # Synced to Wine-0_9_61
|
||||
|
||||
The following libraries are shared with Wine.
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "widltypes.h"
|
||||
#include "typegen.h"
|
||||
#include "expr.h"
|
||||
|
||||
static FILE* client;
|
||||
static int indent = 0;
|
||||
|
@ -70,25 +71,10 @@ static void check_pointers(const func_t *func)
|
|||
}
|
||||
}
|
||||
|
||||
const var_t* get_context_handle_var(const func_t* func)
|
||||
{
|
||||
const var_t* var;
|
||||
|
||||
if (!func->args)
|
||||
return NULL;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
if (is_attr(var->attrs, ATTR_IN) && is_context_handle(var->type))
|
||||
return var;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
const func_t *func;
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
const var_t *var;
|
||||
int method_count = 0;
|
||||
|
||||
|
@ -112,22 +98,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
if (!explicit_generic_handle_var)
|
||||
context_handle_var = get_context_handle_var(func);
|
||||
}
|
||||
if (explicit_handle)
|
||||
{
|
||||
if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
|
||||
{
|
||||
error("%s() does not define an explicit binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (implicit_handle)
|
||||
{
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
error("%s() must not define a binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
write_type_decl_left(client, get_func_return_type(func));
|
||||
if (needs_space_after(get_func_return_type(func)))
|
||||
|
@ -196,12 +166,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
fprintf(client, ");\n\n");
|
||||
}
|
||||
|
||||
if (implicit_handle)
|
||||
{
|
||||
print_client("_Handle = %s;\n", implicit_handle);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
else if (explicit_handle_var)
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
print_client("_Handle = %s;\n", explicit_handle_var->name);
|
||||
fprintf(client, "\n");
|
||||
|
@ -225,6 +190,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
indent--;
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
else if (implicit_handle)
|
||||
{
|
||||
print_client("_Handle = %s;\n", implicit_handle);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE);
|
||||
|
||||
|
@ -460,59 +430,69 @@ static void init_client(void)
|
|||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_routines, unsigned int *proc_offset)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (!need_stub(iface))
|
||||
return;
|
||||
|
||||
void write_client(ifref_list_t *ifaces)
|
||||
fprintf(client, "/*****************************************************************************\n");
|
||||
fprintf(client, " * %s interface\n", iface->name);
|
||||
fprintf(client, " */\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
if (iface->funcs)
|
||||
{
|
||||
write_implicithandledecl(iface);
|
||||
|
||||
write_clientinterfacedecl(iface);
|
||||
write_stubdescdecl(iface);
|
||||
write_function_stubs(iface, proc_offset);
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
print_client("#endif\n");
|
||||
|
||||
fprintf(client, "\n");
|
||||
write_stubdescriptor(iface, expr_eval_routines);
|
||||
}
|
||||
}
|
||||
else if (stmt->type == STMT_LIBRARY)
|
||||
write_client_ifaces(stmt->u.lib->stmts, expr_eval_routines, proc_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void write_client(const statement_list_t *stmts)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
int expr_eval_routines;
|
||||
ifref_t *iface;
|
||||
|
||||
if (!do_client)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(ifaces))
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_client();
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(client, indent, ifaces, need_stub);
|
||||
write_formatstringsdecl(client, indent, stmts, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(client, client_token);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(client, client_token);
|
||||
write_user_quad_list(client);
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
||||
{
|
||||
if (!need_stub(iface->iface))
|
||||
continue;
|
||||
|
||||
fprintf(client, "/*****************************************************************************\n");
|
||||
fprintf(client, " * %s interface\n", iface->iface->name);
|
||||
fprintf(client, " */\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
write_implicithandledecl(iface->iface);
|
||||
|
||||
write_clientinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
write_function_stubs(iface->iface, &proc_offset);
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
print_client("#endif\n");
|
||||
|
||||
fprintf(client, "\n");
|
||||
write_stubdescriptor(iface->iface, expr_eval_routines);
|
||||
}
|
||||
}
|
||||
write_client_ifaces(stmts, expr_eval_routines, &proc_offset);
|
||||
|
||||
fprintf(client, "\n");
|
||||
|
||||
write_procformatstring(client, ifaces, need_stub);
|
||||
write_typeformatstring(client, ifaces, need_stub);
|
||||
write_procformatstring(client, stmts, need_stub);
|
||||
write_typeformatstring(client, stmts, need_stub);
|
||||
|
||||
fclose(client);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
#include "expr.h"
|
||||
|
||||
typedef struct _user_type_t generic_handle_t;
|
||||
|
||||
|
@ -194,7 +195,7 @@ static void write_enums(FILE *h, var_list_t *enums)
|
|||
write_name(h, v);
|
||||
if (v->eval) {
|
||||
fprintf(h, " = ");
|
||||
write_expr(h, v->eval, 0);
|
||||
write_expr(h, v->eval, 0, 1, NULL, NULL);
|
||||
}
|
||||
}
|
||||
if (list_next( enums, &v->entry )) fprintf(h, ",\n");
|
||||
|
@ -212,7 +213,9 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
{
|
||||
if (!h) return;
|
||||
|
||||
if (t->is_const) fprintf(h, "const ");
|
||||
if (is_attr(t->attrs, ATTR_CONST) &&
|
||||
(t->kind == TKIND_ALIAS || t->declarray || !is_ptr(t)))
|
||||
fprintf(h, "const ");
|
||||
|
||||
if (t->kind == TKIND_ALIAS) fprintf(h, "%s", t->name);
|
||||
else if (t->declarray) write_type_left(h, t->ref, declonly);
|
||||
|
@ -272,6 +275,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
case RPC_FC_BOGUS_ARRAY:
|
||||
write_type_left(h, t->ref, declonly);
|
||||
fprintf(h, "%s*", needs_space_after(t->ref) ? " " : "");
|
||||
if (is_ptr(t) && is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const ");
|
||||
break;
|
||||
default:
|
||||
fprintf(h, "%s", t->name);
|
||||
|
@ -308,6 +312,7 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly,
|
|||
int i;
|
||||
const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV);
|
||||
if (!callconv) callconv = "";
|
||||
if (is_attr(pt->attrs, ATTR_INLINE)) fprintf(h, "inline ");
|
||||
write_type_left(h, pt->ref, declonly);
|
||||
fputc(' ', h);
|
||||
if (ptr_level) fputc('(', h);
|
||||
|
@ -472,111 +477,56 @@ void write_typedef(type_t *type)
|
|||
fprintf(header, ";\n");
|
||||
}
|
||||
|
||||
void write_expr(FILE *h, const expr_t *e, int brackets)
|
||||
int is_const_decl(const var_t *var)
|
||||
{
|
||||
switch (e->type) {
|
||||
case EXPR_VOID:
|
||||
break;
|
||||
case EXPR_NUM:
|
||||
fprintf(h, "%lu", e->u.lval);
|
||||
break;
|
||||
case EXPR_HEXNUM:
|
||||
fprintf(h, "0x%lx", e->u.lval);
|
||||
break;
|
||||
case EXPR_DOUBLE:
|
||||
fprintf(h, "%#.15g", e->u.dval);
|
||||
break;
|
||||
case EXPR_TRUEFALSE:
|
||||
if (e->u.lval == 0)
|
||||
fprintf(h, "FALSE");
|
||||
else
|
||||
fprintf(h, "TRUE");
|
||||
break;
|
||||
case EXPR_IDENTIFIER:
|
||||
fprintf(h, "%s", e->u.sval);
|
||||
break;
|
||||
case EXPR_NEG:
|
||||
fprintf(h, "-");
|
||||
write_expr(h, e->ref, 1);
|
||||
break;
|
||||
case EXPR_NOT:
|
||||
fprintf(h, "~");
|
||||
write_expr(h, e->ref, 1);
|
||||
break;
|
||||
case EXPR_PPTR:
|
||||
fprintf(h, "*");
|
||||
write_expr(h, e->ref, 1);
|
||||
break;
|
||||
case EXPR_CAST:
|
||||
fprintf(h, "(");
|
||||
write_type_decl(h, e->u.tref, NULL);
|
||||
fprintf(h, ")");
|
||||
write_expr(h, e->ref, 1);
|
||||
break;
|
||||
case EXPR_SIZEOF:
|
||||
fprintf(h, "sizeof(");
|
||||
write_type_decl(h, e->u.tref, NULL);
|
||||
fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_SHL:
|
||||
case EXPR_SHR:
|
||||
case EXPR_MUL:
|
||||
case EXPR_DIV:
|
||||
case EXPR_ADD:
|
||||
case EXPR_SUB:
|
||||
case EXPR_AND:
|
||||
case EXPR_OR:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1);
|
||||
switch (e->type) {
|
||||
case EXPR_SHL: fprintf(h, " << "); break;
|
||||
case EXPR_SHR: fprintf(h, " >> "); break;
|
||||
case EXPR_MUL: fprintf(h, " * "); break;
|
||||
case EXPR_DIV: fprintf(h, " / "); break;
|
||||
case EXPR_ADD: fprintf(h, " + "); break;
|
||||
case EXPR_SUB: fprintf(h, " - "); break;
|
||||
case EXPR_AND: fprintf(h, " & "); break;
|
||||
case EXPR_OR: fprintf(h, " | "); break;
|
||||
default: break;
|
||||
const type_t *t;
|
||||
/* strangely, MIDL accepts a const attribute on any pointer in the
|
||||
* declaration to mean that data isn't being instantiated. this appears
|
||||
* to be a bug, but there is no benefit to being incompatible with MIDL,
|
||||
* so we'll do the same thing */
|
||||
for (t = var->type; ; )
|
||||
{
|
||||
if (is_attr(t->attrs, ATTR_CONST))
|
||||
return TRUE;
|
||||
else if (is_ptr(t))
|
||||
t = t->ref;
|
||||
else break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void write_declaration(const var_t *v, int is_in_interface)
|
||||
{
|
||||
if (is_const_decl(v) && v->eval)
|
||||
{
|
||||
fprintf(header, "#define %s (", v->name);
|
||||
write_expr(header, v->eval, 0, 1, NULL, NULL);
|
||||
fprintf(header, ")\n\n");
|
||||
}
|
||||
else if (v->type->type != RPC_FC_FUNCTION || !is_in_interface)
|
||||
{
|
||||
switch (v->stgclass)
|
||||
{
|
||||
case STG_NONE:
|
||||
case STG_REGISTER: /* ignored */
|
||||
break;
|
||||
case STG_STATIC:
|
||||
fprintf(header, "static ");
|
||||
break;
|
||||
case STG_EXTERN:
|
||||
fprintf(header, "extern ");
|
||||
break;
|
||||
}
|
||||
write_expr(h, e->u.ext, 1);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_COND:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1);
|
||||
fprintf(h, " ? ");
|
||||
write_expr(h, e->u.ext, 1);
|
||||
fprintf(h, " : ");
|
||||
write_expr(h, e->ext2, 1);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_ADDRESSOF:
|
||||
fprintf(h, "&");
|
||||
write_expr(h, e->ref, 1);
|
||||
break;
|
||||
write_type_def_or_decl(header, v->type, FALSE, "%s", v->name);
|
||||
fprintf(header, ";\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void write_constdef(const var_t *v)
|
||||
void write_library(const typelib_t *typelib)
|
||||
{
|
||||
fprintf(header, "#define %s (", v->name);
|
||||
write_expr(header, v->eval, 0);
|
||||
fprintf(header, ")\n\n");
|
||||
}
|
||||
|
||||
void write_externdef(const var_t *v)
|
||||
{
|
||||
fprintf(header, "extern const ");
|
||||
write_type_def_or_decl(header, v->type, FALSE, "%s", v->name);
|
||||
fprintf(header, ";\n\n");
|
||||
}
|
||||
|
||||
void write_library(const char *name, const attr_list_t *attr)
|
||||
{
|
||||
const UUID *uuid = get_attrp(attr, ATTR_UUID);
|
||||
const UUID *uuid = get_attrp(typelib->attrs, ATTR_UUID);
|
||||
fprintf(header, "\n");
|
||||
write_guid(header, "LIBID", name, uuid);
|
||||
write_guid(header, "LIBID", typelib->name, uuid);
|
||||
fprintf(header, "\n");
|
||||
}
|
||||
|
||||
|
@ -626,6 +576,20 @@ const var_t* get_explicit_generic_handle_var(const func_t* func)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const var_t* get_context_handle_var(const func_t* func)
|
||||
{
|
||||
const var_t* var;
|
||||
|
||||
if (!func->args)
|
||||
return NULL;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
if (is_attr(var->attrs, ATTR_IN) && is_context_handle(var->type))
|
||||
return var;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int has_out_arg_or_return(const func_t *func)
|
||||
{
|
||||
const var_t *var;
|
||||
|
@ -664,11 +628,11 @@ const var_t *is_callas(const attr_list_t *a)
|
|||
return get_attrp(a, ATTR_CALLAS);
|
||||
}
|
||||
|
||||
static void write_method_macro(const type_t *iface, const char *name)
|
||||
static void write_method_macro(FILE *header, const type_t *iface, const char *name)
|
||||
{
|
||||
const func_t *cur;
|
||||
|
||||
if (iface->ref) write_method_macro(iface->ref, name);
|
||||
if (iface->ref) write_method_macro(header, iface->ref, name);
|
||||
|
||||
if (!iface->funcs) return;
|
||||
|
||||
|
@ -727,7 +691,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
|
|||
if (do_indent) indentation--;
|
||||
}
|
||||
|
||||
static void write_cpp_method_def(const type_t *iface)
|
||||
static void write_cpp_method_def(FILE *header, const type_t *iface)
|
||||
{
|
||||
const func_t *cur;
|
||||
|
||||
|
@ -752,11 +716,11 @@ static void write_cpp_method_def(const type_t *iface)
|
|||
}
|
||||
}
|
||||
|
||||
static void do_write_c_method_def(const type_t *iface, const char *name)
|
||||
static void do_write_c_method_def(FILE *header, const type_t *iface, const char *name)
|
||||
{
|
||||
const func_t *cur;
|
||||
|
||||
if (iface->ref) do_write_c_method_def(iface->ref, name);
|
||||
if (iface->ref) do_write_c_method_def(header, iface->ref, name);
|
||||
|
||||
if (!iface->funcs) return;
|
||||
indent(header, 0);
|
||||
|
@ -779,17 +743,17 @@ static void do_write_c_method_def(const type_t *iface, const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
static void write_c_method_def(const type_t *iface)
|
||||
static void write_c_method_def(FILE *header, const type_t *iface)
|
||||
{
|
||||
do_write_c_method_def(iface, iface->name);
|
||||
do_write_c_method_def(header, iface, iface->name);
|
||||
}
|
||||
|
||||
static void write_c_disp_method_def(const type_t *iface)
|
||||
static void write_c_disp_method_def(FILE *header, const type_t *iface)
|
||||
{
|
||||
do_write_c_method_def(iface->ref, iface->name);
|
||||
do_write_c_method_def(header, iface->ref, iface->name);
|
||||
}
|
||||
|
||||
static void write_method_proto(const type_t *iface)
|
||||
static void write_method_proto(FILE *header, const type_t *iface)
|
||||
{
|
||||
const func_t *cur;
|
||||
|
||||
|
@ -884,7 +848,7 @@ void write_locals(FILE *fp, const type_t *iface, int body)
|
|||
}
|
||||
}
|
||||
|
||||
static void write_function_proto(const type_t *iface, const func_t *fun, const char *prefix)
|
||||
static void write_function_proto(FILE *header, const type_t *iface, const func_t *fun, const char *prefix)
|
||||
{
|
||||
var_t *def = fun->def;
|
||||
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
|
||||
|
@ -902,47 +866,20 @@ static void write_function_proto(const type_t *iface, const func_t *fun, const c
|
|||
fprintf(header, ");\n\n");
|
||||
}
|
||||
|
||||
static void write_function_protos(const type_t *iface)
|
||||
static void write_function_protos(FILE *header, const type_t *iface)
|
||||
{
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
const var_t* explicit_handle_var;
|
||||
const var_t* explicit_generic_handle_var = NULL;
|
||||
const var_t* context_handle_var = NULL;
|
||||
const func_t *cur;
|
||||
int prefixes_differ = strcmp(prefix_client, prefix_server);
|
||||
|
||||
if (!iface->funcs) return;
|
||||
LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
|
||||
{
|
||||
var_t *def = cur->def;
|
||||
|
||||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(cur);
|
||||
if (!explicit_handle_var)
|
||||
{
|
||||
explicit_generic_handle_var = get_explicit_generic_handle_var(cur);
|
||||
if (!explicit_generic_handle_var)
|
||||
context_handle_var = get_context_handle_var(cur);
|
||||
}
|
||||
if (explicit_handle) {
|
||||
if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var) {
|
||||
error("%s() does not define an explicit binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
} else if (implicit_handle) {
|
||||
if (explicit_handle_var) {
|
||||
error("%s() must not define a binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefixes_differ) {
|
||||
fprintf(header, "/* client prototype */\n");
|
||||
write_function_proto(iface, cur, prefix_client);
|
||||
write_function_proto(header, iface, cur, prefix_client);
|
||||
fprintf(header, "/* server prototype */\n");
|
||||
}
|
||||
write_function_proto(iface, cur, prefix_server);
|
||||
write_function_proto(header, iface, cur, prefix_server);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -963,68 +900,76 @@ void write_forward(type_t *iface)
|
|||
}
|
||||
}
|
||||
|
||||
static void write_iface_guid(const type_t *iface)
|
||||
static void write_iface_guid(FILE *header, const type_t *iface)
|
||||
{
|
||||
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
||||
write_guid(header, "IID", iface->name, uuid);
|
||||
}
|
||||
|
||||
static void write_dispiface_guid(const type_t *iface)
|
||||
static void write_dispiface_guid(FILE *header, const type_t *iface)
|
||||
{
|
||||
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
||||
write_guid(header, "DIID", iface->name, uuid);
|
||||
}
|
||||
|
||||
static void write_coclass_guid(type_t *cocl)
|
||||
static void write_coclass_guid(FILE *header, const type_t *cocl)
|
||||
{
|
||||
const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID);
|
||||
write_guid(header, "CLSID", cocl->name, uuid);
|
||||
}
|
||||
|
||||
static void write_com_interface(type_t *iface)
|
||||
static void write_com_interface_start(FILE *header, const type_t *iface)
|
||||
{
|
||||
if (!iface->funcs && !iface->ref) {
|
||||
parser_warning("%s has no methods\n", iface->name);
|
||||
return;
|
||||
}
|
||||
|
||||
int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
|
||||
fprintf(header, "/*****************************************************************************\n");
|
||||
fprintf(header, " * %s interface\n", iface->name);
|
||||
fprintf(header, " * %s %sinterface\n", iface->name, dispinterface ? "disp" : "");
|
||||
fprintf(header, " */\n");
|
||||
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
|
||||
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
|
||||
write_iface_guid(iface);
|
||||
write_forward(iface);
|
||||
fprintf(header,"#ifndef __%s_%sINTERFACE_DEFINED__\n", iface->name, dispinterface ? "DISP" : "");
|
||||
fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->name, dispinterface ? "DISP" : "");
|
||||
}
|
||||
|
||||
static void write_com_interface_end(FILE *header, type_t *iface)
|
||||
{
|
||||
int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
|
||||
if (dispinterface)
|
||||
write_dispiface_guid(header, iface);
|
||||
else
|
||||
write_iface_guid(header, iface);
|
||||
/* C++ interface */
|
||||
fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
|
||||
if (iface->ref)
|
||||
{
|
||||
fprintf(header, "interface %s : public %s\n", iface->name, iface->ref->name);
|
||||
fprintf(header, "{\n");
|
||||
indentation++;
|
||||
write_cpp_method_def(iface);
|
||||
indentation--;
|
||||
fprintf(header, "};\n");
|
||||
fprintf(header, "interface %s : public %s\n", iface->name, iface->ref->name);
|
||||
fprintf(header, "{\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(header, "interface %s\n", iface->name);
|
||||
fprintf(header, "{\n");
|
||||
fprintf(header, " BEGIN_INTERFACE\n");
|
||||
fprintf(header, "\n");
|
||||
indentation++;
|
||||
write_cpp_method_def(iface);
|
||||
indentation--;
|
||||
fprintf(header, " END_INTERFACE\n");
|
||||
fprintf(header, "};\n");
|
||||
fprintf(header, "interface %s\n", iface->name);
|
||||
fprintf(header, "{\n");
|
||||
fprintf(header, " BEGIN_INTERFACE\n");
|
||||
fprintf(header, "\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 (!iface->ref)
|
||||
fprintf(header, " END_INTERFACE\n");
|
||||
fprintf(header, "};\n");
|
||||
fprintf(header, "#else\n");
|
||||
/* C interface */
|
||||
fprintf(header, "typedef struct %sVtbl {\n", iface->name);
|
||||
indentation++;
|
||||
fprintf(header, " BEGIN_INTERFACE\n");
|
||||
fprintf(header, "\n");
|
||||
write_c_method_def(iface);
|
||||
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);
|
||||
|
@ -1033,17 +978,25 @@ static void write_com_interface(type_t *iface)
|
|||
fprintf(header, "};\n");
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "#ifdef COBJMACROS\n");
|
||||
write_method_macro(iface, iface->name);
|
||||
/* dispinterfaces don't have real functions, so don't write macros for them,
|
||||
* only for the interface this interface inherits from, i.e. IDispatch */
|
||||
write_method_macro(header, dispinterface ? iface->ref : iface, iface->name);
|
||||
fprintf(header, "#endif\n");
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "#endif\n");
|
||||
fprintf(header, "\n");
|
||||
write_method_proto(iface);
|
||||
write_locals(header, iface, FALSE);
|
||||
fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
|
||||
/* dispinterfaces don't have real functions, so don't write prototypes for
|
||||
* them */
|
||||
if (!dispinterface)
|
||||
{
|
||||
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" : "");
|
||||
}
|
||||
|
||||
static void write_rpc_interface(const type_t *iface)
|
||||
static void write_rpc_interface_start(FILE *header, const type_t *iface)
|
||||
{
|
||||
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
|
@ -1061,72 +1014,39 @@ static void write_rpc_interface(const type_t *iface)
|
|||
fprintf(header, " */\n");
|
||||
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
|
||||
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
|
||||
if (iface->funcs)
|
||||
if (var) fprintf(header, "extern handle_t %s;\n", var);
|
||||
if (old_names)
|
||||
{
|
||||
write_iface_guid(iface);
|
||||
if (var) fprintf(header, "extern handle_t %s;\n", var);
|
||||
if (old_names)
|
||||
{
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_ClientIfHandle;\n", prefix_client, iface->name);
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_ServerIfHandle;\n", prefix_server, iface->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec;\n",
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec;\n",
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
}
|
||||
write_function_protos(iface);
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_ClientIfHandle;\n", prefix_client, iface->name);
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_ServerIfHandle;\n", prefix_server, iface->name);
|
||||
}
|
||||
fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
|
||||
else
|
||||
{
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec;\n",
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec;\n",
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: server/client code */
|
||||
static void write_rpc_interface_end(FILE *header, const type_t *iface)
|
||||
{
|
||||
fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
|
||||
}
|
||||
|
||||
void write_interface(type_t *iface)
|
||||
{
|
||||
if (is_object(iface->attrs))
|
||||
write_com_interface(iface);
|
||||
if (is_attr(iface->attrs, ATTR_DISPINTERFACE) || is_object(iface->attrs))
|
||||
{
|
||||
write_com_interface_start(header, iface);
|
||||
write_com_interface_end(header, iface);
|
||||
}
|
||||
else
|
||||
write_rpc_interface(iface);
|
||||
}
|
||||
|
||||
void write_dispinterface(type_t *iface)
|
||||
{
|
||||
fprintf(header, "/*****************************************************************************\n");
|
||||
fprintf(header, " * %s dispinterface\n", iface->name);
|
||||
fprintf(header, " */\n");
|
||||
fprintf(header,"#ifndef __%s_DISPINTERFACE_DEFINED__\n", iface->name);
|
||||
fprintf(header,"#define __%s_DISPINTERFACE_DEFINED__\n\n", iface->name);
|
||||
write_dispiface_guid(iface);
|
||||
write_forward(iface);
|
||||
/* C++ interface */
|
||||
fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
|
||||
fprintf(header, "interface %s : public %s\n", iface->name, iface->ref->name);
|
||||
fprintf(header, "{\n");
|
||||
fprintf(header, "};\n");
|
||||
fprintf(header, "#else\n");
|
||||
/* C interface */
|
||||
fprintf(header, "typedef struct %sVtbl {\n", iface->name);
|
||||
indentation++;
|
||||
fprintf(header, " BEGIN_INTERFACE\n");
|
||||
fprintf(header, "\n");
|
||||
write_c_disp_method_def(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");
|
||||
fprintf(header, "#ifdef COBJMACROS\n");
|
||||
write_method_macro(iface->ref, iface->name);
|
||||
fprintf(header, "#endif\n");
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "#endif\n");
|
||||
fprintf(header, "\n");
|
||||
fprintf(header,"#endif /* __%s_DISPINTERFACE_DEFINED__ */\n\n", iface->name);
|
||||
{
|
||||
write_rpc_interface_start(header, iface);
|
||||
write_function_protos(header, iface);
|
||||
write_rpc_interface_end(header, iface);
|
||||
}
|
||||
}
|
||||
|
||||
void write_coclass(type_t *cocl)
|
||||
|
@ -1134,7 +1054,7 @@ void write_coclass(type_t *cocl)
|
|||
fprintf(header, "/*****************************************************************************\n");
|
||||
fprintf(header, " * %s coclass\n", cocl->name);
|
||||
fprintf(header, " */\n\n");
|
||||
write_coclass_guid(cocl);
|
||||
write_coclass_guid(header, cocl);
|
||||
fprintf(header, "\n");
|
||||
}
|
||||
|
||||
|
@ -1145,3 +1065,15 @@ void write_coclass_forward(type_t *cocl)
|
|||
fprintf(header, "typedef struct %s %s;\n", cocl->name, cocl->name);
|
||||
fprintf(header, "#endif /* defined __%s_FWD_DEFINED__ */\n\n", cocl->name );
|
||||
}
|
||||
|
||||
void write_import(const char *fname)
|
||||
{
|
||||
char *hname, *p;
|
||||
|
||||
hname = dup_basename(fname, ".idl");
|
||||
p = hname + strlen(hname) - 2;
|
||||
if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
|
||||
|
||||
fprintf(header, "#include <%s>\n", hname);
|
||||
free(hname);
|
||||
}
|
||||
|
|
|
@ -44,22 +44,20 @@ extern int is_object(const attr_list_t *list);
|
|||
extern int is_local(const attr_list_t *list);
|
||||
extern int need_stub(const type_t *iface);
|
||||
extern int need_proxy(const type_t *iface);
|
||||
extern int need_stub_files(const ifref_list_t *ifaces);
|
||||
extern int need_proxy_file(const ifref_list_t *ifaces);
|
||||
extern int need_stub_files(const statement_list_t *stmts);
|
||||
extern int need_proxy_file(const statement_list_t *stmts);
|
||||
extern const var_t *is_callas(const attr_list_t *list);
|
||||
extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);
|
||||
extern void write_array(FILE *h, array_dims_t *v, int field);
|
||||
extern void write_import(const char *fname);
|
||||
extern void write_forward(type_t *iface);
|
||||
extern void write_interface(type_t *iface);
|
||||
extern void write_dispinterface(type_t *iface);
|
||||
extern void write_locals(FILE *fp, const type_t *iface, int body);
|
||||
extern void write_coclass(type_t *cocl);
|
||||
extern void write_coclass_forward(type_t *cocl);
|
||||
extern void write_typedef(type_t *type);
|
||||
extern void write_expr(FILE *h, const expr_t *e, int brackets);
|
||||
extern void write_constdef(const var_t *v);
|
||||
extern void write_externdef(const var_t *v);
|
||||
extern void write_library(const char *name, const attr_list_t *attr);
|
||||
extern void write_declaration(const var_t *v, int is_in_interface);
|
||||
extern void write_library(const typelib_t *typelib);
|
||||
extern void write_user_types(void);
|
||||
extern void write_context_handle_rundowns(void);
|
||||
extern void write_generic_handle_routines(void);
|
||||
|
@ -70,6 +68,7 @@ extern const var_t* get_context_handle_var(const func_t* func);
|
|||
extern int has_out_arg_or_return(const func_t *func);
|
||||
extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
|
||||
const UUID *uuid);
|
||||
extern int is_const_decl(const var_t *var);
|
||||
|
||||
static inline int last_ptr(const type_t *type)
|
||||
{
|
||||
|
|
|
@ -25,13 +25,16 @@
|
|||
nl \r?\n
|
||||
ws [ \f\t\r]
|
||||
cident [a-zA-Z_][0-9a-zA-Z_]*
|
||||
int [0-9]+
|
||||
u_suffix (u|U)
|
||||
l_suffix (l|L)
|
||||
int [0-9]+({l_suffix}?{u_suffix}?|{u_suffix}?{l_suffix}?)?
|
||||
hexd [0-9a-fA-F]
|
||||
hex 0x{hexd}+
|
||||
hex 0(x|X){hexd}+({l_suffix}?{u_suffix}?|{u_suffix}?{l_suffix}?)?
|
||||
uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12}
|
||||
double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
|
||||
|
||||
%x QUOTE
|
||||
%x WSTRQUOTE
|
||||
%x ATTR
|
||||
%x PP_LINE
|
||||
|
||||
|
@ -133,10 +136,16 @@ UUID *parse_uuid(const char *u)
|
|||
parser_lval.str = get_buffered_cstring();
|
||||
return aSTRING;
|
||||
}
|
||||
<QUOTE>\\\\ |
|
||||
<QUOTE>\\\" addcchar(yytext[1]);
|
||||
<QUOTE>\\. addcchar('\\'); addcchar(yytext[1]);
|
||||
<QUOTE>. addcchar(yytext[0]);
|
||||
<INITIAL,ATTR>L\" yy_push_state(WSTRQUOTE);
|
||||
<WSTRQUOTE>\" {
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
return aWSTRING;
|
||||
}
|
||||
<QUOTE,WSTRQUOTE>\\\\ |
|
||||
<QUOTE,WSTRQUOTE>\\\" addcchar(yytext[1]);
|
||||
<QUOTE,WSTRQUOTE>\\. addcchar('\\'); addcchar(yytext[1]);
|
||||
<QUOTE,WSTRQUOTE>. addcchar(yytext[0]);
|
||||
<INITIAL,ATTR>\[ yy_push_state(ATTR); return '[';
|
||||
<ATTR>\] yy_pop_state(); return ']';
|
||||
<ATTR>{cident} return attr_token(yytext);
|
||||
|
@ -162,6 +171,13 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
|||
<INITIAL,ATTR>{ws}
|
||||
<INITIAL,ATTR>\<\< return SHL;
|
||||
<INITIAL,ATTR>\>\> return SHR;
|
||||
<INITIAL,ATTR>\-\> return MEMBERPTR;
|
||||
<INITIAL,ATTR>== return EQUALITY;
|
||||
<INITIAL,ATTR>!= return INEQUALITY;
|
||||
<INITIAL,ATTR>\>= return GREATEREQUAL;
|
||||
<INITIAL,ATTR>\<= return LESSEQUAL;
|
||||
<INITIAL,ATTR>\|\| return LOGICALOR;
|
||||
<INITIAL,ATTR>&& return LOGICALAND;
|
||||
<INITIAL,ATTR>. return yytext[0];
|
||||
<<EOF>> {
|
||||
if (import_stack_ptr)
|
||||
|
@ -184,6 +200,7 @@ struct keyword {
|
|||
|
||||
static const struct keyword keywords[] = {
|
||||
{"FALSE", tFALSE},
|
||||
{"NULL", tNULL},
|
||||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__fastcall", tFASTCALL},
|
||||
|
@ -196,13 +213,10 @@ static const struct keyword keywords[] = {
|
|||
{"_stdcall", tSTDCALL},
|
||||
{"boolean", tBOOLEAN},
|
||||
{"byte", tBYTE},
|
||||
{"callback", tCALLBACK},
|
||||
{"case", tCASE},
|
||||
{"cdecl", tCDECL},
|
||||
{"char", tCHAR},
|
||||
{"coclass", tCOCLASS},
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"const", tCONST},
|
||||
{"cpp_quote", tCPPQUOTE},
|
||||
{"default", tDEFAULT},
|
||||
|
@ -216,7 +230,7 @@ static const struct keyword keywords[] = {
|
|||
{"hyper", tHYPER},
|
||||
{"import", tIMPORT},
|
||||
{"importlib", tIMPORTLIB},
|
||||
{"in_line", tINLINE},
|
||||
{"inline", tINLINE},
|
||||
{"int", tINT},
|
||||
{"interface", tINTERFACE},
|
||||
{"library", tLIBRARY},
|
||||
|
@ -225,10 +239,12 @@ static const struct keyword keywords[] = {
|
|||
{"module", tMODULE},
|
||||
{"pascal", tPASCAL},
|
||||
{"properties", tPROPERTIES},
|
||||
{"register", tREGISTER},
|
||||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
{"small", tSMALL},
|
||||
{"static", tSTATIC},
|
||||
{"stdcall", tSTDCALL},
|
||||
{"struct", tSTRUCT},
|
||||
{"switch", tSWITCH},
|
||||
|
@ -253,6 +269,9 @@ static const struct keyword attr_keywords[] =
|
|||
{"broadcast", tBROADCAST},
|
||||
{"byte_count", tBYTECOUNT},
|
||||
{"call_as", tCALLAS},
|
||||
{"callback", tCALLBACK},
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"context_handle", tCONTEXTHANDLE},
|
||||
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
|
@ -279,6 +298,7 @@ static const struct keyword attr_keywords[] =
|
|||
{"immediatebind", tIMMEDIATEBIND},
|
||||
{"implicit_handle", tIMPLICITHANDLE},
|
||||
{"in", tIN},
|
||||
{"in_line", tIN_LINE},
|
||||
{"input_sync", tINPUTSYNC},
|
||||
{"lcid", tLCID},
|
||||
{"length_is", tLENGTHIS},
|
||||
|
@ -383,7 +403,6 @@ void pop_import(void)
|
|||
free(temp_name);
|
||||
}
|
||||
temp_name = import_stack[ptr].temp_name;
|
||||
free( input_name );
|
||||
input_name = import_stack[ptr].input_name;
|
||||
line_number = import_stack[ptr].line_number;
|
||||
import_stack_ptr--;
|
||||
|
@ -397,20 +416,11 @@ struct imports {
|
|||
int do_import(char *fname)
|
||||
{
|
||||
FILE *f;
|
||||
char *hname, *path, *p;
|
||||
char *path;
|
||||
struct imports *import;
|
||||
int ptr = import_stack_ptr;
|
||||
int ret;
|
||||
|
||||
if (!parse_only && do_header) {
|
||||
hname = dup_basename(fname, ".idl");
|
||||
p = hname + strlen(hname) - 2;
|
||||
if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
|
||||
|
||||
fprintf(header, "#include <%s>\n", hname);
|
||||
free(hname);
|
||||
}
|
||||
|
||||
import = first_import;
|
||||
while (import && strcmp(import->name, fname))
|
||||
import = import->next;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,136 +35,149 @@
|
|||
aHEXNUM = 261,
|
||||
aDOUBLE = 262,
|
||||
aSTRING = 263,
|
||||
aUUID = 264,
|
||||
aEOF = 265,
|
||||
SHL = 266,
|
||||
SHR = 267,
|
||||
tAGGREGATABLE = 268,
|
||||
tALLOCATE = 269,
|
||||
tAPPOBJECT = 270,
|
||||
tASYNC = 271,
|
||||
tASYNCUUID = 272,
|
||||
tAUTOHANDLE = 273,
|
||||
tBINDABLE = 274,
|
||||
tBOOLEAN = 275,
|
||||
tBROADCAST = 276,
|
||||
tBYTE = 277,
|
||||
tBYTECOUNT = 278,
|
||||
tCALLAS = 279,
|
||||
tCALLBACK = 280,
|
||||
tCASE = 281,
|
||||
tCDECL = 282,
|
||||
tCHAR = 283,
|
||||
tCOCLASS = 284,
|
||||
tCODE = 285,
|
||||
tCOMMSTATUS = 286,
|
||||
tCONST = 287,
|
||||
tCONTEXTHANDLE = 288,
|
||||
tCONTEXTHANDLENOSERIALIZE = 289,
|
||||
tCONTEXTHANDLESERIALIZE = 290,
|
||||
tCONTROL = 291,
|
||||
tCPPQUOTE = 292,
|
||||
tDEFAULT = 293,
|
||||
tDEFAULTCOLLELEM = 294,
|
||||
tDEFAULTVALUE = 295,
|
||||
tDEFAULTVTABLE = 296,
|
||||
tDISPLAYBIND = 297,
|
||||
tDISPINTERFACE = 298,
|
||||
tDLLNAME = 299,
|
||||
tDOUBLE = 300,
|
||||
tDUAL = 301,
|
||||
tENDPOINT = 302,
|
||||
tENTRY = 303,
|
||||
tENUM = 304,
|
||||
tERRORSTATUST = 305,
|
||||
tEXPLICITHANDLE = 306,
|
||||
tEXTERN = 307,
|
||||
tFALSE = 308,
|
||||
tFASTCALL = 309,
|
||||
tFLOAT = 310,
|
||||
tHANDLE = 311,
|
||||
tHANDLET = 312,
|
||||
tHELPCONTEXT = 313,
|
||||
tHELPFILE = 314,
|
||||
tHELPSTRING = 315,
|
||||
tHELPSTRINGCONTEXT = 316,
|
||||
tHELPSTRINGDLL = 317,
|
||||
tHIDDEN = 318,
|
||||
tHYPER = 319,
|
||||
tID = 320,
|
||||
tIDEMPOTENT = 321,
|
||||
tIIDIS = 322,
|
||||
tIMMEDIATEBIND = 323,
|
||||
tIMPLICITHANDLE = 324,
|
||||
tIMPORT = 325,
|
||||
tIMPORTLIB = 326,
|
||||
tIN = 327,
|
||||
tINLINE = 328,
|
||||
tINPUTSYNC = 329,
|
||||
tINT = 330,
|
||||
tINT64 = 331,
|
||||
tINTERFACE = 332,
|
||||
tLCID = 333,
|
||||
tLENGTHIS = 334,
|
||||
tLIBRARY = 335,
|
||||
tLOCAL = 336,
|
||||
tLONG = 337,
|
||||
tMETHODS = 338,
|
||||
tMODULE = 339,
|
||||
tNONBROWSABLE = 340,
|
||||
tNONCREATABLE = 341,
|
||||
tNONEXTENSIBLE = 342,
|
||||
tOBJECT = 343,
|
||||
tODL = 344,
|
||||
tOLEAUTOMATION = 345,
|
||||
tOPTIONAL = 346,
|
||||
tOUT = 347,
|
||||
tPASCAL = 348,
|
||||
tPOINTERDEFAULT = 349,
|
||||
tPROPERTIES = 350,
|
||||
tPROPGET = 351,
|
||||
tPROPPUT = 352,
|
||||
tPROPPUTREF = 353,
|
||||
tPTR = 354,
|
||||
tPUBLIC = 355,
|
||||
tRANGE = 356,
|
||||
tREADONLY = 357,
|
||||
tREF = 358,
|
||||
tREQUESTEDIT = 359,
|
||||
tRESTRICTED = 360,
|
||||
tRETVAL = 361,
|
||||
tSAFEARRAY = 362,
|
||||
tSHORT = 363,
|
||||
tSIGNED = 364,
|
||||
tSINGLE = 365,
|
||||
tSIZEIS = 366,
|
||||
tSIZEOF = 367,
|
||||
tSMALL = 368,
|
||||
tSOURCE = 369,
|
||||
tSTDCALL = 370,
|
||||
tSTRICTCONTEXTHANDLE = 371,
|
||||
tSTRING = 372,
|
||||
tSTRUCT = 373,
|
||||
tSWITCH = 374,
|
||||
tSWITCHIS = 375,
|
||||
tSWITCHTYPE = 376,
|
||||
tTRANSMITAS = 377,
|
||||
tTRUE = 378,
|
||||
tTYPEDEF = 379,
|
||||
tUNION = 380,
|
||||
tUNIQUE = 381,
|
||||
tUNSIGNED = 382,
|
||||
tUUID = 383,
|
||||
tV1ENUM = 384,
|
||||
tVARARG = 385,
|
||||
tVERSION = 386,
|
||||
tVOID = 387,
|
||||
tWCHAR = 388,
|
||||
tWIREMARSHAL = 389,
|
||||
CAST = 390,
|
||||
PPTR = 391,
|
||||
NEG = 392,
|
||||
ADDRESSOF = 393
|
||||
aWSTRING = 264,
|
||||
aUUID = 265,
|
||||
aEOF = 266,
|
||||
SHL = 267,
|
||||
SHR = 268,
|
||||
MEMBERPTR = 269,
|
||||
EQUALITY = 270,
|
||||
INEQUALITY = 271,
|
||||
GREATEREQUAL = 272,
|
||||
LESSEQUAL = 273,
|
||||
LOGICALOR = 274,
|
||||
LOGICALAND = 275,
|
||||
tAGGREGATABLE = 276,
|
||||
tALLOCATE = 277,
|
||||
tAPPOBJECT = 278,
|
||||
tASYNC = 279,
|
||||
tASYNCUUID = 280,
|
||||
tAUTOHANDLE = 281,
|
||||
tBINDABLE = 282,
|
||||
tBOOLEAN = 283,
|
||||
tBROADCAST = 284,
|
||||
tBYTE = 285,
|
||||
tBYTECOUNT = 286,
|
||||
tCALLAS = 287,
|
||||
tCALLBACK = 288,
|
||||
tCASE = 289,
|
||||
tCDECL = 290,
|
||||
tCHAR = 291,
|
||||
tCOCLASS = 292,
|
||||
tCODE = 293,
|
||||
tCOMMSTATUS = 294,
|
||||
tCONST = 295,
|
||||
tCONTEXTHANDLE = 296,
|
||||
tCONTEXTHANDLENOSERIALIZE = 297,
|
||||
tCONTEXTHANDLESERIALIZE = 298,
|
||||
tCONTROL = 299,
|
||||
tCPPQUOTE = 300,
|
||||
tDEFAULT = 301,
|
||||
tDEFAULTCOLLELEM = 302,
|
||||
tDEFAULTVALUE = 303,
|
||||
tDEFAULTVTABLE = 304,
|
||||
tDISPLAYBIND = 305,
|
||||
tDISPINTERFACE = 306,
|
||||
tDLLNAME = 307,
|
||||
tDOUBLE = 308,
|
||||
tDUAL = 309,
|
||||
tENDPOINT = 310,
|
||||
tENTRY = 311,
|
||||
tENUM = 312,
|
||||
tERRORSTATUST = 313,
|
||||
tEXPLICITHANDLE = 314,
|
||||
tEXTERN = 315,
|
||||
tFALSE = 316,
|
||||
tFASTCALL = 317,
|
||||
tFLOAT = 318,
|
||||
tHANDLE = 319,
|
||||
tHANDLET = 320,
|
||||
tHELPCONTEXT = 321,
|
||||
tHELPFILE = 322,
|
||||
tHELPSTRING = 323,
|
||||
tHELPSTRINGCONTEXT = 324,
|
||||
tHELPSTRINGDLL = 325,
|
||||
tHIDDEN = 326,
|
||||
tHYPER = 327,
|
||||
tID = 328,
|
||||
tIDEMPOTENT = 329,
|
||||
tIIDIS = 330,
|
||||
tIMMEDIATEBIND = 331,
|
||||
tIMPLICITHANDLE = 332,
|
||||
tIMPORT = 333,
|
||||
tIMPORTLIB = 334,
|
||||
tIN = 335,
|
||||
tIN_LINE = 336,
|
||||
tINLINE = 337,
|
||||
tINPUTSYNC = 338,
|
||||
tINT = 339,
|
||||
tINT64 = 340,
|
||||
tINTERFACE = 341,
|
||||
tLCID = 342,
|
||||
tLENGTHIS = 343,
|
||||
tLIBRARY = 344,
|
||||
tLOCAL = 345,
|
||||
tLONG = 346,
|
||||
tMETHODS = 347,
|
||||
tMODULE = 348,
|
||||
tNONBROWSABLE = 349,
|
||||
tNONCREATABLE = 350,
|
||||
tNONEXTENSIBLE = 351,
|
||||
tNULL = 352,
|
||||
tOBJECT = 353,
|
||||
tODL = 354,
|
||||
tOLEAUTOMATION = 355,
|
||||
tOPTIONAL = 356,
|
||||
tOUT = 357,
|
||||
tPASCAL = 358,
|
||||
tPOINTERDEFAULT = 359,
|
||||
tPROPERTIES = 360,
|
||||
tPROPGET = 361,
|
||||
tPROPPUT = 362,
|
||||
tPROPPUTREF = 363,
|
||||
tPTR = 364,
|
||||
tPUBLIC = 365,
|
||||
tRANGE = 366,
|
||||
tREADONLY = 367,
|
||||
tREF = 368,
|
||||
tREGISTER = 369,
|
||||
tREQUESTEDIT = 370,
|
||||
tRESTRICTED = 371,
|
||||
tRETVAL = 372,
|
||||
tSAFEARRAY = 373,
|
||||
tSHORT = 374,
|
||||
tSIGNED = 375,
|
||||
tSINGLE = 376,
|
||||
tSIZEIS = 377,
|
||||
tSIZEOF = 378,
|
||||
tSMALL = 379,
|
||||
tSOURCE = 380,
|
||||
tSTATIC = 381,
|
||||
tSTDCALL = 382,
|
||||
tSTRICTCONTEXTHANDLE = 383,
|
||||
tSTRING = 384,
|
||||
tSTRUCT = 385,
|
||||
tSWITCH = 386,
|
||||
tSWITCHIS = 387,
|
||||
tSWITCHTYPE = 388,
|
||||
tTRANSMITAS = 389,
|
||||
tTRUE = 390,
|
||||
tTYPEDEF = 391,
|
||||
tUNION = 392,
|
||||
tUNIQUE = 393,
|
||||
tUNSIGNED = 394,
|
||||
tUUID = 395,
|
||||
tV1ENUM = 396,
|
||||
tVARARG = 397,
|
||||
tVERSION = 398,
|
||||
tVOID = 399,
|
||||
tWCHAR = 400,
|
||||
tWIREMARSHAL = 401,
|
||||
ADDRESSOF = 402,
|
||||
NEG = 403,
|
||||
POS = 404,
|
||||
PPTR = 405,
|
||||
CAST = 406
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -174,142 +187,155 @@
|
|||
#define aHEXNUM 261
|
||||
#define aDOUBLE 262
|
||||
#define aSTRING 263
|
||||
#define aUUID 264
|
||||
#define aEOF 265
|
||||
#define SHL 266
|
||||
#define SHR 267
|
||||
#define tAGGREGATABLE 268
|
||||
#define tALLOCATE 269
|
||||
#define tAPPOBJECT 270
|
||||
#define tASYNC 271
|
||||
#define tASYNCUUID 272
|
||||
#define tAUTOHANDLE 273
|
||||
#define tBINDABLE 274
|
||||
#define tBOOLEAN 275
|
||||
#define tBROADCAST 276
|
||||
#define tBYTE 277
|
||||
#define tBYTECOUNT 278
|
||||
#define tCALLAS 279
|
||||
#define tCALLBACK 280
|
||||
#define tCASE 281
|
||||
#define tCDECL 282
|
||||
#define tCHAR 283
|
||||
#define tCOCLASS 284
|
||||
#define tCODE 285
|
||||
#define tCOMMSTATUS 286
|
||||
#define tCONST 287
|
||||
#define tCONTEXTHANDLE 288
|
||||
#define tCONTEXTHANDLENOSERIALIZE 289
|
||||
#define tCONTEXTHANDLESERIALIZE 290
|
||||
#define tCONTROL 291
|
||||
#define tCPPQUOTE 292
|
||||
#define tDEFAULT 293
|
||||
#define tDEFAULTCOLLELEM 294
|
||||
#define tDEFAULTVALUE 295
|
||||
#define tDEFAULTVTABLE 296
|
||||
#define tDISPLAYBIND 297
|
||||
#define tDISPINTERFACE 298
|
||||
#define tDLLNAME 299
|
||||
#define tDOUBLE 300
|
||||
#define tDUAL 301
|
||||
#define tENDPOINT 302
|
||||
#define tENTRY 303
|
||||
#define tENUM 304
|
||||
#define tERRORSTATUST 305
|
||||
#define tEXPLICITHANDLE 306
|
||||
#define tEXTERN 307
|
||||
#define tFALSE 308
|
||||
#define tFASTCALL 309
|
||||
#define tFLOAT 310
|
||||
#define tHANDLE 311
|
||||
#define tHANDLET 312
|
||||
#define tHELPCONTEXT 313
|
||||
#define tHELPFILE 314
|
||||
#define tHELPSTRING 315
|
||||
#define tHELPSTRINGCONTEXT 316
|
||||
#define tHELPSTRINGDLL 317
|
||||
#define tHIDDEN 318
|
||||
#define tHYPER 319
|
||||
#define tID 320
|
||||
#define tIDEMPOTENT 321
|
||||
#define tIIDIS 322
|
||||
#define tIMMEDIATEBIND 323
|
||||
#define tIMPLICITHANDLE 324
|
||||
#define tIMPORT 325
|
||||
#define tIMPORTLIB 326
|
||||
#define tIN 327
|
||||
#define tINLINE 328
|
||||
#define tINPUTSYNC 329
|
||||
#define tINT 330
|
||||
#define tINT64 331
|
||||
#define tINTERFACE 332
|
||||
#define tLCID 333
|
||||
#define tLENGTHIS 334
|
||||
#define tLIBRARY 335
|
||||
#define tLOCAL 336
|
||||
#define tLONG 337
|
||||
#define tMETHODS 338
|
||||
#define tMODULE 339
|
||||
#define tNONBROWSABLE 340
|
||||
#define tNONCREATABLE 341
|
||||
#define tNONEXTENSIBLE 342
|
||||
#define tOBJECT 343
|
||||
#define tODL 344
|
||||
#define tOLEAUTOMATION 345
|
||||
#define tOPTIONAL 346
|
||||
#define tOUT 347
|
||||
#define tPASCAL 348
|
||||
#define tPOINTERDEFAULT 349
|
||||
#define tPROPERTIES 350
|
||||
#define tPROPGET 351
|
||||
#define tPROPPUT 352
|
||||
#define tPROPPUTREF 353
|
||||
#define tPTR 354
|
||||
#define tPUBLIC 355
|
||||
#define tRANGE 356
|
||||
#define tREADONLY 357
|
||||
#define tREF 358
|
||||
#define tREQUESTEDIT 359
|
||||
#define tRESTRICTED 360
|
||||
#define tRETVAL 361
|
||||
#define tSAFEARRAY 362
|
||||
#define tSHORT 363
|
||||
#define tSIGNED 364
|
||||
#define tSINGLE 365
|
||||
#define tSIZEIS 366
|
||||
#define tSIZEOF 367
|
||||
#define tSMALL 368
|
||||
#define tSOURCE 369
|
||||
#define tSTDCALL 370
|
||||
#define tSTRICTCONTEXTHANDLE 371
|
||||
#define tSTRING 372
|
||||
#define tSTRUCT 373
|
||||
#define tSWITCH 374
|
||||
#define tSWITCHIS 375
|
||||
#define tSWITCHTYPE 376
|
||||
#define tTRANSMITAS 377
|
||||
#define tTRUE 378
|
||||
#define tTYPEDEF 379
|
||||
#define tUNION 380
|
||||
#define tUNIQUE 381
|
||||
#define tUNSIGNED 382
|
||||
#define tUUID 383
|
||||
#define tV1ENUM 384
|
||||
#define tVARARG 385
|
||||
#define tVERSION 386
|
||||
#define tVOID 387
|
||||
#define tWCHAR 388
|
||||
#define tWIREMARSHAL 389
|
||||
#define CAST 390
|
||||
#define PPTR 391
|
||||
#define NEG 392
|
||||
#define ADDRESSOF 393
|
||||
#define aWSTRING 264
|
||||
#define aUUID 265
|
||||
#define aEOF 266
|
||||
#define SHL 267
|
||||
#define SHR 268
|
||||
#define MEMBERPTR 269
|
||||
#define EQUALITY 270
|
||||
#define INEQUALITY 271
|
||||
#define GREATEREQUAL 272
|
||||
#define LESSEQUAL 273
|
||||
#define LOGICALOR 274
|
||||
#define LOGICALAND 275
|
||||
#define tAGGREGATABLE 276
|
||||
#define tALLOCATE 277
|
||||
#define tAPPOBJECT 278
|
||||
#define tASYNC 279
|
||||
#define tASYNCUUID 280
|
||||
#define tAUTOHANDLE 281
|
||||
#define tBINDABLE 282
|
||||
#define tBOOLEAN 283
|
||||
#define tBROADCAST 284
|
||||
#define tBYTE 285
|
||||
#define tBYTECOUNT 286
|
||||
#define tCALLAS 287
|
||||
#define tCALLBACK 288
|
||||
#define tCASE 289
|
||||
#define tCDECL 290
|
||||
#define tCHAR 291
|
||||
#define tCOCLASS 292
|
||||
#define tCODE 293
|
||||
#define tCOMMSTATUS 294
|
||||
#define tCONST 295
|
||||
#define tCONTEXTHANDLE 296
|
||||
#define tCONTEXTHANDLENOSERIALIZE 297
|
||||
#define tCONTEXTHANDLESERIALIZE 298
|
||||
#define tCONTROL 299
|
||||
#define tCPPQUOTE 300
|
||||
#define tDEFAULT 301
|
||||
#define tDEFAULTCOLLELEM 302
|
||||
#define tDEFAULTVALUE 303
|
||||
#define tDEFAULTVTABLE 304
|
||||
#define tDISPLAYBIND 305
|
||||
#define tDISPINTERFACE 306
|
||||
#define tDLLNAME 307
|
||||
#define tDOUBLE 308
|
||||
#define tDUAL 309
|
||||
#define tENDPOINT 310
|
||||
#define tENTRY 311
|
||||
#define tENUM 312
|
||||
#define tERRORSTATUST 313
|
||||
#define tEXPLICITHANDLE 314
|
||||
#define tEXTERN 315
|
||||
#define tFALSE 316
|
||||
#define tFASTCALL 317
|
||||
#define tFLOAT 318
|
||||
#define tHANDLE 319
|
||||
#define tHANDLET 320
|
||||
#define tHELPCONTEXT 321
|
||||
#define tHELPFILE 322
|
||||
#define tHELPSTRING 323
|
||||
#define tHELPSTRINGCONTEXT 324
|
||||
#define tHELPSTRINGDLL 325
|
||||
#define tHIDDEN 326
|
||||
#define tHYPER 327
|
||||
#define tID 328
|
||||
#define tIDEMPOTENT 329
|
||||
#define tIIDIS 330
|
||||
#define tIMMEDIATEBIND 331
|
||||
#define tIMPLICITHANDLE 332
|
||||
#define tIMPORT 333
|
||||
#define tIMPORTLIB 334
|
||||
#define tIN 335
|
||||
#define tIN_LINE 336
|
||||
#define tINLINE 337
|
||||
#define tINPUTSYNC 338
|
||||
#define tINT 339
|
||||
#define tINT64 340
|
||||
#define tINTERFACE 341
|
||||
#define tLCID 342
|
||||
#define tLENGTHIS 343
|
||||
#define tLIBRARY 344
|
||||
#define tLOCAL 345
|
||||
#define tLONG 346
|
||||
#define tMETHODS 347
|
||||
#define tMODULE 348
|
||||
#define tNONBROWSABLE 349
|
||||
#define tNONCREATABLE 350
|
||||
#define tNONEXTENSIBLE 351
|
||||
#define tNULL 352
|
||||
#define tOBJECT 353
|
||||
#define tODL 354
|
||||
#define tOLEAUTOMATION 355
|
||||
#define tOPTIONAL 356
|
||||
#define tOUT 357
|
||||
#define tPASCAL 358
|
||||
#define tPOINTERDEFAULT 359
|
||||
#define tPROPERTIES 360
|
||||
#define tPROPGET 361
|
||||
#define tPROPPUT 362
|
||||
#define tPROPPUTREF 363
|
||||
#define tPTR 364
|
||||
#define tPUBLIC 365
|
||||
#define tRANGE 366
|
||||
#define tREADONLY 367
|
||||
#define tREF 368
|
||||
#define tREGISTER 369
|
||||
#define tREQUESTEDIT 370
|
||||
#define tRESTRICTED 371
|
||||
#define tRETVAL 372
|
||||
#define tSAFEARRAY 373
|
||||
#define tSHORT 374
|
||||
#define tSIGNED 375
|
||||
#define tSINGLE 376
|
||||
#define tSIZEIS 377
|
||||
#define tSIZEOF 378
|
||||
#define tSMALL 379
|
||||
#define tSOURCE 380
|
||||
#define tSTATIC 381
|
||||
#define tSTDCALL 382
|
||||
#define tSTRICTCONTEXTHANDLE 383
|
||||
#define tSTRING 384
|
||||
#define tSTRUCT 385
|
||||
#define tSWITCH 386
|
||||
#define tSWITCHIS 387
|
||||
#define tSWITCHTYPE 388
|
||||
#define tTRANSMITAS 389
|
||||
#define tTRUE 390
|
||||
#define tTYPEDEF 391
|
||||
#define tUNION 392
|
||||
#define tUNIQUE 393
|
||||
#define tUNSIGNED 394
|
||||
#define tUUID 395
|
||||
#define tV1ENUM 396
|
||||
#define tVARARG 397
|
||||
#define tVERSION 398
|
||||
#define tVOID 399
|
||||
#define tWCHAR 400
|
||||
#define tWIREMARSHAL 401
|
||||
#define ADDRESSOF 402
|
||||
#define NEG 403
|
||||
#define POS 404
|
||||
#define PPTR 405
|
||||
#define CAST 406
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 151 "parser.y"
|
||||
#line 177 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
attr_t *attr;
|
||||
attr_list_t *attr_list;
|
||||
|
@ -320,10 +346,12 @@ typedef union YYSTYPE {
|
|||
type_t *type;
|
||||
var_t *var;
|
||||
var_list_t *var_list;
|
||||
pident_t *pident;
|
||||
pident_list_t *pident_list;
|
||||
declarator_t *declarator;
|
||||
declarator_list_t *declarator_list;
|
||||
func_t *func;
|
||||
func_list_t *func_list;
|
||||
statement_t *statement;
|
||||
statement_list_t *stmt_list;
|
||||
ifref_t *ifref;
|
||||
ifref_list_t *ifref_list;
|
||||
char *str;
|
||||
|
@ -331,9 +359,13 @@ typedef union YYSTYPE {
|
|||
unsigned int num;
|
||||
double dbl;
|
||||
interface_info_t ifinfo;
|
||||
typelib_t *typelib;
|
||||
struct _import_t *import;
|
||||
struct _decl_spec_t *declspec;
|
||||
enum storage_class stgclass;
|
||||
} YYSTYPE;
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 337 "parser.tab.h"
|
||||
#line 369 "parser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -301,23 +301,25 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
|||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 23
|
||||
#define YY_END_OF_BUFFER 24
|
||||
static yyconst short int yy_accept[113] =
|
||||
#define YY_NUM_RULES 32
|
||||
#define YY_END_OF_BUFFER 33
|
||||
static yyconst short int yy_accept[139] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 2, 2, 24, 22,
|
||||
19, 18, 3, 14, 14, 22, 22, 17, 17, 9,
|
||||
19, 1, 8, 23, 4, 8, 14, 14, 11, 11,
|
||||
10, 2, 0, 14, 0, 20, 21, 17, 17, 0,
|
||||
1, 1, 7, 6, 5, 14, 0, 11, 11, 2,
|
||||
15, 13, 17, 14, 0, 11, 0, 17, 14, 0,
|
||||
11, 0, 15, 17, 14, 0, 11, 17, 14, 0,
|
||||
11, 17, 14, 0, 11, 17, 14, 0, 11, 17,
|
||||
0, 14, 0, 16, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
|
||||
33, 31, 21, 20, 31, 3, 31, 31, 16, 16,
|
||||
31, 31, 31, 19, 19, 19, 11, 31, 21, 1,
|
||||
10, 32, 4, 10, 6, 16, 16, 13, 13, 13,
|
||||
12, 2, 26, 30, 24, 0, 16, 16, 16, 0,
|
||||
22, 28, 25, 27, 23, 19, 5, 19, 29, 0,
|
||||
1, 1, 9, 8, 7, 16, 0, 13, 13, 2,
|
||||
17, 16, 16, 15, 19, 16, 0, 13, 0, 15,
|
||||
15, 19, 16, 0, 13, 0, 17, 15, 15, 19,
|
||||
16, 0, 13, 19, 16, 0, 13, 19, 16, 0,
|
||||
|
||||
13, 19, 16, 0, 13, 19, 0, 16, 0, 18,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
12, 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 14, 0
|
||||
} ;
|
||||
|
||||
static yyconst int yy_ec[256] =
|
||||
|
@ -325,17 +327,17 @@ static yyconst int yy_ec[256] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
||||
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 1, 4, 5, 1, 1, 1, 1, 6,
|
||||
1, 1, 7, 1, 8, 9, 1, 10, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 1, 1, 12,
|
||||
1, 13, 1, 1, 14, 15, 15, 15, 16, 17,
|
||||
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 19, 20, 18, 18, 18, 18, 18, 21, 18,
|
||||
22, 23, 24, 1, 18, 1, 15, 15, 15, 15,
|
||||
1, 2, 4, 5, 6, 1, 1, 7, 1, 8,
|
||||
1, 1, 9, 1, 10, 11, 1, 12, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 1, 1, 14,
|
||||
15, 16, 1, 1, 17, 18, 18, 18, 19, 20,
|
||||
21, 21, 21, 21, 21, 22, 21, 21, 21, 21,
|
||||
21, 23, 24, 21, 25, 21, 21, 26, 27, 21,
|
||||
28, 29, 30, 1, 21, 1, 18, 18, 18, 18,
|
||||
|
||||
25, 15, 18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 18, 18, 26,
|
||||
18, 18, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
31, 18, 21, 21, 21, 21, 21, 32, 21, 21,
|
||||
21, 21, 21, 21, 21, 21, 33, 21, 21, 34,
|
||||
21, 21, 1, 35, 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,
|
||||
|
@ -352,125 +354,182 @@ static yyconst int yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst int yy_meta[27] =
|
||||
static yyconst int yy_meta[36] =
|
||||
{ 0,
|
||||
1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
|
||||
3, 1, 1, 3, 3, 3, 3, 4, 4, 4,
|
||||
4, 1, 1, 1, 3, 5
|
||||
1, 1, 2, 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,
|
||||
3, 4, 4, 4, 1
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_base[151] =
|
||||
static yyconst short int yy_base[175] =
|
||||
{ 0,
|
||||
0, 25, 25, 28, 42, 31, 265, 264, 266, 269,
|
||||
269, 269, 269, 60, 28, 253, 251, 0, 249, 269,
|
||||
38, 260, 269, 269, 269, 31, 39, 62, 79, 0,
|
||||
269, 0, 31, 35, 0, 269, 269, 0, 244, 72,
|
||||
258, 257, 269, 269, 269, 65, 0, 96, 0, 0,
|
||||
113, 0, 242, 68, 0, 129, 149, 240, 70, 0,
|
||||
151, 72, 74, 229, 81, 0, 168, 224, 91, 0,
|
||||
185, 212, 98, 0, 202, 204, 117, 216, 207, 124,
|
||||
0, 108, 129, 269, 0, 0, 0, 206, 0, 0,
|
||||
0, 0, 201, 0, 0, 0, 0, 200, 0, 0,
|
||||
0, 34, 34, 38, 39, 42, 71, 44, 268, 267,
|
||||
265, 491, 491, 491, 249, 491, 256, 241, 96, 22,
|
||||
37, 241, 38, 0, 250, 237, 491, 218, 53, 249,
|
||||
491, 491, 491, 33, 491, 119, 23, 142, 165, 245,
|
||||
491, 0, 491, 491, 491, 48, 0, 33, 88, 0,
|
||||
491, 491, 491, 491, 491, 0, 491, 228, 491, 63,
|
||||
241, 240, 491, 491, 491, 185, 0, 207, 0, 0,
|
||||
104, 491, 491, 124, 222, 227, 0, 249, 102, 94,
|
||||
102, 220, 269, 0, 291, 113, 168, 491, 491, 213,
|
||||
311, 0, 333, 212, 353, 0, 375, 217, 395, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
269, 269, 228, 233, 236, 241, 244, 247, 252, 204,
|
||||
195, 194, 189, 188, 187, 178, 177, 172, 171, 170,
|
||||
161, 160, 155, 150, 149, 148, 139, 138, 134, 133,
|
||||
131, 130, 129, 117, 100, 84, 61, 52, 44, 31
|
||||
417, 206, 439, 222, 221, 62, 0, 220, 140, 491,
|
||||
0, 0, 0, 219, 0, 0, 0, 0, 218, 0,
|
||||
0, 0, 0, 213, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 491, 491, 472, 476,
|
||||
478, 482, 486, 219, 218, 212, 211, 210, 209, 208,
|
||||
206, 205, 203, 198, 197, 192, 191, 190, 189, 188,
|
||||
187, 186, 185, 183, 176, 169, 168, 167, 155, 144,
|
||||
140, 137, 130, 110
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_def[151] =
|
||||
static yyconst short int yy_def[175] =
|
||||
{ 0,
|
||||
112, 1, 113, 113, 1, 5, 114, 114, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 115, 115, 112,
|
||||
112, 112, 112, 112, 112, 116, 117, 117, 112, 118,
|
||||
112, 119, 112, 112, 120, 112, 112, 115, 115, 112,
|
||||
112, 112, 112, 112, 112, 121, 121, 112, 118, 119,
|
||||
112, 120, 115, 122, 122, 112, 112, 115, 123, 123,
|
||||
112, 112, 51, 115, 124, 124, 112, 115, 125, 125,
|
||||
112, 115, 126, 126, 112, 115, 112, 112, 118, 115,
|
||||
127, 112, 112, 112, 128, 129, 130, 112, 131, 132,
|
||||
133, 134, 112, 135, 136, 137, 138, 112, 139, 140,
|
||||
138, 1, 139, 139, 139, 139, 138, 7, 140, 140,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 19,
|
||||
138, 138, 138, 141, 141, 141, 138, 138, 138, 138,
|
||||
138, 138, 138, 142, 138, 138, 36, 138, 38, 39,
|
||||
138, 143, 138, 138, 138, 138, 20, 138, 138, 144,
|
||||
138, 138, 138, 138, 138, 141, 138, 141, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 145, 39, 39, 143,
|
||||
138, 138, 138, 144, 141, 138, 146, 39, 138, 138,
|
||||
138, 141, 138, 147, 39, 138, 138, 138, 138, 141,
|
||||
138, 148, 39, 141, 138, 149, 39, 141, 138, 150,
|
||||
|
||||
141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
|
||||
112, 0, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112
|
||||
39, 141, 138, 138, 39, 141, 151, 103, 138, 138,
|
||||
152, 153, 154, 138, 155, 156, 157, 158, 138, 159,
|
||||
160, 161, 162, 138, 163, 164, 165, 166, 167, 168,
|
||||
169, 170, 171, 172, 173, 174, 138, 0, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_nxt[296] =
|
||||
static yyconst short int yy_nxt[527] =
|
||||
{ 0,
|
||||
10, 11, 12, 13, 10, 10, 10, 10, 10, 14,
|
||||
15, 16, 17, 18, 18, 18, 18, 18, 18, 19,
|
||||
18, 20, 10, 10, 18, 18, 21, 24, 25, 22,
|
||||
24, 25, 21, 111, 44, 22, 33, 34, 34, 40,
|
||||
51, 51, 41, 33, 34, 34, 110, 26, 46, 46,
|
||||
26, 27, 28, 45, 109, 29, 29, 29, 29, 30,
|
||||
30, 30, 30, 108, 35, 31, 29, 30, 33, 34,
|
||||
34, 46, 46, 40, 54, 54, 41, 59, 59, 65,
|
||||
65, 63, 63, 63, 63, 35, 107, 112, 48, 48,
|
||||
69, 69, 48, 48, 48, 48, 49, 49, 49, 49,
|
||||
12, 13, 14, 15, 16, 12, 17, 12, 12, 18,
|
||||
12, 19, 20, 21, 22, 23, 24, 24, 24, 24,
|
||||
24, 25, 24, 26, 24, 24, 24, 27, 12, 12,
|
||||
24, 24, 24, 24, 28, 29, 32, 64, 33, 30,
|
||||
32, 32, 33, 35, 32, 29, 35, 138, 138, 30,
|
||||
51, 52, 54, 55, 60, 138, 138, 72, 61, 71,
|
||||
71, 65, 34, 109, 60, 72, 34, 34, 61, 110,
|
||||
34, 12, 13, 14, 15, 16, 12, 17, 12, 12,
|
||||
18, 12, 36, 37, 21, 22, 23, 38, 38, 38,
|
||||
38, 39, 40, 39, 39, 39, 39, 39, 27, 12,
|
||||
|
||||
73, 73, 106, 48, 49, 56, 56, 77, 77, 56,
|
||||
56, 56, 56, 49, 49, 49, 49, 82, 82, 105,
|
||||
56, 49, 51, 51, 81, 83, 82, 82, 57, 84,
|
||||
83, 104, 103, 102, 84, 101, 100, 57, 61, 61,
|
||||
98, 97, 61, 61, 61, 61, 49, 49, 49, 49,
|
||||
96, 95, 93, 61, 49, 62, 62, 92, 63, 63,
|
||||
67, 67, 91, 90, 67, 67, 67, 67, 49, 49,
|
||||
49, 49, 88, 87, 86, 67, 49, 71, 71, 85,
|
||||
78, 71, 71, 71, 71, 49, 49, 49, 49, 74,
|
||||
70, 66, 71, 49, 75, 75, 60, 55, 75, 75,
|
||||
41, 38, 39, 39, 39, 28, 46, 47, 47, 73,
|
||||
86, 86, 137, 87, 87, 71, 71, 48, 88, 73,
|
||||
49, 50, 79, 89, 87, 87, 88, 48, 49, 50,
|
||||
66, 66, 136, 89, 79, 67, 67, 67, 67, 135,
|
||||
48, 109, 134, 49, 50, 80, 133, 110, 81, 67,
|
||||
48, 49, 50, 68, 68, 80, 81, 132, 68, 68,
|
||||
68, 68, 69, 69, 69, 69, 69, 69, 69, 131,
|
||||
130, 129, 68, 69, 69, 69, 69, 69, 128, 87,
|
||||
87, 69, 69, 69, 69, 127, 79, 126, 124, 123,
|
||||
122, 121, 119, 118, 117, 69, 76, 76, 79, 116,
|
||||
|
||||
75, 75, 49, 49, 49, 49, 52, 99, 94, 75,
|
||||
49, 79, 79, 89, 81, 79, 79, 79, 79, 49,
|
||||
49, 49, 49, 81, 80, 76, 79, 49, 23, 23,
|
||||
23, 23, 23, 32, 32, 32, 32, 32, 38, 38,
|
||||
38, 43, 72, 43, 43, 43, 47, 68, 47, 49,
|
||||
49, 49, 50, 64, 50, 50, 50, 58, 42, 42,
|
||||
53, 42, 39, 37, 36, 112, 24, 24, 9, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112
|
||||
114, 77, 77, 77, 77, 113, 48, 112, 111, 49,
|
||||
104, 100, 96, 92, 84, 77, 48, 49, 78, 78,
|
||||
77, 74, 125, 78, 78, 78, 78, 120, 115, 138,
|
||||
107, 107, 106, 102, 98, 94, 90, 78, 83, 83,
|
||||
82, 62, 62, 84, 84, 84, 84, 75, 48, 57,
|
||||
62, 49, 59, 58, 57, 53, 45, 84, 48, 49,
|
||||
85, 85, 44, 43, 138, 85, 85, 85, 85, 32,
|
||||
32, 138, 138, 138, 138, 138, 138, 138, 138, 85,
|
||||
91, 91, 138, 138, 138, 92, 92, 92, 92, 138,
|
||||
48, 138, 138, 49, 138, 138, 138, 138, 138, 92,
|
||||
|
||||
48, 49, 93, 93, 138, 138, 138, 93, 93, 93,
|
||||
93, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 93, 95, 95, 138, 138, 138, 96, 96, 96,
|
||||
96, 138, 48, 138, 138, 49, 138, 138, 138, 138,
|
||||
138, 96, 48, 49, 97, 97, 138, 138, 138, 97,
|
||||
97, 97, 97, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 97, 99, 99, 138, 138, 138, 100,
|
||||
100, 100, 100, 138, 48, 138, 138, 49, 138, 138,
|
||||
138, 138, 138, 100, 48, 49, 101, 101, 138, 138,
|
||||
138, 101, 101, 101, 101, 138, 138, 138, 138, 138,
|
||||
|
||||
138, 138, 138, 138, 138, 101, 103, 103, 138, 138,
|
||||
138, 104, 104, 104, 104, 138, 48, 138, 138, 49,
|
||||
138, 138, 138, 138, 138, 104, 48, 49, 105, 105,
|
||||
138, 138, 138, 105, 105, 105, 105, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 105, 107, 138,
|
||||
108, 108, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
48, 138, 138, 49, 138, 138, 138, 138, 138, 138,
|
||||
48, 49, 31, 31, 31, 31, 42, 42, 42, 42,
|
||||
56, 56, 63, 138, 63, 63, 70, 138, 70, 70,
|
||||
11, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_chk[296] =
|
||||
static yyconst short int yy_chk[527] =
|
||||
{ 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, 2, 3, 3, 2,
|
||||
4, 4, 6, 150, 26, 6, 15, 15, 15, 21,
|
||||
33, 33, 21, 34, 34, 34, 149, 3, 27, 27,
|
||||
4, 5, 5, 26, 148, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 147, 27, 5, 5, 5, 14, 14,
|
||||
14, 28, 28, 40, 46, 46, 40, 54, 54, 59,
|
||||
59, 62, 62, 63, 63, 14, 146, 28, 29, 29,
|
||||
65, 65, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 2, 3, 34, 3, 2,
|
||||
4, 5, 4, 5, 6, 8, 6, 20, 37, 8,
|
||||
21, 21, 23, 23, 29, 20, 37, 48, 29, 46,
|
||||
46, 34, 3, 106, 60, 48, 4, 5, 60, 106,
|
||||
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,
|
||||
|
||||
69, 69, 145, 29, 29, 48, 48, 73, 73, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 82, 82, 144,
|
||||
48, 48, 51, 51, 77, 80, 77, 77, 51, 80,
|
||||
83, 143, 142, 141, 83, 140, 139, 51, 56, 56,
|
||||
138, 137, 56, 56, 56, 56, 56, 56, 56, 56,
|
||||
136, 135, 134, 56, 56, 57, 57, 133, 57, 57,
|
||||
61, 61, 132, 131, 61, 61, 61, 61, 61, 61,
|
||||
61, 61, 130, 129, 128, 61, 61, 67, 67, 127,
|
||||
126, 67, 67, 67, 67, 67, 67, 67, 67, 125,
|
||||
124, 123, 67, 67, 71, 71, 122, 121, 71, 71,
|
||||
7, 7, 7, 7, 7, 7, 19, 19, 19, 49,
|
||||
79, 79, 174, 79, 79, 71, 71, 19, 80, 49,
|
||||
19, 19, 71, 81, 86, 86, 80, 19, 19, 19,
|
||||
36, 36, 173, 81, 71, 36, 36, 36, 36, 172,
|
||||
36, 109, 171, 36, 36, 74, 170, 109, 74, 36,
|
||||
36, 36, 36, 38, 38, 74, 74, 169, 38, 38,
|
||||
38, 38, 38, 38, 38, 38, 38, 38, 38, 168,
|
||||
167, 166, 38, 38, 38, 38, 39, 39, 165, 87,
|
||||
87, 39, 39, 39, 39, 164, 87, 163, 162, 161,
|
||||
160, 159, 158, 157, 156, 39, 66, 66, 87, 155,
|
||||
|
||||
71, 71, 71, 71, 71, 71, 120, 98, 93, 71,
|
||||
71, 75, 75, 88, 79, 75, 75, 75, 75, 75,
|
||||
75, 75, 75, 78, 76, 72, 75, 75, 113, 113,
|
||||
113, 113, 113, 114, 114, 114, 114, 114, 115, 115,
|
||||
115, 116, 68, 116, 116, 116, 117, 64, 117, 118,
|
||||
118, 118, 119, 58, 119, 119, 119, 53, 42, 41,
|
||||
39, 22, 19, 17, 16, 9, 8, 7, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 112
|
||||
154, 66, 66, 66, 66, 153, 66, 152, 151, 66,
|
||||
150, 149, 148, 147, 146, 66, 66, 66, 68, 68,
|
||||
145, 144, 124, 68, 68, 68, 68, 119, 114, 108,
|
||||
105, 104, 102, 98, 94, 90, 82, 68, 76, 76,
|
||||
75, 62, 61, 76, 76, 76, 76, 58, 76, 40,
|
||||
30, 76, 28, 26, 25, 22, 18, 76, 76, 76,
|
||||
78, 78, 17, 15, 11, 78, 78, 78, 78, 10,
|
||||
9, 0, 0, 0, 0, 0, 0, 0, 0, 78,
|
||||
83, 83, 0, 0, 0, 83, 83, 83, 83, 0,
|
||||
83, 0, 0, 83, 0, 0, 0, 0, 0, 83,
|
||||
|
||||
83, 83, 85, 85, 0, 0, 0, 85, 85, 85,
|
||||
85, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 85, 91, 91, 0, 0, 0, 91, 91, 91,
|
||||
91, 0, 91, 0, 0, 91, 0, 0, 0, 0,
|
||||
0, 91, 91, 91, 93, 93, 0, 0, 0, 93,
|
||||
93, 93, 93, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 93, 95, 95, 0, 0, 0, 95,
|
||||
95, 95, 95, 0, 95, 0, 0, 95, 0, 0,
|
||||
0, 0, 0, 95, 95, 95, 97, 97, 0, 0,
|
||||
0, 97, 97, 97, 97, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 97, 99, 99, 0, 0,
|
||||
0, 99, 99, 99, 99, 0, 99, 0, 0, 99,
|
||||
0, 0, 0, 0, 0, 99, 99, 99, 101, 101,
|
||||
0, 0, 0, 101, 101, 101, 101, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 101, 103, 0,
|
||||
103, 103, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
103, 0, 0, 103, 0, 0, 0, 0, 0, 0,
|
||||
103, 103, 139, 139, 139, 139, 140, 140, 140, 140,
|
||||
141, 141, 142, 0, 142, 142, 143, 0, 143, 143,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
|
||||
138, 138, 138, 138, 138, 138
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
|
@ -511,11 +570,13 @@ char *yytext;
|
|||
#define YY_NEVER_INTERACTIVE 1
|
||||
#define QUOTE 1
|
||||
|
||||
#define ATTR 2
|
||||
#define WSTRQUOTE 2
|
||||
|
||||
#define PP_LINE 3
|
||||
#define ATTR 3
|
||||
|
||||
#line 39 "parser.l"
|
||||
#define PP_LINE 4
|
||||
|
||||
#line 42 "parser.l"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
@ -584,7 +645,7 @@ UUID *parse_uuid(const char *u)
|
|||
* The flexer starts here
|
||||
**************************************************************************
|
||||
*/
|
||||
#line 588 "parser.yy.c"
|
||||
#line 649 "parser.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -738,9 +799,9 @@ YY_DECL
|
|||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 109 "parser.l"
|
||||
#line 112 "parser.l"
|
||||
|
||||
#line 744 "parser.yy.c"
|
||||
#line 805 "parser.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
|
@ -792,13 +853,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 >= 113 )
|
||||
if ( yy_current_state >= 139 )
|
||||
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_base[yy_current_state] != 269 );
|
||||
while ( yy_base[yy_current_state] != 491 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
|
@ -826,12 +887,12 @@ do_action: /* This label is used only to access EOF actions. */
|
|||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 110 "parser.l"
|
||||
#line 113 "parser.l"
|
||||
yy_push_state(PP_LINE);
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 111 "parser.l"
|
||||
#line 114 "parser.l"
|
||||
{
|
||||
int lineno;
|
||||
char *cptr, *fname;
|
||||
|
@ -854,12 +915,12 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 130 "parser.l"
|
||||
#line 133 "parser.l"
|
||||
yy_push_state(QUOTE); cbufidx = 0;
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 131 "parser.l"
|
||||
#line 134 "parser.l"
|
||||
{
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
|
@ -867,124 +928,174 @@ YY_RULE_SETUP
|
|||
}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
#line 137 "parser.l"
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 137 "parser.l"
|
||||
addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 138 "parser.l"
|
||||
addcchar('\\'); addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 139 "parser.l"
|
||||
addcchar(yytext[0]);
|
||||
yy_push_state(WSTRQUOTE);
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 140 "parser.l"
|
||||
{
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
return aWSTRING;
|
||||
}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
#line 146 "parser.l"
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 146 "parser.l"
|
||||
addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 140 "parser.l"
|
||||
yy_push_state(ATTR); return '[';
|
||||
#line 147 "parser.l"
|
||||
addcchar('\\'); addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 141 "parser.l"
|
||||
yy_pop_state(); return ']';
|
||||
#line 148 "parser.l"
|
||||
addcchar(yytext[0]);
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 142 "parser.l"
|
||||
return attr_token(yytext);
|
||||
#line 149 "parser.l"
|
||||
yy_push_state(ATTR); return '[';
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 143 "parser.l"
|
||||
#line 150 "parser.l"
|
||||
yy_pop_state(); return ']';
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 151 "parser.l"
|
||||
return attr_token(yytext);
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 152 "parser.l"
|
||||
{
|
||||
parser_lval.uuid = parse_uuid(yytext);
|
||||
return aUUID;
|
||||
}
|
||||
YY_BREAK
|
||||
case 13:
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 147 "parser.l"
|
||||
#line 156 "parser.l"
|
||||
{
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aHEXNUM;
|
||||
}
|
||||
YY_BREAK
|
||||
case 14:
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 151 "parser.l"
|
||||
#line 160 "parser.l"
|
||||
{
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aNUM;
|
||||
}
|
||||
YY_BREAK
|
||||
case 15:
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 155 "parser.l"
|
||||
#line 164 "parser.l"
|
||||
{
|
||||
parser_lval.dbl = strtod(yytext, NULL);
|
||||
return aDOUBLE;
|
||||
}
|
||||
YY_BREAK
|
||||
case 16:
|
||||
case 18:
|
||||
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
|
||||
yy_c_buf_p = yy_cp -= 1;
|
||||
YY_DO_BEFORE_ACTION; /* set up yytext again */
|
||||
YY_RULE_SETUP
|
||||
#line 159 "parser.l"
|
||||
#line 168 "parser.l"
|
||||
return tSAFEARRAY;
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 160 "parser.l"
|
||||
return kw_token(yytext);
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 161 "parser.l"
|
||||
line_number++;
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 162 "parser.l"
|
||||
|
||||
#line 169 "parser.l"
|
||||
return kw_token(yytext);
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 163 "parser.l"
|
||||
return SHL;
|
||||
#line 170 "parser.l"
|
||||
line_number++;
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 164 "parser.l"
|
||||
return SHR;
|
||||
#line 171 "parser.l"
|
||||
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 165 "parser.l"
|
||||
#line 172 "parser.l"
|
||||
return SHL;
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 173 "parser.l"
|
||||
return SHR;
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 174 "parser.l"
|
||||
return MEMBERPTR;
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 175 "parser.l"
|
||||
return EQUALITY;
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 176 "parser.l"
|
||||
return INEQUALITY;
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 177 "parser.l"
|
||||
return GREATEREQUAL;
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 178 "parser.l"
|
||||
return LESSEQUAL;
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 179 "parser.l"
|
||||
return LOGICALOR;
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 180 "parser.l"
|
||||
return LOGICALAND;
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 181 "parser.l"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(QUOTE):
|
||||
case YY_STATE_EOF(WSTRQUOTE):
|
||||
case YY_STATE_EOF(ATTR):
|
||||
case YY_STATE_EOF(PP_LINE):
|
||||
#line 166 "parser.l"
|
||||
#line 182 "parser.l"
|
||||
{
|
||||
if (import_stack_ptr)
|
||||
return aEOF;
|
||||
else yyterminate();
|
||||
}
|
||||
YY_BREAK
|
||||
case 23:
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 171 "parser.l"
|
||||
#line 187 "parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 988 "parser.yy.c"
|
||||
#line 1099 "parser.yy.c"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
|
@ -1275,7 +1386,7 @@ static yy_state_type yy_get_previous_state()
|
|||
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 >= 113 )
|
||||
if ( yy_current_state >= 139 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1310,11 +1421,11 @@ yy_state_type yy_current_state;
|
|||
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 >= 113 )
|
||||
if ( yy_current_state >= 139 )
|
||||
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 == 112);
|
||||
yy_is_jam = (yy_current_state == 138);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -1870,7 +1981,7 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 171 "parser.l"
|
||||
#line 187 "parser.l"
|
||||
|
||||
|
||||
#ifndef parser_wrap
|
||||
|
@ -1887,6 +1998,7 @@ struct keyword {
|
|||
|
||||
static const struct keyword keywords[] = {
|
||||
{"FALSE", tFALSE},
|
||||
{"NULL", tNULL},
|
||||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__fastcall", tFASTCALL},
|
||||
|
@ -1899,13 +2011,10 @@ static const struct keyword keywords[] = {
|
|||
{"_stdcall", tSTDCALL},
|
||||
{"boolean", tBOOLEAN},
|
||||
{"byte", tBYTE},
|
||||
{"callback", tCALLBACK},
|
||||
{"case", tCASE},
|
||||
{"cdecl", tCDECL},
|
||||
{"char", tCHAR},
|
||||
{"coclass", tCOCLASS},
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"const", tCONST},
|
||||
{"cpp_quote", tCPPQUOTE},
|
||||
{"default", tDEFAULT},
|
||||
|
@ -1919,7 +2028,7 @@ static const struct keyword keywords[] = {
|
|||
{"hyper", tHYPER},
|
||||
{"import", tIMPORT},
|
||||
{"importlib", tIMPORTLIB},
|
||||
{"in_line", tINLINE},
|
||||
{"inline", tINLINE},
|
||||
{"int", tINT},
|
||||
{"interface", tINTERFACE},
|
||||
{"library", tLIBRARY},
|
||||
|
@ -1928,10 +2037,12 @@ static const struct keyword keywords[] = {
|
|||
{"module", tMODULE},
|
||||
{"pascal", tPASCAL},
|
||||
{"properties", tPROPERTIES},
|
||||
{"register", tREGISTER},
|
||||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
{"small", tSMALL},
|
||||
{"static", tSTATIC},
|
||||
{"stdcall", tSTDCALL},
|
||||
{"struct", tSTRUCT},
|
||||
{"switch", tSWITCH},
|
||||
|
@ -1956,6 +2067,9 @@ static const struct keyword attr_keywords[] =
|
|||
{"broadcast", tBROADCAST},
|
||||
{"byte_count", tBYTECOUNT},
|
||||
{"call_as", tCALLAS},
|
||||
{"callback", tCALLBACK},
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"context_handle", tCONTEXTHANDLE},
|
||||
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
|
@ -1982,6 +2096,7 @@ static const struct keyword attr_keywords[] =
|
|||
{"immediatebind", tIMMEDIATEBIND},
|
||||
{"implicit_handle", tIMPLICITHANDLE},
|
||||
{"in", tIN},
|
||||
{"in_line", tIN_LINE},
|
||||
{"input_sync", tINPUTSYNC},
|
||||
{"lcid", tLCID},
|
||||
{"length_is", tLENGTHIS},
|
||||
|
@ -2086,7 +2201,6 @@ void pop_import(void)
|
|||
free(temp_name);
|
||||
}
|
||||
temp_name = import_stack[ptr].temp_name;
|
||||
free( input_name );
|
||||
input_name = import_stack[ptr].input_name;
|
||||
line_number = import_stack[ptr].line_number;
|
||||
import_stack_ptr--;
|
||||
|
@ -2100,20 +2214,11 @@ struct imports {
|
|||
int do_import(char *fname)
|
||||
{
|
||||
FILE *f;
|
||||
char *hname, *path, *p;
|
||||
char *path;
|
||||
struct imports *import;
|
||||
int ptr = import_stack_ptr;
|
||||
int ret;
|
||||
|
||||
if (!parse_only && do_header) {
|
||||
hname = dup_basename(fname, ".idl");
|
||||
p = hname + strlen(hname) - 2;
|
||||
if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
|
||||
|
||||
fprintf(header, "#include <%s>\n", hname);
|
||||
free(hname);
|
||||
}
|
||||
|
||||
import = first_import;
|
||||
while (import && strcmp(import->name, fname))
|
||||
import = import->next;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "parser.h"
|
||||
#include "header.h"
|
||||
#include "typegen.h"
|
||||
#include "expr.h"
|
||||
|
||||
#define END_OF_LIST(list) \
|
||||
do { \
|
||||
|
@ -88,7 +89,7 @@ static void write_stubdesc(int expr_eval_routines)
|
|||
print_proxy( "\n");
|
||||
}
|
||||
|
||||
static void init_proxy(ifref_list_t *ifaces)
|
||||
static void init_proxy(const statement_list_t *stmts)
|
||||
{
|
||||
if (proxy) return;
|
||||
if(!(proxy = fopen(proxy_name, "w")))
|
||||
|
@ -108,7 +109,7 @@ static void init_proxy(ifref_list_t *ifaces)
|
|||
print_proxy( "\n");
|
||||
print_proxy( "#include \"%s\"\n", header_name);
|
||||
print_proxy( "\n");
|
||||
write_formatstringsdecl(proxy, indent, ifaces, need_proxy);
|
||||
write_formatstringsdecl(proxy, indent, stmts, need_proxy);
|
||||
write_stubdescproto();
|
||||
}
|
||||
|
||||
|
@ -193,7 +194,7 @@ static void free_variable( const var_t *arg )
|
|||
if (size)
|
||||
{
|
||||
print_proxy( "_StubMsg.MaxCount = " );
|
||||
write_expr(proxy, size, 0);
|
||||
write_expr(proxy, size, 0, 1, NULL, NULL);
|
||||
fprintf(proxy, ";\n\n");
|
||||
print_proxy( "NdrClearOutParameters( &_StubMsg, ");
|
||||
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
|
||||
|
@ -221,7 +222,7 @@ static void free_variable( const var_t *arg )
|
|||
if( iid )
|
||||
{
|
||||
print_proxy( "_StubMsg.MaxCount = (unsigned long) " );
|
||||
write_expr(proxy, iid, 1);
|
||||
write_expr(proxy, iid, 1, 1, NULL, NULL);
|
||||
print_proxy( ";\n\n" );
|
||||
}
|
||||
print_proxy( "NdrClearOutParameters( &_StubMsg, ");
|
||||
|
@ -600,14 +601,24 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
|||
print_proxy( "\n");
|
||||
}
|
||||
|
||||
static int does_any_iface(const ifref_list_t *ifaces, type_pred_t pred)
|
||||
static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
ifref_t *ir;
|
||||
const statement_t *stmt;
|
||||
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY(ir, ifaces, ifref_t, entry)
|
||||
if (pred(ir->iface))
|
||||
return TRUE;
|
||||
if (stmts)
|
||||
LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
{
|
||||
if (does_any_iface(stmt->u.lib->stmts, pred))
|
||||
return TRUE;
|
||||
}
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
if (pred(stmt->u.type))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -622,34 +633,84 @@ int need_stub(const type_t *iface)
|
|||
return !is_object(iface->attrs) && !is_local(iface->attrs);
|
||||
}
|
||||
|
||||
int need_proxy_file(const ifref_list_t *ifaces)
|
||||
int need_proxy_file(const statement_list_t *stmts)
|
||||
{
|
||||
return does_any_iface(ifaces, need_proxy);
|
||||
return does_any_iface(stmts, need_proxy);
|
||||
}
|
||||
|
||||
int need_stub_files(const ifref_list_t *ifaces)
|
||||
int need_stub_files(const statement_list_t *stmts)
|
||||
{
|
||||
return does_any_iface(ifaces, need_stub);
|
||||
return does_any_iface(stmts, need_stub);
|
||||
}
|
||||
|
||||
void write_proxies(ifref_list_t *ifaces)
|
||||
static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_offset)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_proxy_stmts(stmt->u.lib->stmts, proc_offset);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
if (need_proxy(stmt->u.type))
|
||||
write_proxy(stmt->u.type, proc_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_proxy_iface_name_format(const statement_list_t *stmts, const char *format)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_proxy_iface_name_format(stmt->u.lib->stmts, format);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (iface->ref && iface->funcs && need_proxy(iface))
|
||||
fprintf(proxy, format, iface->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_iid_lookup(const statement_list_t *stmts, const char *file_id, int *c)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_iid_lookup(stmt->u.lib->stmts, file_id, c);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if(iface->ref && iface->funcs && need_proxy(iface))
|
||||
{
|
||||
fprintf(proxy, " if (!_%s_CHECK_IID(%d))\n", file_id, *c);
|
||||
fprintf(proxy, " {\n");
|
||||
fprintf(proxy, " *pIndex = %d;\n", *c);
|
||||
fprintf(proxy, " return 1;\n");
|
||||
fprintf(proxy, " }\n");
|
||||
(*c)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_proxies(const statement_list_t *stmts)
|
||||
{
|
||||
ifref_t *cur;
|
||||
int expr_eval_routines;
|
||||
char *file_id = proxy_token;
|
||||
int c;
|
||||
unsigned int proc_offset = 0;
|
||||
|
||||
if (!do_proxies) return;
|
||||
if (do_everything && !need_proxy_file(ifaces)) return;
|
||||
if (do_everything && !need_proxy_file(stmts)) return;
|
||||
|
||||
init_proxy(ifaces);
|
||||
init_proxy(stmts);
|
||||
if(!proxy) return;
|
||||
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
|
||||
if (need_proxy(cur->iface))
|
||||
write_proxy(cur->iface, &proc_offset);
|
||||
write_proxy_stmts(stmts, &proc_offset);
|
||||
|
||||
expr_eval_routines = write_expr_eval_routines(proxy, proxy_token);
|
||||
if (expr_eval_routines)
|
||||
|
@ -661,36 +722,26 @@ void write_proxies(ifref_list_t *ifaces)
|
|||
print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
|
||||
print_proxy( "#endif\n");
|
||||
print_proxy( "\n");
|
||||
write_procformatstring(proxy, ifaces, need_proxy);
|
||||
write_typeformatstring(proxy, ifaces, need_proxy);
|
||||
write_procformatstring(proxy, stmts, need_proxy);
|
||||
write_typeformatstring(proxy, stmts, need_proxy);
|
||||
|
||||
fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
|
||||
if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
|
||||
fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", cur->iface->name);
|
||||
|
||||
write_proxy_iface_name_format(stmts, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n");
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
|
||||
if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
|
||||
fprintf(proxy, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n", cur->iface->name);
|
||||
write_proxy_iface_name_format(stmts, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n");
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
|
||||
if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
|
||||
fprintf(proxy, " \"%s\",\n", cur->iface->name);
|
||||
write_proxy_iface_name_format(stmts, " \"%s\",\n");
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
@ -700,17 +751,7 @@ void write_proxies(ifref_list_t *ifaces)
|
|||
fprintf(proxy, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
c = 0;
|
||||
if (ifaces)
|
||||
LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
|
||||
if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
|
||||
{
|
||||
fprintf(proxy, " if (!_%s_CHECK_IID(%d))\n", file_id, c);
|
||||
fprintf(proxy, " {\n");
|
||||
fprintf(proxy, " *pIndex = %d;\n", c);
|
||||
fprintf(proxy, " return 1;\n");
|
||||
fprintf(proxy, " }\n");
|
||||
c++;
|
||||
}
|
||||
write_iid_lookup(stmts, file_id, &c);
|
||||
fprintf(proxy, " return 0;\n");
|
||||
fprintf(proxy, "}\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
|
|
@ -50,8 +50,6 @@ static void print_server(const char *format, ...)
|
|||
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
const func_t *func;
|
||||
const var_t *var;
|
||||
const var_t* explicit_handle_var;
|
||||
|
@ -60,34 +58,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
const var_t *def = func->def;
|
||||
const var_t* context_handle_var = NULL;
|
||||
const var_t* explicit_generic_handle_var = NULL;
|
||||
int has_full_pointer = is_full_pointer_function(func);
|
||||
|
||||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
if (!explicit_handle_var)
|
||||
{
|
||||
explicit_generic_handle_var = get_explicit_generic_handle_var(func);
|
||||
if (!explicit_generic_handle_var)
|
||||
context_handle_var = get_context_handle_var(func);
|
||||
}
|
||||
if (explicit_handle)
|
||||
{
|
||||
if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
|
||||
{
|
||||
error("%s() does not define an explicit binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (implicit_handle)
|
||||
{
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
error("%s() must not define a binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(server, "void __RPC_STUB\n");
|
||||
fprintf(server, "%s_", iface->name);
|
||||
|
@ -413,58 +387,69 @@ static void init_server(void)
|
|||
}
|
||||
|
||||
|
||||
void write_server(ifref_list_t *ifaces)
|
||||
static void write_server_stmts(const statement_list_t *stmts, int expr_eval_routines, unsigned int *proc_offset)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_server_stmts(stmt->u.lib->stmts, expr_eval_routines, proc_offset);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (!need_stub(iface))
|
||||
continue;
|
||||
|
||||
fprintf(server, "/*****************************************************************************\n");
|
||||
fprintf(server, " * %s interface\n", iface->name);
|
||||
fprintf(server, " */\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
if (iface->funcs)
|
||||
{
|
||||
write_serverinterfacedecl(iface);
|
||||
write_stubdescdecl(iface);
|
||||
|
||||
write_function_stubs(iface, proc_offset);
|
||||
|
||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||
print_server("#error Invalid build platform for this stub.\n");
|
||||
print_server("#endif\n");
|
||||
|
||||
fprintf(server, "\n");
|
||||
write_stubdescriptor(iface, expr_eval_routines);
|
||||
write_dispatchtable(iface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_server(const statement_list_t *stmts)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
int expr_eval_routines;
|
||||
ifref_t *iface;
|
||||
|
||||
if (!do_server)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(ifaces))
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_server();
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(server, indent, ifaces, need_stub);
|
||||
write_formatstringsdecl(server, indent, stmts, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(server, server_token);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(server, server_token);
|
||||
write_user_quad_list(server);
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
||||
{
|
||||
if (!need_stub(iface->iface))
|
||||
continue;
|
||||
|
||||
fprintf(server, "/*****************************************************************************\n");
|
||||
fprintf(server, " * %s interface\n", iface->iface->name);
|
||||
fprintf(server, " */\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
write_serverinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
|
||||
write_function_stubs(iface->iface, &proc_offset);
|
||||
|
||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||
print_server("#error Invalid build platform for this stub.\n");
|
||||
print_server("#endif\n");
|
||||
|
||||
fprintf(server, "\n");
|
||||
write_stubdescriptor(iface->iface, expr_eval_routines);
|
||||
write_dispatchtable(iface->iface);
|
||||
}
|
||||
}
|
||||
write_server_stmts(stmts, expr_eval_routines, &proc_offset);
|
||||
|
||||
fprintf(server, "\n");
|
||||
|
||||
write_procformatstring(server, ifaces, need_stub);
|
||||
write_typeformatstring(server, ifaces, need_stub);
|
||||
write_procformatstring(server, stmts, need_stub);
|
||||
write_typeformatstring(server, stmts, need_stub);
|
||||
|
||||
fclose(server);
|
||||
}
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
#include "wine/list.h"
|
||||
|
||||
#include "typegen.h"
|
||||
#include "expr.h"
|
||||
|
||||
static const func_t *current_func;
|
||||
static const type_t *current_structure;
|
||||
static const ifref_t *current_iface;
|
||||
static const type_t *current_iface;
|
||||
|
||||
static struct list expr_eval_routines = LIST_INIT(expr_eval_routines);
|
||||
struct expr_eval_routine
|
||||
|
@ -307,77 +308,6 @@ static const char *get_context_handle_type_name(const type_t *type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* This is actually fairly involved to implement precisely, due to the
|
||||
effects attributes may have and things like that. Right now this is
|
||||
only used for optimization, so just check for a very small set of
|
||||
criteria that guarantee the types are equivalent; assume every thing
|
||||
else is different. */
|
||||
static int compare_type(const type_t *a, const type_t *b)
|
||||
{
|
||||
if (a == b
|
||||
|| (a->name
|
||||
&& b->name
|
||||
&& strcmp(a->name, b->name) == 0))
|
||||
return 0;
|
||||
/* Ordering doesn't need to be implemented yet. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int compare_expr(const expr_t *a, const expr_t *b)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (a->type != b->type)
|
||||
return a->type - b->type;
|
||||
|
||||
switch (a->type)
|
||||
{
|
||||
case EXPR_NUM:
|
||||
case EXPR_HEXNUM:
|
||||
case EXPR_TRUEFALSE:
|
||||
return a->u.lval - b->u.lval;
|
||||
case EXPR_DOUBLE:
|
||||
return a->u.dval - b->u.dval;
|
||||
case EXPR_IDENTIFIER:
|
||||
return strcmp(a->u.sval, b->u.sval);
|
||||
case EXPR_COND:
|
||||
ret = compare_expr(a->ref, b->ref);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
ret = compare_expr(a->u.ext, b->u.ext);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
return compare_expr(a->ext2, b->ext2);
|
||||
case EXPR_OR:
|
||||
case EXPR_AND:
|
||||
case EXPR_ADD:
|
||||
case EXPR_SUB:
|
||||
case EXPR_MUL:
|
||||
case EXPR_DIV:
|
||||
case EXPR_SHL:
|
||||
case EXPR_SHR:
|
||||
ret = compare_expr(a->ref, b->ref);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
return compare_expr(a->u.ext, b->u.ext);
|
||||
case EXPR_CAST:
|
||||
ret = compare_type(a->u.tref, b->u.tref);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
/* Fall through. */
|
||||
case EXPR_NOT:
|
||||
case EXPR_NEG:
|
||||
case EXPR_PPTR:
|
||||
case EXPR_ADDRESSOF:
|
||||
return compare_expr(a->ref, b->ref);
|
||||
case EXPR_SIZEOF:
|
||||
return compare_type(a->u.tref, b->u.tref);
|
||||
case EXPR_VOID:
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define WRITE_FCTYPE(file, fctype, typestring_offset) \
|
||||
do { \
|
||||
if (file) \
|
||||
|
@ -440,13 +370,13 @@ static void write_formatdesc(FILE *f, int indent, const char *str)
|
|||
print_file(f, indent, "\n");
|
||||
}
|
||||
|
||||
void write_formatstringsdecl(FILE *f, int indent, ifref_list_t *ifaces, type_pred_t pred)
|
||||
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_typeformatstring(ifaces, pred));
|
||||
get_size_typeformatstring(stmts, pred));
|
||||
|
||||
print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_procformatstring(ifaces, pred));
|
||||
get_size_procformatstring(stmts, pred));
|
||||
|
||||
fprintf(f, "\n");
|
||||
write_formatdesc(f, indent, "TYPE");
|
||||
|
@ -547,33 +477,23 @@ static size_t write_procformatstring_type(FILE *file, int indent,
|
|||
return size;
|
||||
}
|
||||
|
||||
void write_procformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t pred)
|
||||
static void write_procformatstring_stmts(FILE *file, int indent, const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
const ifref_t *iface;
|
||||
int indent = 0;
|
||||
const var_t *var;
|
||||
|
||||
print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
|
||||
print_file(file, indent, "{\n");
|
||||
indent++;
|
||||
print_file(file, indent, "0,\n");
|
||||
print_file(file, indent, "{\n");
|
||||
indent++;
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (!pred(iface->iface))
|
||||
continue;
|
||||
|
||||
if (iface->iface->funcs)
|
||||
if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
const func_t *func;
|
||||
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
|
||||
if (!pred(stmt->u.type))
|
||||
continue;
|
||||
if (stmt->u.type->funcs) LIST_FOR_EACH_ENTRY( func, stmt->u.type->funcs, const func_t, entry )
|
||||
{
|
||||
if (is_local(func->def->attrs)) continue;
|
||||
/* emit argument data */
|
||||
if (func->args)
|
||||
{
|
||||
const var_t *var;
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
write_procformatstring_type(file, indent, var->name, var->type, var->attrs, FALSE);
|
||||
}
|
||||
|
@ -588,7 +508,23 @@ void write_procformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t
|
|||
write_procformatstring_type(file, indent, "return value", get_func_return_type(func), NULL, TRUE);
|
||||
}
|
||||
}
|
||||
else if (stmt->type == STMT_LIBRARY)
|
||||
write_procformatstring_stmts(file, indent, stmt->u.lib->stmts, pred);
|
||||
}
|
||||
}
|
||||
|
||||
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
int indent = 0;
|
||||
|
||||
print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
|
||||
print_file(file, indent, "{\n");
|
||||
indent++;
|
||||
print_file(file, indent, "0,\n");
|
||||
print_file(file, indent, "{\n");
|
||||
indent++;
|
||||
|
||||
write_procformatstring_stmts(file, indent, stmts, pred);
|
||||
|
||||
print_file(file, indent, "0x0\n");
|
||||
indent--;
|
||||
|
@ -725,6 +661,8 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure,
|
|||
error("write_conf_or_var_desc: couldn't find variable %s in structure\n",
|
||||
subexpr->u.sval);
|
||||
|
||||
correlation_variable = expr_resolve_type(NULL, structure, expr);
|
||||
|
||||
offset -= baseoff;
|
||||
correlation_variable_type = correlation_variable->type;
|
||||
|
||||
|
@ -753,15 +691,6 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure,
|
|||
case RPC_FC_ULONG:
|
||||
param_type = RPC_FC_ULONG;
|
||||
break;
|
||||
case RPC_FC_RP:
|
||||
case RPC_FC_UP:
|
||||
case RPC_FC_OP:
|
||||
case RPC_FC_FP:
|
||||
if (sizeof(void *) == 4) /* FIXME */
|
||||
param_type = RPC_FC_LONG;
|
||||
else
|
||||
param_type = RPC_FC_HYPER;
|
||||
break;
|
||||
default:
|
||||
error("write_conf_or_var_desc: conformance variable type not supported 0x%x\n",
|
||||
correlation_variable_type);
|
||||
|
@ -2338,22 +2267,32 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty
|
|||
return retmask;
|
||||
}
|
||||
|
||||
static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pred)
|
||||
static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts,
|
||||
type_pred_t pred, unsigned int *typeformat_offset)
|
||||
{
|
||||
const var_t *var;
|
||||
const ifref_t *iface;
|
||||
unsigned int typeformat_offset = 2;
|
||||
const statement_t *stmt;
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (!pred(iface->iface))
|
||||
const type_t *iface;
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
{
|
||||
process_tfs_stmts(file, stmt->u.lib->stmts, pred, typeformat_offset);
|
||||
continue;
|
||||
}
|
||||
else if (stmt->type != STMT_TYPE || stmt->u.type->type != RPC_FC_IP)
|
||||
continue;
|
||||
|
||||
if (iface->iface->funcs)
|
||||
iface = stmt->u.type;
|
||||
if (!pred(iface))
|
||||
continue;
|
||||
|
||||
if (iface->funcs)
|
||||
{
|
||||
const func_t *func;
|
||||
current_iface = iface;
|
||||
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
if (is_local(func->def->attrs)) continue;
|
||||
|
||||
|
@ -2364,7 +2303,7 @@ static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pr
|
|||
update_tfsoff(get_func_return_type(func),
|
||||
write_typeformatstring_var(
|
||||
file, 2, NULL, get_func_return_type(func),
|
||||
&v, &typeformat_offset),
|
||||
&v, typeformat_offset),
|
||||
file);
|
||||
}
|
||||
|
||||
|
@ -2375,17 +2314,24 @@ static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, type_pred_t pr
|
|||
var->type,
|
||||
write_typeformatstring_var(
|
||||
file, 2, func, var->type, var,
|
||||
&typeformat_offset),
|
||||
typeformat_offset),
|
||||
file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return typeformat_offset + 1;
|
||||
return *typeformat_offset + 1;
|
||||
}
|
||||
|
||||
static size_t process_tfs(FILE *file, const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
unsigned int typeformat_offset = 2;
|
||||
|
||||
return process_tfs_stmts(file, stmts, pred, &typeformat_offset);
|
||||
}
|
||||
|
||||
|
||||
void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t pred)
|
||||
void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
int indent = 0;
|
||||
|
||||
|
@ -2398,7 +2344,7 @@ void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t
|
|||
print_file(file, indent, "NdrFcShort(0x0),\n");
|
||||
|
||||
set_all_tfswrite(TRUE);
|
||||
process_tfs(file, ifaces, pred);
|
||||
process_tfs(file, stmts, pred);
|
||||
|
||||
print_file(file, indent, "0x0\n");
|
||||
indent--;
|
||||
|
@ -2836,7 +2782,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
if (type->size_is && is_size_needed_for_phase(phase))
|
||||
{
|
||||
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
|
||||
write_expr(file, type->size_is, 1);
|
||||
write_expr(file, type->size_is, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n");
|
||||
}
|
||||
|
||||
|
@ -2866,7 +2812,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
{
|
||||
print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
|
||||
print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
|
||||
write_expr(file, type->length_is, 1);
|
||||
write_expr(file, type->length_is, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n\n");
|
||||
}
|
||||
array_type = "VaryingArray";
|
||||
|
@ -2876,7 +2822,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
if (is_size_needed_for_phase(phase))
|
||||
{
|
||||
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
|
||||
write_expr(file, type->size_is, 1);
|
||||
write_expr(file, type->size_is, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n\n");
|
||||
}
|
||||
array_type = "ConformantArray";
|
||||
|
@ -2888,14 +2834,14 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
if (type->size_is)
|
||||
{
|
||||
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)");
|
||||
write_expr(file, type->size_is, 1);
|
||||
write_expr(file, type->size_is, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n");
|
||||
}
|
||||
if (type->length_is)
|
||||
{
|
||||
print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */
|
||||
print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)");
|
||||
write_expr(file, type->length_is, 1);
|
||||
write_expr(file, type->length_is, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n\n");
|
||||
}
|
||||
}
|
||||
|
@ -2959,7 +2905,7 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
|
||||
{
|
||||
print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
|
||||
write_expr( file, iid, 1 );
|
||||
write_expr( file, iid, 1, 1, NULL, NULL );
|
||||
fprintf( file, ";\n\n" );
|
||||
}
|
||||
print_phase_function(file, indent, "Pointer", phase, var, start_offset);
|
||||
|
@ -2989,13 +2935,13 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
|
|||
if ((iid = get_attrp( var->attrs, ATTR_IIDIS )))
|
||||
{
|
||||
print_file( file, indent, "_StubMsg.MaxCount = (unsigned long) " );
|
||||
write_expr( file, iid, 1 );
|
||||
write_expr( file, iid, 1, 1, NULL, NULL );
|
||||
fprintf( file, ";\n\n" );
|
||||
}
|
||||
else if (sx)
|
||||
{
|
||||
print_file(file, indent, "_StubMsg.MaxCount = (unsigned long) ");
|
||||
write_expr(file, sx, 1);
|
||||
write_expr(file, sx, 1, 1, NULL, NULL);
|
||||
fprintf(file, ";\n\n");
|
||||
}
|
||||
if (var->type->ref->type == RPC_FC_IP)
|
||||
|
@ -3061,129 +3007,41 @@ size_t get_size_procformatstring_func(const func_t *func)
|
|||
return size;
|
||||
}
|
||||
|
||||
size_t get_size_procformatstring(const ifref_list_t *ifaces, type_pred_t pred)
|
||||
size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
const ifref_t *iface;
|
||||
const statement_t *stmt;
|
||||
size_t size = 1;
|
||||
const func_t *func;
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (!pred(iface->iface))
|
||||
const type_t *iface;
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
{
|
||||
size += get_size_procformatstring(stmt->u.lib->stmts, pred) - 1;
|
||||
continue;
|
||||
}
|
||||
else if (stmt->type != STMT_TYPE && stmt->u.type->type != RPC_FC_IP)
|
||||
continue;
|
||||
|
||||
if (iface->iface->funcs)
|
||||
LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry )
|
||||
iface = stmt->u.type;
|
||||
if (!pred(iface))
|
||||
continue;
|
||||
|
||||
if (iface->funcs)
|
||||
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
if (!is_local(func->def->attrs))
|
||||
size += get_size_procformatstring_func( func );
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t get_size_typeformatstring(const ifref_list_t *ifaces, type_pred_t pred)
|
||||
size_t get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred)
|
||||
{
|
||||
set_all_tfswrite(FALSE);
|
||||
return process_tfs(NULL, ifaces, pred);
|
||||
return process_tfs(NULL, stmts, pred);
|
||||
}
|
||||
|
||||
static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
||||
const var_list_t *fields, const char *structvar)
|
||||
{
|
||||
switch (e->type) {
|
||||
case EXPR_VOID:
|
||||
break;
|
||||
case EXPR_NUM:
|
||||
fprintf(h, "%lu", e->u.lval);
|
||||
break;
|
||||
case EXPR_HEXNUM:
|
||||
fprintf(h, "0x%lx", e->u.lval);
|
||||
break;
|
||||
case EXPR_DOUBLE:
|
||||
fprintf(h, "%#.15g", e->u.dval);
|
||||
break;
|
||||
case EXPR_TRUEFALSE:
|
||||
if (e->u.lval == 0)
|
||||
fprintf(h, "FALSE");
|
||||
else
|
||||
fprintf(h, "TRUE");
|
||||
break;
|
||||
case EXPR_IDENTIFIER:
|
||||
{
|
||||
const var_t *field;
|
||||
LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
if (!strcmp(e->u.sval, field->name))
|
||||
{
|
||||
fprintf(h, "%s->%s", structvar, e->u.sval);
|
||||
break;
|
||||
}
|
||||
|
||||
if (&field->entry == fields) error("no field found for identifier %s\n", e->u.sval);
|
||||
break;
|
||||
}
|
||||
case EXPR_NEG:
|
||||
fprintf(h, "-");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
break;
|
||||
case EXPR_NOT:
|
||||
fprintf(h, "~");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
break;
|
||||
case EXPR_PPTR:
|
||||
fprintf(h, "*");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
break;
|
||||
case EXPR_CAST:
|
||||
fprintf(h, "(");
|
||||
write_type_decl(h, e->u.tref, NULL);
|
||||
fprintf(h, ")");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
break;
|
||||
case EXPR_SIZEOF:
|
||||
fprintf(h, "sizeof(");
|
||||
write_type_decl(h, e->u.tref, NULL);
|
||||
fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_SHL:
|
||||
case EXPR_SHR:
|
||||
case EXPR_MUL:
|
||||
case EXPR_DIV:
|
||||
case EXPR_ADD:
|
||||
case EXPR_SUB:
|
||||
case EXPR_AND:
|
||||
case EXPR_OR:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
switch (e->type) {
|
||||
case EXPR_SHL: fprintf(h, " << "); break;
|
||||
case EXPR_SHR: fprintf(h, " >> "); break;
|
||||
case EXPR_MUL: fprintf(h, " * "); break;
|
||||
case EXPR_DIV: fprintf(h, " / "); break;
|
||||
case EXPR_ADD: fprintf(h, " + "); break;
|
||||
case EXPR_SUB: fprintf(h, " - "); break;
|
||||
case EXPR_AND: fprintf(h, " & "); break;
|
||||
case EXPR_OR: fprintf(h, " | "); break;
|
||||
default: break;
|
||||
}
|
||||
write_struct_expr(h, e->u.ext, 1, fields, structvar);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_COND:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
fprintf(h, " ? ");
|
||||
write_struct_expr(h, e->u.ext, 1, fields, structvar);
|
||||
fprintf(h, " : ");
|
||||
write_struct_expr(h, e->ext2, 1, fields, structvar);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_ADDRESSOF:
|
||||
fprintf(h, "&");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void declare_stub_args( FILE *file, int indent, const func_t *func )
|
||||
{
|
||||
int in_attr, out_attr;
|
||||
|
@ -3279,7 +3137,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
|
|||
fprintf(file, " = NdrAllocate(&_StubMsg, ");
|
||||
for ( ; type->size_is ; type = type->ref)
|
||||
{
|
||||
write_expr(file, type->size_is, TRUE);
|
||||
write_expr(file, type->size_is, TRUE, TRUE, NULL, NULL);
|
||||
fprintf(file, " * ");
|
||||
}
|
||||
size = type_memsize(type, &align);
|
||||
|
@ -3304,6 +3162,7 @@ void assign_stub_out_args( FILE *file, int indent, const func_t *func )
|
|||
int write_expr_eval_routines(FILE *file, const char *iface)
|
||||
{
|
||||
static const char *var_name = "pS";
|
||||
static const char *var_name_expr = "pS->";
|
||||
int result = 0;
|
||||
struct expr_eval_routine *eval;
|
||||
unsigned short callback_offset = 0;
|
||||
|
@ -3311,7 +3170,6 @@ int write_expr_eval_routines(FILE *file, const char *iface)
|
|||
LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry)
|
||||
{
|
||||
const char *name = eval->structure->name;
|
||||
const var_list_t *fields = eval->structure->fields_or_args;
|
||||
result = 1;
|
||||
|
||||
print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",
|
||||
|
@ -3321,7 +3179,7 @@ int write_expr_eval_routines(FILE *file, const char *iface)
|
|||
name, var_name, name, eval->baseoff);
|
||||
print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */
|
||||
print_file(file, 1, "pStubMsg->MaxCount = (unsigned long)");
|
||||
write_struct_expr(file, eval->expr, 1, fields, var_name);
|
||||
write_expr(file, eval->expr, 1, 1, var_name_expr, eval->structure);
|
||||
fprintf(file, ";\n");
|
||||
print_file(file, 0, "}\n\n");
|
||||
callback_offset++;
|
||||
|
|
|
@ -38,15 +38,15 @@ enum remoting_phase
|
|||
|
||||
typedef int (*type_pred_t)(const type_t *);
|
||||
|
||||
void write_formatstringsdecl(FILE *f, int indent, ifref_list_t *ifaces, type_pred_t pred);
|
||||
void write_procformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t pred);
|
||||
void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t pred);
|
||||
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred);
|
||||
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
|
||||
void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
|
||||
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
|
||||
void write_remoting_arguments(FILE *file, int indent, const func_t *func, enum pass pass, enum remoting_phase phase);
|
||||
size_t get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs);
|
||||
size_t get_size_procformatstring_func(const func_t *func);
|
||||
size_t get_size_procformatstring(const ifref_list_t *ifaces, type_pred_t pred);
|
||||
size_t get_size_typeformatstring(const ifref_list_t *ifaces, type_pred_t pred);
|
||||
size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred);
|
||||
size_t get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred);
|
||||
void assign_stub_out_args( FILE *file, int indent, const func_t *func );
|
||||
void declare_stub_args( FILE *file, int indent, const func_t *func );
|
||||
int write_expr_eval_routines(FILE *file, const char *iface);
|
||||
|
|
|
@ -172,7 +172,7 @@ unsigned short get_type_vt(type_t *t)
|
|||
if (vt) return vt;
|
||||
}
|
||||
|
||||
if (t->kind == TKIND_ALIAS && t->attrs)
|
||||
if (t->kind == TKIND_ALIAS && is_attr(t->attrs, ATTR_PUBLIC))
|
||||
return VT_USERDEFINED;
|
||||
|
||||
switch (t->type) {
|
||||
|
@ -231,6 +231,7 @@ unsigned short get_type_vt(type_t *t)
|
|||
case RPC_FC_CPSTRUCT:
|
||||
case RPC_FC_CVSTRUCT:
|
||||
case RPC_FC_BOGUS_STRUCT:
|
||||
case RPC_FC_COCLASS:
|
||||
return VT_USERDEFINED;
|
||||
case 0:
|
||||
return t->kind == TKIND_PRIMITIVE ? VT_VOID : VT_USERDEFINED;
|
||||
|
@ -240,20 +241,13 @@ unsigned short get_type_vt(type_t *t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void start_typelib(char *name, const attr_list_t *attrs)
|
||||
void start_typelib(typelib_t *typelib_type)
|
||||
{
|
||||
in_typelib++;
|
||||
if (!do_typelib) return;
|
||||
|
||||
typelib = xmalloc(sizeof(*typelib));
|
||||
typelib->name = xstrdup(name);
|
||||
typelib = typelib_type;
|
||||
typelib->filename = xstrdup(typelib_name);
|
||||
typelib->attrs = attrs;
|
||||
list_init( &typelib->entries );
|
||||
list_init( &typelib->importlibs );
|
||||
|
||||
if (is_attr(attrs, ATTR_POINTERDEFAULT))
|
||||
pointer_default = get_attrv(attrs, ATTR_POINTERDEFAULT);
|
||||
}
|
||||
|
||||
void end_typelib(void)
|
||||
|
@ -262,8 +256,6 @@ void end_typelib(void)
|
|||
if (!typelib) return;
|
||||
|
||||
create_msft_typelib(typelib);
|
||||
pointer_default = RPC_FC_UP;
|
||||
return;
|
||||
}
|
||||
|
||||
void add_typelib_entry(type_t *t)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define __WIDL_TYPELIB_H
|
||||
|
||||
extern int in_typelib;
|
||||
extern void start_typelib(char *name, const attr_list_t *attrs);
|
||||
extern void start_typelib(typelib_t *typelib_type);
|
||||
extern void end_typelib(void);
|
||||
extern void add_typelib_entry(type_t *t);
|
||||
extern void add_importlib(const char *name);
|
||||
|
|
|
@ -279,13 +279,13 @@ static char *eat_space(char *s)
|
|||
return s;
|
||||
}
|
||||
|
||||
void write_dlldata(ifref_list_t *ifaces)
|
||||
void write_dlldata(const statement_list_t *stmts)
|
||||
{
|
||||
struct list filenames = LIST_INIT(filenames);
|
||||
filename_node_t *node;
|
||||
FILE *dlldata;
|
||||
|
||||
if (!do_dlldata || !need_proxy_file(ifaces))
|
||||
if (!do_dlldata || !need_proxy_file(stmts))
|
||||
return;
|
||||
|
||||
dlldata = fopen(dlldata_name, "r");
|
||||
|
|
|
@ -68,9 +68,9 @@ extern FILE* header;
|
|||
extern FILE* local_stubs;
|
||||
extern FILE* idfile;
|
||||
|
||||
extern void write_proxies(ifref_list_t *ifaces);
|
||||
extern void write_client(ifref_list_t *ifaces);
|
||||
extern void write_server(ifref_list_t *ifaces);
|
||||
extern void write_dlldata(ifref_list_t *ifaces);
|
||||
extern void write_proxies(const statement_list_t *stmts);
|
||||
extern void write_client(const statement_list_t *stmts);
|
||||
extern void write_server(const statement_list_t *stmts);
|
||||
extern void write_dlldata(const statement_list_t *stmts);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<include base="wpp">.</include>
|
||||
<library>wpp</library>
|
||||
<file>client.c</file>
|
||||
<file>expr.c</file>
|
||||
<file>hash.c</file>
|
||||
<file>header.c</file>
|
||||
<file>proxy.c</file>
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef GUID UUID;
|
|||
#endif
|
||||
#define FALSE 0
|
||||
|
||||
#define RPC_FC_COCLASS 0xfd
|
||||
#define RPC_FC_FUNCTION 0xfe
|
||||
|
||||
typedef struct _loc_info_t loc_info_t;
|
||||
|
@ -51,7 +52,7 @@ typedef struct _expr_t expr_t;
|
|||
typedef struct _type_t type_t;
|
||||
typedef struct _typeref_t typeref_t;
|
||||
typedef struct _var_t var_t;
|
||||
typedef struct _pident_t pident_t;
|
||||
typedef struct _declarator_t declarator_t;
|
||||
typedef struct _func_t func_t;
|
||||
typedef struct _ifref_t ifref_t;
|
||||
typedef struct _typelib_entry_t typelib_entry_t;
|
||||
|
@ -60,17 +61,20 @@ typedef struct _importinfo_t importinfo_t;
|
|||
typedef struct _typelib_t typelib_t;
|
||||
typedef struct _user_type_t user_type_t;
|
||||
typedef struct _user_type_t context_handle_t;
|
||||
typedef struct _type_list_t type_list_t;
|
||||
typedef struct _statement_t statement_t;
|
||||
|
||||
typedef struct list attr_list_t;
|
||||
typedef struct list str_list_t;
|
||||
typedef struct list func_list_t;
|
||||
typedef struct list expr_list_t;
|
||||
typedef struct list var_list_t;
|
||||
typedef struct list pident_list_t;
|
||||
typedef struct list declarator_list_t;
|
||||
typedef struct list ifref_list_t;
|
||||
typedef struct list array_dims_t;
|
||||
typedef struct list user_type_list_t;
|
||||
typedef struct list context_handle_list_t;
|
||||
typedef struct list statement_list_t;
|
||||
|
||||
enum attr_type
|
||||
{
|
||||
|
@ -83,20 +87,19 @@ enum attr_type
|
|||
ATTR_CALLAS,
|
||||
ATTR_CALLCONV, /* calling convention pseudo-attribute */
|
||||
ATTR_CASE,
|
||||
ATTR_CONST, /* const pseudo-attribute */
|
||||
ATTR_CONTEXTHANDLE,
|
||||
ATTR_CONTROL,
|
||||
ATTR_DEFAULT,
|
||||
ATTR_DEFAULTCOLLELEM,
|
||||
ATTR_DEFAULTVALUE_EXPR,
|
||||
ATTR_DEFAULTVALUE_STRING,
|
||||
ATTR_DEFAULTVALUE,
|
||||
ATTR_DEFAULTVTABLE,
|
||||
ATTR_DISPINTERFACE,
|
||||
ATTR_DISPLAYBIND,
|
||||
ATTR_DLLNAME,
|
||||
ATTR_DUAL,
|
||||
ATTR_ENDPOINT,
|
||||
ATTR_ENTRY_ORDINAL,
|
||||
ATTR_ENTRY_STRING,
|
||||
ATTR_ENTRY,
|
||||
ATTR_EXPLICIT_HANDLE,
|
||||
ATTR_HANDLE,
|
||||
ATTR_HELPCONTEXT,
|
||||
|
@ -111,8 +114,10 @@ enum attr_type
|
|||
ATTR_IMMEDIATEBIND,
|
||||
ATTR_IMPLICIT_HANDLE,
|
||||
ATTR_IN,
|
||||
ATTR_INLINE,
|
||||
ATTR_INPUTSYNC,
|
||||
ATTR_LENGTHIS,
|
||||
ATTR_LIBLCID,
|
||||
ATTR_LOCAL,
|
||||
ATTR_NONBROWSABLE,
|
||||
ATTR_NONCREATABLE,
|
||||
|
@ -170,6 +175,22 @@ enum expr_type
|
|||
EXPR_COND,
|
||||
EXPR_TRUEFALSE,
|
||||
EXPR_ADDRESSOF,
|
||||
EXPR_MEMBER,
|
||||
EXPR_ARRAY,
|
||||
EXPR_MOD,
|
||||
EXPR_LOGOR,
|
||||
EXPR_LOGAND,
|
||||
EXPR_XOR,
|
||||
EXPR_EQUALITY,
|
||||
EXPR_INEQUALITY,
|
||||
EXPR_GTR,
|
||||
EXPR_LESS,
|
||||
EXPR_GTREQL,
|
||||
EXPR_LESSEQL,
|
||||
EXPR_LOGNOT,
|
||||
EXPR_POS,
|
||||
EXPR_STRLIT,
|
||||
EXPR_WSTRLIT,
|
||||
};
|
||||
|
||||
enum type_kind
|
||||
|
@ -186,6 +207,27 @@ enum type_kind
|
|||
TKIND_MAX
|
||||
};
|
||||
|
||||
enum storage_class
|
||||
{
|
||||
STG_NONE,
|
||||
STG_STATIC,
|
||||
STG_EXTERN,
|
||||
STG_REGISTER,
|
||||
};
|
||||
|
||||
enum statement_type
|
||||
{
|
||||
STMT_LIBRARY,
|
||||
STMT_DECLARATION,
|
||||
STMT_TYPE,
|
||||
STMT_TYPEREF,
|
||||
STMT_MODULE,
|
||||
STMT_TYPEDEF,
|
||||
STMT_IMPORT,
|
||||
STMT_IMPORTLIB,
|
||||
STMT_CPPQUOTE
|
||||
};
|
||||
|
||||
struct _loc_info_t
|
||||
{
|
||||
const char *input_name;
|
||||
|
@ -231,7 +273,7 @@ struct _type_t {
|
|||
enum type_kind kind;
|
||||
unsigned char type;
|
||||
struct _type_t *ref;
|
||||
const attr_list_t *attrs;
|
||||
attr_list_t *attrs;
|
||||
func_list_t *funcs; /* interfaces and modules */
|
||||
var_list_t *fields_or_args; /* interfaces, structures, enumerations and functions (for args) */
|
||||
ifref_list_t *ifaces; /* coclasses */
|
||||
|
@ -243,11 +285,11 @@ struct _type_t {
|
|||
int typelib_idx;
|
||||
unsigned int declarray : 1; /* if declared as an array */
|
||||
unsigned int ignore : 1;
|
||||
unsigned int is_const : 1;
|
||||
unsigned int defined : 1;
|
||||
unsigned int written : 1;
|
||||
unsigned int user_types_registered : 1;
|
||||
unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
|
||||
unsigned int checked : 1;
|
||||
int sign : 2;
|
||||
};
|
||||
|
||||
|
@ -256,6 +298,7 @@ struct _var_t {
|
|||
type_t *type;
|
||||
attr_list_t *attrs;
|
||||
expr_t *eval;
|
||||
enum storage_class stgclass;
|
||||
|
||||
struct _loc_info_t loc_info;
|
||||
|
||||
|
@ -263,15 +306,11 @@ struct _var_t {
|
|||
struct list entry;
|
||||
};
|
||||
|
||||
struct _pident_t {
|
||||
struct _declarator_t {
|
||||
var_t *var;
|
||||
int ptr_level;
|
||||
|
||||
int is_func;
|
||||
/* levels of indirection for function pointers */
|
||||
int func_ptr_level;
|
||||
var_list_t *args;
|
||||
char *callconv;
|
||||
type_t *type;
|
||||
type_t *func_type;
|
||||
array_dims_t *array;
|
||||
|
||||
/* parser-internal */
|
||||
struct list entry;
|
||||
|
@ -330,6 +369,7 @@ struct _typelib_t {
|
|||
const attr_list_t *attrs;
|
||||
struct list entries;
|
||||
struct list importlibs;
|
||||
statement_list_t *stmts;
|
||||
};
|
||||
|
||||
struct _user_type_t {
|
||||
|
@ -337,6 +377,25 @@ struct _user_type_t {
|
|||
const char *name;
|
||||
};
|
||||
|
||||
struct _type_list_t {
|
||||
type_t *type;
|
||||
struct _type_list_t *next;
|
||||
};
|
||||
|
||||
struct _statement_t {
|
||||
struct list entry;
|
||||
enum statement_type type;
|
||||
union
|
||||
{
|
||||
ifref_t iface;
|
||||
type_t *type;
|
||||
const char *str;
|
||||
var_t *var;
|
||||
typelib_t *lib;
|
||||
type_list_t *type_list;
|
||||
} u;
|
||||
};
|
||||
|
||||
extern unsigned char pointer_default;
|
||||
|
||||
extern user_type_list_t user_type_list;
|
||||
|
@ -356,6 +415,10 @@ int cant_be_null(const var_t *v);
|
|||
int is_struct(unsigned char tc);
|
||||
int is_union(unsigned char tc);
|
||||
|
||||
var_t *find_const(const char *name, int f);
|
||||
type_t *find_type(const char *name, int t);
|
||||
type_t *make_type(unsigned char type, type_t *ref);
|
||||
|
||||
static inline type_t *get_func_return_type(const func_t *func)
|
||||
{
|
||||
return func->def->type->ref;
|
||||
|
|
|
@ -960,8 +960,8 @@ static int encode_type(
|
|||
{
|
||||
int typeinfo_offset;
|
||||
|
||||
/* typedef'd types without attributes aren't included in the typelib */
|
||||
while (type->typelib_idx < 0 && type->kind == TKIND_ALIAS && ! type->attrs)
|
||||
/* typedef'd types without public attribute aren't included in the typelib */
|
||||
while (type->typelib_idx < 0 && type->kind == TKIND_ALIAS && !is_attr(type->attrs, ATTR_PUBLIC))
|
||||
type = type->orig;
|
||||
|
||||
chat("encode_type: VT_USERDEFINED - type %p name = %s type->type %d idx %d\n", type,
|
||||
|
@ -984,10 +984,11 @@ static int encode_type(
|
|||
case RPC_FC_ENUM16:
|
||||
add_enum_typeinfo(typelib, type);
|
||||
break;
|
||||
case RPC_FC_COCLASS:
|
||||
add_coclass_typeinfo(typelib, type);
|
||||
break;
|
||||
case 0:
|
||||
if (type->kind == TKIND_COCLASS)
|
||||
add_coclass_typeinfo(typelib, type);
|
||||
else if (type->kind == TKIND_DISPATCH)
|
||||
if (type->kind == TKIND_DISPATCH)
|
||||
add_dispinterface_typeinfo(typelib, type);
|
||||
else
|
||||
error("encode_type: VT_USERDEFINED - can't yet add typedef's on the fly\n");
|
||||
|
@ -1180,7 +1181,7 @@ static unsigned long get_ulong_val(unsigned long val, int vt)
|
|||
return val;
|
||||
}
|
||||
|
||||
static void write_value(msft_typelib_t* typelib, int *out, int vt, void *value)
|
||||
static void write_value(msft_typelib_t* typelib, int *out, int vt, const void *value)
|
||||
{
|
||||
switch(vt) {
|
||||
case VT_I2:
|
||||
|
@ -1196,7 +1197,7 @@ static void write_value(msft_typelib_t* typelib, int *out, int vt, void *value)
|
|||
case VT_HRESULT:
|
||||
case VT_PTR:
|
||||
{
|
||||
const unsigned long lv = get_ulong_val(*(unsigned long*)value, vt);
|
||||
const unsigned long lv = get_ulong_val(*(const unsigned long*)value, vt);
|
||||
if((lv & 0x3ffffff) == lv) {
|
||||
*out = 0x80000000;
|
||||
*out |= vt << 26;
|
||||
|
@ -1212,7 +1213,7 @@ static void write_value(msft_typelib_t* typelib, int *out, int vt, void *value)
|
|||
}
|
||||
case VT_BSTR:
|
||||
{
|
||||
char *s = (char *) value;
|
||||
const char *s = (const char *) value;
|
||||
int len = strlen(s), seg_len = (len + 6 + 3) & ~0x3;
|
||||
int offset = ctl2_alloc_segment(typelib, MSFT_SEG_CUSTDATA, seg_len, 0);
|
||||
*((unsigned short *)&typelib->typelib_segment_data[MSFT_SEG_CUSTDATA][offset]) = vt;
|
||||
|
@ -1302,7 +1303,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||
{
|
||||
num_params++;
|
||||
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
|
||||
if(attr->type == ATTR_DEFAULTVALUE_EXPR || attr->type == ATTR_DEFAULTVALUE_STRING)
|
||||
if(attr->type == ATTR_DEFAULTVALUE)
|
||||
num_defaults++;
|
||||
else if(attr->type == ATTR_OPTIONAL)
|
||||
num_optional++;
|
||||
|
@ -1326,14 +1327,14 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||
case ATTR_DISPLAYBIND:
|
||||
funcflags |= 0x10; /* FUNCFLAG_FDISPLAYBIND */
|
||||
break;
|
||||
case ATTR_ENTRY_ORDINAL:
|
||||
case ATTR_ENTRY:
|
||||
extra_attr = max(extra_attr, 3);
|
||||
entry = expr->cval;
|
||||
entry_is_ord = 1;
|
||||
break;
|
||||
case ATTR_ENTRY_STRING:
|
||||
extra_attr = max(extra_attr, 3);
|
||||
entry = ctl2_alloc_string(typeinfo->typelib, attr->u.pval);
|
||||
if (expr->type == EXPR_STRLIT || expr->type == EXPR_WSTRLIT)
|
||||
entry = ctl2_alloc_string(typeinfo->typelib, attr->u.pval);
|
||||
else {
|
||||
entry = expr->cval;
|
||||
entry_is_ord = 1;
|
||||
}
|
||||
break;
|
||||
case ATTR_HELPCONTEXT:
|
||||
extra_attr = max(extra_attr, 1);
|
||||
|
@ -1474,7 +1475,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||
encode_var(typeinfo->typelib, arg->type, arg, paramdata, NULL, NULL, &decoded_size);
|
||||
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
|
||||
switch(attr->type) {
|
||||
case ATTR_DEFAULTVALUE_EXPR:
|
||||
case ATTR_DEFAULTVALUE:
|
||||
{
|
||||
int vt;
|
||||
expr_t *expr = (expr_t *)attr->u.pval;
|
||||
|
@ -1483,21 +1484,17 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||
else
|
||||
vt = get_type_vt(arg->type);
|
||||
paramflags |= 0x30; /* PARAMFLAG_FHASDEFAULT | PARAMFLAG_FOPT */
|
||||
chat("default value %ld\n", expr->cval);
|
||||
write_value(typeinfo->typelib, defaultdata, vt, &expr->cval);
|
||||
break;
|
||||
}
|
||||
case ATTR_DEFAULTVALUE_STRING:
|
||||
{
|
||||
char *s = (char *)attr->u.pval;
|
||||
int vt;
|
||||
if (arg->type->type == RPC_FC_ENUM16)
|
||||
vt = VT_INT;
|
||||
if (expr->type == EXPR_STRLIT || expr->type == EXPR_WSTRLIT)
|
||||
{
|
||||
if (vt != VT_BSTR) error("string default value applied to non-string type\n");
|
||||
chat("default value '%s'\n", expr->u.sval);
|
||||
write_value(typeinfo->typelib, defaultdata, vt, expr->u.sval);
|
||||
}
|
||||
else
|
||||
vt = get_type_vt(arg->type);
|
||||
paramflags |= 0x30; /* PARAMFLAG_FHASDEFAULT | PARAMFLAG_FOPT */
|
||||
chat("default value '%s'\n", s);
|
||||
write_value(typeinfo->typelib, defaultdata, vt, s);
|
||||
{
|
||||
chat("default value %ld\n", expr->cval);
|
||||
write_value(typeinfo->typelib, defaultdata, vt, &expr->cval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ATTR_IN:
|
||||
|
@ -2320,8 +2317,8 @@ static void set_help_string_context(msft_typelib_t *typelib)
|
|||
|
||||
static void set_lcid(msft_typelib_t *typelib)
|
||||
{
|
||||
typelib->typelib_header.lcid2 = 0x0;
|
||||
return;
|
||||
const expr_t *lcid_expr = get_attrp( typelib->typelib->attrs, ATTR_LIBLCID );
|
||||
typelib->typelib_header.lcid2 = lcid_expr ? lcid_expr->cval : 0x0;
|
||||
}
|
||||
|
||||
static void set_lib_flags(msft_typelib_t *typelib)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue