diff --git a/reactos/tools/widl/ChangeLog b/reactos/tools/widl/ChangeLog index 40c0dcb94e6..0863aa53f34 100644 --- a/reactos/tools/widl/ChangeLog +++ b/reactos/tools/widl/ChangeLog @@ -1,5 +1,10 @@ ChangeLog +2007-05-20 ekohl + +- Synchronized with WINE widl 20070519. + + 2007-05-17 ekohl tools/widl/lex.yy.c diff --git a/reactos/tools/widl/Makefile.in b/reactos/tools/widl/Makefile.in index e2bd0cc887f..a3145b2eeb0 100644 --- a/reactos/tools/widl/Makefile.in +++ b/reactos/tools/widl/Makefile.in @@ -20,34 +20,27 @@ C_SRCS = \ widl.c \ write_msft.c -EXTRA_SRCS = parser.y parser.l -EXTRA_OBJS = parser.tab.o @LEX_OUTPUT_ROOT@.o +LEX_SRCS = parser.l +BISON_SRCS = parser.y + +INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) all: $(PROGRAMS) $(MANPAGES) @MAKE_RULES@ widl$(EXEEXT): $(OBJS) $(LIBWPP) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LEXLIB) $(LDFLAGS) + $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LDFLAGS) -parser.tab.c parser.tab.h: parser.y - $(BISON) -d -t $(SRCDIR)/parser.y -o parser.tab.c - -# hack to allow parallel make -parser.tab.h: parser.tab.c -parser.tab.o: parser.tab.h - -@LEX_OUTPUT_ROOT@.c: parser.l - $(LEX) $(SRCDIR)/parser.l - -@LEX_OUTPUT_ROOT@.o: parser.tab.h - -install:: $(PROGRAMS) $(MANPAGES) - $(MKINSTALLDIRS) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext) +install:: $(PROGRAMS) $(MANPAGES) $(INSTALLDIRS) $(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(INSTALL_DATA) widl.man $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext) uninstall:: $(RM) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext) -### Dependencies: +parser.tab.c: parser.tab.h # for parallel makes + +@DEPENDENCIES@ # everything below this line is overwritten by make depend + +parser.yy.o: parser.tab.h diff --git a/reactos/tools/widl/client.c b/reactos/tools/widl/client.c index 6f8773e3957..29c8132a58e 100644 --- a/reactos/tools/widl/client.c +++ b/reactos/tools/widl/client.c @@ -50,82 +50,51 @@ static int print_client( const char *format, ... ) int i, r; va_start(va, format); - for (i = 0; i < indent; i++) - fprintf(client, " "); + if (format[0] != '\n') + for (i = 0; i < indent; i++) + fprintf(client, " "); r = vfprintf(client, format, va); va_end(va); return r; } -static void print_message_buffer_size(const func_t *func) -{ - unsigned int total_size = 0; - - if (func->args) - { - const var_t *var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - unsigned int alignment; - - total_size += get_required_buffer_size(var, &alignment, PASS_IN); - total_size += alignment; - - var = PREV_LINK(var); - } - } - fprintf(client, " %u", total_size); -} - static void check_pointers(const func_t *func) { - var_t *var; - int pointer_type; + const var_t *var; if (!func->args) return; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) { - pointer_type = get_attrv(var->attrs, ATTR_POINTERTYPE); - if (!pointer_type) - pointer_type = RPC_FC_RP; - - if (pointer_type == RPC_FC_RP) + if (is_var_ptr(var) && cant_be_null(var)) { - if (var->ptr_level >= 1) - { - print_client("if (!%s)\n", var->name); - print_client("{\n"); - indent++; - print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); - indent--; - print_client("}\n\n"); - } + print_client("if (!%s)\n", var->name); + print_client("{\n"); + indent++; + print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); + indent--; + print_client("}\n\n"); } - - var = PREV_LINK(var); } } -static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset) +static void write_function_stubs(type_t *iface, unsigned int *proc_offset) { - const func_t *func = iface->funcs; + 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); - var_t *var; + const var_t *var; int method_count = 0; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - while (func) + if (!implicit_handle) + print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n\n", iface->name); + + if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry ) { const var_t *def = func->def; const var_t* explicit_handle_var; - unsigned int type_offset_func; /* check for a defined binding handle */ explicit_handle_var = get_explicit_handle_var(func); @@ -146,9 +115,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig } } - write_type(client, def->type, def, def->tname); + write_type(client, def->type); fprintf(client, " "); - write_name(client, def); + write_prefix_name(client, prefix_client, def); fprintf(client, "(\n"); indent++; if (func->args) @@ -163,10 +132,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig indent++; /* declare return value '_RetVal' */ - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) { print_client(""); - write_type(client, def->type, def, def->tname); + write_type(client, def->type); fprintf(client, " _RetVal;\n"); } @@ -204,13 +173,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(client, "\n"); } - /* emit the message buffer size */ - print_client("_StubMsg.BufferLength ="); - print_message_buffer_size(func); - fprintf(client, ";\n"); - - type_offset_func = *type_offset; - write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_BUFFERSIZE); + write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE); print_client("NdrGetBuffer(\n"); indent++; @@ -223,12 +186,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig indent--; fprintf(client, "\n"); - - /* make a copy so we don't increment the type offset twice */ - type_offset_func = *type_offset; - /* marshal arguments */ - write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_MARSHAL); + write_remoting_arguments(client, indent, func, PASS_IN, PHASE_MARSHAL); /* send/receive message */ /* print_client("NdrNsSendReceive(\n"); */ @@ -258,24 +217,19 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig /* unmarshall arguments */ fprintf(client, "\n"); - write_remoting_arguments(client, indent, func, type_offset, PASS_OUT, PHASE_UNMARSHAL); + write_remoting_arguments(client, indent, func, PASS_OUT, PHASE_UNMARSHAL); /* unmarshal return value */ - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) print_phase_basetype(client, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal"); /* update proc_offset */ if (func->args) { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) *proc_offset += get_size_procformatstring_var(var); - var = PREV_LINK(var); - } } - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) *proc_offset += get_size_procformatstring_var(def); else *proc_offset += 2; /* FC_END and FC_PAD */ @@ -297,7 +251,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig /* emit return code */ - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) { fprintf(client, "\n"); print_client("return _RetVal;\n"); @@ -308,18 +262,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(client, "\n"); method_count++; - func = PREV_LINK(func); } } -static void write_bindinghandledecl(type_t *iface) -{ - print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n", iface->name); - fprintf(client, "\n"); -} - - static void write_stubdescdecl(type_t *iface) { print_client("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name); @@ -374,6 +320,9 @@ static void write_clientinterfacedecl(type_t *iface) { unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT); + + if (endpoints) write_endpoints( client, iface->name, endpoints ); print_client("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name ); print_client("{\n"); @@ -385,8 +334,16 @@ static void write_clientinterfacedecl(type_t *iface) uuid->Data4[7], LOWORD(ver), HIWORD(ver)); print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */ print_client("0,\n"); - print_client("0,\n"); - print_client("0,\n"); + if (endpoints) + { + print_client("%u,\n", list_count(endpoints)); + print_client("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name); + } + else + { + print_client("0,\n"); + print_client("0,\n"); + } print_client("0,\n"); print_client("0,\n"); print_client("0,\n"); @@ -396,43 +353,12 @@ static void write_clientinterfacedecl(type_t *iface) print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", iface->name, iface->name); else - print_client("RPC_IF_HANDLE %s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", - iface->name, LOWORD(ver), HIWORD(ver), iface->name); + print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n", + prefix_client, iface->name, LOWORD(ver), HIWORD(ver), iface->name); fprintf(client, "\n"); } -static void write_formatdesc( const char *str ) -{ - print_client("typedef struct _MIDL_%s_FORMAT_STRING\n", str ); - print_client("{\n"); - indent++; - print_client("short Pad;\n"); - print_client("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str); - indent--; - print_client("} MIDL_%s_FORMAT_STRING;\n", str); - print_client("\n"); -} - - -static void write_formatstringsdecl(ifref_t *ifaces) -{ - print_client("#define TYPE_FORMAT_STRING_SIZE %d\n", - get_size_typeformatstring(ifaces)); - - print_client("#define PROC_FORMAT_STRING_SIZE %d\n", - get_size_procformatstring(ifaces)); - - fprintf(client, "\n"); - write_formatdesc("TYPE"); - write_formatdesc("PROC"); - fprintf(client, "\n"); - print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n"); - print_client("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n"); - print_client("\n"); -} - - static void write_implicithandledecl(type_t *iface) { const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE); @@ -451,7 +377,7 @@ static void init_client(void) if (!(client = fopen(client_name, "w"))) error("Could not open %s for output\n", client_name); - print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name); + print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name); print_client("#include \n"); print_client("#ifdef _ALPHA_\n"); print_client("#include \n"); @@ -462,25 +388,24 @@ static void init_client(void) } -void write_client(ifref_t *ifaces) +void write_client(ifref_list_t *ifaces) { unsigned int proc_offset = 0; - unsigned int type_offset = 2; - ifref_t *iface = ifaces; + ifref_t *iface; if (!do_client) return; - if (!iface) + if (do_everything && !ifaces) return; - END_OF_LIST(iface); + init_client(); if (!client) return; - write_formatstringsdecl(ifaces); + write_formatstringsdecl(client, indent, ifaces, 0); - for (; iface; iface = PREV_LINK(iface)) + if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry ) { if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) continue; @@ -495,12 +420,10 @@ void write_client(ifref_t *ifaces) int expr_eval_routines; write_implicithandledecl(iface->iface); - + write_clientinterfacedecl(iface->iface); write_stubdescdecl(iface->iface); - write_bindinghandledecl(iface->iface); - - write_function_stubs(iface->iface, &proc_offset, &type_offset); + write_function_stubs(iface->iface, &proc_offset); print_client("#if !defined(__RPC_WIN32__)\n"); print_client("#error Invalid build platform for this stub.\n"); @@ -517,8 +440,8 @@ void write_client(ifref_t *ifaces) fprintf(client, "\n"); - write_procformatstring(client, ifaces); - write_typeformatstring(client, ifaces); + write_procformatstring(client, ifaces, 0); + write_typeformatstring(client, ifaces, 0); fclose(client); } diff --git a/reactos/tools/widl/hash.c b/reactos/tools/widl/hash.c index d67cb6b16a0..2d6f1d302d6 100644 --- a/reactos/tools/widl/hash.c +++ b/reactos/tools/widl/hash.c @@ -605,13 +605,7 @@ unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr) while (*str) { - ULONG newLoWord = 0, i; - - /* Cumulative prime multiplication (*37) with modulo 2^32 wrap-around */ - for (i = 0; i < 37; i++) - newLoWord += nLoWord; - - nLoWord = newLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str]; + nLoWord = 37 * nLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str]; str++; } /* Constrain to a prime modulo and sizeof(WORD) */ diff --git a/reactos/tools/widl/header.c b/reactos/tools/widl/header.c index c807691c594..4f5b6b51091 100644 --- a/reactos/tools/widl/header.c +++ b/reactos/tools/widl/header.c @@ -46,59 +46,84 @@ static void indent(FILE *h, int delta) if (delta > 0) indentation += delta; } -int is_attr(const attr_t *a, enum attr_type t) +int is_ptrchain_attr(const var_t *var, enum attr_type t) { - while (a) { - if (a->type == t) return 1; - a = NEXT_LINK(a); - } - return 0; + if (is_attr(var->attrs, t)) + return 1; + else + { + type_t *type = var->type; + for (;;) + { + if (is_attr(type->attrs, t)) + return 1; + else if (type->kind == TKIND_ALIAS) + type = type->orig; + else if (is_ptr(type)) + type = type->ref; + else return 0; + } + } } -void *get_attrp(const attr_t *a, enum attr_type t) +int is_attr(const attr_list_t *list, enum attr_type t) { - while (a) { - if (a->type == t) return a->u.pval; - a = NEXT_LINK(a); - } - return NULL; + const attr_t *attr; + if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry ) + if (attr->type == t) return 1; + return 0; } -unsigned long get_attrv(const attr_t *a, enum attr_type t) +void *get_attrp(const attr_list_t *list, enum attr_type t) { - while (a) { - if (a->type == t) return a->u.ival; - a = NEXT_LINK(a); - } - return 0; + const attr_t *attr; + if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry ) + if (attr->type == t) return attr->u.pval; + return NULL; } -int is_void(const type_t *t, const var_t *v) +unsigned long get_attrv(const attr_list_t *list, enum attr_type t) +{ + const attr_t *attr; + if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry ) + if (attr->type == t) return attr->u.ival; + return 0; +} + +int is_void(const type_t *t) { - if (v && v->ptr_level) return 0; if (!t->type && !t->ref) return 1; return 0; } -static void write_guid(const char *guid_prefix, const char *name, const UUID *uuid) +int is_conformant_array( const array_dims_t *array ) +{ + expr_t *dim; + if (!array) return 0; + dim = LIST_ENTRY( list_head( array ), expr_t, entry ); + return !dim->is_const; +} + +int is_non_void(const expr_list_t *list) +{ + const expr_t *expr; + + if (list) + LIST_FOR_EACH_ENTRY( expr, list, const expr_t, entry ) + if (expr->type != EXPR_VOID) return 1; + return 0; +} + +void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid) { if (!uuid) return; - fprintf(header, "DEFINE_GUID(%s_%s, 0x%08lx, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x," + fprintf(f, "DEFINE_GUID(%s_%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x," "0x%02x,0x%02x,0x%02x,0x%02x,0x%02x);\n", guid_prefix, name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]); } -static void write_pident(FILE *h, const var_t *v) -{ - int c; - for (c=0; cptr_level; c++) { - fprintf(h, "*"); - } - if (v->name) fprintf(h, "%s", v->name); -} - void write_name(FILE *h, const var_t *v) { if (is_attr( v->attrs, ATTR_PROPGET )) @@ -110,24 +135,31 @@ void write_name(FILE *h, const var_t *v) fprintf(h, "%s", v->name); } +void write_prefix_name(FILE *h, const char *prefix, const var_t *v) +{ + fprintf(h, "%s", prefix); + write_name(h, v); +} + const char* get_name(const var_t *v) { return v->name; } -void write_array(FILE *h, const expr_t *v, int field) +void write_array(FILE *h, array_dims_t *dims, int field) { - if (!v) return; - while (NEXT_LINK(v)) v = NEXT_LINK(v); + expr_t *v; + + if (!dims) return; fprintf(h, "["); - while (v) { + LIST_FOR_EACH_ENTRY( v, dims, expr_t, entry ) + { if (v->is_const) fprintf(h, "%ld", v->cval); /* statically sized array */ else if (field) fprintf(h, "1"); /* dynamically sized array */ - if (PREV_LINK(v)) + if (list_next( dims, &v->entry )) fprintf(h, ", "); - v = PREV_LINK(v); } fprintf(h, "]"); } @@ -137,11 +169,9 @@ static void write_field(FILE *h, var_t *v) if (!v) return; if (v->type) { indent(h, 0); - write_type(h, v->type, NULL, v->tname); - if (get_name(v)) { - fprintf(h, " "); - write_pident(h, v); - } + write_type(h, v->type); + if (get_name(v)) + fprintf(h, " %s", v->name); else { /* not all C/C++ compilers support anonymous structs and unions */ switch (v->type->type) { @@ -167,23 +197,19 @@ static void write_field(FILE *h, var_t *v) } } -static void write_fields(FILE *h, var_t *v) +static void write_fields(FILE *h, var_list_t *fields) { - var_t *first = v; - if (!v) return; - while (NEXT_LINK(v)) v = NEXT_LINK(v); - while (v) { - write_field(h, v); - if (v == first) break; - v = PREV_LINK(v); - } + var_t *v; + if (!fields) return; + LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) write_field(h, v); } -static void write_enums(FILE *h, var_t *v) +static void write_enums(FILE *h, var_list_t *enums) { - if (!v) return; - while (NEXT_LINK(v)) v = NEXT_LINK(v); - while (v) { + var_t *v; + if (!enums) return; + LIST_FOR_EACH_ENTRY( v, enums, var_t, entry ) + { if (get_name(v)) { indent(h, 0); write_name(h, v); @@ -192,60 +218,25 @@ static void write_enums(FILE *h, var_t *v) write_expr(h, v->eval, 0); } } - if (PREV_LINK(v)) - fprintf(h, ",\n"); - v = PREV_LINK(v); + if (list_next( enums, &v->entry )) fprintf(h, ",\n"); } fprintf(h, "\n"); } -void write_type(FILE *h, type_t *t, const var_t *v, const char *n) +static int needs_space_after(type_t *t) { - int c; + return t->kind == TKIND_ALIAS || ! is_ptr(t); +} - if (n) fprintf(h, "%s", n); +void write_type(FILE *h, type_t *t) +{ + if (t->is_const) fprintf(h, "const "); + + if (t->kind == TKIND_ALIAS) fprintf(h, "%s", t->name); else { - if (t->is_const) fprintf(h, "const "); - if (t->type) { - if (t->sign > 0) fprintf(h, "signed "); - else if (t->sign < 0) fprintf(h, "unsigned "); - switch (t->type) { - case RPC_FC_BYTE: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "byte"); - break; - case RPC_FC_CHAR: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "char"); - break; - case RPC_FC_WCHAR: - fprintf(h, "WCHAR"); - break; - case RPC_FC_USMALL: - case RPC_FC_SMALL: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "small"); - break; - case RPC_FC_USHORT: - case RPC_FC_SHORT: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "short"); - break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "long"); - break; - case RPC_FC_HYPER: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "hyper"); - break; - case RPC_FC_FLOAT: - fprintf(h, "float"); - break; - case RPC_FC_DOUBLE: - fprintf(h, "double"); - break; + if (t->sign > 0) fprintf(h, "signed "); + else if (t->sign < 0) fprintf(h, "unsigned "); + switch (t->type) { case RPC_FC_ENUM16: case RPC_FC_ENUM32: if (t->defined && !t->written && !t->ignore) { @@ -259,14 +250,6 @@ void write_type(FILE *h, type_t *t, const var_t *v, const char *n) } else fprintf(h, "enum %s", t->name); break; - case RPC_FC_ERROR_STATUS_T: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "error_status_t"); - break; - case RPC_FC_BIND_PRIMITIVE: - if (t->ref) fprintf(h, t->ref->name); - else fprintf(h, "handle_t"); - break; case RPC_FC_STRUCT: case RPC_FC_CVSTRUCT: case RPC_FC_CPSTRUCT: @@ -297,24 +280,15 @@ void write_type(FILE *h, type_t *t, const var_t *v, const char *n) } else fprintf(h, "union %s", t->name); break; + case RPC_FC_RP: + case RPC_FC_UP: case RPC_FC_FP: - if (t->ref) write_type(h, t->ref, NULL, t->name); - fprintf(h, "*"); + case RPC_FC_OP: + if (t->ref) write_type(h, t->ref); + fprintf(h, "%s*", needs_space_after(t->ref) ? " " : ""); break; default: - fprintf(h, "(unknown-type:%d)", t->type); - } - } - else { - if (t->ref) { - write_type(h, t->ref, NULL, t->name); - } - else fprintf(h, "void"); - } - } - if (v) { - for (c=0; cptr_level; c++) { - fprintf(h, "*"); + fprintf(h, "%s", t->name); } } } @@ -337,12 +311,16 @@ static int user_type_registered(const char *name) return 0; } -static void check_for_user_types(const var_t *v) +static void check_for_user_types(const var_list_t *list) { - while (v) { - type_t *type = v->type; - const char *name = v->tname; - for (type = v->type; type; type = type->ref) { + const var_t *v; + + if (!list) return; + LIST_FOR_EACH_ENTRY( v, list, const var_t, entry ) + { + type_t *type; + for (type = v->type; type; type = type->kind == TKIND_ALIAS ? type->orig : type->ref) { + const char *name = type->name; if (type->user_types_registered) continue; type->user_types_registered = 1; if (is_attr(type->attrs, ATTR_WIREMARSHAL)) { @@ -357,18 +335,11 @@ static void check_for_user_types(const var_t *v) * using a wire marshaled type */ break; } - else if (type->fields) + else { - const var_t *fields = type->fields; - while (NEXT_LINK(fields)) fields = NEXT_LINK(fields); - check_for_user_types(fields); + check_for_user_types(type->fields); } - /* the wire_marshal attribute is always at least one reference away - * from the name of the type, so update it after the rest of the - * processing above */ - if (type->name) name = type->name; } - v = PREV_LINK(v); } } @@ -378,29 +349,18 @@ void write_user_types(void) for (ut = user_type_list; ut; ut = ut->next) { const char *name = ut->name; - fprintf(header, "unsigned long __RPC_USER %s_UserSize (unsigned long *, unsigned long, %s *);\n", name, name); - fprintf(header, "unsigned char * __RPC_USER %s_UserMarshal (unsigned long *, unsigned char *, %s *);\n", name, name); - fprintf(header, "unsigned char * __RPC_USER %s_UserUnmarshal(unsigned long *, unsigned char *, %s *);\n", name, name); - fprintf(header, "void __RPC_USER %s_UserFree (unsigned long *, %s *);\n", name, name); + fprintf(header, "ULONG __RPC_USER %s_UserSize (ULONG *, ULONG, %s *);\n", name, name); + fprintf(header, "unsigned char * __RPC_USER %s_UserMarshal (ULONG *, unsigned char *, %s *);\n", name, name); + fprintf(header, "unsigned char * __RPC_USER %s_UserUnmarshal(ULONG *, unsigned char *, %s *);\n", name, name); + fprintf(header, "void __RPC_USER %s_UserFree (ULONG *, %s *);\n", name, name); } } -void write_typedef(type_t *type, const var_t *names) +void write_typedef(type_t *type) { - const char *tname = names->tname; - const var_t *lname; - while (NEXT_LINK(names)) names = NEXT_LINK(names); - lname = names; fprintf(header, "typedef "); - write_type(header, type, NULL, tname); - fprintf(header, " "); - while (names) { - write_pident(header, names); - if (PREV_LINK(names)) - fprintf(header, ", "); - names = PREV_LINK(names); - } - fprintf(header, ";\n"); + write_type(header, type->orig); + fprintf(header, "%s%s;\n", needs_space_after(type->orig) ? " " : "", type->name); } void write_expr(FILE *h, const expr_t *e, int brackets) @@ -409,7 +369,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets) case EXPR_VOID: break; case EXPR_NUM: - fprintf(h, "%ld", e->u.lval); + fprintf(h, "%lu", e->u.lval); break; case EXPR_HEXNUM: fprintf(h, "0x%lx", e->u.lval); @@ -437,13 +397,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets) break; case EXPR_CAST: fprintf(h, "("); - write_type(h, e->u.tref->ref, NULL, e->u.tref->name); + write_type(h, e->u.tref); fprintf(h, ")"); write_expr(h, e->ref, 1); break; case EXPR_SIZEOF: fprintf(h, "sizeof("); - write_type(h, e->u.tref->ref, NULL, e->u.tref->name); + write_type(h, e->u.tref); fprintf(h, ")"); break; case EXPR_SHL: @@ -492,18 +452,17 @@ void write_constdef(const var_t *v) void write_externdef(const var_t *v) { fprintf(header, "extern const "); - write_type(header, v->type, NULL, v->tname); - if (get_name(v)) { - fprintf(header, " "); - write_pident(header, v); - } + write_type(header, v->type); + if (get_name(v)) + fprintf(header, " %s", v->name); fprintf(header, ";\n\n"); } -void write_library(const char *name, const attr_t *attr) { +void write_library(const char *name, const attr_list_t *attr) +{ const UUID *uuid = get_attrp(attr, ATTR_UUID); fprintf(header, "\n"); - write_guid("LIBID", name, uuid); + write_guid(header, "LIBID", name, uuid); fprintf(header, "\n"); } @@ -515,85 +474,69 @@ const var_t* get_explicit_handle_var(const func_t* func) if (!func->args) return NULL; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) if (var->type->type == RPC_FC_BIND_PRIMITIVE) return var; - var = PREV_LINK(var); - } - return NULL; } int has_out_arg_or_return(const func_t *func) { - var_t *var; + const var_t *var; - if (!is_void(func->def->type, NULL)) + if (!is_void(func->def->type)) return 1; if (!func->args) return 0; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) if (is_attr(var->attrs, ATTR_OUT)) return 1; - var = PREV_LINK(var); - } return 0; } /********** INTERFACES **********/ -int is_object(const attr_t *a) +int is_object(const attr_list_t *list) { - while (a) { - if (a->type == ATTR_OBJECT || a->type == ATTR_ODL) return 1; - a = NEXT_LINK(a); - } - return 0; + const attr_t *attr; + if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry ) + if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1; + return 0; } -int is_local(const attr_t *a) +int is_local(const attr_list_t *a) { return is_attr(a, ATTR_LOCAL); } -const var_t *is_callas(const attr_t *a) +const var_t *is_callas(const attr_list_t *a) { return get_attrp(a, ATTR_CALLAS); } -static int write_method_macro(const type_t *iface, const char *name) +static void write_method_macro(const type_t *iface, const char *name) { - int idx; - func_t *cur = iface->funcs; + const func_t *cur; - if (iface->ref) idx = write_method_macro(iface->ref, name); - else idx = 0; + if (iface->ref) write_method_macro(iface->ref, name); - if (!cur) return idx; - while (NEXT_LINK(cur)) cur = NEXT_LINK(cur); + if (!iface->funcs) return; fprintf(header, "/*** %s methods ***/\n", iface->name); - while (cur) { + LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) + { var_t *def = cur->def; if (!is_callas(def->attrs)) { - var_t *arg = cur->args; + const var_t *arg; int argc = 0; int c; - while (arg) { - arg = NEXT_LINK(arg); - argc++; - } + + if (cur->args) LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) argc++; fprintf(header, "#define %s_", name); write_name(header,def); @@ -608,22 +551,15 @@ static int write_method_macro(const type_t *iface, const char *name) for (c=0; cidx == -1) cur->idx = idx; - else if (cur->idx != idx) yyerror("BUG: method index mismatch in write_method_macro"); - idx++; } - cur = PREV_LINK(cur); } - return idx; } -void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent) +void write_args(FILE *h, const var_list_t *args, const char *name, int method, int do_indent) { + const var_t *arg; int count = 0; - if (arg) { - while (NEXT_LINK(arg)) - arg = NEXT_LINK(arg); - } + if (do_indent) { indentation++; @@ -633,7 +569,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent fprintf(h, "%s* This", name); count++; } - while (arg) { + if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) { if (count) { if (do_indent) { @@ -642,7 +578,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent } else fprintf(h, ","); } - write_type(h, arg->type, arg, arg->tname); + write_type(h, arg->type); if (arg->args) { fprintf(h, " (STDMETHODCALLTYPE *"); @@ -653,11 +589,11 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent } else { - fprintf(h, " "); + if (needs_space_after(arg->type)) + fprintf(h, " "); write_name(h, arg); } write_array(h, arg->array, 0); - arg = PREV_LINK(arg); count++; } if (do_indent) indentation--; @@ -665,16 +601,17 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent static void write_cpp_method_def(const type_t *iface) { - func_t *cur = iface->funcs; + const func_t *cur; - if (!cur) return; - while (NEXT_LINK(cur)) cur = NEXT_LINK(cur); - while (cur) { + if (!iface->funcs) return; + + LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) + { var_t *def = cur->def; if (!is_callas(def->attrs)) { indent(header, 0); fprintf(header, "virtual "); - write_type(header, def->type, def, def->tname); + write_type(header, def->type); fprintf(header, " STDMETHODCALLTYPE "); write_name(header, def); fprintf(header, "(\n"); @@ -682,25 +619,24 @@ static void write_cpp_method_def(const type_t *iface) fprintf(header, ") = 0;\n"); fprintf(header, "\n"); } - cur = PREV_LINK(cur); } } static void do_write_c_method_def(const type_t *iface, const char *name) { - const func_t *cur = iface->funcs; + const func_t *cur; if (iface->ref) do_write_c_method_def(iface->ref, name); - if (!cur) return; - while (NEXT_LINK(cur)) cur = NEXT_LINK(cur); + if (!iface->funcs) return; indent(header, 0); fprintf(header, "/*** %s methods ***/\n", iface->name); - while (cur) { + LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) + { const var_t *def = cur->def; if (!is_callas(def->attrs)) { indent(header, 0); - write_type(header, def->type, def, def->tname); + write_type(header, def->type); fprintf(header, " (STDMETHODCALLTYPE *"); write_name(header, def); fprintf(header, ")(\n"); @@ -708,7 +644,6 @@ static void do_write_c_method_def(const type_t *iface, const char *name) fprintf(header, ");\n"); fprintf(header, "\n"); } - cur = PREV_LINK(cur); } } @@ -724,17 +659,17 @@ static void write_c_disp_method_def(const type_t *iface) static void write_method_proto(const type_t *iface) { - const func_t *cur = iface->funcs; + const func_t *cur; - if (!cur) return; - while (NEXT_LINK(cur)) cur = NEXT_LINK(cur); - while (cur) { + if (!iface->funcs) return; + LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) + { const var_t *def = cur->def; const var_t *cas = is_callas(def->attrs); - const var_t *args; + if (!is_local(def->attrs)) { /* proxy prototype */ - write_type(header, def->type, def, def->tname); + write_type(header, def->type); fprintf(header, " CALLBACK %s_", iface->name); write_name(header, def); fprintf(header, "_Proxy(\n"); @@ -748,29 +683,23 @@ static void write_method_proto(const type_t *iface) fprintf(header, " IRpcChannelBuffer* pRpcChannelBuffer,\n"); fprintf(header, " PRPC_MESSAGE pRpcMessage,\n"); fprintf(header, " DWORD* pdwStubPhase);\n"); - - args = cur->args; - if (args) { - while (NEXT_LINK(args)) - args = NEXT_LINK(args); - } - check_for_user_types(args); + check_for_user_types(cur->args); } if (cas) { - const func_t *m = iface->funcs; - while (m && strcmp(get_name(m->def), cas->name)) - m = NEXT_LINK(m); - if (m) { + const func_t *m; + LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry ) + if (!strcmp(get_name(m->def), cas->name)) break; + if (&m->entry != iface->funcs) { const var_t *mdef = m->def; /* proxy prototype - use local prototype */ - write_type(header, mdef->type, mdef, mdef->tname); + write_type(header, mdef->type); fprintf(header, " CALLBACK %s_", iface->name); write_name(header, mdef); fprintf(header, "_Proxy(\n"); write_args(header, m->args, iface->name, 1, TRUE); fprintf(header, ");\n"); /* stub prototype - use remotable prototype */ - write_type(header, def->type, def, def->tname); + write_type(header, def->type); fprintf(header, " __RPC_STUB %s_", iface->name); write_name(header, mdef); fprintf(header, "_Stub(\n"); @@ -778,23 +707,39 @@ static void write_method_proto(const type_t *iface) fprintf(header, ");\n"); } else { - yywarning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name); + parser_warning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name); } } - - cur = PREV_LINK(cur); } } -static void write_function_proto(const type_t *iface) +static void write_function_proto(const type_t *iface, const func_t *fun, const char *prefix) +{ + var_t *def = fun->def; + + /* FIXME: do we need to handle call_as? */ + write_type(header, def->type); + fprintf(header, " "); + write_prefix_name(header, prefix, def); + fprintf(header, "(\n"); + if (fun->args) + write_args(header, fun->args, iface->name, 0, TRUE); + else + fprintf(header, " void"); + fprintf(header, ");\n"); +} + +static void write_function_protos(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 func_t *cur; + int prefixes_differ = strcmp(prefix_client, prefix_server); - func_t *cur = iface->funcs; - while (NEXT_LINK(cur)) cur = NEXT_LINK(cur); - while (cur) { + 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 */ @@ -811,18 +756,12 @@ static void write_function_proto(const type_t *iface) } } - /* FIXME: do we need to handle call_as? */ - write_type(header, def->type, def, def->tname); - fprintf(header, " "); - write_name(header, def); - fprintf(header, "(\n"); - if (cur->args) - write_args(header, cur->args, iface->name, 0, TRUE); - else - fprintf(header, " void"); - fprintf(header, ");\n"); - - cur = PREV_LINK(cur); + if (prefixes_differ) { + fprintf(header, "/* client prototype */\n"); + write_function_proto(iface, cur, prefix_client); + fprintf(header, "/* server prototype */\n"); + } + write_function_proto(iface, cur, prefix_server); } } @@ -846,25 +785,25 @@ void write_forward(type_t *iface) static void write_iface_guid(const type_t *iface) { const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); - write_guid("IID", iface->name, uuid); + write_guid(header, "IID", iface->name, uuid); } static void write_dispiface_guid(const type_t *iface) { const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); - write_guid("DIID", iface->name, uuid); + write_guid(header, "DIID", iface->name, uuid); } static void write_coclass_guid(type_t *cocl) { const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID); - write_guid("CLSID", cocl->name, uuid); + write_guid(header, "CLSID", cocl->name, uuid); } static void write_com_interface(type_t *iface) { if (!iface->funcs && !iface->ref) { - yywarning("%s has no methods", iface->name); + parser_warning("%s has no methods", iface->name); return; } @@ -909,7 +848,7 @@ static void write_com_interface(type_t *iface) fprintf(header, " END_INTERFACE\n"); fprintf(header, "} %sVtbl;\n", iface->name); fprintf(header, "interface %s {\n", iface->name); - fprintf(header, " const %sVtbl* lpVtbl;\n", iface->name); + fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->name); fprintf(header, "};\n"); fprintf(header, "\n"); fprintf(header, "#ifdef COBJMACROS\n"); @@ -946,15 +885,17 @@ static void write_rpc_interface(const type_t *iface) if (var) fprintf(header, "extern handle_t %s;\n", var); if (old_names) { - fprintf(header, "extern RPC_IF_HANDLE %s_ClientIfHandle;\n", iface->name); - fprintf(header, "extern RPC_IF_HANDLE %s_ServerIfHandle;\n", iface->name); + 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_v%d_%d_c_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); - fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_s_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver)); + fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec;\n", + prefix_client, iface->name, LOWORD(ver), HIWORD(ver)); + fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec;\n", + prefix_server, iface->name, LOWORD(ver), HIWORD(ver)); } - write_function_proto(iface); + write_function_protos(iface); } fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name); @@ -994,7 +935,7 @@ void write_dispinterface(type_t *iface) fprintf(header, " END_INTERFACE\n"); fprintf(header, "} %sVtbl;\n", iface->name); fprintf(header, "interface %s {\n", iface->name); - fprintf(header, " const %sVtbl* lpVtbl;\n", iface->name); + fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->name); fprintf(header, "};\n"); fprintf(header, "\n"); fprintf(header, "#ifdef COBJMACROS\n"); diff --git a/reactos/tools/widl/header.h b/reactos/tools/widl/header.h index 5863f3b0eff..57ae6b4a72d 100644 --- a/reactos/tools/widl/header.h +++ b/reactos/tools/widl/header.h @@ -21,42 +21,55 @@ #ifndef __WIDL_HEADER_H #define __WIDL_HEADER_H -extern int is_attr(const attr_t *a, enum attr_type t); -extern void *get_attrp(const attr_t *a, enum attr_type t); -extern unsigned long get_attrv(const attr_t *a, enum attr_type t); -extern int is_void(const type_t *t, const var_t *v); +#include "widltypes.h" + +extern int is_ptrchain_attr(const var_t *var, enum attr_type t); +extern int is_attr(const attr_list_t *list, enum attr_type t); +extern void *get_attrp(const attr_list_t *list, enum attr_type t); +extern unsigned long get_attrv(const attr_list_t *list, enum attr_type t); +extern int is_void(const type_t *t); +extern int is_conformant_array( const array_dims_t *array ); +extern int is_non_void(const expr_list_t *list); extern void write_name(FILE *h, const var_t *v); +extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v); extern const char* get_name(const var_t *v); -extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n); -extern int is_object(const attr_t *a); -extern int is_local(const attr_t *a); -extern const var_t *is_callas(const attr_t *a); -extern void write_args(FILE *h, var_t *arg, const char *name, int obj, int do_indent); -extern void write_array(FILE *h, const expr_t *v, int field); +extern void write_type(FILE *h, type_t *t); +extern int is_object(const attr_list_t *list); +extern int is_local(const attr_list_t *list); +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_forward(type_t *iface); extern void write_interface(type_t *iface); extern void write_dispinterface(type_t *iface); extern void write_coclass(type_t *cocl); extern void write_coclass_forward(type_t *cocl); -extern void write_typedef(type_t *type, const var_t *names); +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_t *attr); +extern void write_library(const char *name, const attr_list_t *attr); extern void write_user_types(void); extern const var_t* get_explicit_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); -static inline int is_string_type(const attr_t *attrs, int ptr_level, const expr_t *array) +static inline int last_ptr(const type_t *type) { - return (is_attr(attrs, ATTR_STRING) && - ((ptr_level == 1 && !array) || (ptr_level == 0 && array))); + return is_ptr(type) && !is_ptr(type->ref); } -static inline int is_array_type(const attr_t *attrs, int ptr_level, const expr_t *array) +static inline int is_string_type(const attr_list_t *attrs, const type_t *type, const array_dims_t *array) { - return ((ptr_level == 1 && !array && is_attr(attrs, ATTR_SIZEIS)) || - (ptr_level == 0 && array)); + return (is_attr(attrs, ATTR_STRING) && + ((last_ptr(type) && !array) || (!is_ptr(type) && array))); +} + +static inline int is_array_type(const attr_list_t *attrs, const type_t *type, const array_dims_t *array) +{ + return ((last_ptr(type) && !array && is_attr(attrs, ATTR_SIZEIS)) || + (!is_ptr(type) && array)); } #endif diff --git a/reactos/tools/widl/lex.yy.c b/reactos/tools/widl/lex.yy.c index c5601a7d0cc..bfd5be89721 100644 --- a/reactos/tools/widl/lex.yy.c +++ b/reactos/tools/widl/lex.yy.c @@ -1,4 +1,22 @@ -#line 2 "lex.yy.c" +#define yy_create_buffer parser__create_buffer +#define yy_delete_buffer parser__delete_buffer +#define yy_scan_buffer parser__scan_buffer +#define yy_scan_string parser__scan_string +#define yy_scan_bytes parser__scan_bytes +#define yy_flex_debug parser__flex_debug +#define yy_init_buffer parser__init_buffer +#define yy_flush_buffer parser__flush_buffer +#define yy_load_buffer_state parser__load_buffer_state +#define yy_switch_to_buffer parser__switch_to_buffer +#define yyin parser_in +#define yyleng parser_leng +#define yylex parser_lex +#define yyout parser_out +#define yyrestart parser_restart +#define yytext parser_text +#define yywrap parser_wrap + +#line 20 "tools\\widl_new\\lex.yy.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: @@ -262,3115 +280,11 @@ static void yy_flex_free YY_PROTO(( void * )); #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -#define FLEX_DEBUG typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; - -#define FLEX_DEBUG extern char *yytext; #define yytext_ptr yytext -static yyconst short yy_nxt[][256] = - { - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 - }, - - { - 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 10, 8, 9, 9, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 9, 8, 11, 8, 8, 8, 8, 8, - - 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 8, 8, - 14, 8, 15, 8, 8, 16, 16, 16, 16, 16, - 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 18, 17, 17, 17, 17, 17, 17, - 17, 8, 8, 8, 8, 17, 8, 16, 16, 16, - 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8 - }, - - { - 7, 8, 8, 8, 8, 8, 8, 8, 8, 19, - 10, 8, 19, 19, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 19, 8, 11, 20, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 8, 8, - 14, 8, 15, 8, 8, 16, 16, 16, 16, 16, - 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, - - 17, 17, 17, 18, 17, 17, 17, 17, 17, 17, - 17, 8, 8, 8, 8, 17, 8, 16, 16, 16, - 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8 - }, - - { - 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 23, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 24, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21 - }, - - { - 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 23, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 24, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21 - - }, - - { - 7, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 22, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25 - }, - - { - 7, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 22, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25 - }, - - { - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7 - }, - - { - 7, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, - -8, -8, -8, -8, -8, -8 - }, - - { - 7, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, - -9, -9, -9, -9, -9, -9 - - }, - - { - 7, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, - -10, -10, -10, -10, -10, -10 - }, - - { - 7, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11 - }, - - { - 7, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, -12, -12, - -12, -12, -12, -12, -12, 27, 27, 27, 27, 27, - 27, -12, -12, -12, -12, -12, -12, -12, -12, -12, - - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, 27, 27, 27, - 27, 27, 27, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - 28, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12 - }, - - { - 7, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, -13, -13, - -13, -13, -13, -13, -13, 27, 27, 27, 27, 27, - 27, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, 27, 27, 27, - 27, 27, 27, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13 - }, - - { - 7, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - - 29, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14 - - }, - - { - 7, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, 30, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15 - }, - - { - 7, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - - -16, -16, -16, -16, -16, -16, -16, -16, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, -16, -16, - -16, -16, -16, -16, -16, 31, 31, 31, 31, 31, - 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -16, -16, -16, -16, 32, -16, 31, 31, 31, - 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16 - }, - - { - 7, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -17, -17, - -17, -17, -17, -17, -17, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -17, -17, -17, -17, 32, -17, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17 - }, - - { - 7, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -18, -18, - -18, -18, -18, -18, -18, 33, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -18, -18, -18, -18, 32, -18, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18 - }, - - { - 7, -19, -19, -19, -19, -19, -19, -19, -19, 34, - -19, -19, 34, 34, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, 34, -19, -19, 35, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19 - - }, - - { - 7, -20, -20, -20, -20, -20, -20, -20, -20, 36, - -20, -20, 36, 36, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, 36, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20 - }, - - { - 7, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - - -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, -21, -21, -21 - }, - - { - 7, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22 - }, - - { - 7, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23 - }, - - { - 7, 37, 37, 37, 37, 37, 37, 37, 37, 37, - -24, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 39, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37 - - }, - - { - 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, - -25, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40 - }, - - { - 7, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - - -26, -26, -26, -26, -26, -26, -26, -26, 41, 41, - 41, 41, 41, 41, 41, 41, 41, 41, -26, -26, - -26, -26, -26, -26, -26, 42, 42, 42, 42, 42, - 42, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, 42, 42, 42, - 42, 42, 42, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26 - }, - - { - 7, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, -27, -27, - -27, -27, -27, -27, -27, 42, 42, 42, 42, 42, - 42, -27, -27, -27, -27, -27, -27, -27, -27, -27, - - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, 42, 42, 42, - 42, 42, 42, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27 - }, - - { - 7, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, -28, -28, - -28, -28, -28, -28, -28, 43, 43, 43, 43, 43, - 43, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, 43, 43, 43, - 43, 43, 43, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28 - }, - - { - 7, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, -29, -29 - - }, - - { - 7, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30 - }, - - { - 7, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - - -31, -31, -31, -31, -31, -31, -31, -31, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, -31, -31, - -31, -31, -31, -31, -31, 44, 44, 44, 44, 44, - 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -31, -31, -31, -31, 32, -31, 44, 44, 44, - 44, 44, 44, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - - -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, - -31, -31, -31, -31, -31, -31 - }, - - { - 7, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -32, -32, - -32, -32, -32, -32, -32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -32, -32, -32, -32, 32, -32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32 - }, - - { - 7, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -33, -33, - -33, -33, -33, -33, -33, 32, 32, 32, 32, 32, - 45, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -33, -33, -33, -33, 32, -33, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33 - }, - - { - 7, -34, -34, -34, -34, -34, -34, -34, -34, 34, - -34, -34, 34, 34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, 34, -34, -34, 35, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34 - - }, - - { - 7, -35, -35, -35, -35, -35, -35, -35, -35, 36, - -35, -35, 36, 36, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, 36, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35 - }, - - { - 7, -36, -36, -36, -36, -36, -36, -36, -36, 36, - -36, -36, 36, 36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, 36, -36, -36, -36, -36, -36, -36, -36, - - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36 - }, - - { - 7, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37 - }, - - { - 7, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38 - }, - - { - 7, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39 - - }, - - { - 7, 40, 40, 40, 40, 40, 40, 40, 40, 40, - -40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40 - }, - - { - 7, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - - -41, -41, -41, -41, -41, -41, -41, -41, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, -41, -41, - -41, -41, -41, -41, -41, 47, 47, 47, 47, 47, - 47, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, 47, 47, 47, - 47, 47, 47, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41 - }, - - { - 7, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, -42, -42, - -42, -42, -42, -42, -42, 47, 47, 47, 47, 47, - 47, -42, -42, -42, -42, -42, -42, -42, -42, -42, - - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, 47, 47, 47, - 47, 47, 47, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42 - }, - - { - 7, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, -43, -43, - -43, -43, -43, -43, -43, 43, 43, 43, 43, 43, - 43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, 43, 43, 43, - 43, 43, 43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43 - }, - - { - 7, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, -44, -44, - - -44, -44, -44, -44, -44, 48, 48, 48, 48, 48, - 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -44, -44, -44, -44, 32, -44, 48, 48, 48, - 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44 - - }, - - { - 7, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -45, -45, - -45, -45, -45, -45, -45, 32, 32, 32, 32, 49, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -45, -45, -45, -45, 32, -45, 32, 32, 32, - - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45 - }, - - { - 7, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - - -46, -46, -46, -46, -46, -46, -46, -46, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, -46, -46, - -46, -46, -46, -46, -46, 51, 51, 51, 51, 51, - 51, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, 51, 51, 51, - 51, 51, 51, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - - -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, -46, -46, -46, -46, -46 - }, - - { - 7, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, -47, -47, - -47, -47, -47, -47, -47, 51, 51, 51, 51, 51, - 51, -47, -47, -47, -47, -47, -47, -47, -47, -47, - - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, 51, 51, 51, - 51, 51, 51, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47 - }, - - { - 7, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, -48, -48, - -48, -48, -48, -48, -48, 52, 52, 52, 52, 52, - 52, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -48, -48, -48, -48, 32, -48, 52, 52, 52, - 52, 52, 52, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48 - }, - - { - 7, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -49, -49, - - -49, -49, -49, -49, -49, 53, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -49, -49, -49, -49, 32, -49, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49 - - }, - - { - 7, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, -50, -50, - -50, -50, -50, -50, -50, 55, 55, 55, 55, 55, - 55, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, 55, 55, 55, - - 55, 55, 55, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50 - }, - - { - 7, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - - -51, -51, -51, -51, -51, -51, -51, -51, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, -51, -51, - -51, -51, -51, -51, -51, 55, 55, 55, 55, 55, - 55, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, 55, 55, 55, - 55, 55, 55, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51 - }, - - { - 7, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, -52, -52, - -52, -52, -52, -52, -52, 56, 56, 56, 56, 56, - 56, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -52, -52, -52, -52, 32, -52, 56, 56, 56, - 56, 56, 56, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52 - }, - - { - 7, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -53, -53, - -53, -53, -53, -53, -53, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 57, 32, 32, 32, 32, 32, 32, 32, - 32, -53, -53, -53, -53, 32, -53, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53 - }, - - { - 7, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, -54, -54, - - -54, -54, -54, -54, -54, 59, 59, 59, 59, 59, - 59, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, 59, 59, 59, - 59, 59, 59, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54 - - }, - - { - 7, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, -55, -55, - -55, -55, -55, -55, -55, 59, 59, 59, 59, 59, - 59, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, 59, 59, 59, - - 59, 59, 59, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55 - }, - - { - 7, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - - -56, -56, -56, -56, -56, -56, -56, -56, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, -56, -56, - -56, -56, -56, -56, -56, 60, 60, 60, 60, 60, - 60, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -56, -56, -56, -56, 32, -56, 60, 60, 60, - 60, 60, 60, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - - -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56 - }, - - { - 7, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -57, -57, - -57, -57, -57, -57, -57, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 61, 32, 32, 32, 32, 32, 32, 32, - 32, -57, -57, -57, -57, 32, -57, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57 - }, - - { - 7, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, -58, -58, - -58, -58, -58, -58, -58, 63, 63, 63, 63, 63, - 63, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, 63, 63, 63, - 63, 63, 63, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58 - }, - - { - 7, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, -59, -59, - - -59, -59, -59, -59, -59, 63, 63, 63, 63, 63, - 63, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, 63, 63, 63, - 63, 63, 63, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, -59, -59, -59 - - }, - - { - 7, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, -60, -60, - -60, -60, -60, -60, -60, 64, 64, 64, 64, 64, - 64, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -60, -60, -60, -60, 32, -60, 64, 64, 64, - - 64, 64, 64, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60 - }, - - { - 7, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - - -61, -61, -61, -61, -61, -61, -61, -61, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -61, -61, - -61, -61, -61, -61, -61, 65, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -61, -61, -61, -61, 32, -61, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61 - }, - - { - 7, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, 66, -62, -62, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62 - }, - - { - 7, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, 66, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63 - }, - - { - 7, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, 66, -64, -64, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -64, -64, - - -64, -64, -64, -64, -64, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -64, -64, -64, -64, 32, -64, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64 - - }, - - { - 7, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -65, -65, - -65, -65, -65, -65, -65, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 68, - 32, -65, -65, -65, -65, 32, -65, 32, 32, 32, - - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65 - }, - - { - 7, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - - -66, -66, -66, -66, -66, -66, -66, -66, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, -66, -66, - -66, -66, -66, -66, -66, 69, 69, 69, 69, 69, - 69, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, 69, 69, 69, - 69, 69, 69, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - - -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, -66, -66, -66 - }, - - { - 7, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, -67, -67, -67 - }, - - { - 7, -68, -68, -68, -68, -68, -68, -68, -68, 70, - -68, -68, 70, 70, -68, -68, -68, -68, -68, -68, - - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, 70, -68, -68, -68, -68, -68, -68, -68, - 71, -68, -68, -68, -68, -68, -68, -68, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, -68, -68, - -68, -68, -68, -68, -68, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, -68, -68, -68, -68, 32, -68, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - - 32, 32, 32, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, -68, -68, -68 - }, - - { - 7, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, -69, -69, - - -69, -69, -69, -69, -69, 72, 72, 72, 72, 72, - 72, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, 72, 72, 72, - 72, 72, 72, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, -69, -69, -69 - - }, - - { - 7, -70, -70, -70, -70, -70, -70, -70, -70, 70, - -70, -70, 70, 70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, 70, -70, -70, -70, -70, -70, -70, -70, - 71, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, -70, -70, -70 - }, - - { - 7, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - - -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, -71, -71, -71 - }, - - { - 7, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, -72, -72, - -72, -72, -72, -72, -72, 73, 73, 73, 73, 73, - 73, -72, -72, -72, -72, -72, -72, -72, -72, -72, - - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, 73, 73, 73, - 73, 73, 73, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, -72, -72, -72 - }, - - { - 7, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, -73, -73, - -73, -73, -73, -73, -73, 74, 74, 74, 74, 74, - 74, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, 74, 74, 74, - 74, 74, 74, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, -73, -73 - }, - - { - 7, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, 75, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, -74, -74, -74 - - }, - - { - 7, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, 76, 76, - 76, 76, 76, 76, 76, 76, 76, 76, -75, -75, - -75, -75, -75, -75, -75, 76, 76, 76, 76, 76, - 76, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, 76, 76, 76, - - 76, 76, 76, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, -75, -75, -75 - }, - - { - 7, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - - -76, -76, -76, -76, -76, -76, -76, -76, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, -76, -76, - -76, -76, -76, -76, -76, 77, 77, 77, 77, 77, - 77, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, 77, 77, 77, - 77, 77, 77, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - - -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, -76, -76, -76 - }, - - { - 7, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, -77, -77, - -77, -77, -77, -77, -77, 78, 78, 78, 78, 78, - 78, -77, -77, -77, -77, -77, -77, -77, -77, -77, - - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, 78, 78, 78, - 78, 78, 78, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77 - }, - - { - 7, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, -78, -78, - -78, -78, -78, -78, -78, 79, 79, 79, 79, 79, - 79, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, 79, 79, 79, - 79, 79, 79, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78 - }, - - { - 7, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, 80, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, - -79, -79, -79, -79, -79, -79 - - }, - - { - 7, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, -80, -80, - -80, -80, -80, -80, -80, 81, 81, 81, 81, 81, - 81, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, 81, 81, 81, - - 81, 81, 81, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80 - }, - - { - 7, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - - -81, -81, -81, -81, -81, -81, -81, -81, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, -81, -81, - -81, -81, -81, -81, -81, 82, 82, 82, 82, 82, - 82, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, 82, 82, 82, - 82, 82, 82, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - - -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, - -81, -81, -81, -81, -81, -81 - }, - - { - 7, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, -82, -82, - -82, -82, -82, -82, -82, 83, 83, 83, 83, 83, - 83, -82, -82, -82, -82, -82, -82, -82, -82, -82, - - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, 83, 83, 83, - 83, 83, 83, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82 - }, - - { - 7, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, -83, -83, - -83, -83, -83, -83, -83, 84, 84, 84, 84, 84, - 84, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, 84, 84, 84, - 84, 84, 84, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83 - }, - - { - 7, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, 85, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84 - - }, - - { - 7, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, -85, -85, - -85, -85, -85, -85, -85, 86, 86, 86, 86, 86, - 86, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, 86, 86, 86, - - 86, 86, 86, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85 - }, - - { - 7, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - - -86, -86, -86, -86, -86, -86, -86, -86, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, -86, -86, - -86, -86, -86, -86, -86, 87, 87, 87, 87, 87, - 87, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, 87, 87, 87, - 87, 87, 87, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - - -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, - -86, -86, -86, -86, -86, -86 - }, - - { - 7, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, -87, -87, - -87, -87, -87, -87, -87, 88, 88, 88, 88, 88, - 88, -87, -87, -87, -87, -87, -87, -87, -87, -87, - - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, 88, 88, 88, - 88, 88, 88, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87 - }, - - { - 7, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, -88, -88, - -88, -88, -88, -88, -88, 89, 89, 89, 89, 89, - 89, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, 89, 89, 89, - 89, 89, 89, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, -88 - }, - - { - 7, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, -89, -89, - - -89, -89, -89, -89, -89, 90, 90, 90, 90, 90, - 90, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, 90, 90, 90, - 90, 90, 90, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89, -89, -89 - - }, - - { - 7, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, -90, -90, - -90, -90, -90, -90, -90, 91, 91, 91, 91, 91, - 91, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, 91, 91, 91, - - 91, 91, 91, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90 - }, - - { - 7, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - - -91, -91, -91, -91, -91, -91, -91, -91, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, -91, -91, - -91, -91, -91, -91, -91, 92, 92, 92, 92, 92, - 92, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, 92, 92, 92, - 92, 92, 92, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91 - }, - - { - 7, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, -92, -92, - -92, -92, -92, -92, -92, 93, 93, 93, 93, 93, - 93, -92, -92, -92, -92, -92, -92, -92, -92, -92, - - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, 93, 93, 93, - 93, 93, 93, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92 - }, - - { - 7, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, -93, -93, - -93, -93, -93, -93, -93, 94, 94, 94, 94, 94, - 94, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, 94, 94, 94, - 94, 94, 94, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93 - }, - - { - 7, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, -94, -94, - - -94, -94, -94, -94, -94, 95, 95, 95, 95, 95, - 95, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, 95, 95, 95, - 95, 95, 95, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, -94, -94, -94 - - }, - - { - 7, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, -95, -95, - -95, -95, -95, -95, -95, 96, 96, 96, 96, 96, - 96, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, 96, 96, 96, - - 96, 96, 96, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95 - }, - - { - 7, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - - -96, -96, -96, -96, -96, -96, -96, -96, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, -96, -96, - -96, -96, -96, -96, -96, 97, 97, 97, 97, 97, - 97, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, 97, 97, 97, - 97, 97, 97, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - - -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, -96, -96, -96 - }, - - { - 7, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, -97, -97, -97 - }, - - } ; - static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); @@ -3387,50 +301,172 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 19 -#define YY_END_OF_BUFFER 20 -static yyconst short int yy_accept[98] = +#define YY_NUM_RULES 22 +#define YY_END_OF_BUFFER 23 +static yyconst short int yy_accept[107] = { 0, - 0, 0, 0, 0, 2, 2, 20, 18, 15, 14, - 3, 11, 11, 18, 18, 13, 13, 13, 15, 1, - 8, 19, 4, 8, 2, 11, 0, 0, 16, 17, - 13, 13, 13, 0, 1, 1, 7, 6, 5, 2, - 11, 0, 10, 13, 13, 11, 0, 13, 13, 11, - 0, 13, 13, 11, 0, 13, 13, 11, 0, 13, - 13, 11, 0, 13, 13, 0, 11, 13, 0, 0, - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2, 2, 23, 21, + 18, 17, 3, 14, 14, 21, 21, 16, 16, 9, + 18, 1, 8, 22, 4, 8, 14, 14, 11, 11, + 10, 2, 14, 0, 19, 20, 16, 16, 0, 1, + 1, 7, 6, 5, 14, 0, 11, 11, 2, 13, + 16, 14, 0, 11, 16, 14, 0, 11, 16, 14, + 0, 11, 16, 14, 0, 11, 16, 14, 0, 11, + 16, 14, 0, 11, 16, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 9 + 0, 0, 0, 0, 12, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 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, 1, 1, 7, 1, 1, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 1, 1, 10, + 1, 11, 1, 1, 12, 13, 13, 13, 14, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 17, 18, 16, 16, 16, 16, 16, 19, 16, + 20, 21, 22, 1, 16, 1, 13, 13, 13, 13, + + 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 23, + 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[24] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 3, 3, 1, + 1, 3, 3, 3, 3, 4, 4, 4, 4, 1, + 1, 1, 4 + } ; + +static yyconst short int yy_base[144] = + { 0, + 0, 22, 22, 25, 46, 28, 240, 239, 241, 244, + 244, 244, 244, 62, 23, 230, 228, 0, 226, 244, + 32, 233, 244, 244, 244, 68, 82, 206, 98, 0, + 244, 0, 27, 0, 244, 244, 0, 201, 36, 213, + 212, 244, 244, 244, 31, 0, 114, 0, 0, 0, + 191, 36, 0, 130, 192, 65, 0, 146, 183, 67, + 0, 162, 182, 69, 0, 178, 186, 71, 0, 194, + 170, 74, 181, 177, 82, 0, 96, 244, 0, 0, + 0, 176, 0, 0, 0, 0, 175, 0, 0, 0, + 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 244, 244, 217, 221, 223, 227, + 229, 233, 169, 165, 164, 163, 154, 153, 149, 148, + 147, 138, 137, 133, 132, 131, 122, 121, 117, 116, + 115, 106, 105, 101, 100, 98, 97, 96, 90, 89, + 84, 83, 39 + } ; + +static yyconst short int yy_def[144] = + { 0, + 106, 1, 107, 107, 106, 5, 108, 108, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 109, 109, 106, + 106, 106, 106, 106, 106, 110, 106, 27, 106, 111, + 106, 112, 106, 113, 106, 106, 109, 109, 106, 106, + 106, 106, 106, 106, 114, 114, 106, 111, 112, 113, + 109, 115, 115, 106, 109, 116, 116, 106, 109, 117, + 117, 106, 109, 118, 118, 106, 109, 119, 119, 106, + 109, 106, 106, 111, 109, 120, 106, 106, 121, 122, + 123, 106, 124, 125, 126, 127, 106, 128, 129, 130, + 131, 106, 132, 133, 134, 135, 136, 137, 138, 139, + + 140, 141, 142, 143, 106, 0, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106 + } ; + +static yyconst short int yy_nxt[268] = + { 0, + 10, 11, 12, 13, 10, 10, 10, 14, 15, 16, + 17, 18, 18, 18, 18, 18, 18, 19, 18, 20, + 10, 10, 18, 21, 24, 25, 22, 24, 25, 21, + 33, 33, 22, 39, 33, 33, 40, 39, 52, 52, + 40, 105, 26, 56, 56, 26, 10, 11, 12, 13, + 10, 10, 10, 27, 28, 16, 17, 29, 29, 29, + 29, 30, 30, 30, 30, 20, 10, 31, 30, 33, + 33, 43, 60, 60, 64, 64, 68, 68, 72, 72, + 76, 33, 33, 77, 34, 104, 103, 78, 44, 45, + 45, 102, 101, 46, 46, 46, 46, 77, 100, 99, + + 98, 78, 97, 96, 34, 47, 47, 95, 94, 47, + 47, 47, 47, 48, 48, 48, 48, 92, 91, 90, + 48, 54, 54, 89, 87, 54, 54, 54, 54, 48, + 48, 48, 48, 86, 85, 84, 48, 58, 58, 82, + 81, 58, 58, 58, 58, 48, 48, 48, 48, 80, + 79, 73, 48, 62, 62, 69, 65, 62, 62, 62, + 62, 48, 48, 48, 48, 61, 57, 53, 48, 66, + 66, 50, 93, 66, 66, 66, 66, 48, 48, 48, + 48, 88, 83, 76, 48, 70, 70, 76, 75, 70, + 70, 70, 70, 48, 48, 48, 48, 71, 67, 63, + + 48, 74, 74, 59, 55, 74, 74, 74, 74, 48, + 48, 48, 48, 41, 41, 51, 48, 23, 23, 23, + 23, 32, 32, 32, 32, 37, 37, 42, 106, 42, + 42, 48, 48, 49, 41, 49, 49, 38, 36, 35, + 106, 24, 24, 9, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106 + } ; + +static yyconst short int yy_chk[268] = + { 0, + 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, + 15, 15, 6, 21, 33, 33, 21, 39, 45, 45, + 39, 143, 3, 52, 52, 4, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 14, + 14, 26, 56, 56, 60, 60, 64, 64, 68, 68, + 72, 72, 72, 75, 14, 142, 141, 75, 26, 27, + 27, 140, 139, 27, 27, 27, 27, 77, 138, 137, + + 136, 77, 135, 134, 27, 29, 29, 133, 132, 29, + 29, 29, 29, 29, 29, 29, 29, 131, 130, 129, + 29, 47, 47, 128, 127, 47, 47, 47, 47, 47, + 47, 47, 47, 126, 125, 124, 47, 54, 54, 123, + 122, 54, 54, 54, 54, 54, 54, 54, 54, 121, + 120, 119, 54, 58, 58, 118, 117, 58, 58, 58, + 58, 58, 58, 58, 58, 116, 115, 114, 58, 62, + 62, 113, 92, 62, 62, 62, 62, 62, 62, 62, + 62, 87, 82, 74, 62, 66, 66, 73, 71, 66, + 66, 66, 66, 66, 66, 66, 66, 67, 63, 59, + + 66, 70, 70, 55, 51, 70, 70, 70, 70, 70, + 70, 70, 70, 41, 40, 38, 70, 107, 107, 107, + 107, 108, 108, 108, 108, 109, 109, 110, 28, 110, + 110, 111, 111, 112, 22, 112, 112, 19, 17, 16, + 9, 8, 7, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -static yyconst yy_state_type yy_NUL_trans[98] = - { 0, - 8, 8, 21, 21, 25, 25, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 37, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 - - } ; - -extern int yy_flex_debug; -int yy_flex_debug = 1; - -static yyconst short int yy_rule_linenum[19] = - { 0, - 106, 107, 126, 127, 132, 133, 134, 135, 136, 140, - 144, 148, 149, 150, 151, 152, 153, 154 - } ; - /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -3439,7 +475,7 @@ static yyconst short int yy_rule_linenum[19] = #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "parser.l" +#line 1 "tools\\widl_new\\parser.l" #define INITIAL 0 /* -*-C-*- * IDL Compiler @@ -3466,9 +502,11 @@ char *yytext; #define YY_NEVER_INTERACTIVE 1 #define QUOTE 1 -#define pp_line 2 +#define ATTR 2 -#line 37 "parser.l" +#define PP_LINE 3 + +#line 38 "tools\\widl_new\\parser.l" #include "config.h" @@ -3498,6 +536,7 @@ static int cbufidx; static int cbufalloc = 0; static int kw_token(const char *kw); +static int attr_token(const char *kw); #define MAX_IMPORT_DEPTH 10 struct { @@ -3535,7 +574,7 @@ static UUID* parse_uuid(const char*u) * The flexer starts here ************************************************************************** */ -#line 3539 "lex.yy.c" +#line 578 "tools\\widl_new\\lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -3689,9 +728,9 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 105 "parser.l" +#line 107 "tools\\widl_new\\parser.l" -#line 3695 "lex.yy.c" +#line 734 "tools\\widl_new\\lex.yy.c" if ( yy_init ) { @@ -3732,74 +771,71 @@ YY_DECL yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); yy_match: - while ( (yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]) > 0 ) + do { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } - + 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 >= 107 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - - yy_current_state = -yy_current_state; + while ( yy_base[yy_current_state] != 244 ); yy_find_action: yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ - if ( yy_flex_debug ) - { - if ( yy_act == 0 ) - fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 19 ) - fprintf( stderr, "--accepting rule at line %d (\"%s\")\n", - yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 19 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - yytext ); - else if ( yy_act == 20 ) - fprintf( stderr, "--(end of buffer or a NUL)\n" ); - else - fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); - } switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos + 1; + yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP -#line 106 "parser.l" -yy_push_state(pp_line); +#line 108 "tools\\widl_new\\parser.l" +yy_push_state(PP_LINE); YY_BREAK case 2: YY_RULE_SETUP -#line 107 "parser.l" +#line 109 "tools\\widl_new\\parser.l" { int lineno; char *cptr, *fname; yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - yyerror("Malformed '#...' line-directive; invalid linenumber"); + parser_error("Malformed '#...' line-directive; invalid linenumber"); fname = strchr(cptr, '"'); if(!fname) - yyerror("Malformed '#...' line-directive; missing filename"); + parser_error("Malformed '#...' line-directive; missing filename"); fname++; cptr = strchr(fname, '"'); if(!cptr) - yyerror("Malformed '#...' line-directive; missing terminating \""); + parser_error("Malformed '#...' line-directive; missing terminating \""); *cptr = '\0'; line_number = lineno - 1; /* We didn't read the newline */ free( input_name ); @@ -3808,101 +844,117 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 126 "parser.l" +#line 128 "tools\\widl_new\\parser.l" yy_push_state(QUOTE); cbufidx = 0; YY_BREAK case 4: YY_RULE_SETUP -#line 127 "parser.l" +#line 129 "tools\\widl_new\\parser.l" { yy_pop_state(); - yylval.str = get_buffered_cstring(); + parser_lval.str = get_buffered_cstring(); return aSTRING; } YY_BREAK case 5: -#line 133 "parser.l" +#line 135 "tools\\widl_new\\parser.l" case 6: YY_RULE_SETUP -#line 133 "parser.l" +#line 135 "tools\\widl_new\\parser.l" addcchar(yytext[1]); YY_BREAK case 7: YY_RULE_SETUP -#line 134 "parser.l" +#line 136 "tools\\widl_new\\parser.l" addcchar('\\'); addcchar(yytext[1]); YY_BREAK case 8: YY_RULE_SETUP -#line 135 "parser.l" +#line 137 "tools\\widl_new\\parser.l" addcchar(yytext[0]); YY_BREAK case 9: YY_RULE_SETUP -#line 136 "parser.l" -{ - yylval.uuid = parse_uuid(yytext); - return aUUID; - } +#line 138 "tools\\widl_new\\parser.l" +yy_push_state(ATTR); return '['; YY_BREAK case 10: YY_RULE_SETUP -#line 140 "parser.l" -{ - yylval.num = strtoul(yytext, NULL, 0); - return aHEXNUM; - } +#line 139 "tools\\widl_new\\parser.l" +yy_pop_state(); return ']'; YY_BREAK case 11: YY_RULE_SETUP -#line 144 "parser.l" +#line 140 "tools\\widl_new\\parser.l" +return attr_token(yytext); + YY_BREAK +case 12: +YY_RULE_SETUP +#line 141 "tools\\widl_new\\parser.l" { - yylval.num = strtoul(yytext, NULL, 0); + parser_lval.uuid = parse_uuid(yytext); + return aUUID; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 145 "tools\\widl_new\\parser.l" +{ + parser_lval.num = strtoul(yytext, NULL, 0); + return aHEXNUM; + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 149 "tools\\widl_new\\parser.l" +{ + parser_lval.num = strtoul(yytext, NULL, 0); return aNUM; } YY_BREAK -case 12: +case 15: *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 148 "parser.l" +#line 153 "tools\\widl_new\\parser.l" return tSAFEARRAY; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 149 "parser.l" -return kw_token(yytext); - YY_BREAK -case 14: -YY_RULE_SETUP -#line 150 "parser.l" -line_number++; - YY_BREAK -case 15: -YY_RULE_SETUP -#line 151 "parser.l" - YY_BREAK case 16: YY_RULE_SETUP -#line 152 "parser.l" -return SHL; +#line 154 "tools\\widl_new\\parser.l" +return kw_token(yytext); YY_BREAK case 17: YY_RULE_SETUP -#line 153 "parser.l" -return SHR; +#line 155 "tools\\widl_new\\parser.l" +line_number++; YY_BREAK case 18: YY_RULE_SETUP -#line 154 "parser.l" +#line 156 "tools\\widl_new\\parser.l" + + YY_BREAK +case 19: +YY_RULE_SETUP +#line 157 "tools\\widl_new\\parser.l" +return SHL; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 158 "tools\\widl_new\\parser.l" +return SHR; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 159 "tools\\widl_new\\parser.l" return yytext[0]; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(QUOTE): -case YY_STATE_EOF(pp_line): -#line 155 "parser.l" +case YY_STATE_EOF(ATTR): +case YY_STATE_EOF(PP_LINE): +#line 160 "tools\\widl_new\\parser.l" { if (import_stack_ptr) { pop_import(); @@ -3911,12 +963,12 @@ case YY_STATE_EOF(pp_line): else yyterminate(); } YY_BREAK -case 19: +case 22: YY_RULE_SETUP -#line 162 "parser.l" +#line 167 "tools\\widl_new\\parser.l" ECHO; YY_BREAK -#line 3920 "lex.yy.c" +#line 972 "tools\\widl_new\\lex.yy.c" case YY_END_OF_BUFFER: { @@ -4198,17 +1250,19 @@ static yy_state_type yy_get_previous_state() for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { - if ( *yy_cp ) - { - yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; - } - else - yy_current_state = yy_NUL_trans[yy_current_state]; + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } + 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 >= 107 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -4231,17 +1285,20 @@ yy_state_type yy_current_state; register int yy_is_jam; register char *yy_cp = yy_c_buf_p; - yy_current_state = yy_NUL_trans[yy_current_state]; - yy_is_jam = (yy_current_state == 0); - - if ( ! yy_is_jam ) + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) { - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; } + 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 >= 107 ) + 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 == 106); return yy_is_jam ? 0 : yy_current_state; } @@ -4797,39 +1854,30 @@ int main() return 0; } #endif -#line 162 "parser.l" +#line 167 "tools\\widl_new\\parser.l" -#ifndef yywrap -int yywrap(void) +#ifndef parser_wrap +int parser_wrap(void) { return 1; } #endif -static struct keyword { +struct keyword { const char *kw; int token; - int val; -} keywords[] = { +}; + +static const struct keyword keywords[] = { {"FALSE", tFALSE}, {"TRUE", tTRUE}, {"__cdecl", tCDECL}, {"__int64", tINT64}, {"__stdcall", tSTDCALL}, {"_stdcall", tSTDCALL}, - {"aggregatable", tAGGREGATABLE}, - {"allocate", tALLOCATE}, - {"appobject", tAPPOBJECT}, - {"async", tASYNC}, - {"async_uuid", tASYNCUUID}, - {"auto_handle", tAUTOHANDLE}, - {"bindable", tBINDABLE}, {"boolean", tBOOLEAN}, - {"broadcast", tBROADCAST}, {"byte", tBYTE}, - {"byte_count", tBYTECOUNT}, - {"call_as", tCALLAS}, {"callback", tCALLBACK}, {"case", tCASE}, {"char", tCHAR}, @@ -4837,121 +1885,119 @@ static struct keyword { {"code", tCODE}, {"comm_status", tCOMMSTATUS}, {"const", tCONST}, - {"context_handle", tCONTEXTHANDLE}, - {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE}, - {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE}, - {"control", tCONTROL}, {"cpp_quote", tCPPQUOTE}, -/* ... */ {"default", tDEFAULT}, - {"defaultcollelem", tDEFAULTCOLLELEM}, - {"defaultvalue", tDEFAULTVALUE}, - {"defaultvtable", tDEFAULTVTABLE}, {"dispinterface", tDISPINTERFACE}, - {"displaybind", tDISPLAYBIND}, - {"dllname", tDLLNAME}, {"double", tDOUBLE}, - {"dual", tDUAL}, - {"endpoint", tENDPOINT}, - {"entry", tENTRY}, {"enum", tENUM}, {"error_status_t", tERRORSTATUST}, - {"explicit_handle", tEXPLICITHANDLE}, {"extern", tEXTERN}, {"float", tFLOAT}, - {"handle", tHANDLE}, {"handle_t", tHANDLET}, - {"helpcontext", tHELPCONTEXT}, - {"helpfile", tHELPFILE}, - {"helpstring", tHELPSTRING}, - {"helpstringcontext", tHELPSTRINGCONTEXT}, - {"helpstringdll", tHELPSTRINGDLL}, - {"hidden", tHIDDEN}, {"hyper", tHYPER}, - {"id", tID}, - {"idempotent", tIDEMPOTENT}, -/* ... */ - {"iid_is", tIIDIS}, - {"immediatebind", tIMMEDIATEBIND}, - {"implicit_handle", tIMPLICITHANDLE}, {"import", tIMPORT}, {"importlib", tIMPORTLIB}, - {"in", tIN}, {"in_line", tINLINE}, - {"input_sync", tINPUTSYNC}, {"int", tINT}, -/* ... */ {"interface", tINTERFACE}, - {"lcid", tLCID}, - {"length_is", tLENGTHIS}, {"library", tLIBRARY}, -/* ... */ - {"local", tLOCAL}, {"long", tLONG}, -/* ... */ {"methods", tMETHODS}, -/* ... */ {"module", tMODULE}, -/* ... */ - {"nonbrowsable", tNONBROWSABLE}, - {"noncreatable", tNONCREATABLE}, - {"nonextensible", tNONEXTENSIBLE}, - {"object", tOBJECT}, - {"odl", tODL}, - {"oleautomation", tOLEAUTOMATION}, -/* ... */ - {"optional", tOPTIONAL}, - {"out", tOUT}, -/* ... */ - {"pointer_default", tPOINTERDEFAULT}, -/* ... */ {"properties", tPROPERTIES}, - {"propget", tPROPGET}, - {"propput", tPROPPUT}, - {"propputref", tPROPPUTREF}, - {"ptr", tPTR}, -/* ... */ - {"public", tPUBLIC}, - {"range", tRANGE}, -/* ... */ - {"readonly", tREADONLY}, - {"ref", tREF}, - {"requestedit", tREQUESTEDIT}, - {"restricted", tRESTRICTED}, - {"retval", tRETVAL}, -/* ... */ {"short", tSHORT}, {"signed", tSIGNED}, - {"single", tSINGLE}, - {"size_is", tSIZEIS}, {"sizeof", tSIZEOF}, {"small", tSMALL}, -/* ... */ - {"source", tSOURCE}, -/* ... */ - {"string", tSTRING}, {"struct", tSTRUCT}, {"switch", tSWITCH}, - {"switch_is", tSWITCHIS}, - {"switch_type", tSWITCHTYPE}, -/* ... */ - {"transmit_as", tTRANSMITAS}, {"typedef", tTYPEDEF}, {"union", tUNION}, -/* ... */ - {"unique", tUNIQUE}, {"unsigned", tUNSIGNED}, -/* ... */ - {"uuid", tUUID}, - {"v1_enum", tV1ENUM}, -/* ... */ - {"vararg", tVARARG}, - {"version", tVERSION}, {"void", tVOID}, {"wchar_t", tWCHAR}, - {"wire_marshal", tWIREMARSHAL}, }; #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0])) + +/* keywords only recognized in attribute lists */ +static const struct keyword attr_keywords[] = +{ + {"aggregatable", tAGGREGATABLE}, + {"allocate", tALLOCATE}, + {"appobject", tAPPOBJECT}, + {"async", tASYNC}, + {"async_uuid", tASYNCUUID}, + {"auto_handle", tAUTOHANDLE}, + {"bindable", tBINDABLE}, + {"broadcast", tBROADCAST}, + {"byte_count", tBYTECOUNT}, + {"call_as", tCALLAS}, + {"context_handle", tCONTEXTHANDLE}, + {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE}, + {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE}, + {"control", tCONTROL}, + {"defaultcollelem", tDEFAULTCOLLELEM}, + {"defaultvalue", tDEFAULTVALUE}, + {"defaultvtable", tDEFAULTVTABLE}, + {"displaybind", tDISPLAYBIND}, + {"dllname", tDLLNAME}, + {"dual", tDUAL}, + {"endpoint", tENDPOINT}, + {"entry", tENTRY}, + {"explicit_handle", tEXPLICITHANDLE}, + {"handle", tHANDLE}, + {"helpcontext", tHELPCONTEXT}, + {"helpfile", tHELPFILE}, + {"helpstring", tHELPSTRING}, + {"helpstringcontext", tHELPSTRINGCONTEXT}, + {"helpstringdll", tHELPSTRINGDLL}, + {"hidden", tHIDDEN}, + {"id", tID}, + {"idempotent", tIDEMPOTENT}, + {"iid_is", tIIDIS}, + {"immediatebind", tIMMEDIATEBIND}, + {"implicit_handle", tIMPLICITHANDLE}, + {"in", tIN}, + {"input_sync", tINPUTSYNC}, + {"lcid", tLCID}, + {"length_is", tLENGTHIS}, + {"local", tLOCAL}, + {"nonbrowsable", tNONBROWSABLE}, + {"noncreatable", tNONCREATABLE}, + {"nonextensible", tNONEXTENSIBLE}, + {"object", tOBJECT}, + {"odl", tODL}, + {"oleautomation", tOLEAUTOMATION}, + {"optional", tOPTIONAL}, + {"out", tOUT}, + {"pointer_default", tPOINTERDEFAULT}, + {"propget", tPROPGET}, + {"propput", tPROPPUT}, + {"propputref", tPROPPUTREF}, + {"ptr", tPTR}, + {"public", tPUBLIC}, + {"range", tRANGE}, + {"readonly", tREADONLY}, + {"ref", tREF}, + {"requestedit", tREQUESTEDIT}, + {"restricted", tRESTRICTED}, + {"retval", tRETVAL}, + {"single", tSINGLE}, + {"size_is", tSIZEIS}, + {"source", tSOURCE}, + {"string", tSTRING}, + {"switch_is", tSWITCHIS}, + {"switch_type", tSWITCHTYPE}, + {"transmit_as", tTRANSMITAS}, + {"unique", tUNIQUE}, + {"uuid", tUUID}, + {"v1_enum", tV1ENUM}, + {"vararg", tVARARG}, + {"version", tVERSION}, + {"wire_marshal", tWIREMARSHAL}, +}; + + #define KWP(p) ((const struct keyword *)(p)) static int kw_cmp_func(const void *s1, const void *s2) @@ -4959,31 +2005,32 @@ static int kw_cmp_func(const void *s1, const void *s2) return strcmp(KWP(s1)->kw, KWP(s2)->kw); } -#define KW_BSEARCH static int kw_token(const char *kw) { struct keyword key, *kwp; key.kw = kw; -#ifdef KW_BSEARCH kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func); -#else - { - int i; - for (kwp=NULL, i=0; i < NKEYWORDS; i++) - if (!kw_cmp_func(&key, &keywords[i])) { - kwp = &keywords[i]; - break; - } - } -#endif if (kwp) { - yylval.str = (char*)kwp->kw; + parser_lval.str = xstrdup(kwp->kw); return kwp->token; } - yylval.str = xstrdup(kw); + parser_lval.str = xstrdup(kw); return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER; } +static int attr_token(const char *kw) +{ + struct keyword key, *kwp; + key.kw = kw; + kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]), + sizeof(attr_keywords[0]), kw_cmp_func); + if (kwp) { + parser_lval.str = xstrdup(kwp->kw); + return kwp->token; + } + return kw_token(kw); +} + static void addcchar(char c) { if(cbufidx >= cbufalloc) @@ -4991,7 +2038,7 @@ static void addcchar(char c) cbufalloc += 1024; cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0])); if(cbufalloc > 65536) - yywarning("Reallocating string buffer larger than 64kB"); + parser_warning("Reallocating string buffer larger than 64kB"); } cbuffer[cbufidx++] = c; } @@ -5053,7 +2100,7 @@ int do_import(char *fname) first_import = import; if (!(path = wpp_find_include( fname, input_name ))) - yyerror("Unable to open include file %s", fname); + parser_error("Unable to open include file %s", fname); import_stack[ptr].temp_name = temp_name; import_stack[ptr].input_name = input_name; @@ -5066,7 +2113,7 @@ int do_import(char *fname) if (ret) exit(1); if((f = fopen(temp_name, "r")) == NULL) - yyerror("Unable to open %s", temp_name); + parser_error("Unable to open %s", temp_name); import_stack[ptr].state = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); diff --git a/reactos/tools/widl/parser.h b/reactos/tools/widl/parser.h index 2217dbfaa7a..5baf655c64e 100644 --- a/reactos/tools/widl/parser.h +++ b/reactos/tools/widl/parser.h @@ -21,14 +21,14 @@ #ifndef __WIDL_PARSER_H #define __WIDL_PARSER_H -int yyparse(void); +int parser_parse(void); -extern FILE *yyin; -extern char *yytext; -extern int yydebug; +extern FILE *parser_in; +extern char *parser_text; +extern int parser_debug; extern int yy_flex_debug; -int yylex(void); +int parser_lex(void); extern int import_stack_ptr; int do_import(char *fname); diff --git a/reactos/tools/widl/parser.l b/reactos/tools/widl/parser.l index 4fedd341b1b..7ddcedd7cc9 100644 --- a/reactos/tools/widl/parser.l +++ b/reactos/tools/widl/parser.l @@ -20,7 +20,7 @@ %option stack %option nounput noyy_top_state -%option 8bit never-interactive +%option 8bit never-interactive prefix="parser_" nl \r?\n ws [ \f\t\r] @@ -31,7 +31,8 @@ hex 0x{hexd}+ uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12} %x QUOTE -%x pp_line +%x ATTR +%x PP_LINE %{ @@ -63,6 +64,7 @@ static int cbufidx; static int cbufalloc = 0; static int kw_token(const char *kw); +static int attr_token(const char *kw); #define MAX_IMPORT_DEPTH 10 struct { @@ -103,55 +105,58 @@ static UUID* parse_uuid(const char*u) ************************************************************************** */ %% -^{ws}*\#{ws}* yy_push_state(pp_line); -[^\n]* { +^{ws}*\#{ws}* yy_push_state(PP_LINE); +[^\n]* { int lineno; char *cptr, *fname; yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - yyerror("Malformed '#...' line-directive; invalid linenumber"); + parser_error("Malformed '#...' line-directive; invalid linenumber"); fname = strchr(cptr, '"'); if(!fname) - yyerror("Malformed '#...' line-directive; missing filename"); + parser_error("Malformed '#...' line-directive; missing filename"); fname++; cptr = strchr(fname, '"'); if(!cptr) - yyerror("Malformed '#...' line-directive; missing terminating \""); + parser_error("Malformed '#...' line-directive; missing terminating \""); *cptr = '\0'; line_number = lineno - 1; /* We didn't read the newline */ free( input_name ); input_name = xstrdup(fname); } -\" yy_push_state(QUOTE); cbufidx = 0; +\" yy_push_state(QUOTE); cbufidx = 0; \" { yy_pop_state(); - yylval.str = get_buffered_cstring(); + parser_lval.str = get_buffered_cstring(); return aSTRING; } \\\\ | \\\" addcchar(yytext[1]); \\. addcchar('\\'); addcchar(yytext[1]); . addcchar(yytext[0]); -{uuid} { - yylval.uuid = parse_uuid(yytext); +\[ yy_push_state(ATTR); return '['; +\] yy_pop_state(); return ']'; +{cident} return attr_token(yytext); +{uuid} { + parser_lval.uuid = parse_uuid(yytext); return aUUID; } -{hex} { - yylval.num = strtoul(yytext, NULL, 0); +{hex} { + parser_lval.num = strtoul(yytext, NULL, 0); return aHEXNUM; } -{int} { - yylval.num = strtoul(yytext, NULL, 0); +{int} { + parser_lval.num = strtoul(yytext, NULL, 0); return aNUM; } SAFEARRAY{ws}*/\( return tSAFEARRAY; {cident} return kw_token(yytext); -\n line_number++; -{ws} -\<\< return SHL; -\>\> return SHR; -. return yytext[0]; +\n line_number++; +{ws} +\<\< return SHL; +\>\> return SHR; +. return yytext[0]; <> { if (import_stack_ptr) { pop_import(); @@ -161,36 +166,27 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY; } %% -#ifndef yywrap -int yywrap(void) +#ifndef parser_wrap +int parser_wrap(void) { return 1; } #endif -static struct keyword { +struct keyword { const char *kw; int token; - int val; -} keywords[] = { +}; + +static const struct keyword keywords[] = { {"FALSE", tFALSE}, {"TRUE", tTRUE}, {"__cdecl", tCDECL}, {"__int64", tINT64}, {"__stdcall", tSTDCALL}, {"_stdcall", tSTDCALL}, - {"aggregatable", tAGGREGATABLE}, - {"allocate", tALLOCATE}, - {"appobject", tAPPOBJECT}, - {"async", tASYNC}, - {"async_uuid", tASYNCUUID}, - {"auto_handle", tAUTOHANDLE}, - {"bindable", tBINDABLE}, {"boolean", tBOOLEAN}, - {"broadcast", tBROADCAST}, {"byte", tBYTE}, - {"byte_count", tBYTECOUNT}, - {"call_as", tCALLAS}, {"callback", tCALLBACK}, {"case", tCASE}, {"char", tCHAR}, @@ -198,121 +194,119 @@ static struct keyword { {"code", tCODE}, {"comm_status", tCOMMSTATUS}, {"const", tCONST}, - {"context_handle", tCONTEXTHANDLE}, - {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE}, - {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE}, - {"control", tCONTROL}, {"cpp_quote", tCPPQUOTE}, -/* ... */ {"default", tDEFAULT}, - {"defaultcollelem", tDEFAULTCOLLELEM}, - {"defaultvalue", tDEFAULTVALUE}, - {"defaultvtable", tDEFAULTVTABLE}, {"dispinterface", tDISPINTERFACE}, - {"displaybind", tDISPLAYBIND}, - {"dllname", tDLLNAME}, {"double", tDOUBLE}, - {"dual", tDUAL}, - {"endpoint", tENDPOINT}, - {"entry", tENTRY}, {"enum", tENUM}, {"error_status_t", tERRORSTATUST}, - {"explicit_handle", tEXPLICITHANDLE}, {"extern", tEXTERN}, {"float", tFLOAT}, - {"handle", tHANDLE}, {"handle_t", tHANDLET}, - {"helpcontext", tHELPCONTEXT}, - {"helpfile", tHELPFILE}, - {"helpstring", tHELPSTRING}, - {"helpstringcontext", tHELPSTRINGCONTEXT}, - {"helpstringdll", tHELPSTRINGDLL}, - {"hidden", tHIDDEN}, {"hyper", tHYPER}, - {"id", tID}, - {"idempotent", tIDEMPOTENT}, -/* ... */ - {"iid_is", tIIDIS}, - {"immediatebind", tIMMEDIATEBIND}, - {"implicit_handle", tIMPLICITHANDLE}, {"import", tIMPORT}, {"importlib", tIMPORTLIB}, - {"in", tIN}, {"in_line", tINLINE}, - {"input_sync", tINPUTSYNC}, {"int", tINT}, -/* ... */ {"interface", tINTERFACE}, - {"lcid", tLCID}, - {"length_is", tLENGTHIS}, {"library", tLIBRARY}, -/* ... */ - {"local", tLOCAL}, {"long", tLONG}, -/* ... */ {"methods", tMETHODS}, -/* ... */ {"module", tMODULE}, -/* ... */ - {"nonbrowsable", tNONBROWSABLE}, - {"noncreatable", tNONCREATABLE}, - {"nonextensible", tNONEXTENSIBLE}, - {"object", tOBJECT}, - {"odl", tODL}, - {"oleautomation", tOLEAUTOMATION}, -/* ... */ - {"optional", tOPTIONAL}, - {"out", tOUT}, -/* ... */ - {"pointer_default", tPOINTERDEFAULT}, -/* ... */ {"properties", tPROPERTIES}, - {"propget", tPROPGET}, - {"propput", tPROPPUT}, - {"propputref", tPROPPUTREF}, - {"ptr", tPTR}, -/* ... */ - {"public", tPUBLIC}, - {"range", tRANGE}, -/* ... */ - {"readonly", tREADONLY}, - {"ref", tREF}, - {"requestedit", tREQUESTEDIT}, - {"restricted", tRESTRICTED}, - {"retval", tRETVAL}, -/* ... */ {"short", tSHORT}, {"signed", tSIGNED}, - {"single", tSINGLE}, - {"size_is", tSIZEIS}, {"sizeof", tSIZEOF}, {"small", tSMALL}, -/* ... */ - {"source", tSOURCE}, -/* ... */ - {"string", tSTRING}, {"struct", tSTRUCT}, {"switch", tSWITCH}, - {"switch_is", tSWITCHIS}, - {"switch_type", tSWITCHTYPE}, -/* ... */ - {"transmit_as", tTRANSMITAS}, {"typedef", tTYPEDEF}, {"union", tUNION}, -/* ... */ - {"unique", tUNIQUE}, {"unsigned", tUNSIGNED}, -/* ... */ - {"uuid", tUUID}, - {"v1_enum", tV1ENUM}, -/* ... */ - {"vararg", tVARARG}, - {"version", tVERSION}, {"void", tVOID}, {"wchar_t", tWCHAR}, - {"wire_marshal", tWIREMARSHAL}, }; #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0])) + +/* keywords only recognized in attribute lists */ +static const struct keyword attr_keywords[] = +{ + {"aggregatable", tAGGREGATABLE}, + {"allocate", tALLOCATE}, + {"appobject", tAPPOBJECT}, + {"async", tASYNC}, + {"async_uuid", tASYNCUUID}, + {"auto_handle", tAUTOHANDLE}, + {"bindable", tBINDABLE}, + {"broadcast", tBROADCAST}, + {"byte_count", tBYTECOUNT}, + {"call_as", tCALLAS}, + {"context_handle", tCONTEXTHANDLE}, + {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE}, + {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE}, + {"control", tCONTROL}, + {"defaultcollelem", tDEFAULTCOLLELEM}, + {"defaultvalue", tDEFAULTVALUE}, + {"defaultvtable", tDEFAULTVTABLE}, + {"displaybind", tDISPLAYBIND}, + {"dllname", tDLLNAME}, + {"dual", tDUAL}, + {"endpoint", tENDPOINT}, + {"entry", tENTRY}, + {"explicit_handle", tEXPLICITHANDLE}, + {"handle", tHANDLE}, + {"helpcontext", tHELPCONTEXT}, + {"helpfile", tHELPFILE}, + {"helpstring", tHELPSTRING}, + {"helpstringcontext", tHELPSTRINGCONTEXT}, + {"helpstringdll", tHELPSTRINGDLL}, + {"hidden", tHIDDEN}, + {"id", tID}, + {"idempotent", tIDEMPOTENT}, + {"iid_is", tIIDIS}, + {"immediatebind", tIMMEDIATEBIND}, + {"implicit_handle", tIMPLICITHANDLE}, + {"in", tIN}, + {"input_sync", tINPUTSYNC}, + {"lcid", tLCID}, + {"length_is", tLENGTHIS}, + {"local", tLOCAL}, + {"nonbrowsable", tNONBROWSABLE}, + {"noncreatable", tNONCREATABLE}, + {"nonextensible", tNONEXTENSIBLE}, + {"object", tOBJECT}, + {"odl", tODL}, + {"oleautomation", tOLEAUTOMATION}, + {"optional", tOPTIONAL}, + {"out", tOUT}, + {"pointer_default", tPOINTERDEFAULT}, + {"propget", tPROPGET}, + {"propput", tPROPPUT}, + {"propputref", tPROPPUTREF}, + {"ptr", tPTR}, + {"public", tPUBLIC}, + {"range", tRANGE}, + {"readonly", tREADONLY}, + {"ref", tREF}, + {"requestedit", tREQUESTEDIT}, + {"restricted", tRESTRICTED}, + {"retval", tRETVAL}, + {"single", tSINGLE}, + {"size_is", tSIZEIS}, + {"source", tSOURCE}, + {"string", tSTRING}, + {"switch_is", tSWITCHIS}, + {"switch_type", tSWITCHTYPE}, + {"transmit_as", tTRANSMITAS}, + {"unique", tUNIQUE}, + {"uuid", tUUID}, + {"v1_enum", tV1ENUM}, + {"vararg", tVARARG}, + {"version", tVERSION}, + {"wire_marshal", tWIREMARSHAL}, +}; + + #define KWP(p) ((const struct keyword *)(p)) static int kw_cmp_func(const void *s1, const void *s2) @@ -320,31 +314,32 @@ static int kw_cmp_func(const void *s1, const void *s2) return strcmp(KWP(s1)->kw, KWP(s2)->kw); } -#define KW_BSEARCH static int kw_token(const char *kw) { struct keyword key, *kwp; key.kw = kw; -#ifdef KW_BSEARCH kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func); -#else - { - int i; - for (kwp=NULL, i=0; i < NKEYWORDS; i++) - if (!kw_cmp_func(&key, &keywords[i])) { - kwp = &keywords[i]; - break; - } - } -#endif if (kwp) { - yylval.str = (char*)kwp->kw; + parser_lval.str = xstrdup(kwp->kw); return kwp->token; } - yylval.str = xstrdup(kw); + parser_lval.str = xstrdup(kw); return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER; } +static int attr_token(const char *kw) +{ + struct keyword key, *kwp; + key.kw = kw; + kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]), + sizeof(attr_keywords[0]), kw_cmp_func); + if (kwp) { + parser_lval.str = xstrdup(kwp->kw); + return kwp->token; + } + return kw_token(kw); +} + static void addcchar(char c) { if(cbufidx >= cbufalloc) @@ -352,7 +347,7 @@ static void addcchar(char c) cbufalloc += 1024; cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0])); if(cbufalloc > 65536) - yywarning("Reallocating string buffer larger than 64kB"); + parser_warning("Reallocating string buffer larger than 64kB"); } cbuffer[cbufidx++] = c; } @@ -414,7 +409,7 @@ int do_import(char *fname) first_import = import; if (!(path = wpp_find_include( fname, input_name ))) - yyerror("Unable to open include file %s", fname); + parser_error("Unable to open include file %s", fname); import_stack[ptr].temp_name = temp_name; import_stack[ptr].input_name = input_name; @@ -427,7 +422,7 @@ int do_import(char *fname) if (ret) exit(1); if((f = fopen(temp_name, "r")) == NULL) - yyerror("Unable to open %s", temp_name); + parser_error("Unable to open %s", temp_name); import_stack[ptr].state = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); diff --git a/reactos/tools/widl/parser.tab.c b/reactos/tools/widl/parser.tab.c index c4b73a2ea0c..899e7dc985d 100644 --- a/reactos/tools/widl/parser.tab.c +++ b/reactos/tools/widl/parser.tab.c @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -36,6 +36,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,6 +48,14 @@ /* Using locations. */ #define YYLSP_NEEDED 0 +/* Substitute the variable and function names. */ +#define yyparse parser_parse +#define yylex parser_lex +#define yyerror parser_error +#define yylval parser_lval +#define yychar parser_char +#define yydebug parser_debug +#define yynerrs parser_nerrs /* Tokens. */ @@ -186,6 +197,7 @@ NEG = 388 }; #endif +/* Tokens. */ #define aIDENTIFIER 258 #define aKNOWNTYPE 259 #define aNUM 260 @@ -322,7 +334,7 @@ /* Copy the first part of user declarations. */ -#line 1 "parser.y" +#line 1 "tools\\widl_new\\parser.y" /* * IDL Compiler @@ -389,52 +401,65 @@ # endif #endif +static str_list_t *append_str(str_list_t *list, char *str); +static attr_list_t *append_attr(attr_list_t *list, attr_t *attr); static attr_t *make_attr(enum attr_type type); static attr_t *make_attrv(enum attr_type type, unsigned long val); static attr_t *make_attrp(enum attr_type type, void *val); static expr_t *make_expr(enum expr_type type); static expr_t *make_exprl(enum expr_type type, long val); static expr_t *make_exprs(enum expr_type type, char *val); -static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr); +static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr); static expr_t *make_expr1(enum expr_type type, expr_t *expr); static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2); static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3); static type_t *make_type(unsigned char type, type_t *ref); -static typeref_t *make_tref(char *name, type_t *ref); -static typeref_t *uniq_tref(typeref_t *ref); -static type_t *type_ref(typeref_t *ref); -static void set_type(var_t *v, typeref_t *ref, expr_t *arr); +static expr_list_t *append_expr(expr_list_t *list, expr_t *expr); +static array_dims_t *append_array(array_dims_t *list, expr_t *expr); +static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr); +static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface); static ifref_t *make_ifref(type_t *iface); +static var_list_t *append_var(var_list_t *list, var_t *var); static var_t *make_var(char *name); -static func_t *make_func(var_t *def, var_t *args); +static pident_list_t *append_pident(pident_list_t *list, pident_t *p); +static pident_t *make_pident(var_t *var); +static func_list_t *append_func(func_list_t *list, func_t *func); +static func_t *make_func(var_t *def, var_list_t *args); static type_t *make_class(char *name); -static type_t *make_safearray(void); +static type_t *make_safearray(type_t *type); +static type_t *make_builtin(char *name); +static type_t *make_int(int sign); static type_t *reg_type(type_t *type, const char *name, int t); -static type_t *reg_types(type_t *type, var_t *names, int t); +static type_t *reg_typedefs(type_t *type, var_list_t *names, attr_list_t *attrs); static type_t *find_type(const char *name, int t); static type_t *find_type2(char *name, int t); static type_t *get_type(unsigned char type, char *name, int t); static type_t *get_typev(unsigned char type, var_t *name, int t); -static int get_struct_type(var_t *fields); +static int get_struct_type(var_list_t *fields); static var_t *reg_const(var_t *var); static var_t *find_const(char *name, int f); +static void write_libid(const char *name, const attr_list_t *attr); +static void write_clsid(type_t *cls); +static void write_diid(type_t *iface); +static void write_iid(type_t *iface); + +static int compute_method_indexes(type_t *iface); +static char *gen_name(void); +static void process_typedefs(var_list_t *names); +static void check_arg(var_t *arg); + #define tsENUM 1 #define tsSTRUCT 2 #define tsUNION 3 -static type_t std_bool = { "boolean" }; -static type_t std_int = { "int" }; -static type_t std_int64 = { "__int64" }; -static type_t std_uhyper = { "MIDL_uhyper" }; - /* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG 1 +# define YYDEBUG 0 #endif /* Enabling verbose error messages. */ @@ -445,22 +470,35 @@ static type_t std_uhyper = { "MIDL_uhyper" }; # define YYERROR_VERBOSE 0 #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 109 "parser.y" +#line 122 "tools\\widl_new\\parser.y" typedef union YYSTYPE { attr_t *attr; + attr_list_t *attr_list; + str_list_t *str_list; expr_t *expr; + expr_list_t *expr_list; + array_dims_t *array_dims; type_t *type; - typeref_t *tref; var_t *var; + var_list_t *var_list; + pident_t *pident; + pident_list_t *pident_list; func_t *func; + func_list_t *func_list; ifref_t *ifref; + ifref_list_t *ifref_list; char *str; UUID *uuid; unsigned int num; } YYSTYPE; -/* Line 191 of yacc.c. */ -#line 463 "parser.tab.c" +/* Line 196 of yacc.c. */ +#line 502 "tools\\widl_new\\parser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -471,22 +509,48 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 475 "parser.tab.c" +/* Line 219 of yacc.c. */ +#line 514 "tools\\widl_new\\parser.tab.c" + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif #if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H # endif # endif # endif @@ -495,25 +559,51 @@ typedef union YYSTYPE { # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} # endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -523,20 +613,20 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -565,28 +655,28 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1059 +#define YYLAST 1073 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 153 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 74 +#define YYNNTS 75 /* YYNRULES -- Number of rules. */ -#define YYNRULES 272 +#define YYNRULES 267 /* YYNRULES -- Number of states. */ -#define YYNSTATES 496 +#define YYNSTATES 494 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 388 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -636,7 +726,7 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 6, 9, 12, 16, 19, 22, 25, 28, 29, 32, 35, 39, 42, 45, 48, 51, @@ -644,206 +734,204 @@ static const unsigned short yyprhs[] = 80, 83, 88, 92, 96, 101, 104, 108, 112, 113, 115, 117, 119, 123, 125, 130, 134, 141, 147, 148, 152, 156, 158, 162, 167, 168, 170, 174, 176, 180, - 185, 186, 188, 190, 192, 194, 196, 201, 206, 208, - 210, 212, 214, 216, 218, 223, 228, 230, 232, 237, - 239, 244, 249, 254, 256, 258, 263, 268, 273, 278, - 283, 285, 290, 292, 297, 299, 305, 307, 309, 314, - 316, 318, 320, 322, 324, 326, 328, 330, 332, 337, - 339, 341, 343, 345, 352, 354, 356, 358, 360, 365, - 367, 369, 374, 379, 384, 389, 391, 393, 398, 403, - 405, 406, 408, 409, 412, 417, 421, 427, 428, 431, - 433, 435, 439, 443, 445, 451, 453, 457, 458, 460, - 462, 464, 466, 468, 470, 476, 480, 484, 488, 492, - 496, 500, 504, 508, 511, 514, 517, 522, 527, 531, - 533, 537, 539, 544, 545, 548, 551, 555, 558, 560, - 565, 573, 574, 576, 577, 579, 581, 583, 585, 587, - 589, 591, 593, 595, 597, 599, 601, 603, 605, 607, - 610, 613, 615, 617, 619, 621, 623, 625, 627, 628, - 630, 632, 635, 637, 640, 643, 645, 647, 650, 653, - 656, 661, 662, 665, 668, 671, 674, 677, 680, 684, - 687, 691, 697, 698, 701, 704, 707, 710, 716, 724, - 726, 729, 732, 735, 738, 741, 746, 749, 752, 754, - 756, 760, 762, 766, 768, 770, 772, 778, 780, 782, - 784, 787, 789, 792, 794, 797, 799, 802, 807, 812, - 818, 829, 831 + 185, 187, 191, 192, 194, 196, 198, 200, 202, 207, + 212, 214, 216, 218, 220, 222, 224, 229, 234, 236, + 238, 243, 245, 250, 255, 260, 262, 264, 269, 274, + 279, 284, 289, 291, 296, 298, 303, 305, 311, 313, + 315, 320, 322, 324, 326, 328, 330, 332, 334, 336, + 338, 343, 345, 347, 349, 351, 358, 360, 362, 364, + 366, 371, 373, 375, 380, 385, 390, 395, 397, 399, + 404, 409, 411, 412, 414, 415, 418, 423, 427, 433, + 434, 437, 439, 441, 445, 449, 451, 457, 459, 463, + 464, 466, 468, 470, 472, 474, 476, 482, 486, 490, + 494, 498, 502, 506, 510, 514, 517, 520, 523, 528, + 533, 537, 539, 543, 545, 550, 551, 554, 557, 561, + 564, 566, 571, 579, 580, 582, 583, 585, 587, 589, + 591, 593, 595, 597, 600, 603, 605, 607, 609, 611, + 613, 615, 617, 618, 620, 622, 625, 627, 630, 633, + 635, 637, 640, 643, 646, 651, 652, 655, 658, 661, + 664, 667, 670, 674, 677, 681, 687, 693, 694, 697, + 700, 703, 706, 712, 720, 722, 725, 728, 731, 734, + 737, 742, 745, 748, 750, 752, 756, 758, 762, 764, + 766, 768, 774, 776, 778, 780, 783, 785, 788, 790, + 793, 795, 798, 803, 808, 814, 825, 827 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short yyrhs[] = +static const short int yyrhs[] = { - 154, 0, -1, 155, -1, -1, 155, 214, -1, 155, - 213, -1, 155, 200, 144, -1, 155, 202, -1, 155, - 217, -1, 155, 165, -1, 155, 158, -1, -1, 156, - 214, -1, 156, 213, -1, 156, 200, 144, -1, 156, - 202, -1, 156, 217, -1, 156, 158, -1, 156, 162, - -1, -1, 157, 193, 144, -1, 157, 158, -1, 144, - -1, 179, 144, -1, 159, -1, 183, 144, -1, 189, - 144, -1, 161, -1, 222, 144, -1, 224, 144, -1, - 225, 144, -1, 36, 145, 7, 146, -1, 68, 7, + 154, 0, -1, 155, -1, -1, 155, 215, -1, 155, + 214, -1, 155, 201, 144, -1, 155, 203, -1, 155, + 218, -1, 155, 165, -1, 155, 158, -1, -1, 156, + 215, -1, 156, 214, -1, 156, 201, 144, -1, 156, + 203, -1, 156, 218, -1, 156, 158, -1, 156, 162, + -1, -1, 157, 194, 144, -1, 157, 158, -1, 144, + -1, 180, 144, -1, 159, -1, 184, 144, -1, 190, + 144, -1, 161, -1, 223, 144, -1, 225, 144, -1, + 226, 144, -1, 36, 145, 7, 146, -1, 68, 7, 144, -1, 160, 156, 9, -1, 69, 145, 7, 146, -1, 78, 3, -1, 173, 163, 147, -1, 164, 156, 148, -1, -1, 168, -1, 128, -1, 169, -1, 168, - 131, 169, -1, 167, -1, 173, 223, 219, 170, -1, - 223, 219, 170, -1, 173, 223, 219, 145, 166, 146, - -1, 223, 219, 145, 166, 146, -1, -1, 149, 171, - 150, -1, 149, 138, 150, -1, 185, -1, 171, 131, - 186, -1, 171, 150, 149, 186, -1, -1, 173, -1, - 149, 174, 150, -1, 175, -1, 174, 131, 175, -1, - 174, 150, 149, 175, -1, -1, 12, -1, 14, -1, - 15, -1, 17, -1, 18, -1, 23, 145, 196, 146, - -1, 25, 145, 187, 146, -1, 32, -1, 33, -1, - 34, -1, 35, -1, 37, -1, 38, -1, 39, 145, - 188, 146, -1, 39, 145, 7, 146, -1, 40, -1, - 41, -1, 43, 145, 7, 146, -1, 45, -1, 46, - 145, 7, 146, -1, 47, 145, 7, 146, -1, 47, - 145, 188, 146, -1, 50, -1, 54, -1, 56, 145, - 188, 146, -1, 57, 145, 7, 146, -1, 58, 145, - 7, 146, -1, 59, 145, 188, 146, -1, 60, 145, - 7, 146, -1, 61, -1, 63, 145, 188, 146, -1, - 64, -1, 65, 145, 196, 146, -1, 66, -1, 67, - 145, 55, 3, 146, -1, 70, -1, 72, -1, 77, - 145, 184, 146, -1, 79, -1, 83, -1, 84, -1, - 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, - 90, -1, 91, 145, 221, 146, -1, 93, -1, 94, - -1, 95, -1, 97, -1, 98, 145, 188, 131, 188, - 146, -1, 99, -1, 101, -1, 102, -1, 103, -1, - 108, 145, 184, 146, -1, 111, -1, 113, -1, 116, - 145, 186, 146, -1, 117, 145, 223, 146, -1, 118, - 145, 223, 146, -1, 124, 145, 8, 146, -1, 125, - -1, 126, -1, 127, 145, 226, 146, -1, 130, 145, - 223, 146, -1, 221, -1, -1, 112, -1, -1, 177, - 178, -1, 25, 186, 133, 191, -1, 37, 133, 191, - -1, 31, 223, 196, 151, 188, -1, -1, 181, 131, - -1, 181, -1, 182, -1, 181, 131, 182, -1, 196, - 151, 188, -1, 196, -1, 48, 195, 147, 180, 148, - -1, 185, -1, 184, 131, 185, -1, -1, 186, -1, - 5, -1, 6, -1, 52, -1, 119, -1, 3, -1, - 186, 132, 186, 133, 186, -1, 186, 134, 186, -1, - 186, 135, 186, -1, 186, 137, 186, -1, 186, 136, - 186, -1, 186, 138, 186, -1, 186, 139, 186, -1, - 186, 10, 186, -1, 186, 11, 186, -1, 140, 186, - -1, 136, 186, -1, 138, 186, -1, 145, 223, 146, - 186, -1, 109, 145, 223, 146, -1, 145, 186, 146, - -1, 188, -1, 187, 131, 188, -1, 186, -1, 51, - 31, 223, 196, -1, -1, 190, 191, -1, 192, 144, - -1, 172, 225, 144, -1, 173, 144, -1, 144, -1, - 172, 223, 219, 170, -1, 172, 223, 176, 219, 145, - 166, 146, -1, -1, 196, -1, -1, 3, -1, 4, - -1, 3, -1, 4, -1, 15, -1, 63, -1, 76, - -1, 86, -1, 98, -1, 103, -1, 124, -1, 127, - -1, 21, -1, 129, -1, 199, -1, 106, 199, -1, - 123, 199, -1, 123, -1, 53, -1, 107, -1, 44, + 131, 169, -1, 167, -1, 173, 224, 220, 170, -1, + 224, 220, 170, -1, 173, 224, 220, 145, 166, 146, + -1, 224, 220, 145, 166, 146, -1, -1, 149, 171, + 150, -1, 149, 138, 150, -1, 186, -1, 171, 131, + 187, -1, 171, 150, 149, 187, -1, -1, 173, -1, + 149, 174, 150, -1, 176, -1, 174, 131, 176, -1, + 174, 150, 149, 176, -1, 7, -1, 175, 131, 7, + -1, -1, 12, -1, 14, -1, 15, -1, 17, -1, + 18, -1, 23, 145, 197, 146, -1, 25, 145, 188, + 146, -1, 32, -1, 33, -1, 34, -1, 35, -1, + 37, -1, 38, -1, 39, 145, 189, 146, -1, 39, + 145, 7, 146, -1, 40, -1, 41, -1, 43, 145, + 7, 146, -1, 45, -1, 46, 145, 175, 146, -1, + 47, 145, 7, 146, -1, 47, 145, 189, 146, -1, + 50, -1, 54, -1, 56, 145, 189, 146, -1, 57, + 145, 7, 146, -1, 58, 145, 7, 146, -1, 59, + 145, 189, 146, -1, 60, 145, 7, 146, -1, 61, + -1, 63, 145, 189, 146, -1, 64, -1, 65, 145, + 197, 146, -1, 66, -1, 67, 145, 55, 3, 146, + -1, 70, -1, 72, -1, 77, 145, 185, 146, -1, + 79, -1, 83, -1, 84, -1, 85, -1, 86, -1, + 87, -1, 88, -1, 89, -1, 90, -1, 91, 145, + 222, 146, -1, 93, -1, 94, -1, 95, -1, 97, + -1, 98, 145, 189, 131, 189, 146, -1, 99, -1, + 101, -1, 102, -1, 103, -1, 108, 145, 185, 146, + -1, 111, -1, 113, -1, 116, 145, 187, 146, -1, + 117, 145, 224, 146, -1, 118, 145, 224, 146, -1, + 124, 145, 8, 146, -1, 125, -1, 126, -1, 127, + 145, 227, 146, -1, 130, 145, 224, 146, -1, 222, + -1, -1, 112, -1, -1, 178, 179, -1, 25, 187, + 133, 192, -1, 37, 133, 192, -1, 31, 224, 197, + 151, 189, -1, -1, 182, 131, -1, 182, -1, 183, + -1, 182, 131, 183, -1, 197, 151, 189, -1, 197, + -1, 48, 196, 147, 181, 148, -1, 186, -1, 185, + 131, 186, -1, -1, 187, -1, 5, -1, 6, -1, + 52, -1, 119, -1, 3, -1, 187, 132, 187, 133, + 187, -1, 187, 134, 187, -1, 187, 135, 187, -1, + 187, 137, 187, -1, 187, 136, 187, -1, 187, 138, + 187, -1, 187, 139, 187, -1, 187, 10, 187, -1, + 187, 11, 187, -1, 140, 187, -1, 136, 187, -1, + 138, 187, -1, 145, 224, 146, 187, -1, 109, 145, + 224, 146, -1, 145, 187, 146, -1, 189, -1, 188, + 131, 189, -1, 187, -1, 51, 31, 224, 197, -1, + -1, 191, 192, -1, 193, 144, -1, 172, 226, 144, + -1, 173, 144, -1, 144, -1, 172, 224, 220, 170, + -1, 172, 224, 177, 220, 145, 166, 146, -1, -1, + 197, -1, -1, 3, -1, 4, -1, 3, -1, 4, + -1, 21, -1, 129, -1, 200, -1, 106, 200, -1, + 123, 200, -1, 123, -1, 53, -1, 107, -1, 44, -1, 19, -1, 49, -1, 55, -1, -1, 73, -1, - 73, -1, 105, 198, -1, 110, -1, 80, 198, -1, - 62, 198, -1, 74, -1, 27, -1, 28, 3, -1, - 28, 4, -1, 173, 200, -1, 201, 147, 203, 148, - -1, -1, 203, 204, -1, 172, 214, -1, 42, 3, - -1, 42, 4, -1, 173, 205, -1, 92, 133, -1, - 207, 192, 144, -1, 81, 133, -1, 208, 193, 144, - -1, 206, 147, 207, 208, 148, -1, -1, 133, 4, - -1, 75, 3, -1, 75, 4, -1, 173, 211, -1, - 212, 210, 147, 157, 148, -1, 212, 133, 3, 147, - 161, 157, 148, -1, 209, -1, 211, 144, -1, 205, - 144, -1, 82, 3, -1, 82, 4, -1, 173, 215, - -1, 216, 147, 157, 148, -1, 138, 219, -1, 31, - 218, -1, 196, -1, 218, -1, 145, 219, 146, -1, - 219, -1, 220, 131, 219, -1, 100, -1, 122, -1, - 96, -1, 114, 195, 147, 190, 148, -1, 128, -1, - 4, -1, 197, -1, 31, 223, -1, 183, -1, 48, - 3, -1, 222, -1, 114, 3, -1, 225, -1, 121, - 3, -1, 104, 145, 223, 146, -1, 120, 172, 223, - 220, -1, 121, 195, 147, 190, 148, -1, 121, 195, - 115, 145, 192, 146, 194, 147, 177, 148, -1, 5, - -1, 5, 152, 5, -1 + 73, -1, 105, 199, -1, 110, -1, 80, 199, -1, + 62, 199, -1, 74, -1, 27, -1, 28, 3, -1, + 28, 4, -1, 173, 201, -1, 202, 147, 204, 148, + -1, -1, 204, 205, -1, 172, 215, -1, 42, 3, + -1, 42, 4, -1, 173, 206, -1, 92, 133, -1, + 208, 193, 144, -1, 81, 133, -1, 209, 194, 144, + -1, 207, 147, 208, 209, 148, -1, 207, 147, 212, + 144, 148, -1, -1, 133, 4, -1, 75, 3, -1, + 75, 4, -1, 173, 212, -1, 213, 211, 147, 157, + 148, -1, 213, 133, 3, 147, 161, 157, 148, -1, + 210, -1, 212, 144, -1, 206, 144, -1, 82, 3, + -1, 82, 4, -1, 173, 216, -1, 217, 147, 157, + 148, -1, 138, 220, -1, 31, 219, -1, 197, -1, + 219, -1, 145, 220, 146, -1, 220, -1, 221, 131, + 220, -1, 100, -1, 122, -1, 96, -1, 114, 196, + 147, 191, 148, -1, 128, -1, 4, -1, 198, -1, + 31, 224, -1, 184, -1, 48, 3, -1, 223, -1, + 114, 3, -1, 226, -1, 121, 3, -1, 104, 145, + 224, 146, -1, 120, 172, 224, 221, -1, 121, 196, + 147, 191, 148, -1, 121, 196, 115, 145, 193, 146, + 195, 147, 178, 148, -1, 5, -1, 5, 152, 5, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const unsigned short int yyrline[] = { - 0, 239, 239, 242, 243, 244, 245, 249, 253, 254, - 255, 258, 259, 260, 261, 262, 265, 266, 267, 270, - 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 286, 288, 291, 294, 297, 299, 302, 305, 306, - 309, 312, 313, 314, 318, 322, 325, 331, 338, 339, - 340, 343, 344, 345, 348, 349, 353, 359, 360, 363, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 0, 265, 265, 268, 269, 270, 271, 275, 280, 281, + 282, 285, 286, 287, 288, 289, 293, 294, 295, 298, + 299, 300, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 314, 316, 319, 322, 325, 327, 332, 335, 336, + 339, 342, 343, 344, 348, 353, 357, 363, 370, 371, + 372, 375, 376, 377, 380, 381, 385, 391, 392, 393, + 396, 397, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 440, 441, 444, 445, 450, 454, 460, 466, 467, 468, - 471, 474, 480, 484, 489, 497, 498, 511, 512, 515, - 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 527, 528, 529, 530, 531, 532, 533, 534, 537, - 538, 541, 547, 552, 553, 558, 559, 560, 561, 564, - 568, 578, 579, 582, 583, 584, 587, 589, 590, 591, - 592, 593, 594, 595, 596, 597, 600, 601, 602, 603, - 604, 616, 617, 618, 619, 620, 621, 622, 625, 626, - 629, 630, 631, 632, 633, 634, 635, 638, 639, 645, - 652, 657, 658, 662, 665, 666, 669, 682, 683, 686, - 687, 690, 705, 706, 709, 710, 713, 721, 729, 736, - 740, 741, 744, 745, 748, 753, 759, 760, 763, 764, - 765, 769, 770, 774, 775, 776, 779, 789, 790, 791, - 792, 793, 794, 795, 796, 797, 798, 799, 802, 815, - 819, 833, 834 + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 474, 475, 478, 479, 482, 486, 492, 498, + 499, 500, 503, 507, 516, 520, 525, 534, 535, 548, + 549, 552, 553, 554, 555, 556, 557, 558, 559, 560, + 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, + 571, 574, 575, 578, 584, 589, 590, 593, 594, 595, + 596, 599, 607, 619, 620, 623, 624, 625, 628, 630, + 633, 634, 635, 636, 637, 653, 654, 655, 656, 657, + 658, 659, 662, 663, 666, 667, 668, 669, 670, 671, + 672, 675, 676, 682, 691, 697, 698, 702, 705, 706, + 709, 721, 722, 725, 726, 729, 738, 747, 748, 751, + 752, 755, 763, 773, 782, 786, 787, 790, 791, 794, + 799, 805, 806, 809, 810, 811, 815, 816, 820, 821, + 822, 825, 836, 837, 838, 839, 840, 841, 842, 843, + 844, 845, 846, 849, 854, 859, 876, 877 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "aIDENTIFIER", "aKNOWNTYPE", "aNUM", - "aHEXNUM", "aSTRING", "aUUID", "aEOF", "SHL", "SHR", "tAGGREGATABLE", - "tALLOCATE", "tAPPOBJECT", "tASYNC", "tASYNCUUID", "tAUTOHANDLE", - "tBINDABLE", "tBOOLEAN", "tBROADCAST", "tBYTE", "tBYTECOUNT", "tCALLAS", - "tCALLBACK", "tCASE", "tCDECL", "tCHAR", "tCOCLASS", "tCODE", - "tCOMMSTATUS", "tCONST", "tCONTEXTHANDLE", "tCONTEXTHANDLENOSERIALIZE", - "tCONTEXTHANDLESERIALIZE", "tCONTROL", "tCPPQUOTE", "tDEFAULT", - "tDEFAULTCOLLELEM", "tDEFAULTVALUE", "tDEFAULTVTABLE", "tDISPLAYBIND", - "tDISPINTERFACE", "tDLLNAME", "tDOUBLE", "tDUAL", "tENDPOINT", "tENTRY", - "tENUM", "tERRORSTATUST", "tEXPLICITHANDLE", "tEXTERN", "tFALSE", - "tFLOAT", "tHANDLE", "tHANDLET", "tHELPCONTEXT", "tHELPFILE", - "tHELPSTRING", "tHELPSTRINGCONTEXT", "tHELPSTRINGDLL", "tHIDDEN", - "tHYPER", "tID", "tIDEMPOTENT", "tIIDIS", "tIMMEDIATEBIND", - "tIMPLICITHANDLE", "tIMPORT", "tIMPORTLIB", "tIN", "tINLINE", - "tINPUTSYNC", "tINT", "tINT64", "tINTERFACE", "tLCID", "tLENGTHIS", - "tLIBRARY", "tLOCAL", "tLONG", "tMETHODS", "tMODULE", "tNONBROWSABLE", - "tNONCREATABLE", "tNONEXTENSIBLE", "tOBJECT", "tODL", "tOLEAUTOMATION", - "tOPTIONAL", "tOUT", "tPOINTERDEFAULT", "tPROPERTIES", "tPROPGET", - "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC", "tRANGE", "tREADONLY", - "tREF", "tREQUESTEDIT", "tRESTRICTED", "tRETVAL", "tSAFEARRAY", - "tSHORT", "tSIGNED", "tSINGLE", "tSIZEIS", "tSIZEOF", "tSMALL", - "tSOURCE", "tSTDCALL", "tSTRING", "tSTRUCT", "tSWITCH", "tSWITCHIS", - "tSWITCHTYPE", "tTRANSMITAS", "tTRUE", "tTYPEDEF", "tUNION", "tUNIQUE", - "tUNSIGNED", "tUUID", "tV1ENUM", "tVARARG", "tVERSION", "tVOID", - "tWCHAR", "tWIREMARSHAL", "','", "'?'", "':'", "'|'", "'&'", "'-'", - "'+'", "'*'", "'/'", "'~'", "CAST", "PPTR", "NEG", "';'", "'('", "')'", - "'{'", "'}'", "'['", "']'", "'='", "'.'", "$accept", "input", - "gbl_statements", "imp_statements", "int_statements", "statement", - "cppquote", "import_start", "import", "importlib", "libraryhdr", - "library_start", "librarydef", "m_args", "no_args", "args", "arg", - "array", "array_list", "m_attributes", "attributes", "attrib_list", - "attribute", "callconv", "cases", "case", "constdef", "enums", - "enum_list", "enum", "enumdef", "m_exprs", "m_expr", "expr", - "expr_list_const", "expr_const", "externdef", "fields", "field", - "s_field", "funcdef", "m_ident", "t_ident", "ident", "base_type", - "m_int", "int_std", "coclass", "coclasshdr", "coclassdef", - "coclass_ints", "coclass_int", "dispinterface", "dispinterfacehdr", - "dispint_props", "dispint_meths", "dispinterfacedef", "inherit", - "interface", "interfacehdr", "interfacedef", "interfacedec", "module", - "modulehdr", "moduledef", "p_ident", "pident", "pident_list", - "pointer_type", "structdef", "type", "typedef", "uniondef", "version", 0 + "$end", "error", "$undefined", "aIDENTIFIER", "aKNOWNTYPE", "aNUM", + "aHEXNUM", "aSTRING", "aUUID", "aEOF", "SHL", "SHR", "tAGGREGATABLE", + "tALLOCATE", "tAPPOBJECT", "tASYNC", "tASYNCUUID", "tAUTOHANDLE", + "tBINDABLE", "tBOOLEAN", "tBROADCAST", "tBYTE", "tBYTECOUNT", "tCALLAS", + "tCALLBACK", "tCASE", "tCDECL", "tCHAR", "tCOCLASS", "tCODE", + "tCOMMSTATUS", "tCONST", "tCONTEXTHANDLE", "tCONTEXTHANDLENOSERIALIZE", + "tCONTEXTHANDLESERIALIZE", "tCONTROL", "tCPPQUOTE", "tDEFAULT", + "tDEFAULTCOLLELEM", "tDEFAULTVALUE", "tDEFAULTVTABLE", "tDISPLAYBIND", + "tDISPINTERFACE", "tDLLNAME", "tDOUBLE", "tDUAL", "tENDPOINT", "tENTRY", + "tENUM", "tERRORSTATUST", "tEXPLICITHANDLE", "tEXTERN", "tFALSE", + "tFLOAT", "tHANDLE", "tHANDLET", "tHELPCONTEXT", "tHELPFILE", + "tHELPSTRING", "tHELPSTRINGCONTEXT", "tHELPSTRINGDLL", "tHIDDEN", + "tHYPER", "tID", "tIDEMPOTENT", "tIIDIS", "tIMMEDIATEBIND", + "tIMPLICITHANDLE", "tIMPORT", "tIMPORTLIB", "tIN", "tINLINE", + "tINPUTSYNC", "tINT", "tINT64", "tINTERFACE", "tLCID", "tLENGTHIS", + "tLIBRARY", "tLOCAL", "tLONG", "tMETHODS", "tMODULE", "tNONBROWSABLE", + "tNONCREATABLE", "tNONEXTENSIBLE", "tOBJECT", "tODL", "tOLEAUTOMATION", + "tOPTIONAL", "tOUT", "tPOINTERDEFAULT", "tPROPERTIES", "tPROPGET", + "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC", "tRANGE", "tREADONLY", + "tREF", "tREQUESTEDIT", "tRESTRICTED", "tRETVAL", "tSAFEARRAY", "tSHORT", + "tSIGNED", "tSINGLE", "tSIZEIS", "tSIZEOF", "tSMALL", "tSOURCE", + "tSTDCALL", "tSTRING", "tSTRUCT", "tSWITCH", "tSWITCHIS", "tSWITCHTYPE", + "tTRANSMITAS", "tTRUE", "tTYPEDEF", "tUNION", "tUNIQUE", "tUNSIGNED", + "tUUID", "tV1ENUM", "tVARARG", "tVERSION", "tVOID", "tWCHAR", + "tWIREMARSHAL", "','", "'?'", "':'", "'|'", "'&'", "'-'", "'+'", "'*'", + "'/'", "'~'", "CAST", "PPTR", "NEG", "';'", "'('", "')'", "'{'", "'}'", + "'['", "']'", "'='", "'.'", "$accept", "input", "gbl_statements", + "imp_statements", "int_statements", "statement", "cppquote", + "import_start", "import", "importlib", "libraryhdr", "library_start", + "librarydef", "m_args", "no_args", "args", "arg", "array", "array_list", + "m_attributes", "attributes", "attrib_list", "str_list", "attribute", + "callconv", "cases", "case", "constdef", "enums", "enum_list", "enum", + "enumdef", "m_exprs", "m_expr", "expr", "expr_list_const", "expr_const", + "externdef", "fields", "field", "s_field", "funcdef", "m_ident", + "t_ident", "ident", "base_type", "m_int", "int_std", "coclass", + "coclasshdr", "coclassdef", "coclass_ints", "coclass_int", + "dispinterface", "dispinterfacehdr", "dispint_props", "dispint_meths", + "dispinterfacedef", "inherit", "interface", "interfacehdr", + "interfacedef", "interfacedec", "module", "modulehdr", "moduledef", + "p_ident", "pident", "pident_list", "pointer_type", "structdef", "type", + "typedef", "uniondef", "version", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -873,28 +961,27 @@ static const unsigned char yyr1[] = 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 168, 168, 169, 169, 169, 169, 170, 170, 170, 171, 171, 171, 172, 172, 173, 174, 174, 174, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 176, 176, 177, 177, 178, 178, 179, 180, 180, 180, - 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, - 187, 188, 189, 190, 190, 191, 191, 191, 191, 192, - 193, 194, 194, 195, 195, 195, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 198, 198, - 199, 199, 199, 199, 199, 199, 199, 200, 200, 201, - 202, 203, 203, 204, 205, 205, 206, 207, 207, 208, - 208, 209, 210, 210, 211, 211, 212, 213, 213, 213, - 214, 214, 215, 215, 216, 217, 218, 218, 219, 219, - 219, 220, 220, 221, 221, 221, 222, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 224, 225, - 225, 226, 226 + 175, 175, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 177, 177, 178, 178, 179, 179, 180, 181, + 181, 181, 182, 182, 183, 183, 184, 185, 185, 186, + 186, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 188, 188, 189, 190, 191, 191, 192, 192, 192, + 192, 193, 194, 195, 195, 196, 196, 196, 197, 197, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 199, 199, 200, 200, 200, 200, 200, 200, + 200, 201, 201, 202, 203, 204, 204, 205, 206, 206, + 207, 208, 208, 209, 209, 210, 210, 211, 211, 212, + 212, 213, 214, 214, 214, 215, 215, 216, 216, 217, + 218, 219, 219, 220, 220, 220, 221, 221, 222, 222, + 222, 223, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 225, 226, 226, 227, 227 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -906,393 +993,396 @@ static const unsigned char yyr2[] = 2, 4, 3, 3, 4, 2, 3, 3, 0, 1, 1, 1, 3, 1, 4, 3, 6, 5, 0, 3, 3, 1, 3, 4, 0, 1, 3, 1, 3, 4, - 0, 1, 1, 1, 1, 1, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 4, 1, 1, 4, 1, - 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, - 1, 4, 1, 4, 1, 5, 1, 1, 4, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - 1, 1, 1, 6, 1, 1, 1, 1, 4, 1, - 1, 4, 4, 4, 4, 1, 1, 4, 4, 1, - 0, 1, 0, 2, 4, 3, 5, 0, 2, 1, - 1, 3, 3, 1, 5, 1, 3, 0, 1, 1, - 1, 1, 1, 1, 5, 3, 3, 3, 3, 3, - 3, 3, 3, 2, 2, 2, 4, 4, 3, 1, - 3, 1, 4, 0, 2, 2, 3, 2, 1, 4, - 7, 0, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 1, 1, 1, 1, 0, 1, - 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, - 4, 0, 2, 2, 2, 2, 2, 2, 3, 2, - 3, 5, 0, 2, 2, 2, 2, 5, 7, 1, - 2, 2, 2, 2, 2, 4, 2, 2, 1, 1, - 3, 1, 3, 1, 1, 1, 5, 1, 1, 1, - 2, 1, 2, 1, 2, 1, 2, 4, 4, 5, - 10, 1, 3 + 1, 3, 0, 1, 1, 1, 1, 1, 4, 4, + 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, + 4, 1, 4, 4, 4, 1, 1, 4, 4, 4, + 4, 4, 1, 4, 1, 4, 1, 5, 1, 1, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 4, 1, 1, 1, 1, 6, 1, 1, 1, 1, + 4, 1, 1, 4, 4, 4, 4, 1, 1, 4, + 4, 1, 0, 1, 0, 2, 4, 3, 5, 0, + 2, 1, 1, 3, 3, 1, 5, 1, 3, 0, + 1, 1, 1, 1, 1, 1, 5, 3, 3, 3, + 3, 3, 3, 3, 3, 2, 2, 2, 4, 4, + 3, 1, 3, 1, 4, 0, 2, 2, 3, 2, + 1, 4, 7, 0, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 2, 1, 2, 2, 1, + 1, 2, 2, 2, 4, 0, 2, 2, 2, 2, + 2, 2, 3, 2, 3, 5, 5, 0, 2, 2, + 2, 2, 5, 7, 1, 2, 2, 2, 2, 2, + 4, 2, 2, 1, 1, 3, 1, 3, 1, 1, + 1, 5, 1, 1, 1, 2, 1, 2, 1, 2, + 1, 2, 4, 4, 5, 10, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned short yydefact[] = +static const unsigned short int yydefact[] = { - 3, 0, 2, 1, 0, 0, 0, 0, 183, 0, - 0, 0, 183, 54, 183, 22, 60, 10, 24, 11, + 3, 0, 2, 1, 0, 0, 0, 0, 185, 0, + 0, 0, 185, 54, 185, 22, 62, 10, 24, 11, 27, 11, 9, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 239, 0, 232, 5, 4, 0, 8, 0, - 0, 0, 217, 218, 258, 205, 196, 216, 0, 204, - 183, 206, 202, 207, 208, 210, 215, 208, 0, 208, - 0, 203, 212, 183, 183, 201, 257, 197, 261, 259, - 198, 263, 0, 265, 0, 224, 225, 184, 185, 0, - 0, 0, 234, 235, 0, 0, 55, 0, 61, 62, - 63, 64, 65, 0, 0, 68, 69, 70, 71, 72, - 73, 0, 76, 77, 0, 79, 0, 0, 83, 84, - 0, 0, 0, 0, 0, 90, 0, 92, 0, 94, - 0, 96, 97, 0, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 0, 109, 110, 111, 255, 112, 0, - 114, 253, 115, 116, 117, 0, 119, 120, 0, 0, - 0, 254, 0, 125, 126, 0, 0, 0, 57, 129, - 0, 0, 0, 0, 0, 219, 226, 236, 244, 23, - 25, 26, 6, 221, 241, 0, 240, 0, 0, 19, - 28, 29, 30, 260, 262, 209, 214, 213, 0, 211, - 199, 264, 266, 200, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 0, 0, 137, 0, 32, 173, - 0, 0, 173, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 147, 0, 0, - 147, 0, 0, 0, 0, 0, 0, 60, 56, 33, - 0, 17, 18, 0, 0, 15, 13, 12, 16, 37, - 35, 242, 243, 36, 54, 0, 54, 0, 233, 19, - 54, 0, 0, 31, 0, 139, 140, 143, 172, 54, - 0, 0, 0, 248, 249, 251, 268, 54, 54, 0, - 153, 149, 150, 151, 0, 152, 0, 0, 0, 0, - 171, 0, 169, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 145, 148, - 0, 0, 0, 0, 0, 0, 0, 271, 0, 0, - 58, 60, 0, 14, 220, 0, 222, 227, 0, 0, - 0, 54, 0, 54, 245, 21, 0, 0, 267, 136, - 144, 138, 0, 178, 256, 0, 55, 174, 0, 247, - 246, 0, 0, 0, 269, 66, 0, 164, 165, 163, + 0, 0, 234, 0, 227, 5, 4, 0, 8, 0, + 0, 0, 211, 212, 253, 199, 190, 210, 0, 198, + 185, 200, 196, 201, 202, 204, 209, 202, 0, 202, + 0, 197, 206, 185, 185, 195, 252, 191, 256, 254, + 192, 258, 0, 260, 0, 218, 219, 186, 187, 0, + 0, 0, 229, 230, 0, 0, 55, 0, 63, 64, + 65, 66, 67, 0, 0, 70, 71, 72, 73, 74, + 75, 0, 78, 79, 0, 81, 0, 0, 85, 86, + 0, 0, 0, 0, 0, 92, 0, 94, 0, 96, + 0, 98, 99, 0, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 0, 111, 112, 113, 250, 114, 0, + 116, 248, 117, 118, 119, 0, 121, 122, 0, 0, + 0, 249, 0, 127, 128, 0, 0, 0, 57, 131, + 0, 0, 0, 0, 0, 213, 220, 231, 239, 23, + 25, 26, 6, 215, 236, 0, 235, 0, 0, 19, + 28, 29, 30, 255, 257, 203, 208, 207, 0, 205, + 193, 259, 261, 194, 188, 189, 0, 0, 139, 0, + 32, 175, 0, 0, 175, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, + 0, 0, 149, 0, 0, 0, 0, 0, 0, 62, + 56, 33, 0, 17, 18, 0, 0, 15, 13, 12, + 16, 37, 35, 237, 238, 36, 54, 0, 54, 0, + 0, 228, 19, 54, 0, 0, 31, 0, 141, 142, + 145, 174, 54, 0, 0, 0, 243, 244, 246, 263, + 54, 54, 0, 155, 151, 152, 153, 0, 154, 0, + 0, 0, 0, 173, 0, 171, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 67, 75, 74, 78, 80, 81, 82, 85, - 86, 87, 88, 89, 91, 93, 0, 147, 98, 108, - 0, 118, 121, 122, 123, 124, 0, 127, 128, 59, - 0, 223, 229, 0, 228, 231, 0, 19, 237, 130, - 20, 141, 142, 265, 177, 175, 250, 252, 181, 0, - 168, 0, 161, 162, 0, 155, 156, 158, 157, 159, - 160, 170, 95, 146, 0, 272, 34, 48, 230, 54, - 131, 0, 176, 0, 182, 167, 166, 0, 113, 147, - 179, 238, 0, 132, 154, 0, 0, 51, 38, 0, - 50, 0, 49, 257, 0, 43, 39, 41, 0, 0, - 0, 0, 270, 133, 52, 0, 180, 0, 0, 48, - 0, 54, 53, 42, 48, 38, 45, 54, 135, 38, - 44, 0, 134, 0, 47, 46 + 0, 0, 147, 150, 0, 0, 0, 0, 0, 0, + 0, 266, 0, 0, 58, 62, 0, 14, 214, 0, + 216, 221, 0, 0, 0, 54, 0, 0, 54, 240, + 21, 0, 0, 262, 138, 146, 140, 0, 180, 251, + 0, 55, 176, 0, 242, 241, 0, 0, 0, 264, + 68, 0, 166, 167, 165, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 69, 77, 76, + 80, 0, 82, 83, 84, 87, 88, 89, 90, 91, + 93, 95, 0, 149, 100, 110, 0, 120, 123, 124, + 125, 126, 0, 129, 130, 59, 0, 217, 223, 0, + 222, 225, 0, 226, 19, 232, 132, 20, 143, 144, + 260, 179, 177, 245, 247, 183, 0, 170, 0, 163, + 164, 0, 157, 158, 160, 159, 161, 162, 172, 61, + 97, 148, 0, 267, 34, 48, 224, 54, 133, 0, + 178, 0, 184, 169, 168, 0, 115, 149, 181, 233, + 0, 134, 156, 0, 0, 51, 38, 0, 50, 0, + 49, 252, 0, 43, 39, 41, 0, 0, 0, 0, + 265, 135, 52, 0, 182, 0, 0, 48, 0, 54, + 53, 42, 48, 38, 45, 54, 137, 38, 44, 0, + 136, 0, 47, 46 }; /* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +static const short int yydefgoto[] = { - -1, 1, 2, 160, 260, 335, 18, 19, 20, 242, - 164, 21, 22, 464, 465, 466, 467, 450, 456, 336, - 86, 157, 158, 441, 459, 473, 24, 264, 265, 266, - 68, 307, 308, 290, 291, 292, 26, 269, 347, 348, - 337, 443, 79, 273, 69, 186, 70, 165, 28, 245, - 254, 326, 30, 31, 256, 331, 32, 178, 33, 34, - 246, 247, 168, 37, 248, 274, 275, 276, 159, 71, - 469, 40, 73, 318 + -1, 1, 2, 160, 253, 330, 18, 19, 20, 234, + 164, 21, 22, 462, 463, 464, 465, 448, 454, 331, + 86, 157, 290, 158, 439, 457, 471, 24, 257, 258, + 259, 68, 301, 302, 283, 284, 285, 26, 262, 342, + 343, 332, 441, 79, 266, 69, 186, 70, 165, 28, + 237, 246, 320, 30, 31, 248, 325, 32, 178, 33, + 34, 238, 239, 168, 37, 240, 267, 268, 269, 159, + 71, 467, 40, 73, 312 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -447 -static const short yypact[] = +#define YYPACT_NINF -365 +static const short int yypact[] = { - -447, 43, 696, -447, 65, 655, -111, 97, 109, 35, - 78, 118, 109, -46, 109, -447, 809, -447, -447, -447, - -447, -447, -447, 66, -30, 2, 13, 16, -5, -447, - 26, 40, -447, 38, 76, -447, -447, 50, -447, 67, - 69, 71, -447, -447, -447, -447, -447, -447, 655, -447, - 129, -447, -447, -447, 161, -447, -447, 161, 91, 161, - 10, -447, -447, 182, 191, 10, -447, -447, -447, -447, - -447, -447, 587, -447, 235, -447, -447, -447, -447, 96, - 655, 102, -447, -447, 103, 655, -447, -94, -447, -447, - -447, -447, -447, 108, 110, -447, -447, -447, -447, -447, - -447, 112, -447, -447, 114, -447, 121, 127, -447, -447, - 130, 135, 136, 137, 138, -447, 142, -447, 144, -447, - 146, -447, -447, 147, -447, -447, -447, -447, -447, -447, - -447, -447, -447, 148, -447, -447, -447, -447, -447, 149, - -447, -447, -447, -447, -447, 152, -447, -447, 156, 158, - 159, -447, 160, -447, -447, 165, 166, -100, -447, -447, - 528, 665, 271, 201, 167, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -447, 214, -447, 203, 168, -447, - -447, -447, -447, -447, 169, -447, -447, -447, 655, -447, - -447, 169, -82, -447, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, 172, 173, 587, 587, -447, -447, - 223, 175, -447, 587, 246, 9, 305, 320, 99, 246, - 321, 323, 246, 326, 246, 587, 280, 246, -68, 246, - 246, 246, 655, 655, 329, 334, 655, 809, 195, -447, - 200, -447, -447, 220, 196, -447, -447, -447, -447, -447, - -447, -447, -447, -447, 72, 218, -61, 206, -447, -447, - 892, 208, 246, -447, 209, 225, -447, 207, -447, -25, - -21, 223, 223, -447, -447, -447, 228, -46, -19, 216, - -447, -447, -447, -447, 215, -447, 246, 246, 246, 500, - 532, -84, -447, 217, 221, 224, 226, 231, 239, 241, - 242, 243, 247, 248, 249, 250, 361, -79, -447, 532, - 254, 238, -76, 267, 261, 262, 263, 219, 264, 265, - -447, 809, 359, -447, -447, -16, -447, -447, 279, 655, - 270, 92, 347, 901, -447, -447, 655, 272, -447, -447, - -447, 587, 246, -447, -447, 655, 273, -447, 275, -447, - -447, 274, 223, 277, -447, -447, 655, -447, -447, -447, - 297, 278, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -447, -447, 282, 246, -447, -447, - 246, -447, -447, -447, -447, -447, 416, -447, -447, -447, - 284, -447, -447, 223, -447, -447, 281, -447, -447, 314, - -447, -447, -447, 294, -447, -447, -447, -447, 587, 295, - -447, 246, -447, -447, 449, 64, 53, 14, 14, 212, - 212, -447, -447, -447, 300, -447, -447, 298, -447, 910, - -447, 223, -447, 301, -447, -447, -447, 246, -447, 375, - -447, -447, 306, -447, 532, 74, -93, -447, 269, -8, - -447, 246, 303, -60, 304, -447, 322, -447, 655, 223, - 246, 324, -447, -447, 532, 246, -447, 418, 223, -18, - 519, -71, 532, -447, -11, 269, -447, -71, -447, 269, - -447, 308, -447, 309, -447, -447 + -365, 34, 728, -365, 167, 687, -113, 169, 200, 12, + 57, 208, 200, -82, 200, -365, 841, -365, -365, -365, + -365, -365, -365, 7, -67, -60, -49, -21, 10, -365, + -10, 46, -365, 64, 62, -365, -365, 66, -365, 78, + 105, 113, -365, -365, -365, -365, -365, -365, 687, -365, + 212, -365, -365, -365, 197, -365, -365, 197, 128, 197, + 26, -365, -365, 215, 222, 26, -365, -365, -365, -365, + -365, -365, 231, -365, 270, -365, -365, -365, -365, 132, + 687, 138, -365, -365, 133, 687, -365, -91, -365, -365, + -365, -365, -365, 139, 144, -365, -365, -365, -365, -365, + -365, 145, -365, -365, 146, -365, 149, 150, -365, -365, + 151, 153, 155, 156, 157, -365, 158, -365, 159, -365, + 160, -365, -365, 162, -365, -365, -365, -365, -365, -365, + -365, -365, -365, 164, -365, -365, -365, -365, -365, 168, + -365, -365, -365, -365, -365, 170, -365, -365, 171, 175, + 176, -365, 177, -365, -365, 180, 181, -102, -365, -365, + 529, 697, 309, 237, 183, -365, -365, -365, -365, -365, + -365, -365, -365, -365, -365, 0, -365, 239, 187, -365, + -365, -365, -365, -365, 188, -365, -365, -365, 687, -365, + -365, 188, -88, -365, -365, -365, 163, 182, 231, 231, + -365, -365, 47, 192, -365, 231, 305, 136, 331, 332, + 280, 305, 333, 335, 305, 336, 305, 231, 289, 305, + -3, 305, 305, 305, 687, 687, 338, 347, 687, 841, + 204, -365, 210, -365, -365, 32, 216, -365, -365, -365, + -365, -365, -365, -365, -365, -365, 98, 223, -58, 217, + 219, -365, -365, -11, 213, 305, -365, 214, 232, -365, + 218, -365, -31, -13, 47, 47, -365, -365, -365, 233, + -82, -22, 224, -365, -365, -365, -365, 226, -365, 305, + 305, 305, 496, 532, -48, -365, 228, 229, 230, -365, + -44, 234, 235, 236, 238, 240, 241, 245, 246, 248, + 365, -35, -365, 532, 249, 247, -30, 449, 250, 251, + 252, 225, 254, 255, -365, 841, 372, -365, -365, -6, + -365, -365, 269, 687, 264, 103, 242, 315, 686, -365, + -365, 687, 265, -365, -365, -365, 231, 305, -365, -365, + 687, 266, -365, 268, -365, -365, 267, 47, 271, -365, + -365, 687, -365, -365, -365, 519, 273, 305, 305, 305, + 305, 305, 305, 305, 305, 305, 305, -365, -365, -365, + -365, 378, -365, -365, -365, -365, -365, -365, -365, -365, + -365, -365, 275, 305, -365, -365, 305, -365, -365, -365, + -365, -365, 417, -365, -365, -365, 277, -365, -365, 47, + -365, -365, 282, -365, -365, -365, 317, -365, -365, -365, + 283, -365, -365, -365, -365, 231, 284, -365, 305, -365, + -365, 551, 94, 44, 51, 51, 257, 257, -365, -365, + -365, -365, 285, -365, -365, 286, -365, 924, -365, 47, + -365, 287, -365, -365, -365, 305, -365, 401, -365, -365, + 291, -365, 532, 60, -92, -365, 244, -16, -365, 305, + 295, -1, 301, -365, 318, -365, 687, 47, 305, 319, + -365, -365, 532, 305, -365, 384, 47, -25, 562, 50, + 532, -365, -5, 244, -365, 50, -365, 244, -365, 302, + -365, 310, -365, -365 }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const short int yypgoto[] = { - -447, -447, -447, 437, -251, 7, -447, -447, 131, -447, - -447, -447, -447, -350, -447, -447, -7, -397, -447, -9, - -2, -447, -214, -447, -447, -447, -447, -447, -447, 120, - 3, 244, -357, -191, -447, -173, -447, 253, -446, -229, - 145, -447, 46, -70, -447, 34, 51, 20, -447, 466, - -447, -447, -12, -447, -447, -447, -447, -447, -10, -447, - 467, 4, -447, -447, 475, 211, -253, -447, 258, 5, - -4, -447, 1, -447 + -365, -365, -365, 430, -244, 15, -365, -365, 134, -365, + -365, -365, -365, -296, -365, -365, -20, -276, -365, -9, + -2, -365, -365, -207, -365, -365, -365, -365, -365, -365, + 127, 3, 243, -357, -209, -365, -169, -365, 262, -364, + -202, 143, -365, 16, -70, -365, -26, 142, 17, -365, + 465, -365, -365, -7, -365, -365, -365, -365, -365, -8, + -365, 467, 4, -365, -365, 469, 209, -253, -365, 258, + 5, -4, -365, 1, -365 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -185 -static const short yytable[] = +#define YYTABLE_NINF -187 +static const short int yytable[] = { - 23, 72, 204, 41, 85, 25, 36, 39, 333, 17, - 270, 166, 280, 167, 281, 282, 293, 470, 350, 351, - 328, 211, 27, 320, 362, 363, 7, 330, 137, 471, - 433, 237, 141, -184, 74, 488, 309, 47, 461, 309, - 313, 492, 294, 3, 183, 298, 299, 371, 353, 302, - 238, 304, 387, 212, 151, 387, 311, 462, 84, 11, - 87, 283, 372, 362, 363, -184, 80, 388, 42, 43, - 391, -40, 54, 343, 362, 363, 207, 280, 16, 281, - 282, 210, 486, 55, 56, 81, -40, 490, 16, 339, - 57, 187, 457, 189, 4, 357, 358, 359, 360, 417, - 75, 76, 280, 16, 281, 282, 297, 399, 7, 84, - 87, 190, 77, 78, 169, 59, 193, 271, 284, 343, - 62, 82, 83, 344, 16, 343, 283, 485, 285, 354, - 16, 449, 184, 78, 489, 491, 267, 268, 449, 493, - 472, 11, 173, 279, 162, 286, 170, 287, 163, 288, - 437, 283, 369, 370, 289, 305, 439, 171, 243, 243, - 172, 41, 41, 25, 25, 39, 39, 241, 241, 412, - 174, 422, 423, 424, 425, 426, 427, 428, 429, 430, - 244, 244, 176, 284, 261, 191, 78, 175, 452, 367, - 368, 369, 370, 285, 192, 78, 309, 179, 431, 366, - 367, 368, 369, 370, 251, 252, 257, 258, 284, 177, - 286, 180, 287, 181, 288, 182, 479, 434, 285, 289, - 324, 16, 362, 363, 460, 484, 194, 195, 314, 315, - 446, 166, 319, 167, 185, 286, 188, 287, 196, 288, - 405, 16, 205, 206, 289, 325, 208, 329, 4, 280, - 209, 281, 282, 213, 270, 214, 454, 215, 309, 216, - 345, 41, 7, 25, 358, 39, 217, 346, 329, 345, - 474, 267, 218, 44, 250, 219, 346, 362, 363, 480, - 220, 221, 222, 223, 482, 361, 197, 224, 45, 225, - 46, 226, 227, 228, 229, 11, 47, 230, 283, 198, - 48, 231, 163, 232, 233, 234, 255, 362, 363, 199, - 235, 236, 295, 49, 253, 259, -184, 50, 51, 263, - 277, 200, 52, 262, 53, 403, 201, 296, 300, 401, - 301, 54, 409, 303, 41, 306, 25, 316, 39, 317, - 323, 403, 55, 56, 321, 322, 413, 202, 444, 57, - 203, 327, 419, 332, 338, 284, 341, 340, 342, 352, - 356, 271, 355, 373, 386, 285, 400, 374, 272, 390, - 375, 396, 376, 58, 59, 60, 61, 377, 280, 62, - 281, 282, 286, 63, 287, 378, 288, 379, 380, 381, - 64, 289, 65, 382, 383, 384, 385, 463, 67, 364, - 389, 365, 366, 367, 368, 369, 370, 393, 394, 395, - 397, 398, 402, 392, 404, 10, 410, 414, 16, 415, - 416, 435, 44, 418, 421, 438, 440, 283, 432, 364, - 436, 365, 366, 367, 368, 369, 370, 45, 442, 46, - 41, 445, 25, 420, 39, 47, 448, 449, 453, 48, - 476, 458, 475, 477, 494, 495, 468, 481, 161, 362, - 363, 411, 49, 407, 478, 278, 50, 51, 29, 35, - 483, 52, 345, 53, 312, 468, 406, 38, 345, 346, - 54, 349, 0, 468, 284, 346, 310, 468, 0, 0, - 0, 55, 56, 0, 285, 0, 0, 0, 57, 0, - 0, 0, 0, 280, 44, 281, 282, 0, 0, 0, - 0, 286, 0, 455, 0, 288, 0, 0, 0, 45, - 289, 46, 58, 59, 60, 61, 0, 47, 62, 362, - 363, 48, 63, 0, 0, 0, 0, 239, 0, 64, - 0, 65, 362, 363, 49, 0, 66, 67, 50, 51, - 0, 0, 283, 52, 0, 53, 4, 0, 0, 5, - 0, 0, 54, 0, 6, 0, 0, 16, 0, 0, - 7, 0, 0, 55, 56, 0, 8, 0, 0, 9, - 57, 364, 447, 365, 366, 367, 368, 369, 370, 0, - 194, 195, 0, 0, 0, 0, 10, 240, 0, 0, - 0, 0, 196, 11, 58, 59, 60, 61, 0, 284, - 62, 0, 0, 0, 63, 0, 0, 0, 0, 285, - 0, 64, 0, 65, 0, 0, 0, 0, 66, 67, - 0, 0, 0, 0, 0, 0, 286, 0, 287, 0, - 288, 0, 12, 0, 0, 289, 0, 0, 13, 14, - 197, 364, 487, 365, 366, 367, 368, 369, 370, 44, - 0, 0, 0, 198, 364, 0, 365, 366, 367, 368, - 369, 370, 15, 199, 45, 0, 46, 16, 0, 0, - 0, 0, 47, 0, 0, 200, 48, 0, 0, 0, - 201, 0, 0, 4, 0, 0, 5, 0, 0, 49, - 0, 6, 0, 50, 51, 0, 0, 7, 52, 0, - 53, 202, 0, 8, 203, 0, 9, 54, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 5, 55, 56, - 0, 0, 6, 10, 240, 57, 0, 0, 7, 0, - 11, 0, 0, 0, 8, 0, 0, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, - 59, 60, 61, 0, 10, 62, 0, 0, 0, 63, - 0, 11, 0, 0, 0, 0, 64, 0, 65, 12, - 0, 0, 0, 66, 67, 13, 14, 0, 0, 0, + 23, 72, 196, 41, 85, 25, 36, 39, 328, 468, + 303, 345, 346, 303, 307, 167, 166, 17, 263, 27, + 5, 469, 314, 322, 203, 6, 431, -186, 84, 229, + 87, 187, 74, 189, 3, 4, 7, 8, 287, 459, + 9, 292, 293, 80, 183, 296, 324, 298, 230, 7, + 194, 195, 305, 47, 357, 358, 204, 10, 460, -186, + 4, 357, 358, 273, 81, 274, 275, 16, 348, 11, + 352, 353, 354, 355, 7, 11, 199, 169, 263, 84, + 87, 202, 11, 366, 170, 162, 334, 371, 54, 163, + 455, 16, 247, 137, 414, 171, 383, 141, 367, 55, + 56, 383, 372, 12, 357, 358, 57, 11, 395, 13, + 14, 384, 276, 338, 163, 486, 387, 339, 16, 151, + 483, 490, 338, 172, 447, 264, 349, 16, 260, 261, + -40, 59, 470, 15, 174, 272, 62, 329, 16, 273, + 487, 274, 275, 286, 447, -40, 435, 299, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 173, 235, 235, + 437, 41, 41, 25, 25, 39, 39, 249, 409, 277, + 42, 43, 75, 76, 303, 233, 233, 236, 236, 278, + 362, 363, 364, 365, 254, 264, 450, 489, 276, 364, + 365, 491, 265, 175, 338, 177, 279, 428, 280, 16, + 281, 484, 190, 77, 78, 282, 488, 193, 176, 444, + 458, 82, 83, 179, 477, 184, 78, 432, 191, 78, + 308, 309, 180, 482, 313, 192, 78, 167, 166, 361, + 362, 363, 364, 365, 194, 195, 452, 319, 303, 323, + 243, 244, 250, 251, 353, 277, 318, 16, 44, 181, + 472, 401, 16, 340, 41, 278, 25, 182, 39, 478, + 341, 323, 340, 45, 480, 46, 260, 357, 358, 341, + 185, 47, 279, 188, 280, 48, 281, 197, 356, 198, + 201, 282, 200, 273, 205, 274, 275, 291, 49, 206, + 207, 208, 50, 51, 209, 210, 211, 52, 212, 53, + 213, 214, 215, 216, 217, 218, 54, 219, 273, 220, + 274, 275, 242, 221, 255, 222, 223, 55, 56, 399, + 224, 225, 226, 397, 57, 227, 228, 406, 256, 41, + 245, 25, 276, 39, 252, -186, 399, 270, 288, 289, + 294, 410, 295, 297, 300, 442, 310, 416, 58, 59, + 60, 61, 311, 315, 62, 316, 321, 276, 63, 333, + 317, 326, 335, 336, 347, 64, 327, 65, 382, 337, + 350, 351, 461, 67, 368, 369, 370, 392, 386, 396, + 373, 374, 375, 10, 376, 429, 377, 378, 44, 277, + 403, 379, 380, 16, 381, 385, 389, 390, 391, 278, + 393, 394, 398, 45, 273, 46, 274, 275, 400, 407, + 411, 47, 412, 413, 277, 48, 279, 415, 280, 418, + 281, 430, 433, 434, 278, 282, 436, 440, 49, 438, + 443, 446, 50, 51, 451, 447, 456, 52, 41, 53, + 25, 279, 39, 280, 473, 281, 54, 474, 492, 475, + 282, 161, 479, 276, 466, 481, 493, 55, 56, 357, + 358, 404, 476, 408, 57, 306, 271, 29, 402, 35, + 340, 38, 344, 466, 0, 0, 340, 341, 304, 0, + 0, 466, 0, 341, 0, 466, 0, 0, 58, 59, + 60, 61, 0, 0, 62, 0, 0, 0, 63, 273, + 44, 274, 275, 0, 0, 64, 0, 65, 0, 0, + 277, 0, 66, 67, 0, 45, 0, 46, 0, 0, + 278, 0, 0, 47, 0, 0, 0, 48, 0, 357, + 358, 0, 0, 16, 0, 0, 0, 279, 231, 453, + 49, 281, 357, 358, 50, 51, 282, 0, 276, 52, + 0, 53, 0, 0, 0, 0, 0, 4, 54, 0, + 5, 357, 358, 0, 0, 6, 0, 0, 0, 55, + 56, 7, 357, 358, 0, 0, 57, 8, 0, 0, + 9, 359, 0, 360, 361, 362, 363, 364, 365, 0, + 0, 0, 0, 0, 0, 388, 0, 10, 232, 0, + 58, 59, 60, 61, 11, 277, 62, 0, 0, 0, + 63, 0, 0, 0, 0, 278, 0, 64, 0, 65, + 0, 0, 0, 0, 66, 67, 0, 0, 0, 0, + 0, 0, 279, 0, 280, 0, 281, 0, 0, 0, + 0, 282, 0, 12, 0, 0, 0, 0, 0, 13, + 14, 359, 0, 360, 361, 362, 363, 364, 365, 0, + 0, 0, 0, 0, 359, 417, 360, 361, 362, 363, + 364, 365, 0, 15, 0, 0, 0, 0, 16, 0, + 0, 0, 0, 359, 445, 360, 361, 362, 363, 364, + 365, 44, 0, 0, 359, 485, 360, 361, 362, 363, + 364, 365, 0, 0, 0, 0, 45, 0, 46, 0, + 0, 0, 0, 0, 47, 0, 0, 5, 48, 0, + 0, 0, 6, 0, 0, 4, 0, 0, 5, 0, + 0, 49, 0, 6, 8, 50, 51, 9, 0, 7, + 52, 0, 53, 0, 0, 8, 0, 0, 9, 54, + 0, 0, 0, 0, 10, 0, 4, 0, 0, 5, + 55, 56, 0, 0, 6, 10, 232, 57, 0, 0, + 7, 0, 11, 0, 0, 0, 8, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 12, 0, 0, 249, 16, 0, 13, 14, 0, 0, - 0, 88, 0, 89, 90, 0, 91, 92, 0, 0, - 0, 0, 93, 0, 94, 0, 0, 0, 0, 0, - 15, 95, 96, 97, 98, 16, 99, 100, 101, 102, - 103, 0, 104, 0, 105, 106, 107, 0, 0, 108, - 0, 0, 0, 109, 0, 110, 111, 112, 113, 114, - 115, 0, 116, 117, 118, 119, 120, 0, 0, 121, - 0, 122, 0, 0, 0, 0, 123, 0, 124, 0, - 0, 0, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 0, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 0, 0, 0, 0, 145, 0, 0, - 146, 0, 147, 5, 0, 148, 149, 150, 6, 0, - 0, 151, 5, 152, 153, 154, 155, 6, 0, 156, - 8, 5, 0, 9, 0, 0, 6, 0, 0, 8, - 0, 0, 9, 0, 0, 0, 0, 0, 8, 0, - 10, 9, 0, 0, 0, 0, 0, 0, 0, 10, - 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, + 0, 58, 59, 60, 61, 0, 10, 62, 0, 0, + 12, 63, 0, 11, 0, 0, 13, 14, 64, 0, + 65, 12, 0, 0, 0, 66, 67, 13, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 405, 16, 0, 0, 0, 0, + 0, 15, 12, 0, 0, 241, 16, 0, 13, 14, + 0, 0, 0, 88, 0, 89, 90, 0, 91, 92, + 0, 0, 0, 0, 93, 0, 94, 0, 0, 0, + 0, 0, 15, 95, 96, 97, 98, 16, 99, 100, + 101, 102, 103, 0, 104, 0, 105, 106, 107, 0, + 0, 108, 0, 0, 0, 109, 0, 110, 111, 112, + 113, 114, 115, 0, 116, 117, 118, 119, 120, 0, + 0, 121, 0, 122, 0, 0, 0, 0, 123, 0, + 124, 0, 0, 0, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 0, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 0, 0, 0, 0, 145, + 0, 0, 146, 0, 147, 5, 0, 148, 149, 150, + 6, 0, 0, 151, 0, 152, 153, 154, 155, 0, + 0, 156, 8, 0, 0, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, - 0, 0, 13, 14, 0, 12, 0, 0, 0, 0, - 0, 13, 14, 0, 12, 0, 0, 0, 0, 0, - 13, 14, 0, 0, 0, 0, 15, 0, 0, 0, - 334, 16, 0, 0, 0, 15, 0, 0, 0, 408, - 16, 0, 0, 0, 15, 0, 0, 0, 451, 16 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 13, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, + 0, 0, 449, 16 }; -static const short yycheck[] = +static const short int yycheck[] = { - 2, 5, 72, 2, 13, 2, 2, 2, 259, 2, - 31, 23, 3, 23, 5, 6, 7, 25, 271, 272, - 81, 115, 2, 237, 10, 11, 42, 256, 96, 37, - 387, 131, 100, 115, 145, 481, 227, 27, 131, 230, - 231, 487, 215, 0, 48, 218, 219, 131, 277, 222, - 150, 224, 131, 147, 122, 131, 229, 150, 12, 75, - 14, 52, 146, 10, 11, 147, 31, 146, 3, 4, - 146, 131, 62, 144, 10, 11, 80, 3, 149, 5, - 6, 85, 479, 73, 74, 7, 146, 484, 149, 262, - 80, 57, 449, 59, 28, 286, 287, 288, 289, 352, - 3, 4, 3, 149, 5, 6, 7, 321, 42, 63, - 64, 60, 3, 4, 144, 105, 65, 138, 109, 144, - 110, 3, 4, 148, 149, 144, 52, 145, 119, 148, - 149, 149, 3, 4, 145, 485, 206, 207, 149, 489, - 148, 75, 147, 213, 78, 136, 144, 138, 82, 140, - 403, 52, 138, 139, 145, 225, 407, 144, 160, 161, - 144, 160, 161, 160, 161, 160, 161, 160, 161, 342, - 144, 362, 363, 364, 365, 366, 367, 368, 369, 370, - 160, 161, 144, 109, 188, 3, 4, 147, 441, 136, - 137, 138, 139, 119, 3, 4, 387, 147, 371, 135, - 136, 137, 138, 139, 3, 4, 3, 4, 109, 133, - 136, 144, 138, 144, 140, 144, 469, 390, 119, 145, - 148, 149, 10, 11, 150, 478, 3, 4, 232, 233, - 421, 243, 236, 243, 73, 136, 145, 138, 15, 140, - 148, 149, 7, 147, 145, 254, 144, 256, 28, 3, - 147, 5, 6, 145, 31, 145, 447, 145, 449, 145, - 269, 260, 42, 260, 455, 260, 145, 269, 277, 278, - 461, 341, 145, 4, 3, 145, 278, 10, 11, 470, - 145, 145, 145, 145, 475, 289, 63, 145, 19, 145, - 21, 145, 145, 145, 145, 75, 27, 145, 52, 76, - 31, 145, 82, 145, 145, 145, 92, 10, 11, 86, - 145, 145, 7, 44, 147, 147, 147, 48, 49, 146, - 145, 98, 53, 151, 55, 329, 103, 7, 7, 325, - 7, 62, 336, 7, 333, 55, 333, 8, 333, 5, - 144, 345, 73, 74, 149, 145, 345, 124, 418, 80, - 127, 133, 356, 147, 146, 109, 131, 148, 151, 131, - 145, 138, 146, 146, 3, 119, 7, 146, 145, 131, - 146, 152, 146, 104, 105, 106, 107, 146, 3, 110, - 5, 6, 136, 114, 138, 146, 140, 146, 146, 146, - 121, 145, 123, 146, 146, 146, 146, 128, 129, 132, - 146, 134, 135, 136, 137, 138, 139, 146, 146, 146, - 146, 146, 133, 146, 144, 68, 144, 144, 149, 144, - 146, 5, 4, 146, 146, 144, 112, 52, 146, 132, - 146, 134, 135, 136, 137, 138, 139, 19, 144, 21, - 439, 146, 439, 146, 439, 27, 146, 149, 147, 31, - 146, 145, 149, 131, 146, 146, 458, 133, 21, 10, - 11, 341, 44, 332, 468, 212, 48, 49, 2, 2, - 477, 53, 481, 55, 230, 477, 331, 2, 487, 481, - 62, 270, -1, 485, 109, 487, 228, 489, -1, -1, - -1, 73, 74, -1, 119, -1, -1, -1, 80, -1, - -1, -1, -1, 3, 4, 5, 6, -1, -1, -1, - -1, 136, -1, 138, -1, 140, -1, -1, -1, 19, - 145, 21, 104, 105, 106, 107, -1, 27, 110, 10, - 11, 31, 114, -1, -1, -1, -1, 9, -1, 121, - -1, 123, 10, 11, 44, -1, 128, 129, 48, 49, - -1, -1, 52, 53, -1, 55, 28, -1, -1, 31, - -1, -1, 62, -1, 36, -1, -1, 149, -1, -1, - 42, -1, -1, 73, 74, -1, 48, -1, -1, 51, - 80, 132, 133, 134, 135, 136, 137, 138, 139, -1, - 3, 4, -1, -1, -1, -1, 68, 69, -1, -1, - -1, -1, 15, 75, 104, 105, 106, 107, -1, 109, - 110, -1, -1, -1, 114, -1, -1, -1, -1, 119, - -1, 121, -1, 123, -1, -1, -1, -1, 128, 129, - -1, -1, -1, -1, -1, -1, 136, -1, 138, -1, - 140, -1, 114, -1, -1, 145, -1, -1, 120, 121, - 63, 132, 133, 134, 135, 136, 137, 138, 139, 4, - -1, -1, -1, 76, 132, -1, 134, 135, 136, 137, - 138, 139, 144, 86, 19, -1, 21, 149, -1, -1, - -1, -1, 27, -1, -1, 98, 31, -1, -1, -1, - 103, -1, -1, 28, -1, -1, 31, -1, -1, 44, - -1, 36, -1, 48, 49, -1, -1, 42, 53, -1, - 55, 124, -1, 48, 127, -1, 51, 62, -1, -1, - -1, -1, -1, -1, 28, -1, -1, 31, 73, 74, - -1, -1, 36, 68, 69, 80, -1, -1, 42, -1, - 75, -1, -1, -1, 48, -1, -1, 51, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, - 105, 106, 107, -1, 68, 110, -1, -1, -1, 114, - -1, 75, -1, -1, -1, -1, 121, -1, 123, 114, - -1, -1, -1, 128, 129, 120, 121, -1, -1, -1, + 2, 5, 72, 2, 13, 2, 2, 2, 252, 25, + 219, 264, 265, 222, 223, 23, 23, 2, 31, 2, + 31, 37, 229, 81, 115, 36, 383, 115, 12, 131, + 14, 57, 145, 59, 0, 28, 42, 48, 207, 131, + 51, 210, 211, 31, 48, 214, 248, 216, 150, 42, + 3, 4, 221, 27, 10, 11, 147, 68, 150, 147, + 28, 10, 11, 3, 7, 5, 6, 149, 270, 75, + 279, 280, 281, 282, 42, 75, 80, 144, 31, 63, + 64, 85, 75, 131, 144, 78, 255, 131, 62, 82, + 447, 149, 92, 96, 347, 144, 131, 100, 146, 73, + 74, 131, 146, 114, 10, 11, 80, 75, 315, 120, + 121, 146, 52, 144, 82, 479, 146, 148, 149, 122, + 145, 485, 144, 144, 149, 138, 148, 149, 198, 199, + 131, 105, 148, 144, 144, 205, 110, 148, 149, 3, + 145, 5, 6, 7, 149, 146, 399, 217, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 147, 160, 161, + 404, 160, 161, 160, 161, 160, 161, 175, 337, 109, + 3, 4, 3, 4, 383, 160, 161, 160, 161, 119, + 136, 137, 138, 139, 188, 138, 439, 483, 52, 138, + 139, 487, 145, 147, 144, 133, 136, 366, 138, 149, + 140, 477, 60, 3, 4, 145, 482, 65, 144, 418, + 150, 3, 4, 147, 467, 3, 4, 386, 3, 4, + 224, 225, 144, 476, 228, 3, 4, 235, 235, 135, + 136, 137, 138, 139, 3, 4, 445, 246, 447, 248, + 3, 4, 3, 4, 453, 109, 148, 149, 4, 144, + 459, 148, 149, 262, 253, 119, 253, 144, 253, 468, + 262, 270, 271, 19, 473, 21, 336, 10, 11, 271, + 73, 27, 136, 145, 138, 31, 140, 7, 282, 147, + 147, 145, 144, 3, 145, 5, 6, 7, 44, 145, + 145, 145, 48, 49, 145, 145, 145, 53, 145, 55, + 145, 145, 145, 145, 145, 145, 62, 145, 3, 145, + 5, 6, 3, 145, 151, 145, 145, 73, 74, 323, + 145, 145, 145, 319, 80, 145, 145, 331, 146, 328, + 147, 328, 52, 328, 147, 147, 340, 145, 7, 7, + 7, 340, 7, 7, 55, 415, 8, 351, 104, 105, + 106, 107, 5, 149, 110, 145, 133, 52, 114, 146, + 144, 144, 148, 131, 131, 121, 147, 123, 3, 151, + 146, 145, 128, 129, 146, 146, 146, 152, 131, 7, + 146, 146, 146, 68, 146, 7, 146, 146, 4, 109, + 148, 146, 146, 149, 146, 146, 146, 146, 146, 119, + 146, 146, 133, 19, 3, 21, 5, 6, 144, 144, + 144, 27, 144, 146, 109, 31, 136, 146, 138, 146, + 140, 146, 5, 146, 119, 145, 144, 144, 44, 112, + 146, 146, 48, 49, 147, 149, 145, 53, 437, 55, + 437, 136, 437, 138, 149, 140, 62, 146, 146, 131, + 145, 21, 133, 52, 456, 475, 146, 73, 74, 10, + 11, 327, 466, 336, 80, 222, 204, 2, 325, 2, + 479, 2, 263, 475, -1, -1, 485, 479, 220, -1, + -1, 483, -1, 485, -1, 487, -1, -1, 104, 105, + 106, 107, -1, -1, 110, -1, -1, -1, 114, 3, + 4, 5, 6, -1, -1, 121, -1, 123, -1, -1, + 109, -1, 128, 129, -1, 19, -1, 21, -1, -1, + 119, -1, -1, 27, -1, -1, -1, 31, -1, 10, + 11, -1, -1, 149, -1, -1, -1, 136, 9, 138, + 44, 140, 10, 11, 48, 49, 145, -1, 52, 53, + -1, 55, -1, -1, -1, -1, -1, 28, 62, -1, + 31, 10, 11, -1, -1, 36, -1, -1, -1, 73, + 74, 42, 10, 11, -1, -1, 80, 48, -1, -1, + 51, 132, -1, 134, 135, 136, 137, 138, 139, -1, + -1, -1, -1, -1, -1, 146, -1, 68, 69, -1, + 104, 105, 106, 107, 75, 109, 110, -1, -1, -1, + 114, -1, -1, -1, -1, 119, -1, 121, -1, 123, + -1, -1, -1, -1, 128, 129, -1, -1, -1, -1, + -1, -1, 136, -1, 138, -1, 140, -1, -1, -1, + -1, 145, -1, 114, -1, -1, -1, -1, -1, 120, + 121, 132, -1, 134, 135, 136, 137, 138, 139, -1, + -1, -1, -1, -1, 132, 146, 134, 135, 136, 137, + 138, 139, -1, 144, -1, -1, -1, -1, 149, -1, + -1, -1, -1, 132, 133, 134, 135, 136, 137, 138, + 139, 4, -1, -1, 132, 133, 134, 135, 136, 137, + 138, 139, -1, -1, -1, -1, 19, -1, 21, -1, + -1, -1, -1, -1, 27, -1, -1, 31, 31, -1, + -1, -1, 36, -1, -1, 28, -1, -1, 31, -1, + -1, 44, -1, 36, 48, 48, 49, 51, -1, 42, + 53, -1, 55, -1, -1, 48, -1, -1, 51, 62, + -1, -1, -1, -1, 68, -1, 28, -1, -1, 31, + 73, 74, -1, -1, 36, 68, 69, 80, -1, -1, + 42, -1, 75, -1, -1, -1, 48, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, - 114, -1, -1, 148, 149, -1, 120, 121, -1, -1, - -1, 12, -1, 14, 15, -1, 17, 18, -1, -1, - -1, -1, 23, -1, 25, -1, -1, -1, -1, -1, - 144, 32, 33, 34, 35, 149, 37, 38, 39, 40, - 41, -1, 43, -1, 45, 46, 47, -1, -1, 50, - -1, -1, -1, 54, -1, 56, 57, 58, 59, 60, - 61, -1, 63, 64, 65, 66, 67, -1, -1, 70, - -1, 72, -1, -1, -1, -1, 77, -1, 79, -1, - -1, -1, 83, 84, 85, 86, 87, 88, 89, 90, - 91, -1, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, -1, -1, -1, -1, 108, -1, -1, - 111, -1, 113, 31, -1, 116, 117, 118, 36, -1, - -1, 122, 31, 124, 125, 126, 127, 36, -1, 130, - 48, 31, -1, 51, -1, -1, 36, -1, -1, 48, - -1, -1, 51, -1, -1, -1, -1, -1, 48, -1, - 68, 51, -1, -1, -1, -1, -1, -1, -1, 68, - -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, + -1, 104, 105, 106, 107, -1, 68, 110, -1, -1, + 114, 114, -1, 75, -1, -1, 120, 121, 121, -1, + 123, 114, -1, -1, -1, 128, 129, 120, 121, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 144, -1, -1, -1, 148, 149, -1, -1, -1, -1, + -1, 144, 114, -1, -1, 148, 149, -1, 120, 121, + -1, -1, -1, 12, -1, 14, 15, -1, 17, 18, + -1, -1, -1, -1, 23, -1, 25, -1, -1, -1, + -1, -1, 144, 32, 33, 34, 35, 149, 37, 38, + 39, 40, 41, -1, 43, -1, 45, 46, 47, -1, + -1, 50, -1, -1, -1, 54, -1, 56, 57, 58, + 59, 60, 61, -1, 63, 64, 65, 66, 67, -1, + -1, 70, -1, 72, -1, -1, -1, -1, 77, -1, + 79, -1, -1, -1, 83, 84, 85, 86, 87, 88, + 89, 90, 91, -1, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, -1, -1, -1, -1, 108, + -1, -1, 111, -1, 113, 31, -1, 116, 117, 118, + 36, -1, -1, 122, -1, 124, 125, 126, 127, -1, + -1, 130, 48, -1, -1, 51, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 68, -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, 114, -1, -1, -1, - -1, -1, 120, 121, -1, 114, -1, -1, -1, -1, - -1, 120, 121, -1, 114, -1, -1, -1, -1, -1, - 120, 121, -1, -1, -1, -1, 144, -1, -1, -1, - 148, 149, -1, -1, -1, 144, -1, -1, -1, 148, - 149, -1, -1, -1, 144, -1, -1, -1, 148, 149 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, + -1, -1, -1, -1, 120, 121, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, + -1, -1, 148, 149 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1301,72 +1391,56 @@ static const unsigned char yystos[] = { 0, 154, 155, 0, 28, 31, 36, 42, 48, 51, 68, 75, 114, 120, 121, 144, 149, 158, 159, 160, - 161, 164, 165, 173, 179, 183, 189, 200, 201, 202, - 205, 206, 209, 211, 212, 213, 214, 216, 217, 222, - 224, 225, 3, 4, 4, 19, 21, 27, 31, 44, + 161, 164, 165, 173, 180, 184, 190, 201, 202, 203, + 206, 207, 210, 212, 213, 214, 215, 217, 218, 223, + 225, 226, 3, 4, 4, 19, 21, 27, 31, 44, 48, 49, 53, 55, 62, 73, 74, 80, 104, 105, - 106, 107, 110, 114, 121, 123, 128, 129, 183, 197, - 199, 222, 223, 225, 145, 3, 4, 3, 4, 195, - 31, 7, 3, 4, 195, 172, 173, 195, 12, 14, + 106, 107, 110, 114, 121, 123, 128, 129, 184, 198, + 200, 223, 224, 226, 145, 3, 4, 3, 4, 196, + 31, 7, 3, 4, 196, 172, 173, 196, 12, 14, 15, 17, 18, 23, 25, 32, 33, 34, 35, 37, 38, 39, 40, 41, 43, 45, 46, 47, 50, 54, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 70, 72, 77, 79, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 108, 111, 113, 116, 117, - 118, 122, 124, 125, 126, 127, 130, 174, 175, 221, - 156, 156, 78, 82, 163, 200, 205, 211, 215, 144, - 144, 144, 144, 147, 144, 147, 144, 133, 210, 147, - 144, 144, 144, 223, 3, 73, 198, 198, 145, 198, - 199, 3, 3, 199, 3, 4, 15, 63, 76, 86, - 98, 103, 124, 127, 196, 7, 147, 223, 144, 147, - 223, 115, 147, 145, 145, 145, 145, 145, 145, 145, + 118, 122, 124, 125, 126, 127, 130, 174, 176, 222, + 156, 156, 78, 82, 163, 201, 206, 212, 216, 144, + 144, 144, 144, 147, 144, 147, 144, 133, 211, 147, + 144, 144, 144, 224, 3, 73, 199, 199, 145, 199, + 200, 3, 3, 200, 3, 4, 197, 7, 147, 224, + 144, 147, 224, 115, 147, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 131, 150, 9, - 69, 158, 162, 173, 200, 202, 213, 214, 217, 148, - 3, 3, 4, 147, 203, 92, 207, 3, 4, 147, - 157, 223, 151, 146, 180, 181, 182, 196, 196, 190, - 31, 138, 145, 196, 218, 219, 220, 145, 190, 196, - 3, 5, 6, 52, 109, 119, 136, 138, 140, 145, - 186, 187, 188, 7, 188, 7, 7, 7, 188, 188, - 7, 7, 188, 7, 188, 196, 55, 184, 185, 186, - 221, 188, 184, 186, 223, 223, 8, 5, 226, 223, - 175, 149, 145, 144, 148, 172, 204, 133, 81, 172, - 192, 208, 147, 157, 148, 158, 172, 193, 146, 188, - 148, 131, 151, 144, 148, 172, 173, 191, 192, 218, - 219, 219, 131, 192, 148, 146, 145, 186, 186, 186, - 186, 223, 10, 11, 132, 134, 135, 136, 137, 138, - 139, 131, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 3, 131, 146, 146, - 131, 146, 146, 146, 146, 146, 152, 146, 146, 175, - 7, 214, 133, 223, 144, 148, 193, 161, 148, 223, - 144, 182, 188, 225, 144, 144, 146, 219, 146, 223, - 146, 146, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 188, 146, 185, 188, 5, 146, 219, 144, 157, - 112, 176, 144, 194, 196, 146, 186, 133, 146, 149, - 170, 148, 219, 147, 186, 138, 171, 185, 145, 177, - 150, 131, 150, 128, 166, 167, 168, 169, 173, 223, - 25, 37, 148, 178, 186, 149, 146, 131, 223, 219, - 186, 133, 186, 169, 219, 145, 170, 133, 191, 145, - 170, 166, 191, 166, 146, 146 + 145, 145, 145, 145, 145, 145, 145, 145, 145, 131, + 150, 9, 69, 158, 162, 173, 201, 203, 214, 215, + 218, 148, 3, 3, 4, 147, 204, 92, 208, 212, + 3, 4, 147, 157, 224, 151, 146, 181, 182, 183, + 197, 197, 191, 31, 138, 145, 197, 219, 220, 221, + 145, 191, 197, 3, 5, 6, 52, 109, 119, 136, + 138, 140, 145, 187, 188, 189, 7, 189, 7, 7, + 175, 7, 189, 189, 7, 7, 189, 7, 189, 197, + 55, 185, 186, 187, 222, 189, 185, 187, 224, 224, + 8, 5, 227, 224, 176, 149, 145, 144, 148, 172, + 205, 133, 81, 172, 193, 209, 144, 147, 157, 148, + 158, 172, 194, 146, 189, 148, 131, 151, 144, 148, + 172, 173, 192, 193, 219, 220, 220, 131, 193, 148, + 146, 145, 187, 187, 187, 187, 224, 10, 11, 132, + 134, 135, 136, 137, 138, 139, 131, 146, 146, 146, + 146, 131, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 3, 131, 146, 146, 131, 146, 146, 146, + 146, 146, 152, 146, 146, 176, 7, 215, 133, 224, + 144, 148, 194, 148, 161, 148, 224, 144, 183, 189, + 226, 144, 144, 146, 220, 146, 224, 146, 146, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 189, 7, + 146, 186, 189, 5, 146, 220, 144, 157, 112, 177, + 144, 195, 197, 146, 187, 133, 146, 149, 170, 148, + 220, 147, 187, 138, 171, 186, 145, 178, 150, 131, + 150, 128, 166, 167, 168, 169, 173, 224, 25, 37, + 148, 179, 187, 149, 146, 131, 224, 220, 187, 133, + 187, 169, 220, 145, 170, 133, 192, 145, 170, 166, + 192, 166, 146, 146 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -1374,7 +1448,8 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto yyerrorlab + /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. @@ -1395,26 +1470,59 @@ do \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -1437,36 +1545,30 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ + yysymprint (stderr, \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | +| TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -1496,13 +1598,13 @@ yy_reduce_print (yyrule) #endif { int yyi; - unsigned int yylineno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylineno); + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ @@ -1516,8 +1618,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1532,13 +1633,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -1560,7 +1657,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -1585,8 +1682,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -1596,7 +1693,55 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ @@ -1620,15 +1765,15 @@ yysymprint (yyoutput, yytype, yyvaluep) (void) yyvaluep; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -1644,10 +1789,11 @@ yysymprint (yyoutput, yytype, yyvaluep) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif @@ -1655,6 +1801,10 @@ yydestruct (yytype, yyvaluep) /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -1682,10 +1832,10 @@ int yyparse (); -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1711,17 +1861,17 @@ yyparse (void) #else int yyparse () - + ; #endif #endif { - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -1733,14 +1883,14 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; @@ -1797,14 +1947,14 @@ yyparse () these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), @@ -1815,21 +1965,21 @@ yyparse () } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -1861,18 +2011,18 @@ yyparse () yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1887,7 +2037,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1907,8 +2057,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1958,1421 +2108,1456 @@ yyreduce: switch (yyn) { case 2: -#line 239 "parser.y" - { write_proxies(yyvsp[0].ifref); write_client(yyvsp[0].ifref); write_server(yyvsp[0].ifref); ;} +#line 265 "tools\\widl_new\\parser.y" + { write_proxies((yyvsp[0].ifref_list)); write_client((yyvsp[0].ifref_list)); write_server((yyvsp[0].ifref_list)); ;} break; case 3: -#line 242 "parser.y" - { yyval.ifref = NULL; ;} +#line 268 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = NULL; ;} break; case 4: -#line 243 "parser.y" - { yyval.ifref = yyvsp[-1].ifref; ;} +#line 269 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;} break; case 5: -#line 244 "parser.y" - { yyval.ifref = make_ifref(yyvsp[0].type); LINK(yyval.ifref, yyvsp[-1].ifref); ;} +#line 270 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), make_ifref((yyvsp[0].type)) ); ;} break; case 6: -#line 245 "parser.y" - { yyval.ifref = yyvsp[-2].ifref; - reg_type(yyvsp[-1].type, yyvsp[-1].type->name, 0); - if (!parse_only && do_header) write_coclass_forward(yyvsp[-1].type); +#line 271 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-2].ifref_list); + reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0); + if (!parse_only && do_header) write_coclass_forward((yyvsp[-1].type)); ;} break; case 7: -#line 249 "parser.y" - { yyval.ifref = yyvsp[-1].ifref; - add_coclass(yyvsp[0].type); - reg_type(yyvsp[0].type, yyvsp[0].type->name, 0); +#line 275 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-1].ifref_list); + add_typelib_entry((yyvsp[0].type)); + reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0); + if (!parse_only && do_header) write_coclass_forward((yyvsp[0].type)); ;} break; case 8: -#line 253 "parser.y" - { yyval.ifref = yyvsp[-1].ifref; add_module(yyvsp[0].type); ;} +#line 280 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-1].ifref_list); add_typelib_entry((yyvsp[0].type)); ;} break; case 9: -#line 254 "parser.y" - { yyval.ifref = yyvsp[-1].ifref; ;} +#line 281 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;} break; case 10: -#line 255 "parser.y" - { yyval.ifref = yyvsp[-1].ifref; ;} +#line 282 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;} break; case 11: -#line 258 "parser.y" +#line 285 "tools\\widl_new\\parser.y" {;} break; case 12: -#line 259 "parser.y" - { if (!parse_only) add_interface(yyvsp[0].type); ;} +#line 286 "tools\\widl_new\\parser.y" + { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;} break; case 13: -#line 260 "parser.y" - { if (!parse_only) add_interface(yyvsp[0].type); ;} +#line 287 "tools\\widl_new\\parser.y" + { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;} break; case 14: -#line 261 "parser.y" - { reg_type(yyvsp[-1].type, yyvsp[-1].type->name, 0); if (!parse_only && do_header) write_coclass_forward(yyvsp[-1].type); ;} +#line 288 "tools\\widl_new\\parser.y" + { reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0); if (!parse_only && do_header) write_coclass_forward((yyvsp[-1].type)); ;} break; case 15: -#line 262 "parser.y" - { if (!parse_only) add_coclass(yyvsp[0].type); - reg_type(yyvsp[0].type, yyvsp[0].type->name, 0); +#line 289 "tools\\widl_new\\parser.y" + { if (!parse_only) add_typelib_entry((yyvsp[0].type)); + reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0); + if (!parse_only && do_header) write_coclass_forward((yyvsp[0].type)); ;} break; case 16: -#line 265 "parser.y" - { if (!parse_only) add_module(yyvsp[0].type); ;} +#line 293 "tools\\widl_new\\parser.y" + { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;} break; case 17: -#line 266 "parser.y" +#line 294 "tools\\widl_new\\parser.y" {;} break; case 18: -#line 267 "parser.y" +#line 295 "tools\\widl_new\\parser.y" {;} break; case 19: -#line 270 "parser.y" - { yyval.func = NULL; ;} +#line 298 "tools\\widl_new\\parser.y" + { (yyval.func_list) = NULL; ;} break; case 20: -#line 271 "parser.y" - { yyval.func = yyvsp[-1].func; LINK(yyval.func, yyvsp[-2].func); ;} +#line 299 "tools\\widl_new\\parser.y" + { (yyval.func_list) = append_func( (yyvsp[-2].func_list), (yyvsp[-1].func) ); ;} break; case 21: -#line 272 "parser.y" - { yyval.func = yyvsp[-1].func; ;} +#line 300 "tools\\widl_new\\parser.y" + { (yyval.func_list) = (yyvsp[-1].func_list); ;} break; case 22: -#line 275 "parser.y" +#line 303 "tools\\widl_new\\parser.y" {;} break; case 23: -#line 276 "parser.y" - { if (!parse_only && do_header) { write_constdef(yyvsp[-1].var); } ;} +#line 304 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) { write_constdef((yyvsp[-1].var)); } ;} break; case 24: -#line 277 "parser.y" +#line 305 "tools\\widl_new\\parser.y" {;} break; case 25: -#line 278 "parser.y" - { if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ;} +#line 306 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) { write_type(header, (yyvsp[-1].type)); fprintf(header, ";\n\n"); } ;} break; case 26: -#line 279 "parser.y" - { if (!parse_only && do_header) { write_externdef(yyvsp[-1].var); } ;} +#line 307 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) { write_externdef((yyvsp[-1].var)); } ;} break; case 27: -#line 280 "parser.y" +#line 308 "tools\\widl_new\\parser.y" {;} break; case 28: -#line 281 "parser.y" - { if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ;} +#line 309 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) { write_type(header, (yyvsp[-1].type)); fprintf(header, ";\n\n"); } ;} break; case 29: -#line 282 "parser.y" +#line 310 "tools\\widl_new\\parser.y" {;} break; case 30: -#line 283 "parser.y" - { if (!parse_only && do_header) { write_type(header, yyvsp[-1].type, NULL, NULL); fprintf(header, ";\n\n"); } ;} +#line 311 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) { write_type(header, (yyvsp[-1].type)); fprintf(header, ";\n\n"); } ;} break; case 31: -#line 286 "parser.y" - { if (!parse_only && do_header) fprintf(header, "%s\n", yyvsp[-1].str); ;} +#line 314 "tools\\widl_new\\parser.y" + { if (!parse_only && do_header) fprintf(header, "%s\n", (yyvsp[-1].str)); ;} break; case 32: -#line 288 "parser.y" +#line 316 "tools\\widl_new\\parser.y" { assert(yychar == YYEMPTY); - if (!do_import(yyvsp[-1].str)) yychar = aEOF; ;} + if (!do_import((yyvsp[-1].str))) yychar = aEOF; ;} break; case 33: -#line 291 "parser.y" +#line 319 "tools\\widl_new\\parser.y" {;} break; case 34: -#line 294 "parser.y" - { if(!parse_only) add_importlib(yyvsp[-1].str); ;} +#line 322 "tools\\widl_new\\parser.y" + { if(!parse_only) add_importlib((yyvsp[-1].str)); ;} break; case 35: -#line 297 "parser.y" - { yyval.str = yyvsp[0].str; ;} +#line 325 "tools\\widl_new\\parser.y" + { (yyval.str) = (yyvsp[0].str); ;} break; case 36: -#line 299 "parser.y" - { start_typelib(yyvsp[-1].str, yyvsp[-2].attr); - if (!parse_only && do_header) write_library(yyvsp[-1].str, yyvsp[-2].attr); ;} +#line 327 "tools\\widl_new\\parser.y" + { start_typelib((yyvsp[-1].str), (yyvsp[-2].attr_list)); + if (!parse_only && do_header) write_library((yyvsp[-1].str), (yyvsp[-2].attr_list)); + if (!parse_only && do_idfile) write_libid((yyvsp[-1].str), (yyvsp[-2].attr_list)); + ;} break; case 37: -#line 302 "parser.y" +#line 332 "tools\\widl_new\\parser.y" { end_typelib(); ;} break; case 38: -#line 305 "parser.y" - { yyval.var = NULL; ;} +#line 335 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} break; case 40: -#line 309 "parser.y" - { yyval.var = NULL; ;} +#line 339 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} + break; + + case 41: +#line 342 "tools\\widl_new\\parser.y" + { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); ;} break; case 42: -#line 313 "parser.y" - { LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; ;} +#line 343 "tools\\widl_new\\parser.y" + { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var)); ;} break; case 44: -#line 318 "parser.y" - { yyval.var = yyvsp[-1].var; - set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); - yyval.var->attrs = yyvsp[-3].attr; +#line 348 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-1].pident)->var; + set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims)); + free((yyvsp[-1].pident)); + (yyval.var)->attrs = (yyvsp[-3].attr_list); ;} break; case 45: -#line 322 "parser.y" - { yyval.var = yyvsp[-1].var; - set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); +#line 353 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-1].pident)->var; + set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims)); + free((yyvsp[-1].pident)); ;} break; case 46: -#line 325 "parser.y" - { yyval.var = yyvsp[-3].var; - yyval.var->ptr_level--; - set_type(yyval.var, yyvsp[-4].tref, NULL); - yyval.var->attrs = yyvsp[-5].attr; - yyval.var->args = yyvsp[-1].var; +#line 357 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-3].pident)->var; + set_type((yyval.var), (yyvsp[-4].type), (yyvsp[-3].pident)->ptr_level - 1, NULL); + free((yyvsp[-3].pident)); + (yyval.var)->attrs = (yyvsp[-5].attr_list); + (yyval.var)->args = (yyvsp[-1].var_list); ;} break; case 47: -#line 331 "parser.y" - { yyval.var = yyvsp[-3].var; - yyval.var->ptr_level--; - set_type(yyval.var, yyvsp[-4].tref, NULL); - yyval.var->args = yyvsp[-1].var; +#line 363 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-3].pident)->var; + set_type((yyval.var), (yyvsp[-4].type), (yyvsp[-3].pident)->ptr_level - 1, NULL); + free((yyvsp[-3].pident)); + (yyval.var)->args = (yyvsp[-1].var_list); ;} break; case 48: -#line 338 "parser.y" - { yyval.expr = NULL; ;} +#line 370 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = NULL; ;} break; case 49: -#line 339 "parser.y" - { yyval.expr = yyvsp[-1].expr; ;} +#line 371 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = (yyvsp[-1].array_dims); ;} break; case 50: -#line 340 "parser.y" - { yyval.expr = make_expr(EXPR_VOID); ;} +#line 372 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = append_array( NULL, make_expr(EXPR_VOID) ); ;} + break; + + case 51: +#line 375 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = append_array( NULL, (yyvsp[0].expr) ); ;} break; case 52: -#line 344 "parser.y" - { LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ;} +#line 376 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = append_array( (yyvsp[-2].array_dims), (yyvsp[0].expr) ); ;} break; case 53: -#line 345 "parser.y" - { LINK(yyvsp[0].expr, yyvsp[-3].expr); yyval.expr = yyvsp[0].expr; ;} +#line 377 "tools\\widl_new\\parser.y" + { (yyval.array_dims) = append_array( (yyvsp[-3].array_dims), (yyvsp[0].expr) ); ;} break; case 54: -#line 348 "parser.y" - { yyval.attr = NULL; ;} +#line 380 "tools\\widl_new\\parser.y" + { (yyval.attr_list) = NULL; ;} break; case 56: -#line 353 "parser.y" - { yyval.attr = yyvsp[-1].attr; - if (!yyval.attr) +#line 385 "tools\\widl_new\\parser.y" + { (yyval.attr_list) = (yyvsp[-1].attr_list); + if (!(yyval.attr_list)) yyerror("empty attribute lists unsupported"); ;} break; + case 57: +#line 391 "tools\\widl_new\\parser.y" + { (yyval.attr_list) = append_attr( NULL, (yyvsp[0].attr) ); ;} + break; + case 58: -#line 360 "parser.y" - { if (yyvsp[0].attr) { LINK(yyvsp[0].attr, yyvsp[-2].attr); yyval.attr = yyvsp[0].attr; } - else { yyval.attr = yyvsp[-2].attr; } - ;} +#line 392 "tools\\widl_new\\parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[-2].attr_list), (yyvsp[0].attr) ); ;} break; case 59: -#line 363 "parser.y" - { if (yyvsp[0].attr) { LINK(yyvsp[0].attr, yyvsp[-3].attr); yyval.attr = yyvsp[0].attr; } - else { yyval.attr = yyvsp[-3].attr; } - ;} +#line 393 "tools\\widl_new\\parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[-3].attr_list), (yyvsp[0].attr) ); ;} break; case 60: -#line 368 "parser.y" - { yyval.attr = NULL; ;} +#line 396 "tools\\widl_new\\parser.y" + { (yyval.str_list) = append_str( NULL, (yyvsp[0].str) ); ;} break; case 61: -#line 369 "parser.y" - { yyval.attr = make_attr(ATTR_AGGREGATABLE); ;} +#line 397 "tools\\widl_new\\parser.y" + { (yyval.str_list) = append_str( (yyvsp[-2].str_list), (yyvsp[0].str) ); ;} break; case 62: -#line 370 "parser.y" - { yyval.attr = make_attr(ATTR_APPOBJECT); ;} +#line 400 "tools\\widl_new\\parser.y" + { (yyval.attr) = NULL; ;} break; case 63: -#line 371 "parser.y" - { yyval.attr = make_attr(ATTR_ASYNC); ;} +#line 401 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;} break; case 64: -#line 372 "parser.y" - { yyval.attr = make_attr(ATTR_AUTO_HANDLE); ;} +#line 402 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;} break; case 65: -#line 373 "parser.y" - { yyval.attr = make_attr(ATTR_BINDABLE); ;} +#line 403 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_ASYNC); ;} break; case 66: -#line 374 "parser.y" - { yyval.attr = make_attrp(ATTR_CALLAS, yyvsp[-1].var); ;} +#line 404 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;} break; case 67: -#line 375 "parser.y" - { yyval.attr = make_attrp(ATTR_CASE, yyvsp[-1].expr); ;} +#line 405 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_BINDABLE); ;} break; case 68: -#line 376 "parser.y" - { yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); ;} +#line 406 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[-1].var)); ;} break; case 69: -#line 377 "parser.y" - { yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;} +#line 407 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[-1].expr_list)); ;} break; case 70: -#line 378 "parser.y" - { yyval.attr = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;} +#line 408 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;} break; case 71: -#line 379 "parser.y" - { yyval.attr = make_attr(ATTR_CONTROL); ;} +#line 409 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;} break; case 72: -#line 380 "parser.y" - { yyval.attr = make_attr(ATTR_DEFAULT); ;} +#line 410 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;} break; case 73: -#line 381 "parser.y" - { yyval.attr = make_attr(ATTR_DEFAULTCOLLELEM); ;} +#line 411 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_CONTROL); ;} break; case 74: -#line 382 "parser.y" - { yyval.attr = make_attrp(ATTR_DEFAULTVALUE_EXPR, yyvsp[-1].expr); ;} +#line 412 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULT); ;} break; case 75: -#line 383 "parser.y" - { yyval.attr = make_attrp(ATTR_DEFAULTVALUE_STRING, yyvsp[-1].str); ;} +#line 413 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;} break; case 76: -#line 384 "parser.y" - { yyval.attr = make_attr(ATTR_DEFAULTVTABLE); ;} +#line 414 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE_EXPR, (yyvsp[-1].expr)); ;} break; case 77: -#line 385 "parser.y" - { yyval.attr = make_attr(ATTR_DISPLAYBIND); ;} +#line 415 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE_STRING, (yyvsp[-1].str)); ;} break; case 78: -#line 386 "parser.y" - { yyval.attr = make_attrp(ATTR_DLLNAME, yyvsp[-1].str); ;} +#line 416 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;} break; case 79: -#line 387 "parser.y" - { yyval.attr = make_attr(ATTR_DUAL); ;} +#line 417 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;} break; case 80: -#line 388 "parser.y" - { yyval.attr = make_attrp(ATTR_ENDPOINT, yyvsp[-1].str); ;} +#line 418 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[-1].str)); ;} break; case 81: -#line 389 "parser.y" - { yyval.attr = make_attrp(ATTR_ENTRY_STRING, yyvsp[-1].str); ;} +#line 419 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_DUAL); ;} break; case 82: -#line 390 "parser.y" - { yyval.attr = make_attrp(ATTR_ENTRY_ORDINAL, yyvsp[-1].expr); ;} +#line 420 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[-1].str_list)); ;} break; case 83: -#line 391 "parser.y" - { yyval.attr = make_attr(ATTR_EXPLICIT_HANDLE); ;} +#line 421 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_ENTRY_STRING, (yyvsp[-1].str)); ;} break; case 84: -#line 392 "parser.y" - { yyval.attr = make_attr(ATTR_HANDLE); ;} +#line 422 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_ENTRY_ORDINAL, (yyvsp[-1].expr)); ;} break; case 85: -#line 393 "parser.y" - { yyval.attr = make_attrp(ATTR_HELPCONTEXT, yyvsp[-1].expr); ;} +#line 423 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;} break; case 86: -#line 394 "parser.y" - { yyval.attr = make_attrp(ATTR_HELPFILE, yyvsp[-1].str); ;} +#line 424 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_HANDLE); ;} break; case 87: -#line 395 "parser.y" - { yyval.attr = make_attrp(ATTR_HELPSTRING, yyvsp[-1].str); ;} +#line 425 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[-1].expr)); ;} break; case 88: -#line 396 "parser.y" - { yyval.attr = make_attrp(ATTR_HELPSTRINGCONTEXT, yyvsp[-1].expr); ;} +#line 426 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[-1].str)); ;} break; case 89: -#line 397 "parser.y" - { yyval.attr = make_attrp(ATTR_HELPSTRINGDLL, yyvsp[-1].str); ;} +#line 427 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[-1].str)); ;} break; case 90: -#line 398 "parser.y" - { yyval.attr = make_attr(ATTR_HIDDEN); ;} +#line 428 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[-1].expr)); ;} break; case 91: -#line 399 "parser.y" - { yyval.attr = make_attrp(ATTR_ID, yyvsp[-1].expr); ;} +#line 429 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[-1].str)); ;} break; case 92: -#line 400 "parser.y" - { yyval.attr = make_attr(ATTR_IDEMPOTENT); ;} +#line 430 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_HIDDEN); ;} break; case 93: -#line 401 "parser.y" - { yyval.attr = make_attrp(ATTR_IIDIS, yyvsp[-1].var); ;} +#line 431 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[-1].expr)); ;} break; case 94: -#line 402 "parser.y" - { yyval.attr = make_attr(ATTR_IMMEDIATEBIND); ;} +#line 432 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;} break; case 95: -#line 403 "parser.y" - { yyval.attr = make_attrp(ATTR_IMPLICIT_HANDLE, yyvsp[-1].str); ;} +#line 433 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[-1].var)); ;} break; case 96: -#line 404 "parser.y" - { yyval.attr = make_attr(ATTR_IN); ;} +#line 434 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;} break; case 97: -#line 405 "parser.y" - { yyval.attr = make_attr(ATTR_INPUTSYNC); ;} +#line 435 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[-1].str)); ;} break; case 98: -#line 406 "parser.y" - { yyval.attr = make_attrp(ATTR_LENGTHIS, yyvsp[-1].expr); ;} +#line 436 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_IN); ;} break; case 99: -#line 407 "parser.y" - { yyval.attr = make_attr(ATTR_LOCAL); ;} +#line 437 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;} break; case 100: -#line 408 "parser.y" - { yyval.attr = make_attr(ATTR_NONBROWSABLE); ;} +#line 438 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[-1].expr_list)); ;} break; case 101: -#line 409 "parser.y" - { yyval.attr = make_attr(ATTR_NONCREATABLE); ;} +#line 439 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_LOCAL); ;} break; case 102: -#line 410 "parser.y" - { yyval.attr = make_attr(ATTR_NONEXTENSIBLE); ;} +#line 440 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;} break; case 103: -#line 411 "parser.y" - { yyval.attr = make_attr(ATTR_OBJECT); ;} +#line 441 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;} break; case 104: -#line 412 "parser.y" - { yyval.attr = make_attr(ATTR_ODL); ;} +#line 442 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;} break; case 105: -#line 413 "parser.y" - { yyval.attr = make_attr(ATTR_OLEAUTOMATION); ;} +#line 443 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_OBJECT); ;} break; case 106: -#line 414 "parser.y" - { yyval.attr = make_attr(ATTR_OPTIONAL); ;} +#line 444 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_ODL); ;} break; case 107: -#line 415 "parser.y" - { yyval.attr = make_attr(ATTR_OUT); ;} +#line 445 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;} break; case 108: -#line 416 "parser.y" - { yyval.attr = make_attrv(ATTR_POINTERDEFAULT, yyvsp[-1].num); ;} +#line 446 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;} break; case 109: -#line 417 "parser.y" - { yyval.attr = make_attr(ATTR_PROPGET); ;} +#line 447 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_OUT); ;} break; case 110: -#line 418 "parser.y" - { yyval.attr = make_attr(ATTR_PROPPUT); ;} +#line 448 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[-1].num)); ;} break; case 111: -#line 419 "parser.y" - { yyval.attr = make_attr(ATTR_PROPPUTREF); ;} +#line 449 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_PROPGET); ;} break; case 112: -#line 420 "parser.y" - { yyval.attr = make_attr(ATTR_PUBLIC); ;} +#line 450 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_PROPPUT); ;} break; case 113: -#line 421 "parser.y" - { LINK(yyvsp[-1].expr, yyvsp[-3].expr); yyval.attr = make_attrp(ATTR_RANGE, yyvsp[-1].expr); ;} +#line 451 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;} break; case 114: -#line 422 "parser.y" - { yyval.attr = make_attr(ATTR_READONLY); ;} +#line 452 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_PUBLIC); ;} break; case 115: -#line 423 "parser.y" - { yyval.attr = make_attr(ATTR_REQUESTEDIT); ;} +#line 453 "tools\\widl_new\\parser.y" + { expr_list_t *list = append_expr( NULL, (yyvsp[-3].expr) ); + list = append_expr( list, (yyvsp[-1].expr) ); + (yyval.attr) = make_attrp(ATTR_RANGE, list); ;} break; case 116: -#line 424 "parser.y" - { yyval.attr = make_attr(ATTR_RESTRICTED); ;} +#line 456 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_READONLY); ;} break; case 117: -#line 425 "parser.y" - { yyval.attr = make_attr(ATTR_RETVAL); ;} +#line 457 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;} break; case 118: -#line 426 "parser.y" - { yyval.attr = make_attrp(ATTR_SIZEIS, yyvsp[-1].expr); ;} +#line 458 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;} break; case 119: -#line 427 "parser.y" - { yyval.attr = make_attr(ATTR_SOURCE); ;} +#line 459 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_RETVAL); ;} break; case 120: -#line 428 "parser.y" - { yyval.attr = make_attr(ATTR_STRING); ;} +#line 460 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[-1].expr_list)); ;} break; case 121: -#line 429 "parser.y" - { yyval.attr = make_attrp(ATTR_SWITCHIS, yyvsp[-1].expr); ;} +#line 461 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_SOURCE); ;} break; case 122: -#line 430 "parser.y" - { yyval.attr = make_attrp(ATTR_SWITCHTYPE, type_ref(yyvsp[-1].tref)); ;} +#line 462 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_STRING); ;} break; case 123: -#line 431 "parser.y" - { yyval.attr = make_attrp(ATTR_TRANSMITAS, type_ref(yyvsp[-1].tref)); ;} +#line 463 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[-1].expr)); ;} break; case 124: -#line 432 "parser.y" - { yyval.attr = make_attrp(ATTR_UUID, yyvsp[-1].uuid); ;} +#line 464 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[-1].type)); ;} break; case 125: -#line 433 "parser.y" - { yyval.attr = make_attr(ATTR_V1ENUM); ;} +#line 465 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[-1].type)); ;} break; case 126: -#line 434 "parser.y" - { yyval.attr = make_attr(ATTR_VARARG); ;} +#line 466 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[-1].uuid)); ;} break; case 127: -#line 435 "parser.y" - { yyval.attr = make_attrv(ATTR_VERSION, yyvsp[-1].num); ;} +#line 467 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_V1ENUM); ;} break; case 128: -#line 436 "parser.y" - { yyval.attr = make_attrp(ATTR_WIREMARSHAL, type_ref(yyvsp[-1].tref)); ;} +#line 468 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attr(ATTR_VARARG); ;} break; case 129: -#line 437 "parser.y" - { yyval.attr = make_attrv(ATTR_POINTERTYPE, yyvsp[0].num); ;} +#line 469 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[-1].num)); ;} break; - case 132: -#line 444 "parser.y" - { yyval.var = NULL; ;} + case 130: +#line 470 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[-1].type)); ;} break; - case 133: -#line 445 "parser.y" - { if (yyvsp[0].var) { LINK(yyvsp[0].var, yyvsp[-1].var); yyval.var = yyvsp[0].var; } - else { yyval.var = yyvsp[-1].var; } - ;} + case 131: +#line 471 "tools\\widl_new\\parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[0].num)); ;} break; case 134: -#line 450 "parser.y" - { attr_t *a = make_attrp(ATTR_CASE, yyvsp[-2].expr); - yyval.var = yyvsp[0].var; if (!yyval.var) yyval.var = make_var(NULL); - LINK(a, yyval.var->attrs); yyval.var->attrs = a; - ;} +#line 478 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} break; case 135: -#line 454 "parser.y" - { attr_t *a = make_attr(ATTR_DEFAULT); - yyval.var = yyvsp[0].var; if (!yyval.var) yyval.var = make_var(NULL); - LINK(a, yyval.var->attrs); yyval.var->attrs = a; - ;} +#line 479 "tools\\widl_new\\parser.y" + { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;} break; case 136: -#line 460 "parser.y" - { yyval.var = reg_const(yyvsp[-2].var); - set_type(yyval.var, yyvsp[-3].tref, NULL); - yyval.var->eval = yyvsp[0].expr; +#line 482 "tools\\widl_new\\parser.y" + { attr_t *a = make_attrp(ATTR_CASE, (yyvsp[-2].expr)); + (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); + (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); ;} break; case 137: -#line 466 "parser.y" - { yyval.var = NULL; ;} +#line 486 "tools\\widl_new\\parser.y" + { attr_t *a = make_attr(ATTR_DEFAULT); + (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); + (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); + ;} break; case 138: -#line 467 "parser.y" - { yyval.var = yyvsp[-1].var; ;} +#line 492 "tools\\widl_new\\parser.y" + { (yyval.var) = reg_const((yyvsp[-2].var)); + set_type((yyval.var), (yyvsp[-3].type), 0, NULL); + (yyval.var)->eval = (yyvsp[0].expr); + ;} + break; + + case 139: +#line 498 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} break; case 140: -#line 471 "parser.y" - { if (!yyval.var->eval) - yyval.var->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); - ;} - break; - - case 141: -#line 474 "parser.y" - { LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; - if (!yyval.var->eval) - yyval.var->eval = make_exprl(EXPR_NUM, yyvsp[-2].var->eval->cval + 1); - ;} +#line 499 "tools\\widl_new\\parser.y" + { (yyval.var_list) = (yyvsp[-1].var_list); ;} break; case 142: -#line 480 "parser.y" - { yyval.var = reg_const(yyvsp[-2].var); - yyval.var->eval = yyvsp[0].expr; - yyval.var->type = make_type(RPC_FC_LONG, &std_int); +#line 503 "tools\\widl_new\\parser.y" + { if (!(yyvsp[0].var)->eval) + (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); + (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); ;} break; case 143: -#line 484 "parser.y" - { yyval.var = reg_const(yyvsp[0].var); - yyval.var->type = make_type(RPC_FC_LONG, &std_int); +#line 507 "tools\\widl_new\\parser.y" + { if (!(yyvsp[0].var)->eval) + { + var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry ); + (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, last->eval->cval + 1); + } + (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var) ); ;} break; case 144: -#line 489 "parser.y" - { yyval.type = get_typev(RPC_FC_ENUM16, yyvsp[-3].var, tsENUM); - yyval.type->fields = yyvsp[-1].var; - yyval.type->defined = TRUE; - if(in_typelib) - add_enum(yyval.type); +#line 516 "tools\\widl_new\\parser.y" + { (yyval.var) = reg_const((yyvsp[-2].var)); + (yyval.var)->eval = (yyvsp[0].expr); + (yyval.var)->type = make_int(0); + ;} + break; + + case 145: +#line 520 "tools\\widl_new\\parser.y" + { (yyval.var) = reg_const((yyvsp[0].var)); + (yyval.var)->type = make_int(0); ;} break; case 146: -#line 498 "parser.y" - { LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ;} +#line 525 "tools\\widl_new\\parser.y" + { (yyval.type) = get_typev(RPC_FC_ENUM16, (yyvsp[-3].var), tsENUM); + (yyval.type)->kind = TKIND_ENUM; + (yyval.type)->fields = (yyvsp[-1].var_list); + (yyval.type)->defined = TRUE; + if(in_typelib) + add_typelib_entry((yyval.type)); + ;} break; case 147: -#line 511 "parser.y" - { yyval.expr = make_expr(EXPR_VOID); ;} +#line 534 "tools\\widl_new\\parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;} + break; + + case 148: +#line 535 "tools\\widl_new\\parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;} break; case 149: -#line 515 "parser.y" - { yyval.expr = make_exprl(EXPR_NUM, yyvsp[0].num); ;} - break; - - case 150: -#line 516 "parser.y" - { yyval.expr = make_exprl(EXPR_HEXNUM, yyvsp[0].num); ;} +#line 548 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 151: -#line 517 "parser.y" - { yyval.expr = make_exprl(EXPR_TRUEFALSE, 0); ;} +#line 552 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[0].num)); ;} break; case 152: -#line 518 "parser.y" - { yyval.expr = make_exprl(EXPR_TRUEFALSE, 1); ;} +#line 553 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[0].num)); ;} break; case 153: -#line 519 "parser.y" - { yyval.expr = make_exprs(EXPR_IDENTIFIER, yyvsp[0].str); ;} +#line 554 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;} break; case 154: -#line 520 "parser.y" - { yyval.expr = make_expr3(EXPR_COND, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 555 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;} break; case 155: -#line 521 "parser.y" - { yyval.expr = make_expr2(EXPR_OR , yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 556 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str)); ;} break; case 156: -#line 522 "parser.y" - { yyval.expr = make_expr2(EXPR_AND, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 557 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 157: -#line 523 "parser.y" - { yyval.expr = make_expr2(EXPR_ADD, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 558 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 158: -#line 524 "parser.y" - { yyval.expr = make_expr2(EXPR_SUB, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 559 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 159: -#line 525 "parser.y" - { yyval.expr = make_expr2(EXPR_MUL, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 560 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 160: -#line 526 "parser.y" - { yyval.expr = make_expr2(EXPR_DIV, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 561 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 161: -#line 527 "parser.y" - { yyval.expr = make_expr2(EXPR_SHL, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 562 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 162: -#line 528 "parser.y" - { yyval.expr = make_expr2(EXPR_SHR, yyvsp[-2].expr, yyvsp[0].expr); ;} +#line 563 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 163: -#line 529 "parser.y" - { yyval.expr = make_expr1(EXPR_NOT, yyvsp[0].expr); ;} +#line 564 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 164: -#line 530 "parser.y" - { yyval.expr = make_expr1(EXPR_NEG, yyvsp[0].expr); ;} +#line 565 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 165: -#line 531 "parser.y" - { yyval.expr = make_expr1(EXPR_PPTR, yyvsp[0].expr); ;} +#line 566 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[0].expr)); ;} break; case 166: -#line 532 "parser.y" - { yyval.expr = make_exprt(EXPR_CAST, yyvsp[-2].tref, yyvsp[0].expr); ;} +#line 567 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[0].expr)); ;} break; case 167: -#line 533 "parser.y" - { yyval.expr = make_exprt(EXPR_SIZEOF, yyvsp[-1].tref, NULL); ;} +#line 568 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[0].expr)); ;} break; case 168: -#line 534 "parser.y" - { yyval.expr = yyvsp[-1].expr; ;} +#line 569 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprt(EXPR_CAST, (yyvsp[-2].type), (yyvsp[0].expr)); ;} + break; + + case 169: +#line 570 "tools\\widl_new\\parser.y" + { (yyval.expr) = make_exprt(EXPR_SIZEOF, (yyvsp[-1].type), NULL); ;} break; case 170: -#line 538 "parser.y" - { LINK(yyvsp[0].expr, yyvsp[-2].expr); yyval.expr = yyvsp[0].expr; ;} +#line 571 "tools\\widl_new\\parser.y" + { (yyval.expr) = (yyvsp[-1].expr); ;} break; case 171: -#line 541 "parser.y" - { yyval.expr = yyvsp[0].expr; - if (!yyval.expr->is_const) +#line 574 "tools\\widl_new\\parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;} + break; + + case 172: +#line 575 "tools\\widl_new\\parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;} + break; + + case 173: +#line 578 "tools\\widl_new\\parser.y" + { (yyval.expr) = (yyvsp[0].expr); + if (!(yyval.expr)->is_const) yyerror("expression is not constant"); ;} break; - case 172: -#line 547 "parser.y" - { yyval.var = yyvsp[0].var; - set_type(yyval.var, yyvsp[-1].tref, NULL); - ;} - break; - - case 173: -#line 552 "parser.y" - { yyval.var = NULL; ;} - break; - case 174: -#line 553 "parser.y" - { if (yyvsp[0].var) { LINK(yyvsp[0].var, yyvsp[-1].var); yyval.var = yyvsp[0].var; } - else { yyval.var = yyvsp[-1].var; } +#line 584 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[0].var); + set_type((yyval.var), (yyvsp[-1].type), 0, NULL); ;} break; case 175: -#line 558 "parser.y" - { yyval.var = yyvsp[-1].var; ;} +#line 589 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} break; case 176: -#line 559 "parser.y" - { yyval.var = make_var(NULL); yyval.var->type = yyvsp[-1].type; yyval.var->attrs = yyvsp[-2].attr; ;} +#line 590 "tools\\widl_new\\parser.y" + { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;} break; case 177: -#line 560 "parser.y" - { yyval.var = make_var(NULL); yyval.var->attrs = yyvsp[-1].attr; ;} +#line 593 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-1].var); ;} break; case 178: -#line 561 "parser.y" - { yyval.var = NULL; ;} +#line 594 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var(NULL); (yyval.var)->type = (yyvsp[-1].type); (yyval.var)->attrs = (yyvsp[-2].attr_list); ;} break; case 179: -#line 564 "parser.y" - { yyval.var = yyvsp[-1].var; set_type(yyval.var, yyvsp[-2].tref, yyvsp[0].expr); yyval.var->attrs = yyvsp[-3].attr; ;} +#line 595 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[-1].attr_list); ;} break; case 180: -#line 569 "parser.y" - { set_type(yyvsp[-3].var, yyvsp[-5].tref, NULL); - yyvsp[-3].var->attrs = yyvsp[-6].attr; - yyval.func = make_func(yyvsp[-3].var, yyvsp[-1].var); - if (is_attr(yyvsp[-3].var->attrs, ATTR_IN)) { - yyerror("inapplicable attribute [in] for function '%s'",yyval.func->def->name); +#line 596 "tools\\widl_new\\parser.y" + { (yyval.var) = NULL; ;} + break; + + case 181: +#line 599 "tools\\widl_new\\parser.y" + { (yyval.var) = (yyvsp[-1].pident)->var; + set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims)); + free((yyvsp[-1].pident)); + (yyval.var)->attrs = (yyvsp[-3].attr_list); + ;} + break; + + case 182: +#line 608 "tools\\widl_new\\parser.y" + { var_t *v = (yyvsp[-3].pident)->var; + set_type(v, (yyvsp[-5].type), (yyvsp[-3].pident)->ptr_level, NULL); + free((yyvsp[-3].pident)); + v->attrs = (yyvsp[-6].attr_list); + (yyval.func) = make_func(v, (yyvsp[-1].var_list)); + if (is_attr(v->attrs, ATTR_IN)) { + yyerror("inapplicable attribute [in] for function '%s'",(yyval.func)->def->name); } ;} break; - case 181: -#line 578 "parser.y" - { yyval.var = NULL; ;} - break; - case 183: -#line 582 "parser.y" - { yyval.var = NULL; ;} - break; - - case 184: -#line 583 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 619 "tools\\widl_new\\parser.y" + { (yyval.var) = NULL; ;} break; case 185: -#line 584 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 623 "tools\\widl_new\\parser.y" + { (yyval.var) = NULL; ;} break; case 186: -#line 587 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 624 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var((yyvsp[0].str)); ;} break; case 187: -#line 589 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 625 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var((yyvsp[0].str)); ;} break; case 188: -#line 590 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 628 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var((yyvsp[0].str)); ;} break; case 189: -#line 591 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 630 "tools\\widl_new\\parser.y" + { (yyval.var) = make_var((yyvsp[0].str)); ;} break; case 190: -#line 592 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 633 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 191: -#line 593 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} - break; - - case 192: -#line 594 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 634 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 193: -#line 595 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} +#line 636 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = 1; ;} break; case 194: -#line 596 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} - break; - - case 195: -#line 597 "parser.y" - { yyval.var = make_var(yyvsp[0].str); ;} - break; - - case 196: -#line 600 "parser.y" - { yyval.type = make_type(RPC_FC_BYTE, NULL); ;} - break; - - case 197: -#line 601 "parser.y" - { yyval.type = make_type(RPC_FC_WCHAR, NULL); ;} - break; - - case 199: -#line 603 "parser.y" - { yyval.type = yyvsp[0].type; yyval.type->sign = 1; ;} - break; - - case 200: -#line 604 "parser.y" - { yyval.type = yyvsp[0].type; yyval.type->sign = -1; - switch (yyval.type->type) { +#line 637 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = -1; + switch ((yyval.type)->type) { case RPC_FC_CHAR: break; - case RPC_FC_SMALL: yyval.type->type = RPC_FC_USMALL; break; - case RPC_FC_SHORT: yyval.type->type = RPC_FC_USHORT; break; - case RPC_FC_LONG: yyval.type->type = RPC_FC_ULONG; break; + case RPC_FC_SMALL: (yyval.type)->type = RPC_FC_USMALL; break; + case RPC_FC_SHORT: (yyval.type)->type = RPC_FC_USHORT; break; + case RPC_FC_LONG: (yyval.type)->type = RPC_FC_ULONG; break; case RPC_FC_HYPER: - if (!yyval.type->ref) { yyval.type->ref = &std_uhyper; yyval.type->sign = 0; } + if ((yyval.type)->name[0] == 'h') /* hyper, as opposed to __int64 */ + { + (yyval.type) = alias((yyval.type), "MIDL_uhyper"); + (yyval.type)->sign = 0; + } break; default: break; } ;} break; + case 195: +#line 653 "tools\\widl_new\\parser.y" + { (yyval.type) = make_int(-1); ;} + break; + + case 196: +#line 654 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + break; + + case 197: +#line 655 "tools\\widl_new\\parser.y" + { (yyval.type) = duptype(find_type("float", 0), 1); ;} + break; + + case 198: +#line 656 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + break; + + case 199: +#line 657 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + break; + + case 200: +#line 658 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + break; + case 201: -#line 616 "parser.y" - { yyval.type = make_type(RPC_FC_ULONG, &std_int); yyval.type->sign = -1; ;} - break; - - case 202: -#line 617 "parser.y" - { yyval.type = make_type(RPC_FC_FLOAT, NULL); ;} - break; - - case 203: -#line 618 "parser.y" - { yyval.type = make_type(RPC_FC_FLOAT, NULL); ;} +#line 659 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 204: -#line 619 "parser.y" - { yyval.type = make_type(RPC_FC_DOUBLE, NULL); ;} +#line 666 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 205: -#line 620 "parser.y" - { yyval.type = make_type(RPC_FC_BYTE, &std_bool); /* ? */ ;} +#line 667 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} break; case 206: -#line 621 "parser.y" - { yyval.type = make_type(RPC_FC_ERROR_STATUS_T, NULL); ;} +#line 668 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 207: -#line 622 "parser.y" - { yyval.type = make_type(RPC_FC_BIND_PRIMITIVE, NULL); /* ? */ ;} +#line 669 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} + break; + + case 208: +#line 670 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} + break; + + case 209: +#line 671 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 210: -#line 629 "parser.y" - { yyval.type = make_type(RPC_FC_LONG, &std_int); ;} +#line 672 "tools\\widl_new\\parser.y" + { (yyval.type) = make_builtin((yyvsp[0].str)); ;} break; case 211: -#line 630 "parser.y" - { yyval.type = make_type(RPC_FC_SHORT, NULL); ;} +#line 675 "tools\\widl_new\\parser.y" + { (yyval.type) = make_class((yyvsp[0].str)); ;} break; case 212: -#line 631 "parser.y" - { yyval.type = make_type(RPC_FC_SMALL, NULL); ;} +#line 676 "tools\\widl_new\\parser.y" + { (yyval.type) = find_type((yyvsp[0].str), 0); + if ((yyval.type)->defined) yyerror("multiple definition error"); + if ((yyval.type)->kind != TKIND_COCLASS) yyerror("%s was not declared a coclass", (yyvsp[0].str)); + ;} break; case 213: -#line 632 "parser.y" - { yyval.type = make_type(RPC_FC_LONG, NULL); ;} +#line 682 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); + (yyval.type)->attrs = (yyvsp[-1].attr_list); + if (!parse_only && do_header) + write_coclass((yyval.type)); + if (!parse_only && do_idfile) + write_clsid((yyval.type)); + ;} break; case 214: -#line 633 "parser.y" - { yyval.type = make_type(RPC_FC_HYPER, NULL); ;} +#line 691 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-3].type); + (yyval.type)->ifaces = (yyvsp[-1].ifref_list); + (yyval.type)->defined = TRUE; + ;} break; case 215: -#line 634 "parser.y" - { yyval.type = make_type(RPC_FC_HYPER, &std_int64); ;} +#line 697 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = NULL; ;} break; case 216: -#line 635 "parser.y" - { yyval.type = make_type(RPC_FC_CHAR, NULL); ;} +#line 698 "tools\\widl_new\\parser.y" + { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), (yyvsp[0].ifref) ); ;} break; case 217: -#line 638 "parser.y" - { yyval.type = make_class(yyvsp[0].str); ;} +#line 702 "tools\\widl_new\\parser.y" + { (yyval.ifref) = make_ifref((yyvsp[0].type)); (yyval.ifref)->attrs = (yyvsp[-1].attr_list); ;} break; case 218: -#line 639 "parser.y" - { yyval.type = find_type(yyvsp[0].str, 0); - if (yyval.type->defined) yyerror("multiple definition error"); - if (yyval.type->kind != TKIND_COCLASS) yyerror("%s was not declared a coclass", yyvsp[0].str); - ;} +#line 705 "tools\\widl_new\\parser.y" + { (yyval.type) = get_type(0, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_DISPATCH; ;} break; case 219: -#line 645 "parser.y" - { yyval.type = yyvsp[0].type; - yyval.type->attrs = yyvsp[-1].attr; - if (!parse_only && do_header) - write_coclass(yyval.type); - ;} +#line 706 "tools\\widl_new\\parser.y" + { (yyval.type) = get_type(0, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_DISPATCH; ;} break; case 220: -#line 652 "parser.y" - { yyval.type = yyvsp[-3].type; - yyval.type->ifaces = yyvsp[-1].ifref; +#line 709 "tools\\widl_new\\parser.y" + { attr_t *attrs; + (yyval.type) = (yyvsp[0].type); + if ((yyval.type)->defined) yyerror("multiple definition error"); + attrs = make_attr(ATTR_DISPINTERFACE); + (yyval.type)->attrs = append_attr( (yyvsp[-1].attr_list), attrs ); + (yyval.type)->ref = find_type("IDispatch", 0); + if (!(yyval.type)->ref) yyerror("IDispatch is undefined"); + (yyval.type)->defined = TRUE; + if (!parse_only && do_header) write_forward((yyval.type)); ;} break; case 221: -#line 657 "parser.y" - { yyval.ifref = NULL; ;} +#line 721 "tools\\widl_new\\parser.y" + { (yyval.var_list) = NULL; ;} break; case 222: -#line 658 "parser.y" - { LINK(yyvsp[0].ifref, yyvsp[-1].ifref); yyval.ifref = yyvsp[0].ifref; ;} +#line 722 "tools\\widl_new\\parser.y" + { (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[-1].var) ); ;} break; case 223: -#line 662 "parser.y" - { yyval.ifref = make_ifref(yyvsp[0].type); yyval.ifref->attrs = yyvsp[-1].attr; ;} +#line 725 "tools\\widl_new\\parser.y" + { (yyval.func_list) = NULL; ;} break; case 224: -#line 665 "parser.y" - { yyval.type = get_type(0, yyvsp[0].str, 0); ;} +#line 726 "tools\\widl_new\\parser.y" + { (yyval.func_list) = append_func( (yyvsp[-2].func_list), (yyvsp[-1].func) ); ;} break; case 225: -#line 666 "parser.y" - { yyval.type = get_type(0, yyvsp[0].str, 0); ;} +#line 732 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-4].type); + (yyval.type)->fields = (yyvsp[-2].var_list); + (yyval.type)->funcs = (yyvsp[-1].func_list); + if (!parse_only && do_header) write_dispinterface((yyval.type)); + if (!parse_only && do_idfile) write_diid((yyval.type)); + ;} break; case 226: -#line 669 "parser.y" - { attr_t *attrs; - yyval.type = yyvsp[0].type; - if (yyval.type->defined) yyerror("multiple definition error"); - attrs = make_attr(ATTR_DISPINTERFACE); - LINK(attrs, yyvsp[-1].attr); - yyval.type->attrs = attrs; - yyval.type->ref = find_type("IDispatch", 0); - if (!yyval.type->ref) yyerror("IDispatch is undefined"); - yyval.type->defined = TRUE; - if (!parse_only && do_header) write_forward(yyval.type); +#line 739 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-4].type); + (yyval.type)->fields = (yyvsp[-2].type)->fields; + (yyval.type)->funcs = (yyvsp[-2].type)->funcs; + if (!parse_only && do_header) write_dispinterface((yyval.type)); + if (!parse_only && do_idfile) write_diid((yyval.type)); ;} break; case 227: -#line 682 "parser.y" - { yyval.var = NULL; ;} +#line 747 "tools\\widl_new\\parser.y" + { (yyval.type) = NULL; ;} break; case 228: -#line 683 "parser.y" - { LINK(yyvsp[-1].var, yyvsp[-2].var); yyval.var = yyvsp[-1].var; ;} +#line 748 "tools\\widl_new\\parser.y" + { (yyval.type) = find_type2((yyvsp[0].str), 0); ;} break; case 229: -#line 686 "parser.y" - { yyval.func = NULL; ;} +#line 751 "tools\\widl_new\\parser.y" + { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_INTERFACE; ;} break; case 230: -#line 687 "parser.y" - { LINK(yyvsp[-1].func, yyvsp[-2].func); yyval.func = yyvsp[-1].func; ;} +#line 752 "tools\\widl_new\\parser.y" + { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_INTERFACE; ;} break; case 231: -#line 693 "parser.y" - { yyval.type = yyvsp[-4].type; - yyval.type->fields = yyvsp[-2].var; - yyval.type->funcs = yyvsp[-1].func; - if (!parse_only && do_header) write_dispinterface(yyval.type); +#line 755 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); + if ((yyval.type)->defined) yyerror("multiple definition error"); + (yyval.type)->attrs = (yyvsp[-1].attr_list); + (yyval.type)->defined = TRUE; + if (!parse_only && do_header) write_forward((yyval.type)); ;} break; case 232: -#line 705 "parser.y" - { yyval.type = NULL; ;} +#line 764 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-4].type); + (yyval.type)->ref = (yyvsp[-3].type); + (yyval.type)->funcs = (yyvsp[-1].func_list); + compute_method_indexes((yyval.type)); + if (!parse_only && do_header) write_interface((yyval.type)); + if (!parse_only && do_idfile) write_iid((yyval.type)); + ;} break; case 233: -#line 706 "parser.y" - { yyval.type = find_type2(yyvsp[0].str, 0); ;} +#line 774 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-6].type); + (yyval.type)->ref = find_type2((yyvsp[-4].str), 0); + if (!(yyval.type)->ref) yyerror("base class '%s' not found in import", (yyvsp[-4].str)); + (yyval.type)->funcs = (yyvsp[-1].func_list); + compute_method_indexes((yyval.type)); + if (!parse_only && do_header) write_interface((yyval.type)); + if (!parse_only && do_idfile) write_iid((yyval.type)); + ;} break; case 234: -#line 709 "parser.y" - { yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ;} +#line 782 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); ;} break; case 235: -#line 710 "parser.y" - { yyval.type = get_type(RPC_FC_IP, yyvsp[0].str, 0); ;} +#line 786 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-1].type); if (!parse_only && do_header) write_forward((yyval.type)); ;} break; case 236: -#line 713 "parser.y" - { yyval.type = yyvsp[0].type; - if (yyval.type->defined) yyerror("multiple definition error"); - yyval.type->attrs = yyvsp[-1].attr; - yyval.type->defined = TRUE; - if (!parse_only && do_header) write_forward(yyval.type); - ;} +#line 787 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-1].type); if (!parse_only && do_header) write_forward((yyval.type)); ;} break; case 237: -#line 722 "parser.y" - { yyval.type = yyvsp[-4].type; - yyval.type->ref = yyvsp[-3].type; - yyval.type->funcs = yyvsp[-1].func; - if (!parse_only && do_header) write_interface(yyval.type); - ;} +#line 790 "tools\\widl_new\\parser.y" + { (yyval.type) = make_type(0, NULL); (yyval.type)->name = (yyvsp[0].str); (yyval.type)->kind = TKIND_MODULE; ;} break; case 238: -#line 730 "parser.y" - { yyval.type = yyvsp[-6].type; - yyval.type->ref = find_type2(yyvsp[-4].str, 0); - if (!yyval.type->ref) yyerror("base class '%s' not found in import", yyvsp[-4].str); - yyval.type->funcs = yyvsp[-1].func; - if (!parse_only && do_header) write_interface(yyval.type); - ;} +#line 791 "tools\\widl_new\\parser.y" + { (yyval.type) = make_type(0, NULL); (yyval.type)->name = (yyvsp[0].str); (yyval.type)->kind = TKIND_MODULE; ;} break; case 239: -#line 736 "parser.y" - { yyval.type = yyvsp[0].type; ;} - break; - - case 240: -#line 740 "parser.y" - { yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ;} - break; - - case 241: -#line 741 "parser.y" - { yyval.type = yyvsp[-1].type; if (!parse_only && do_header) write_forward(yyval.type); ;} - break; - - case 242: -#line 744 "parser.y" - { yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ;} - break; - - case 243: -#line 745 "parser.y" - { yyval.type = make_type(0, NULL); yyval.type->name = yyvsp[0].str; ;} - break; - - case 244: -#line 748 "parser.y" - { yyval.type = yyvsp[0].type; - yyval.type->attrs = yyvsp[-1].attr; +#line 794 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); + (yyval.type)->attrs = (yyvsp[-1].attr_list); ;} break; - case 245: -#line 753 "parser.y" - { yyval.type = yyvsp[-3].type; - yyval.type->funcs = yyvsp[-1].func; + case 240: +#line 799 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[-3].type); + (yyval.type)->funcs = (yyvsp[-1].func_list); /* FIXME: if (!parse_only && do_header) write_module($$); */ ;} break; + case 241: +#line 805 "tools\\widl_new\\parser.y" + { (yyval.pident) = (yyvsp[0].pident); (yyval.pident)->ptr_level++; ;} + break; + + case 242: +#line 806 "tools\\widl_new\\parser.y" + { (yyval.pident) = (yyvsp[0].pident); /* FIXME */ ;} + break; + + case 243: +#line 809 "tools\\widl_new\\parser.y" + { (yyval.pident) = make_pident((yyvsp[0].var)); ;} + break; + + case 245: +#line 811 "tools\\widl_new\\parser.y" + { (yyval.pident) = (yyvsp[-1].pident); ;} + break; + case 246: -#line 759 "parser.y" - { yyval.var = yyvsp[0].var; yyval.var->ptr_level++; ;} +#line 815 "tools\\widl_new\\parser.y" + { (yyval.pident_list) = append_pident( NULL, (yyvsp[0].pident) ); ;} break; case 247: -#line 760 "parser.y" - { yyval.var = yyvsp[0].var; /* FIXME */ ;} +#line 816 "tools\\widl_new\\parser.y" + { (yyval.pident_list) = append_pident( (yyvsp[-2].pident_list), (yyvsp[0].pident) ); ;} + break; + + case 248: +#line 820 "tools\\widl_new\\parser.y" + { (yyval.num) = RPC_FC_RP; ;} + break; + + case 249: +#line 821 "tools\\widl_new\\parser.y" + { (yyval.num) = RPC_FC_UP; ;} break; case 250: -#line 765 "parser.y" - { yyval.var = yyvsp[-1].var; ;} +#line 822 "tools\\widl_new\\parser.y" + { (yyval.num) = RPC_FC_FP; ;} break; - case 252: -#line 770 "parser.y" - { LINK(yyvsp[0].var, yyvsp[-2].var); yyval.var = yyvsp[0].var; ;} - break; - - case 253: -#line 774 "parser.y" - { yyval.num = RPC_FC_RP; ;} - break; - - case 254: -#line 775 "parser.y" - { yyval.num = RPC_FC_UP; ;} - break; - - case 255: -#line 776 "parser.y" - { yyval.num = RPC_FC_FP; ;} - break; - - case 256: -#line 779 "parser.y" - { yyval.type = get_typev(RPC_FC_STRUCT, yyvsp[-3].var, tsSTRUCT); + case 251: +#line 825 "tools\\widl_new\\parser.y" + { (yyval.type) = get_typev(RPC_FC_STRUCT, (yyvsp[-3].var), tsSTRUCT); /* overwrite RPC_FC_STRUCT with a more exact type */ - yyval.type->type = get_struct_type( yyvsp[-1].var ); - yyval.type->fields = yyvsp[-1].var; - yyval.type->defined = TRUE; + (yyval.type)->type = get_struct_type( (yyvsp[-1].var_list) ); + (yyval.type)->kind = TKIND_RECORD; + (yyval.type)->fields = (yyvsp[-1].var_list); + (yyval.type)->defined = TRUE; if(in_typelib) - add_struct(yyval.type); + add_typelib_entry((yyval.type)); ;} break; + case 252: +#line 836 "tools\\widl_new\\parser.y" + { (yyval.type) = duptype(find_type("void", 0), 1); ;} + break; + + case 253: +#line 837 "tools\\widl_new\\parser.y" + { (yyval.type) = find_type((yyvsp[0].str), 0); ;} + break; + + case 254: +#line 838 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); ;} + break; + + case 255: +#line 839 "tools\\widl_new\\parser.y" + { (yyval.type) = duptype((yyvsp[0].type), 1); (yyval.type)->is_const = TRUE; ;} + break; + + case 256: +#line 840 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); ;} + break; + case 257: -#line 789 "parser.y" - { yyval.tref = make_tref(NULL, make_type(0, NULL)); ;} +#line 841 "tools\\widl_new\\parser.y" + { (yyval.type) = find_type2((yyvsp[0].str), tsENUM); ;} break; case 258: -#line 790 "parser.y" - { yyval.tref = make_tref(yyvsp[0].str, find_type(yyvsp[0].str, 0)); ;} +#line 842 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); ;} break; case 259: -#line 791 "parser.y" - { yyval.tref = make_tref(NULL, yyvsp[0].type); ;} +#line 843 "tools\\widl_new\\parser.y" + { (yyval.type) = get_type(RPC_FC_STRUCT, (yyvsp[0].str), tsSTRUCT); ;} break; case 260: -#line 792 "parser.y" - { yyval.tref = uniq_tref(yyvsp[0].tref); yyval.tref->ref->is_const = TRUE; ;} +#line 844 "tools\\widl_new\\parser.y" + { (yyval.type) = (yyvsp[0].type); ;} break; case 261: -#line 793 "parser.y" - { yyval.tref = make_tref(NULL, yyvsp[0].type); ;} +#line 845 "tools\\widl_new\\parser.y" + { (yyval.type) = find_type2((yyvsp[0].str), tsUNION); ;} break; case 262: -#line 794 "parser.y" - { yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsENUM)); ;} +#line 846 "tools\\widl_new\\parser.y" + { (yyval.type) = make_safearray((yyvsp[-1].type)); ;} break; case 263: -#line 795 "parser.y" - { yyval.tref = make_tref(NULL, yyvsp[0].type); ;} +#line 849 "tools\\widl_new\\parser.y" + { reg_typedefs((yyvsp[-1].type), (yyvsp[0].pident_list), (yyvsp[-2].attr_list)); + process_typedefs((yyvsp[0].pident_list)); + ;} break; case 264: -#line 796 "parser.y" - { yyval.tref = make_tref(NULL, get_type(RPC_FC_STRUCT, yyvsp[0].str, tsSTRUCT)); ;} +#line 854 "tools\\widl_new\\parser.y" + { (yyval.type) = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, (yyvsp[-3].var), tsUNION); + (yyval.type)->kind = TKIND_UNION; + (yyval.type)->fields = (yyvsp[-1].var_list); + (yyval.type)->defined = TRUE; + ;} break; case 265: -#line 797 "parser.y" - { yyval.tref = make_tref(NULL, yyvsp[0].type); ;} +#line 861 "tools\\widl_new\\parser.y" + { var_t *u = (yyvsp[-3].var); + (yyval.type) = get_typev(RPC_FC_ENCAPSULATED_UNION, (yyvsp[-8].var), tsUNION); + (yyval.type)->kind = TKIND_UNION; + if (!u) u = make_var( xstrdup("tagged_union") ); + u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); + u->type->kind = TKIND_UNION; + u->type->fields = (yyvsp[-1].var_list); + u->type->defined = TRUE; + (yyval.type)->fields = append_var( (yyval.type)->fields, (yyvsp[-5].var) ); + (yyval.type)->fields = append_var( (yyval.type)->fields, u ); + (yyval.type)->defined = TRUE; + ;} break; case 266: -#line 798 "parser.y" - { yyval.tref = make_tref(NULL, find_type2(yyvsp[0].str, tsUNION)); ;} +#line 876 "tools\\widl_new\\parser.y" + { (yyval.num) = MAKELONG((yyvsp[0].num), 0); ;} break; case 267: -#line 799 "parser.y" - { yyval.tref = make_tref(NULL, make_safearray()); ;} - break; - - case 268: -#line 802 "parser.y" - { typeref_t *tref = uniq_tref(yyvsp[-1].tref); - yyvsp[0].var->tname = tref->name; - tref->name = NULL; - yyval.type = type_ref(tref); - yyval.type->attrs = yyvsp[-2].attr; - if (!parse_only && do_header) - write_typedef(yyval.type, yyvsp[0].var); - if (in_typelib && yyval.type->attrs) - add_typedef(yyval.type, yyvsp[0].var); - reg_types(yyval.type, yyvsp[0].var, 0); - ;} - break; - - case 269: -#line 815 "parser.y" - { yyval.type = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, yyvsp[-3].var, tsUNION); - yyval.type->fields = yyvsp[-1].var; - yyval.type->defined = TRUE; - ;} - break; - - case 270: -#line 821 "parser.y" - { var_t *u = yyvsp[-3].var; - yyval.type = get_typev(RPC_FC_ENCAPSULATED_UNION, yyvsp[-8].var, tsUNION); - if (!u) u = make_var("tagged_union"); - u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); - u->type->fields = yyvsp[-1].var; - u->type->defined = TRUE; - LINK(u, yyvsp[-5].var); yyval.type->fields = u; - yyval.type->defined = TRUE; - ;} - break; - - case 271: -#line 833 "parser.y" - { yyval.num = MAKELONG(yyvsp[0].num, 0); ;} - break; - - case 272: -#line 834 "parser.y" - { yyval.num = MAKELONG(yyvsp[-2].num, yyvsp[0].num); ;} +#line 877 "tools\\widl_new\\parser.y" + { (yyval.num) = MAKELONG((yyvsp[-2].num), (yyvsp[0].num)); ;} break; + default: break; } -/* Line 991 of yacc.c. */ -#line 3375 "parser.tab.c" +/* Line 1126 of yacc.c. */ +#line 3561 "tools\\widl_new\\parser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -3411,103 +3596,153 @@ yyerrlab: if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - char *yymsg; - int yyx, yycount; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; - yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("syntax error, unexpected ") + 1; - yysize += yystrlen (yytname[yytype]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); + int yyxbegin = yyn < 0 ? -yyn : 0; - if (yycount < 5) + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("syntax error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + yyerror (YY_("syntax error")); } if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar <= YYEOF) { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; } - - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ - goto yyerrlab2; + goto yyerrlab1; -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (0) + goto yyerrorlab; + +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: - - /* Suppress GCC warning that yyerrlab1 is unused when no action - invokes YYERROR. */ -#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) - __attribute__ ((__unused__)) -#endif - - - goto yyerrlab2; - - -/*---------------------------------------------------------------. -| yyerrlab2 -- pop states until the error token can be shifted. | -`---------------------------------------------------------------*/ -yyerrlab2: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) @@ -3528,22 +3763,22 @@ yyerrlab2: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -3563,16 +3798,25 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -3581,15 +3825,87 @@ yyreturn: } -#line 837 "parser.y" +#line 880 "tools\\widl_new\\parser.y" +static void decl_builtin(const char *name, unsigned char type) +{ + type_t *t = make_type(type, NULL); + t->name = xstrdup(name); + reg_type(t, name, 0); +} + +static type_t *make_builtin(char *name) +{ + /* NAME is strdup'd in the lexer */ + type_t *t = duptype(find_type(name, 0), 0); + t->name = name; + return t; +} + +static type_t *make_int(int sign) +{ + type_t *t = duptype(find_type("int", 0), 1); + + t->sign = sign; + if (sign < 0) + t->type = t->type == RPC_FC_LONG ? RPC_FC_ULONG : RPC_FC_USHORT; + + return t; +} + +void init_types(void) +{ + decl_builtin("void", 0); + decl_builtin("byte", RPC_FC_BYTE); + decl_builtin("wchar_t", RPC_FC_WCHAR); + decl_builtin("int", RPC_FC_LONG); /* win32 */ + decl_builtin("short", RPC_FC_SHORT); + decl_builtin("small", RPC_FC_SMALL); + decl_builtin("long", RPC_FC_LONG); + decl_builtin("hyper", RPC_FC_HYPER); + decl_builtin("__int64", RPC_FC_HYPER); + decl_builtin("char", RPC_FC_CHAR); + decl_builtin("float", RPC_FC_FLOAT); + decl_builtin("double", RPC_FC_DOUBLE); + decl_builtin("boolean", RPC_FC_BYTE); + decl_builtin("error_status_t", RPC_FC_ERROR_STATUS_T); + decl_builtin("handle_t", RPC_FC_BIND_PRIMITIVE); +} + +static str_list_t *append_str(str_list_t *list, char *str) +{ + struct str_list_entry_t *entry; + + if (!str) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + entry = xmalloc( sizeof(*entry) ); + entry->str = str; + list_add_tail( list, &entry->entry ); + return list; +} + +static attr_list_t *append_attr(attr_list_t *list, attr_t *attr) +{ + if (!attr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &attr->entry ); + return list; +} + static attr_t *make_attr(enum attr_type type) { attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.ival = 0; - INIT_LINK(a); return a; } @@ -3598,7 +3914,6 @@ static attr_t *make_attrv(enum attr_type type, unsigned long val) attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.ival = val; - INIT_LINK(a); return a; } @@ -3607,7 +3922,6 @@ static attr_t *make_attrp(enum attr_type type, void *val) attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.pval = val; - INIT_LINK(a); return a; } @@ -3618,7 +3932,6 @@ static expr_t *make_expr(enum expr_type type) e->ref = NULL; e->u.lval = 0; e->is_const = FALSE; - INIT_LINK(e); return e; } @@ -3629,7 +3942,6 @@ static expr_t *make_exprl(enum expr_type type, long val) e->ref = NULL; e->u.lval = val; e->is_const = FALSE; - INIT_LINK(e); /* check for numeric constant */ if (type == EXPR_NUM || type == EXPR_HEXNUM || type == EXPR_TRUEFALSE) { /* make sure true/false value is valid */ @@ -3648,7 +3960,6 @@ static expr_t *make_exprs(enum expr_type type, char *val) e->ref = NULL; e->u.sval = val; e->is_const = FALSE; - INIT_LINK(e); /* check for predefined constants */ if (type == EXPR_IDENTIFIER) { var_t *c = find_const(val, 0); @@ -3662,7 +3973,7 @@ static expr_t *make_exprs(enum expr_type type, char *val) return e; } -static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr) +static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr) { expr_t *e; e = xmalloc(sizeof(expr_t)); @@ -3670,10 +3981,9 @@ static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr) e->ref = expr; e->u.tref = tref; e->is_const = FALSE; - INIT_LINK(e); /* check for cast of constant expression */ if (type == EXPR_SIZEOF) { - switch (tref->ref->type) { + switch (tref->type) { case RPC_FC_BYTE: case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -3716,7 +4026,6 @@ static expr_t *make_expr1(enum expr_type type, expr_t *expr) e->ref = expr; e->u.lval = 0; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr->is_const) { e->is_const = TRUE; @@ -3743,7 +4052,6 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2) e->ref = expr1; e->u.ext = expr2; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr1->is_const && expr2->is_const) { e->is_const = TRUE; @@ -3789,7 +4097,6 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp e->u.ext = expr2; e->ext2 = expr3; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr1->is_const && expr2->is_const && expr3->is_const) { e->is_const = TRUE; @@ -3805,6 +4112,30 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp return e; } +static expr_list_t *append_expr(expr_list_t *list, expr_t *expr) +{ + if (!expr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &expr->entry ); + return list; +} + +static array_dims_t *append_array(array_dims_t *list, expr_t *expr) +{ + if (!expr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &expr->entry ); + return list; +} + static type_t *make_type(unsigned char type, type_t *ref) { type_t *t = xmalloc(sizeof(type_t)); @@ -3813,56 +4144,40 @@ static type_t *make_type(unsigned char type, type_t *ref) t->type = type; t->ref = ref; t->attrs = NULL; + t->orig = NULL; t->funcs = NULL; t->fields = NULL; t->ifaces = NULL; + t->typestring_offset = 0; t->ignore = parse_only; t->is_const = FALSE; t->sign = 0; t->defined = FALSE; t->written = FALSE; + t->user_types_registered = FALSE; t->typelib_idx = -1; - INIT_LINK(t); return t; } -static typeref_t *make_tref(char *name, type_t *ref) +static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr) { - typeref_t *t = xmalloc(sizeof(typeref_t)); - t->name = name; - t->ref = ref; - t->uniq = ref ? 0 : 1; - return t; -} - -static typeref_t *uniq_tref(typeref_t *ref) -{ - typeref_t *t = ref; - type_t *tp; - if (t->uniq) return t; - tp = make_type(0, t->ref); - tp->name = t->name; - t->name = NULL; - t->ref = tp; - t->uniq = 1; - return t; -} - -static type_t *type_ref(typeref_t *ref) -{ - type_t *t = ref->ref; - if (ref->name) free(ref->name); - free(ref); - return t; -} - -static void set_type(var_t *v, typeref_t *ref, expr_t *arr) -{ - v->type = ref->ref; - v->tname = ref->name; - ref->name = NULL; - free(ref); + v->type = type; v->array = arr; + + for ( ; 0 < ptr_level; --ptr_level) + v->type = make_type(RPC_FC_RP, v->type); +} + +static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface) +{ + if (!iface) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &iface->entry ); + return list; } static ifref_t *make_ifref(type_t *iface) @@ -3870,32 +4185,71 @@ static ifref_t *make_ifref(type_t *iface) ifref_t *l = xmalloc(sizeof(ifref_t)); l->iface = iface; l->attrs = NULL; - INIT_LINK(l); return l; } +static var_list_t *append_var(var_list_t *list, var_t *var) +{ + if (!var) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &var->entry ); + return list; +} + static var_t *make_var(char *name) { var_t *v = xmalloc(sizeof(var_t)); v->name = name; - v->ptr_level = 0; v->type = NULL; - v->tname = NULL; + v->args = NULL; v->attrs = NULL; v->array = NULL; v->eval = NULL; - INIT_LINK(v); return v; } -static func_t *make_func(var_t *def, var_t *args) +static pident_list_t *append_pident(pident_list_t *list, pident_t *p) +{ + if (!p) return list; + if (!list) { + list = xmalloc(sizeof(*list)); + list_init(list); + } + list_add_tail(list, &p->entry); + return list; +} + +static pident_t *make_pident(var_t *var) +{ + pident_t *p = xmalloc(sizeof(*p)); + p->var = var; + p->ptr_level = 0; + return p; +} + +static func_list_t *append_func(func_list_t *list, func_t *func) +{ + if (!func) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &func->entry ); + return list; +} + +static func_t *make_func(var_t *def, var_list_t *args) { func_t *f = xmalloc(sizeof(func_t)); f->def = def; f->args = args; f->ignore = parse_only; f->idx = -1; - INIT_LINK(f); return f; } @@ -3904,13 +4258,14 @@ static type_t *make_class(char *name) type_t *c = make_type(0, NULL); c->name = name; c->kind = TKIND_COCLASS; - INIT_LINK(c); return c; } -static type_t *make_safearray(void) +static type_t *make_safearray(type_t *type) { - return make_type(RPC_FC_FP, find_type("SAFEARRAY", 0)); + type_t *sa = duptype(find_type("SAFEARRAY", 0), 1); + sa->ref = type; + return make_type(RPC_FC_FP, sa); } #define HASHMAX 64 @@ -3956,42 +4311,53 @@ static type_t *reg_type(type_t *type, const char *name, int t) return type; } -/* determine pointer type from attrs */ -static unsigned char get_pointer_type( type_t *type ) -{ - int t; - if (is_attr( type->attrs, ATTR_STRING )) - { - type_t *t = type; - while( t->type == 0 && t->ref ) - t = t->ref; - switch( t->type ) - { - case RPC_FC_CHAR: - return RPC_FC_C_CSTRING; - case RPC_FC_WCHAR: - return RPC_FC_C_WSTRING; - } - } - t = get_attrv( type->attrs, ATTR_POINTERTYPE ); - if (t) return t; - return RPC_FC_FP; -} - -static type_t *reg_types(type_t *type, var_t *names, int t) +static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *attrs) { type_t *ptr = type; + const pident_t *pident; int ptrc = 0; + int is_str = is_attr(attrs, ATTR_STRING); + unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE); - while (names) { - var_t *next = NEXT_LINK(names); - if (names->name) { + if (is_str) + { + type_t *t = type; + unsigned char c; + + while (is_ptr(t)) + t = t->ref; + + c = t->type; + if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR) + { + pident = LIST_ENTRY( list_head( pidents ), const pident_t, entry ); + yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays", + pident->var->name); + } + } + + /* We must generate names for tagless enum, struct or union. + Typedef-ing a tagless enum, struct or union means we want the typedef + to be included in a library whether it has other attributes or not, + hence the public attribute. */ + if ((type->kind == TKIND_ENUM || type->kind == TKIND_RECORD + || type->kind == TKIND_UNION) && ! type->name && ! parse_only) + { + if (! is_attr(attrs, ATTR_PUBLIC)) + attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); + type->name = gen_name(); + } + + LIST_FOR_EACH_ENTRY( pident, pidents, const pident_t, entry ) + { + var_t *name = pident->var; + + if (name->name) { type_t *cur = ptr; - int cptr = names->ptr_level; + int cptr = pident->ptr_level; if (cptr > ptrc) { while (cptr > ptrc) { - int t = get_pointer_type( cur ); - cur = ptr = make_type(t, cur); + cur = ptr = make_type(RPC_FC_RP, cur); ptrc++; } } else { @@ -4000,10 +4366,22 @@ static type_t *reg_types(type_t *type, var_t *names, int t) cptr++; } } - reg_type(cur, names->name, t); + cur = alias(cur, name->name); + cur->attrs = attrs; + if (ptr_type) + { + if (is_ptr(cur)) + cur->type = ptr_type; + else + yyerror("'%s': pointer attribute applied to non-pointer type", + cur->name); + } + else if (is_str && ! is_ptr(cur)) + yyerror("'%s': [string] attribute applied to non-pointer type", + cur->name); + + reg_type(cur, cur->name, 0); } - free(names); - names = next; } return type; } @@ -4065,39 +4443,36 @@ static type_t *get_typev(unsigned char type, var_t *name, int t) return get_type(type, sname, t); } -static int get_struct_type(var_t *field) +static int get_struct_type(var_list_t *fields) { int has_pointer = 0; int has_conformance = 0; int has_variance = 0; + var_t *field; - for (; field; field = NEXT_LINK(field)) + if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry ) { type_t *t = field->type; - /* get the base type */ - while( (t->type == 0) && t->ref ) - t = t->ref; - - if (field->ptr_level > 0) + if (is_ptr(field->type)) { has_pointer = 1; continue; } - if (is_string_type(field->attrs, 0, field->array)) + if (is_string_type(field->attrs, field->type, field->array)) { has_conformance = 1; has_variance = 1; continue; } - if (is_array_type(field->attrs, 0, field->array)) + if (is_array_type(field->attrs, field->type, field->array)) { - if (field->array && !field->array->is_const) + if (field->array && is_conformant_array(field->array)) { has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); } @@ -4133,21 +4508,18 @@ static int get_struct_type(var_t *field) case RPC_FC_ENUM32: break; + case RPC_FC_RP: case RPC_FC_UP: case RPC_FC_FP: + case RPC_FC_OP: has_pointer = 1; break; case RPC_FC_CARRAY: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - has_conformance = 1; - has_variance = 1; - break; /* * Propagate member attributes @@ -4161,7 +4533,7 @@ static int get_struct_type(var_t *field) case RPC_FC_CPSTRUCT: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); has_pointer = 1; @@ -4169,7 +4541,7 @@ static int get_struct_type(var_t *field) case RPC_FC_CSTRUCT: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); break; @@ -4246,3 +4618,100 @@ static var_t *find_const(char *name, int f) return cur->var; } +static void write_libid(const char *name, const attr_list_t *attr) +{ + const UUID *uuid = get_attrp(attr, ATTR_UUID); + write_guid(idfile, "LIBID", name, uuid); +} + +static void write_clsid(type_t *cls) +{ + const UUID *uuid = get_attrp(cls->attrs, ATTR_UUID); + write_guid(idfile, "CLSID", cls->name, uuid); +} + +static void write_diid(type_t *iface) +{ + const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + write_guid(idfile, "DIID", iface->name, uuid); +} + +static void write_iid(type_t *iface) +{ + const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + write_guid(idfile, "IID", iface->name, uuid); +} + +static int compute_method_indexes(type_t *iface) +{ + int idx; + func_t *f; + + if (iface->ref) + idx = compute_method_indexes(iface->ref); + else + idx = 0; + + if (!iface->funcs) + return idx; + + LIST_FOR_EACH_ENTRY( f, iface->funcs, func_t, entry ) + if (! is_callas(f->def->attrs)) + f->idx = idx++; + + return idx; +} + +static char *gen_name(void) +{ + static const char format[] = "__WIDL_%s_generated_name_%08lX"; + static unsigned long n = 0; + static const char *file_id; + static size_t size; + char *name; + + if (! file_id) + { + char *dst = dup_basename(input_name, ".idl"); + file_id = dst; + + for (; *dst; ++dst) + if (! isalnum((unsigned char) *dst)) + *dst = '_'; + + size = sizeof format - 7 + strlen(file_id) + 8; + } + + name = xmalloc(size); + sprintf(name, format, file_id, n++); + return name; +} + +static void process_typedefs(pident_list_t *pidents) +{ + pident_t *pident, *next; + + if (!pidents) return; + LIST_FOR_EACH_ENTRY_SAFE( pident, next, pidents, pident_t, entry ) + { + var_t *var = pident->var; + type_t *type = find_type(var->name, 0); + + if (! parse_only && do_header) + write_typedef(type); + if (in_typelib && type->attrs) + add_typelib_entry(type); + + free(pident); + free(var); + } +} + +static void check_arg(var_t *arg) +{ + type_t *t = arg->type; + + if (t->type == 0 && ! is_var_ptr(arg)) + yyerror("argument '%s' has void type", arg->name); +} + diff --git a/reactos/tools/widl/parser.tab.h b/reactos/tools/widl/parser.tab.h index 8c33a70aa9f..6c3ca81b0f4 100644 --- a/reactos/tools/widl/parser.tab.h +++ b/reactos/tools/widl/parser.tab.h @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -162,6 +162,7 @@ NEG = 388 }; #endif +/* Tokens. */ #define aIDENTIFIER 258 #define aKNOWNTYPE 259 #define aNUM 260 @@ -298,27 +299,35 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 109 "parser.y" +#line 122 "tools\\widl_new\\parser.y" typedef union YYSTYPE { attr_t *attr; + attr_list_t *attr_list; + str_list_t *str_list; expr_t *expr; + expr_list_t *expr_list; + array_dims_t *array_dims; type_t *type; - typeref_t *tref; var_t *var; + var_list_t *var_list; + pident_t *pident; + pident_list_t *pident_list; func_t *func; + func_list_t *func_list; ifref_t *ifref; + ifref_list_t *ifref_list; char *str; UUID *uuid; unsigned int num; } YYSTYPE; -/* Line 1248 of yacc.c. */ -#line 315 "parser.tab.h" +/* Line 1447 of yacc.c. */ +#line 325 "tools\\widl_new\\parser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif -extern YYSTYPE yylval; +extern YYSTYPE parser_lval; diff --git a/reactos/tools/widl/parser.y b/reactos/tools/widl/parser.y index b8e1c397a2d..a74aab15ae5 100644 --- a/reactos/tools/widl/parser.y +++ b/reactos/tools/widl/parser.y @@ -64,56 +64,77 @@ # endif #endif +static str_list_t *append_str(str_list_t *list, char *str); +static attr_list_t *append_attr(attr_list_t *list, attr_t *attr); static attr_t *make_attr(enum attr_type type); static attr_t *make_attrv(enum attr_type type, unsigned long val); static attr_t *make_attrp(enum attr_type type, void *val); static expr_t *make_expr(enum expr_type type); static expr_t *make_exprl(enum expr_type type, long val); static expr_t *make_exprs(enum expr_type type, char *val); -static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr); +static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr); static expr_t *make_expr1(enum expr_type type, expr_t *expr); static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2); static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3); static type_t *make_type(unsigned char type, type_t *ref); -static typeref_t *make_tref(char *name, type_t *ref); -static typeref_t *uniq_tref(typeref_t *ref); -static type_t *type_ref(typeref_t *ref); -static void set_type(var_t *v, typeref_t *ref, expr_t *arr); +static expr_list_t *append_expr(expr_list_t *list, expr_t *expr); +static array_dims_t *append_array(array_dims_t *list, expr_t *expr); +static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr); +static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface); static ifref_t *make_ifref(type_t *iface); +static var_list_t *append_var(var_list_t *list, var_t *var); static var_t *make_var(char *name); -static func_t *make_func(var_t *def, var_t *args); +static pident_list_t *append_pident(pident_list_t *list, pident_t *p); +static pident_t *make_pident(var_t *var); +static func_list_t *append_func(func_list_t *list, func_t *func); +static func_t *make_func(var_t *def, var_list_t *args); static type_t *make_class(char *name); -static type_t *make_safearray(void); +static type_t *make_safearray(type_t *type); +static type_t *make_builtin(char *name); +static type_t *make_int(int sign); static type_t *reg_type(type_t *type, const char *name, int t); -static type_t *reg_types(type_t *type, var_t *names, int t); +static type_t *reg_typedefs(type_t *type, var_list_t *names, attr_list_t *attrs); static type_t *find_type(const char *name, int t); static type_t *find_type2(char *name, int t); static type_t *get_type(unsigned char type, char *name, int t); static type_t *get_typev(unsigned char type, var_t *name, int t); -static int get_struct_type(var_t *fields); +static int get_struct_type(var_list_t *fields); static var_t *reg_const(var_t *var); static var_t *find_const(char *name, int f); +static void write_libid(const char *name, const attr_list_t *attr); +static void write_clsid(type_t *cls); +static void write_diid(type_t *iface); +static void write_iid(type_t *iface); + +static int compute_method_indexes(type_t *iface); +static char *gen_name(void); +static void process_typedefs(var_list_t *names); +static void check_arg(var_t *arg); + #define tsENUM 1 #define tsSTRUCT 2 #define tsUNION 3 -static type_t std_bool = { "boolean" }; -static type_t std_int = { "int" }; -static type_t std_int64 = { "__int64" }; -static type_t std_uhyper = { "MIDL_uhyper" }; - %} %union { attr_t *attr; + attr_list_t *attr_list; + str_list_t *str_list; expr_t *expr; + expr_list_t *expr_list; + array_dims_t *array_dims; type_t *type; - typeref_t *tref; var_t *var; + var_list_t *var_list; + pident_t *pident; + pident_list_t *pident_list; func_t *func; + func_list_t *func_list; ifref_t *ifref; + ifref_list_t *ifref_list; char *str; UUID *uuid; unsigned int num; @@ -202,22 +223,27 @@ static type_t std_uhyper = { "MIDL_uhyper" }; %token tVOID %token tWCHAR tWIREMARSHAL -%type m_attributes attributes attrib_list attribute -%type m_exprs /* exprs expr_list */ m_expr expr expr_list_const expr_const -%type array array_list +%type attribute +%type m_attributes attributes attrib_list +%type str_list +%type m_expr expr expr_const +%type m_exprs /* exprs expr_list */ expr_list_const +%type array array_list %type inherit interface interfacehdr interfacedef interfacedec %type dispinterface dispinterfacehdr dispinterfacedef %type module modulehdr moduledef %type base_type int_std -%type enumdef structdef typedef uniondef -%type gbl_statements coclass_ints coclass_int -%type type -%type m_args no_args args arg -%type fields field s_field cases case enums enum_list enum constdef externdef -%type m_ident t_ident ident p_ident pident pident_list -%type dispint_props -%type funcdef int_statements -%type dispint_meths +%type enumdef structdef uniondef +%type type +%type coclass_int +%type gbl_statements coclass_ints +%type arg field s_field case enum constdef externdef +%type m_args no_args args fields cases enums enum_list dispint_props +%type m_ident t_ident ident +%type p_ident pident +%type pident_list +%type funcdef +%type int_statements dispint_meths %type coclass coclasshdr coclassdef %type pointer_type version %type libraryhdr @@ -241,46 +267,48 @@ input: gbl_statements { write_proxies($1); write_client gbl_statements: { $$ = NULL; } | gbl_statements interfacedec { $$ = $1; } - | gbl_statements interfacedef { $$ = make_ifref($2); LINK($$, $1); } + | gbl_statements interfacedef { $$ = append_ifref( $1, make_ifref($2) ); } | gbl_statements coclass ';' { $$ = $1; reg_type($2, $2->name, 0); if (!parse_only && do_header) write_coclass_forward($2); } | gbl_statements coclassdef { $$ = $1; - add_coclass($2); + add_typelib_entry($2); reg_type($2, $2->name, 0); + if (!parse_only && do_header) write_coclass_forward($2); } - | gbl_statements moduledef { $$ = $1; add_module($2); } + | gbl_statements moduledef { $$ = $1; add_typelib_entry($2); } | gbl_statements librarydef { $$ = $1; } | gbl_statements statement { $$ = $1; } ; imp_statements: {} - | imp_statements interfacedec { if (!parse_only) add_interface($2); } - | imp_statements interfacedef { if (!parse_only) add_interface($2); } + | imp_statements interfacedec { if (!parse_only) add_typelib_entry($2); } + | imp_statements interfacedef { if (!parse_only) add_typelib_entry($2); } | imp_statements coclass ';' { reg_type($2, $2->name, 0); if (!parse_only && do_header) write_coclass_forward($2); } - | imp_statements coclassdef { if (!parse_only) add_coclass($2); + | imp_statements coclassdef { if (!parse_only) add_typelib_entry($2); reg_type($2, $2->name, 0); + if (!parse_only && do_header) write_coclass_forward($2); } - | imp_statements moduledef { if (!parse_only) add_module($2); } + | imp_statements moduledef { if (!parse_only) add_typelib_entry($2); } | imp_statements statement {} | imp_statements importlib {} ; int_statements: { $$ = NULL; } - | int_statements funcdef ';' { $$ = $2; LINK($$, $1); } + | int_statements funcdef ';' { $$ = append_func( $1, $2 ); } | int_statements statement { $$ = $1; } ; statement: ';' {} | constdef ';' { if (!parse_only && do_header) { write_constdef($1); } } | cppquote {} - | enumdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | enumdef ';' { if (!parse_only && do_header) { write_type(header, $1); fprintf(header, ";\n\n"); } } | externdef ';' { if (!parse_only && do_header) { write_externdef($1); } } | import {} - | structdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | structdef ';' { if (!parse_only && do_header) { write_type(header, $1); fprintf(header, ";\n\n"); } } | typedef ';' {} - | uniondef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | uniondef ';' { if (!parse_only && do_header) { write_type(header, $1); fprintf(header, ";\n\n"); } } ; cppquote: tCPPQUOTE '(' aSTRING ')' { if (!parse_only && do_header) fprintf(header, "%s\n", $3); } @@ -297,7 +325,9 @@ importlib: tIMPORTLIB '(' aSTRING ')' { if(!parse_only) add_importlib($3); } libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; } ; library_start: attributes libraryhdr '{' { start_typelib($2, $1); - if (!parse_only && do_header) write_library($2, $1); } + if (!parse_only && do_header) write_library($2, $1); + if (!parse_only && do_idfile) write_libid($2, $1); + } ; librarydef: library_start imp_statements '}' { end_typelib(); } ; @@ -309,40 +339,42 @@ m_args: { $$ = NULL; } no_args: tVOID { $$ = NULL; } ; -args: arg - | args ',' arg { LINK($3, $1); $$ = $3; } +args: arg { check_arg($1); $$ = append_var( NULL, $1 ); } + | args ',' arg { check_arg($3); $$ = append_var( $1, $3); } | no_args ; /* split into two rules to get bison to resolve a tVOID conflict */ -arg: attributes type pident array { $$ = $3; - set_type($$, $2, $4); +arg: attributes type pident array { $$ = $3->var; + set_type($$, $2, $3->ptr_level, $4); + free($3); $$->attrs = $1; } - | type pident array { $$ = $2; - set_type($$, $1, $3); + | type pident array { $$ = $2->var; + set_type($$, $1, $2->ptr_level, $3); + free($2); } - | attributes type pident '(' m_args ')' { $$ = $3; - $$->ptr_level--; - set_type($$, $2, NULL); + | attributes type pident '(' m_args ')' { $$ = $3->var; + set_type($$, $2, $3->ptr_level - 1, NULL); + free($3); $$->attrs = $1; $$->args = $5; } - | type pident '(' m_args ')' { $$ = $2; - $$->ptr_level--; - set_type($$, $1, NULL); + | type pident '(' m_args ')' { $$ = $2->var; + set_type($$, $1, $2->ptr_level - 1, NULL); + free($2); $$->args = $4; } ; array: { $$ = NULL; } | '[' array_list ']' { $$ = $2; } - | '[' '*' ']' { $$ = make_expr(EXPR_VOID); } + | '[' '*' ']' { $$ = append_array( NULL, make_expr(EXPR_VOID) ); } ; -array_list: m_expr /* size of first dimension is optional */ - | array_list ',' expr { LINK($3, $1); $$ = $3; } - | array_list ']' '[' expr { LINK($4, $1); $$ = $4; } +array_list: m_expr /* size of first dimension is optional */ { $$ = append_array( NULL, $1 ); } + | array_list ',' expr { $$ = append_array( $1, $3 ); } + | array_list ']' '[' expr { $$ = append_array( $1, $4 ); } ; m_attributes: { $$ = NULL; } @@ -356,13 +388,13 @@ attributes: } ; -attrib_list: attribute - | attrib_list ',' attribute { if ($3) { LINK($3, $1); $$ = $3; } - else { $$ = $1; } - } - | attrib_list ']' '[' attribute { if ($4) { LINK($4, $1); $$ = $4; } - else { $$ = $1; } - } +attrib_list: attribute { $$ = append_attr( NULL, $1 ); } + | attrib_list ',' attribute { $$ = append_attr( $1, $3 ); } + | attrib_list ']' '[' attribute { $$ = append_attr( $1, $4 ); } + ; + +str_list: aSTRING { $$ = append_str( NULL, $1 ); } + | str_list ',' aSTRING { $$ = append_str( $1, $3 ); } ; attribute: { $$ = NULL; } @@ -385,7 +417,7 @@ attribute: { $$ = NULL; } | tDISPLAYBIND { $$ = make_attr(ATTR_DISPLAYBIND); } | tDLLNAME '(' aSTRING ')' { $$ = make_attrp(ATTR_DLLNAME, $3); } | tDUAL { $$ = make_attr(ATTR_DUAL); } - | tENDPOINT '(' aSTRING ')' { $$ = make_attrp(ATTR_ENDPOINT, $3); } + | tENDPOINT '(' str_list ')' { $$ = make_attrp(ATTR_ENDPOINT, $3); } | tENTRY '(' aSTRING ')' { $$ = make_attrp(ATTR_ENTRY_STRING, $3); } | tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY_ORDINAL, $3); } | tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); } @@ -418,7 +450,9 @@ attribute: { $$ = NULL; } | tPROPPUT { $$ = make_attr(ATTR_PROPPUT); } | tPROPPUTREF { $$ = make_attr(ATTR_PROPPUTREF); } | tPUBLIC { $$ = make_attr(ATTR_PUBLIC); } - | tRANGE '(' expr_const ',' expr_const ')' { LINK($5, $3); $$ = make_attrp(ATTR_RANGE, $5); } + | tRANGE '(' expr_const ',' expr_const ')' { expr_list_t *list = append_expr( NULL, $3 ); + list = append_expr( list, $5 ); + $$ = make_attrp(ATTR_RANGE, list); } | tREADONLY { $$ = make_attr(ATTR_READONLY); } | tREQUESTEDIT { $$ = make_attr(ATTR_REQUESTEDIT); } | tRESTRICTED { $$ = make_attr(ATTR_RESTRICTED); } @@ -427,13 +461,13 @@ attribute: { $$ = NULL; } | tSOURCE { $$ = make_attr(ATTR_SOURCE); } | tSTRING { $$ = make_attr(ATTR_STRING); } | tSWITCHIS '(' expr ')' { $$ = make_attrp(ATTR_SWITCHIS, $3); } - | tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, type_ref($3)); } - | tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, type_ref($3)); } + | tSWITCHTYPE '(' type ')' { $$ = make_attrp(ATTR_SWITCHTYPE, $3); } + | tTRANSMITAS '(' type ')' { $$ = make_attrp(ATTR_TRANSMITAS, $3); } | tUUID '(' aUUID ')' { $$ = make_attrp(ATTR_UUID, $3); } | tV1ENUM { $$ = make_attr(ATTR_V1ENUM); } | tVARARG { $$ = make_attr(ATTR_VARARG); } | tVERSION '(' version ')' { $$ = make_attrv(ATTR_VERSION, $3); } - | tWIREMARSHAL '(' type ')' { $$ = make_attrp(ATTR_WIREMARSHAL, type_ref($3)); } + | tWIREMARSHAL '(' type ')' { $$ = make_attrp(ATTR_WIREMARSHAL, $3); } | pointer_type { $$ = make_attrv(ATTR_POINTERTYPE, $1); } ; @@ -442,23 +476,21 @@ callconv: ; cases: { $$ = NULL; } - | cases case { if ($2) { LINK($2, $1); $$ = $2; } - else { $$ = $1; } - } + | cases case { $$ = append_var( $1, $2 ); } ; case: tCASE expr ':' field { attr_t *a = make_attrp(ATTR_CASE, $2); $$ = $4; if (!$$) $$ = make_var(NULL); - LINK(a, $$->attrs); $$->attrs = a; + $$->attrs = append_attr( $$->attrs, a ); } | tDEFAULT ':' field { attr_t *a = make_attr(ATTR_DEFAULT); $$ = $3; if (!$$) $$ = make_var(NULL); - LINK(a, $$->attrs); $$->attrs = a; + $$->attrs = append_attr( $$->attrs, a ); } ; constdef: tCONST type ident '=' expr_const { $$ = reg_const($3); - set_type($$, $2, NULL); + set_type($$, $2, 0, NULL); $$->eval = $5; } ; @@ -468,34 +500,39 @@ enums: { $$ = NULL; } | enum_list ; -enum_list: enum { if (!$$->eval) - $$->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); +enum_list: enum { if (!$1->eval) + $1->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); + $$ = append_var( NULL, $1 ); } - | enum_list ',' enum { LINK($3, $1); $$ = $3; - if (!$$->eval) - $$->eval = make_exprl(EXPR_NUM, $1->eval->cval + 1); + | enum_list ',' enum { if (!$3->eval) + { + var_t *last = LIST_ENTRY( list_tail($$), var_t, entry ); + $3->eval = make_exprl(EXPR_NUM, last->eval->cval + 1); + } + $$ = append_var( $1, $3 ); } ; enum: ident '=' expr_const { $$ = reg_const($1); $$->eval = $3; - $$->type = make_type(RPC_FC_LONG, &std_int); + $$->type = make_int(0); } | ident { $$ = reg_const($1); - $$->type = make_type(RPC_FC_LONG, &std_int); + $$->type = make_int(0); } ; enumdef: tENUM t_ident '{' enums '}' { $$ = get_typev(RPC_FC_ENUM16, $2, tsENUM); + $$->kind = TKIND_ENUM; $$->fields = $4; $$->defined = TRUE; if(in_typelib) - add_enum($$); + add_typelib_entry($$); } ; -m_exprs: m_expr - | m_exprs ',' m_expr { LINK($3, $1); $$ = $3; } +m_exprs: m_expr { $$ = append_expr( NULL, $1 ); } + | m_exprs ',' m_expr { $$ = append_expr( $1, $3 ); } ; /* @@ -534,8 +571,8 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); } | '(' expr ')' { $$ = $2; } ; -expr_list_const: expr_const - | expr_list_const ',' expr_const { LINK($3, $1); $$ = $3; } +expr_list_const: expr_const { $$ = append_expr( NULL, $1 ); } + | expr_list_const ',' expr_const { $$ = append_expr( $1, $3 ); } ; expr_const: expr { $$ = $1; @@ -545,14 +582,12 @@ expr_const: expr { $$ = $1; ; externdef: tEXTERN tCONST type ident { $$ = $4; - set_type($$, $3, NULL); + set_type($$, $3, 0, NULL); } ; fields: { $$ = NULL; } - | fields field { if ($2) { LINK($2, $1); $$ = $2; } - else { $$ = $1; } - } + | fields field { $$ = append_var( $1, $2 ); } ; field: s_field ';' { $$ = $1; } @@ -561,15 +596,21 @@ field: s_field ';' { $$ = $1; } | ';' { $$ = NULL; } ; -s_field: m_attributes type pident array { $$ = $3; set_type($$, $2, $4); $$->attrs = $1; } +s_field: m_attributes type pident array { $$ = $3->var; + set_type($$, $2, $3->ptr_level, $4); + free($3); + $$->attrs = $1; + } ; funcdef: m_attributes type callconv pident - '(' m_args ')' { set_type($4, $2, NULL); - $4->attrs = $1; - $$ = make_func($4, $6); - if (is_attr($4->attrs, ATTR_IN)) { + '(' m_args ')' { var_t *v = $4->var; + set_type(v, $2, $4->ptr_level, NULL); + free($4); + v->attrs = $1; + $$ = make_func(v, $6); + if (is_attr(v->attrs, ATTR_IN)) { yyerror("inapplicable attribute [in] for function '%s'",$$->def->name); } } @@ -587,18 +628,10 @@ t_ident: { $$ = NULL; } ident: aIDENTIFIER { $$ = make_var($1); } /* some "reserved words" used in attributes are also used as field names in some MS IDL files */ | aKNOWNTYPE { $$ = make_var($1); } - | tASYNC { $$ = make_var($1); } - | tID { $$ = make_var($1); } - | tLCID { $$ = make_var($1); } - | tOBJECT { $$ = make_var($1); } - | tRANGE { $$ = make_var($1); } - | tRETVAL { $$ = make_var($1); } - | tUUID { $$ = make_var($1); } - | tVERSION { $$ = make_var($1); } ; -base_type: tBYTE { $$ = make_type(RPC_FC_BYTE, NULL); } - | tWCHAR { $$ = make_type(RPC_FC_WCHAR, NULL); } +base_type: tBYTE { $$ = make_builtin($1); } + | tWCHAR { $$ = make_builtin($1); } | int_std | tSIGNED int_std { $$ = $2; $$->sign = 1; } | tUNSIGNED int_std { $$ = $2; $$->sign = -1; @@ -608,31 +641,35 @@ base_type: tBYTE { $$ = make_type(RPC_FC_BYTE, NULL); } case RPC_FC_SHORT: $$->type = RPC_FC_USHORT; break; case RPC_FC_LONG: $$->type = RPC_FC_ULONG; break; case RPC_FC_HYPER: - if (!$$->ref) { $$->ref = &std_uhyper; $$->sign = 0; } + if ($$->name[0] == 'h') /* hyper, as opposed to __int64 */ + { + $$ = alias($$, "MIDL_uhyper"); + $$->sign = 0; + } break; default: break; } } - | tUNSIGNED { $$ = make_type(RPC_FC_ULONG, &std_int); $$->sign = -1; } - | tFLOAT { $$ = make_type(RPC_FC_FLOAT, NULL); } - | tSINGLE { $$ = make_type(RPC_FC_FLOAT, NULL); } - | tDOUBLE { $$ = make_type(RPC_FC_DOUBLE, NULL); } - | tBOOLEAN { $$ = make_type(RPC_FC_BYTE, &std_bool); /* ? */ } - | tERRORSTATUST { $$ = make_type(RPC_FC_ERROR_STATUS_T, NULL); } - | tHANDLET { $$ = make_type(RPC_FC_BIND_PRIMITIVE, NULL); /* ? */ } + | tUNSIGNED { $$ = make_int(-1); } + | tFLOAT { $$ = make_builtin($1); } + | tSINGLE { $$ = duptype(find_type("float", 0), 1); } + | tDOUBLE { $$ = make_builtin($1); } + | tBOOLEAN { $$ = make_builtin($1); } + | tERRORSTATUST { $$ = make_builtin($1); } + | tHANDLET { $$ = make_builtin($1); } ; m_int: | tINT ; -int_std: tINT { $$ = make_type(RPC_FC_LONG, &std_int); } /* win32 only */ - | tSHORT m_int { $$ = make_type(RPC_FC_SHORT, NULL); } - | tSMALL { $$ = make_type(RPC_FC_SMALL, NULL); } - | tLONG m_int { $$ = make_type(RPC_FC_LONG, NULL); } - | tHYPER m_int { $$ = make_type(RPC_FC_HYPER, NULL); } - | tINT64 { $$ = make_type(RPC_FC_HYPER, &std_int64); } - | tCHAR { $$ = make_type(RPC_FC_CHAR, NULL); } +int_std: tINT { $$ = make_builtin($1); } + | tSHORT m_int { $$ = make_builtin($1); } + | tSMALL { $$ = make_builtin($1); } + | tLONG m_int { $$ = make_builtin($1); } + | tHYPER m_int { $$ = make_builtin($1); } + | tINT64 { $$ = make_builtin($1); } + | tCHAR { $$ = make_builtin($1); } ; coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); } @@ -646,32 +683,34 @@ coclasshdr: attributes coclass { $$ = $2; $$->attrs = $1; if (!parse_only && do_header) write_coclass($$); + if (!parse_only && do_idfile) + write_clsid($$); } ; coclassdef: coclasshdr '{' coclass_ints '}' { $$ = $1; $$->ifaces = $3; + $$->defined = TRUE; } ; coclass_ints: { $$ = NULL; } - | coclass_ints coclass_int { LINK($2, $1); $$ = $2; } + | coclass_ints coclass_int { $$ = append_ifref( $1, $2 ); } ; coclass_int: m_attributes interfacedec { $$ = make_ifref($2); $$->attrs = $1; } ; -dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(0, $2, 0); } - | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(0, $2, 0); } +dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(0, $2, 0); $$->kind = TKIND_DISPATCH; } + | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(0, $2, 0); $$->kind = TKIND_DISPATCH; } ; dispinterfacehdr: attributes dispinterface { attr_t *attrs; $$ = $2; if ($$->defined) yyerror("multiple definition error"); attrs = make_attr(ATTR_DISPINTERFACE); - LINK(attrs, $1); - $$->attrs = attrs; + $$->attrs = append_attr( $1, attrs ); $$->ref = find_type("IDispatch", 0); if (!$$->ref) yyerror("IDispatch is undefined"); $$->defined = TRUE; @@ -680,11 +719,11 @@ dispinterfacehdr: attributes dispinterface { attr_t *attrs; ; dispint_props: tPROPERTIES ':' { $$ = NULL; } - | dispint_props s_field ';' { LINK($2, $1); $$ = $2; } + | dispint_props s_field ';' { $$ = append_var( $1, $2 ); } ; dispint_meths: tMETHODS ':' { $$ = NULL; } - | dispint_meths funcdef ';' { LINK($2, $1); $$ = $2; } + | dispint_meths funcdef ';' { $$ = append_func( $1, $2 ); } ; dispinterfacedef: dispinterfacehdr '{' @@ -694,20 +733,23 @@ dispinterfacedef: dispinterfacehdr '{' $$->fields = $3; $$->funcs = $4; if (!parse_only && do_header) write_dispinterface($$); + if (!parse_only && do_idfile) write_diid($$); } -/* FIXME: not sure how to handle this yet - | dispinterfacehdr '{' interface '}' { $$ = $1; - if (!parse_only && do_header) write_interface($$); + | dispinterfacehdr + '{' interface ';' '}' { $$ = $1; + $$->fields = $3->fields; + $$->funcs = $3->funcs; + if (!parse_only && do_header) write_dispinterface($$); + if (!parse_only && do_idfile) write_diid($$); } -*/ ; inherit: { $$ = NULL; } | ':' aKNOWNTYPE { $$ = find_type2($2, 0); } ; -interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); } - | tINTERFACE aKNOWNTYPE { $$ = get_type(RPC_FC_IP, $2, 0); } +interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; } + | tINTERFACE aKNOWNTYPE { $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; } ; interfacehdr: attributes interface { $$ = $2; @@ -722,7 +764,9 @@ interfacedef: interfacehdr inherit '{' int_statements '}' { $$ = $1; $$->ref = $2; $$->funcs = $4; + compute_method_indexes($$); if (!parse_only && do_header) write_interface($$); + if (!parse_only && do_idfile) write_iid($$); } /* MIDL is able to import the definition of a base class from inside the * definition of a derived class, I'll try to support it with this rule */ @@ -731,7 +775,9 @@ interfacedef: interfacehdr inherit $$->ref = find_type2($3, 0); if (!$$->ref) yyerror("base class '%s' not found in import", $3); $$->funcs = $6; + compute_method_indexes($$); if (!parse_only && do_header) write_interface($$); + if (!parse_only && do_idfile) write_iid($$); } | dispinterfacedef { $$ = $1; } ; @@ -741,8 +787,8 @@ interfacedec: | dispinterface ';' { $$ = $1; if (!parse_only && do_header) write_forward($$); } ; -module: tMODULE aIDENTIFIER { $$ = make_type(0, NULL); $$->name = $2; } - | tMODULE aKNOWNTYPE { $$ = make_type(0, NULL); $$->name = $2; } +module: tMODULE aIDENTIFIER { $$ = make_type(0, NULL); $$->name = $2; $$->kind = TKIND_MODULE; } + | tMODULE aKNOWNTYPE { $$ = make_type(0, NULL); $$->name = $2; $$->kind = TKIND_MODULE; } ; modulehdr: attributes module { $$ = $2; @@ -760,14 +806,14 @@ p_ident: '*' pident %prec PPTR { $$ = $2; $$->ptr_level++; } | tCONST p_ident { $$ = $2; /* FIXME */ } ; -pident: ident +pident: ident { $$ = make_pident($1); } | p_ident | '(' pident ')' { $$ = $2; } ; pident_list: - pident - | pident_list ',' pident { LINK($3, $1); $$ = $3; } + pident { $$ = append_pident( NULL, $1 ); } + | pident_list ',' pident { $$ = append_pident( $1, $3 ); } ; pointer_type: @@ -779,40 +825,34 @@ pointer_type: structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, tsSTRUCT); /* overwrite RPC_FC_STRUCT with a more exact type */ $$->type = get_struct_type( $4 ); + $$->kind = TKIND_RECORD; $$->fields = $4; $$->defined = TRUE; if(in_typelib) - add_struct($$); + add_typelib_entry($$); } ; -type: tVOID { $$ = make_tref(NULL, make_type(0, NULL)); } - | aKNOWNTYPE { $$ = make_tref($1, find_type($1, 0)); } - | base_type { $$ = make_tref(NULL, $1); } - | tCONST type { $$ = uniq_tref($2); $$->ref->is_const = TRUE; } - | enumdef { $$ = make_tref(NULL, $1); } - | tENUM aIDENTIFIER { $$ = make_tref(NULL, find_type2($2, tsENUM)); } - | structdef { $$ = make_tref(NULL, $1); } - | tSTRUCT aIDENTIFIER { $$ = make_tref(NULL, get_type(RPC_FC_STRUCT, $2, tsSTRUCT)); } - | uniondef { $$ = make_tref(NULL, $1); } - | tUNION aIDENTIFIER { $$ = make_tref(NULL, find_type2($2, tsUNION)); } - | tSAFEARRAY '(' type ')' { $$ = make_tref(NULL, make_safearray()); } +type: tVOID { $$ = duptype(find_type("void", 0), 1); } + | aKNOWNTYPE { $$ = find_type($1, 0); } + | base_type { $$ = $1; } + | tCONST type { $$ = duptype($2, 1); $$->is_const = TRUE; } + | enumdef { $$ = $1; } + | tENUM aIDENTIFIER { $$ = find_type2($2, tsENUM); } + | structdef { $$ = $1; } + | tSTRUCT aIDENTIFIER { $$ = get_type(RPC_FC_STRUCT, $2, tsSTRUCT); } + | uniondef { $$ = $1; } + | tUNION aIDENTIFIER { $$ = find_type2($2, tsUNION); } + | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); } ; -typedef: tTYPEDEF m_attributes type pident_list { typeref_t *tref = uniq_tref($3); - $4->tname = tref->name; - tref->name = NULL; - $$ = type_ref(tref); - $$->attrs = $2; - if (!parse_only && do_header) - write_typedef($$, $4); - if (in_typelib && $$->attrs) - add_typedef($$, $4); - reg_types($$, $4, 0); +typedef: tTYPEDEF m_attributes type pident_list { reg_typedefs($3, $4, $2); + process_typedefs($4); } ; uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, $2, tsUNION); + $$->kind = TKIND_UNION; $$->fields = $4; $$->defined = TRUE; } @@ -820,11 +860,14 @@ uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATE tSWITCH '(' s_field ')' m_ident '{' cases '}' { var_t *u = $7; $$ = get_typev(RPC_FC_ENCAPSULATED_UNION, $2, tsUNION); - if (!u) u = make_var("tagged_union"); + $$->kind = TKIND_UNION; + if (!u) u = make_var( xstrdup("tagged_union") ); u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); + u->type->kind = TKIND_UNION; u->type->fields = $9; u->type->defined = TRUE; - LINK(u, $5); $$->fields = u; + $$->fields = append_var( $$->fields, $5 ); + $$->fields = append_var( $$->fields, u ); $$->defined = TRUE; } ; @@ -836,12 +879,84 @@ version: %% +static void decl_builtin(const char *name, unsigned char type) +{ + type_t *t = make_type(type, NULL); + t->name = xstrdup(name); + reg_type(t, name, 0); +} + +static type_t *make_builtin(char *name) +{ + /* NAME is strdup'd in the lexer */ + type_t *t = duptype(find_type(name, 0), 0); + t->name = name; + return t; +} + +static type_t *make_int(int sign) +{ + type_t *t = duptype(find_type("int", 0), 1); + + t->sign = sign; + if (sign < 0) + t->type = t->type == RPC_FC_LONG ? RPC_FC_ULONG : RPC_FC_USHORT; + + return t; +} + +void init_types(void) +{ + decl_builtin("void", 0); + decl_builtin("byte", RPC_FC_BYTE); + decl_builtin("wchar_t", RPC_FC_WCHAR); + decl_builtin("int", RPC_FC_LONG); /* win32 */ + decl_builtin("short", RPC_FC_SHORT); + decl_builtin("small", RPC_FC_SMALL); + decl_builtin("long", RPC_FC_LONG); + decl_builtin("hyper", RPC_FC_HYPER); + decl_builtin("__int64", RPC_FC_HYPER); + decl_builtin("char", RPC_FC_CHAR); + decl_builtin("float", RPC_FC_FLOAT); + decl_builtin("double", RPC_FC_DOUBLE); + decl_builtin("boolean", RPC_FC_BYTE); + decl_builtin("error_status_t", RPC_FC_ERROR_STATUS_T); + decl_builtin("handle_t", RPC_FC_BIND_PRIMITIVE); +} + +static str_list_t *append_str(str_list_t *list, char *str) +{ + struct str_list_entry_t *entry; + + if (!str) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + entry = xmalloc( sizeof(*entry) ); + entry->str = str; + list_add_tail( list, &entry->entry ); + return list; +} + +static attr_list_t *append_attr(attr_list_t *list, attr_t *attr) +{ + if (!attr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &attr->entry ); + return list; +} + static attr_t *make_attr(enum attr_type type) { attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.ival = 0; - INIT_LINK(a); return a; } @@ -850,7 +965,6 @@ static attr_t *make_attrv(enum attr_type type, unsigned long val) attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.ival = val; - INIT_LINK(a); return a; } @@ -859,7 +973,6 @@ static attr_t *make_attrp(enum attr_type type, void *val) attr_t *a = xmalloc(sizeof(attr_t)); a->type = type; a->u.pval = val; - INIT_LINK(a); return a; } @@ -870,7 +983,6 @@ static expr_t *make_expr(enum expr_type type) e->ref = NULL; e->u.lval = 0; e->is_const = FALSE; - INIT_LINK(e); return e; } @@ -881,7 +993,6 @@ static expr_t *make_exprl(enum expr_type type, long val) e->ref = NULL; e->u.lval = val; e->is_const = FALSE; - INIT_LINK(e); /* check for numeric constant */ if (type == EXPR_NUM || type == EXPR_HEXNUM || type == EXPR_TRUEFALSE) { /* make sure true/false value is valid */ @@ -900,7 +1011,6 @@ static expr_t *make_exprs(enum expr_type type, char *val) e->ref = NULL; e->u.sval = val; e->is_const = FALSE; - INIT_LINK(e); /* check for predefined constants */ if (type == EXPR_IDENTIFIER) { var_t *c = find_const(val, 0); @@ -914,7 +1024,7 @@ static expr_t *make_exprs(enum expr_type type, char *val) return e; } -static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr) +static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr) { expr_t *e; e = xmalloc(sizeof(expr_t)); @@ -922,10 +1032,9 @@ static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr) e->ref = expr; e->u.tref = tref; e->is_const = FALSE; - INIT_LINK(e); /* check for cast of constant expression */ if (type == EXPR_SIZEOF) { - switch (tref->ref->type) { + switch (tref->type) { case RPC_FC_BYTE: case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -968,7 +1077,6 @@ static expr_t *make_expr1(enum expr_type type, expr_t *expr) e->ref = expr; e->u.lval = 0; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr->is_const) { e->is_const = TRUE; @@ -995,7 +1103,6 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2) e->ref = expr1; e->u.ext = expr2; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr1->is_const && expr2->is_const) { e->is_const = TRUE; @@ -1041,7 +1148,6 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp e->u.ext = expr2; e->ext2 = expr3; e->is_const = FALSE; - INIT_LINK(e); /* check for compile-time optimization */ if (expr1->is_const && expr2->is_const && expr3->is_const) { e->is_const = TRUE; @@ -1057,6 +1163,30 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp return e; } +static expr_list_t *append_expr(expr_list_t *list, expr_t *expr) +{ + if (!expr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &expr->entry ); + return list; +} + +static array_dims_t *append_array(array_dims_t *list, expr_t *expr) +{ + if (!expr) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &expr->entry ); + return list; +} + static type_t *make_type(unsigned char type, type_t *ref) { type_t *t = xmalloc(sizeof(type_t)); @@ -1065,56 +1195,40 @@ static type_t *make_type(unsigned char type, type_t *ref) t->type = type; t->ref = ref; t->attrs = NULL; + t->orig = NULL; t->funcs = NULL; t->fields = NULL; t->ifaces = NULL; + t->typestring_offset = 0; t->ignore = parse_only; t->is_const = FALSE; t->sign = 0; t->defined = FALSE; t->written = FALSE; + t->user_types_registered = FALSE; t->typelib_idx = -1; - INIT_LINK(t); return t; } -static typeref_t *make_tref(char *name, type_t *ref) +static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr) { - typeref_t *t = xmalloc(sizeof(typeref_t)); - t->name = name; - t->ref = ref; - t->uniq = ref ? 0 : 1; - return t; -} - -static typeref_t *uniq_tref(typeref_t *ref) -{ - typeref_t *t = ref; - type_t *tp; - if (t->uniq) return t; - tp = make_type(0, t->ref); - tp->name = t->name; - t->name = NULL; - t->ref = tp; - t->uniq = 1; - return t; -} - -static type_t *type_ref(typeref_t *ref) -{ - type_t *t = ref->ref; - if (ref->name) free(ref->name); - free(ref); - return t; -} - -static void set_type(var_t *v, typeref_t *ref, expr_t *arr) -{ - v->type = ref->ref; - v->tname = ref->name; - ref->name = NULL; - free(ref); + v->type = type; v->array = arr; + + for ( ; 0 < ptr_level; --ptr_level) + v->type = make_type(RPC_FC_RP, v->type); +} + +static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface) +{ + if (!iface) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &iface->entry ); + return list; } static ifref_t *make_ifref(type_t *iface) @@ -1122,32 +1236,71 @@ static ifref_t *make_ifref(type_t *iface) ifref_t *l = xmalloc(sizeof(ifref_t)); l->iface = iface; l->attrs = NULL; - INIT_LINK(l); return l; } +static var_list_t *append_var(var_list_t *list, var_t *var) +{ + if (!var) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &var->entry ); + return list; +} + static var_t *make_var(char *name) { var_t *v = xmalloc(sizeof(var_t)); v->name = name; - v->ptr_level = 0; v->type = NULL; - v->tname = NULL; + v->args = NULL; v->attrs = NULL; v->array = NULL; v->eval = NULL; - INIT_LINK(v); return v; } -static func_t *make_func(var_t *def, var_t *args) +static pident_list_t *append_pident(pident_list_t *list, pident_t *p) +{ + if (!p) return list; + if (!list) { + list = xmalloc(sizeof(*list)); + list_init(list); + } + list_add_tail(list, &p->entry); + return list; +} + +static pident_t *make_pident(var_t *var) +{ + pident_t *p = xmalloc(sizeof(*p)); + p->var = var; + p->ptr_level = 0; + return p; +} + +static func_list_t *append_func(func_list_t *list, func_t *func) +{ + if (!func) return list; + if (!list) + { + list = xmalloc( sizeof(*list) ); + list_init( list ); + } + list_add_tail( list, &func->entry ); + return list; +} + +static func_t *make_func(var_t *def, var_list_t *args) { func_t *f = xmalloc(sizeof(func_t)); f->def = def; f->args = args; f->ignore = parse_only; f->idx = -1; - INIT_LINK(f); return f; } @@ -1156,13 +1309,14 @@ static type_t *make_class(char *name) type_t *c = make_type(0, NULL); c->name = name; c->kind = TKIND_COCLASS; - INIT_LINK(c); return c; } -static type_t *make_safearray(void) +static type_t *make_safearray(type_t *type) { - return make_type(RPC_FC_FP, find_type("SAFEARRAY", 0)); + type_t *sa = duptype(find_type("SAFEARRAY", 0), 1); + sa->ref = type; + return make_type(RPC_FC_FP, sa); } #define HASHMAX 64 @@ -1208,42 +1362,53 @@ static type_t *reg_type(type_t *type, const char *name, int t) return type; } -/* determine pointer type from attrs */ -static unsigned char get_pointer_type( type_t *type ) -{ - int t; - if (is_attr( type->attrs, ATTR_STRING )) - { - type_t *t = type; - while( t->type == 0 && t->ref ) - t = t->ref; - switch( t->type ) - { - case RPC_FC_CHAR: - return RPC_FC_C_CSTRING; - case RPC_FC_WCHAR: - return RPC_FC_C_WSTRING; - } - } - t = get_attrv( type->attrs, ATTR_POINTERTYPE ); - if (t) return t; - return RPC_FC_FP; -} - -static type_t *reg_types(type_t *type, var_t *names, int t) +static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *attrs) { type_t *ptr = type; + const pident_t *pident; int ptrc = 0; + int is_str = is_attr(attrs, ATTR_STRING); + unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE); - while (names) { - var_t *next = NEXT_LINK(names); - if (names->name) { + if (is_str) + { + type_t *t = type; + unsigned char c; + + while (is_ptr(t)) + t = t->ref; + + c = t->type; + if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR) + { + pident = LIST_ENTRY( list_head( pidents ), const pident_t, entry ); + yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays", + pident->var->name); + } + } + + /* We must generate names for tagless enum, struct or union. + Typedef-ing a tagless enum, struct or union means we want the typedef + to be included in a library whether it has other attributes or not, + hence the public attribute. */ + if ((type->kind == TKIND_ENUM || type->kind == TKIND_RECORD + || type->kind == TKIND_UNION) && ! type->name && ! parse_only) + { + if (! is_attr(attrs, ATTR_PUBLIC)) + attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) ); + type->name = gen_name(); + } + + LIST_FOR_EACH_ENTRY( pident, pidents, const pident_t, entry ) + { + var_t *name = pident->var; + + if (name->name) { type_t *cur = ptr; - int cptr = names->ptr_level; + int cptr = pident->ptr_level; if (cptr > ptrc) { while (cptr > ptrc) { - int t = get_pointer_type( cur ); - cur = ptr = make_type(t, cur); + cur = ptr = make_type(RPC_FC_RP, cur); ptrc++; } } else { @@ -1252,10 +1417,22 @@ static type_t *reg_types(type_t *type, var_t *names, int t) cptr++; } } - reg_type(cur, names->name, t); + cur = alias(cur, name->name); + cur->attrs = attrs; + if (ptr_type) + { + if (is_ptr(cur)) + cur->type = ptr_type; + else + yyerror("'%s': pointer attribute applied to non-pointer type", + cur->name); + } + else if (is_str && ! is_ptr(cur)) + yyerror("'%s': [string] attribute applied to non-pointer type", + cur->name); + + reg_type(cur, cur->name, 0); } - free(names); - names = next; } return type; } @@ -1317,39 +1494,36 @@ static type_t *get_typev(unsigned char type, var_t *name, int t) return get_type(type, sname, t); } -static int get_struct_type(var_t *field) +static int get_struct_type(var_list_t *fields) { int has_pointer = 0; int has_conformance = 0; int has_variance = 0; + var_t *field; - for (; field; field = NEXT_LINK(field)) + if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry ) { type_t *t = field->type; - /* get the base type */ - while( (t->type == 0) && t->ref ) - t = t->ref; - - if (field->ptr_level > 0) + if (is_ptr(field->type)) { has_pointer = 1; continue; } - if (is_string_type(field->attrs, 0, field->array)) + if (is_string_type(field->attrs, field->type, field->array)) { has_conformance = 1; has_variance = 1; continue; } - if (is_array_type(field->attrs, 0, field->array)) + if (is_array_type(field->attrs, field->type, field->array)) { - if (field->array && !field->array->is_const) + if (field->array && is_conformant_array(field->array)) { has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); } @@ -1385,21 +1559,18 @@ static int get_struct_type(var_t *field) case RPC_FC_ENUM32: break; + case RPC_FC_RP: case RPC_FC_UP: case RPC_FC_FP: + case RPC_FC_OP: has_pointer = 1; break; case RPC_FC_CARRAY: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - has_conformance = 1; - has_variance = 1; - break; /* * Propagate member attributes @@ -1413,7 +1584,7 @@ static int get_struct_type(var_t *field) case RPC_FC_CPSTRUCT: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); has_pointer = 1; @@ -1421,7 +1592,7 @@ static int get_struct_type(var_t *field) case RPC_FC_CSTRUCT: has_conformance = 1; - if (PREV_LINK(field)) + if (list_next( fields, &field->entry )) yyerror("field '%s' deriving from a conformant array must be the last field in the structure", field->name); break; @@ -1497,3 +1668,100 @@ static var_t *find_const(char *name, int f) } return cur->var; } + +static void write_libid(const char *name, const attr_list_t *attr) +{ + const UUID *uuid = get_attrp(attr, ATTR_UUID); + write_guid(idfile, "LIBID", name, uuid); +} + +static void write_clsid(type_t *cls) +{ + const UUID *uuid = get_attrp(cls->attrs, ATTR_UUID); + write_guid(idfile, "CLSID", cls->name, uuid); +} + +static void write_diid(type_t *iface) +{ + const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + write_guid(idfile, "DIID", iface->name, uuid); +} + +static void write_iid(type_t *iface) +{ + const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + write_guid(idfile, "IID", iface->name, uuid); +} + +static int compute_method_indexes(type_t *iface) +{ + int idx; + func_t *f; + + if (iface->ref) + idx = compute_method_indexes(iface->ref); + else + idx = 0; + + if (!iface->funcs) + return idx; + + LIST_FOR_EACH_ENTRY( f, iface->funcs, func_t, entry ) + if (! is_callas(f->def->attrs)) + f->idx = idx++; + + return idx; +} + +static char *gen_name(void) +{ + static const char format[] = "__WIDL_%s_generated_name_%08lX"; + static unsigned long n = 0; + static const char *file_id; + static size_t size; + char *name; + + if (! file_id) + { + char *dst = dup_basename(input_name, ".idl"); + file_id = dst; + + for (; *dst; ++dst) + if (! isalnum((unsigned char) *dst)) + *dst = '_'; + + size = sizeof format - 7 + strlen(file_id) + 8; + } + + name = xmalloc(size); + sprintf(name, format, file_id, n++); + return name; +} + +static void process_typedefs(pident_list_t *pidents) +{ + pident_t *pident, *next; + + if (!pidents) return; + LIST_FOR_EACH_ENTRY_SAFE( pident, next, pidents, pident_t, entry ) + { + var_t *var = pident->var; + type_t *type = find_type(var->name, 0); + + if (! parse_only && do_header) + write_typedef(type); + if (in_typelib && type->attrs) + add_typelib_entry(type); + + free(pident); + free(var); + } +} + +static void check_arg(var_t *arg) +{ + type_t *t = arg->type; + + if (t->type == 0 && ! is_var_ptr(arg)) + yyerror("argument '%s' has void type", arg->name); +} diff --git a/reactos/tools/widl/proxy.c b/reactos/tools/widl/proxy.c index 1710cdcadb7..933792a21c3 100644 --- a/reactos/tools/widl/proxy.c +++ b/reactos/tools/widl/proxy.c @@ -36,6 +36,7 @@ #include "utils.h" #include "parser.h" #include "header.h" +#include "typegen.h" #define END_OF_LIST(list) \ do { \ @@ -56,103 +57,58 @@ static int print_proxy( const char *format, ... ) int i, r; va_start( va, format ); - for( i=0; itype; - while( (t->type == 0) && t->ref ) - t = t->ref; - return t; -} - static void write_stubdescproto(void) { - print_proxy( "extern const MIDL_STUB_DESC Object_StubDesc;\n"); + print_proxy( "static const MIDL_STUB_DESC Object_StubDesc;\n"); print_proxy( "\n"); } static void write_stubdesc(void) { - print_proxy( "const MIDL_STUB_DESC Object_StubDesc = {\n"); - print_proxy( " 0,\n"); - print_proxy( " NdrOleAllocate,\n"); - print_proxy( " NdrOleFree,\n"); - print_proxy( " {0}, 0, 0, 0, 0,\n"); - print_proxy( " 0 /* __MIDL_TypeFormatString.Format */\n"); - print_proxy( "};\n"); - print_proxy( "\n"); -} - -static void write_formatdesc( const char *str ) -{ - print_proxy( "typedef struct _MIDL_%s_FORMAT_STRING\n", str ); - indent++; - print_proxy( "{\n"); - print_proxy( "short Pad;\n"); - print_proxy( "unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str); - indent--; - print_proxy( "} MIDL_%s_FORMAT_STRING;\n", str); - print_proxy( "\n"); -} - -static void write_formatstringsdecl(void) -{ - print_proxy( "#define TYPE_FORMAT_STRING_SIZE %d\n",1); /* FIXME */ - print_proxy( "#define PROC_FORMAT_STRING_SIZE %d\n",1); /* FIXME */ - fprintf(proxy, "\n"); - write_formatdesc( "TYPE" ); - write_formatdesc( "PROC" ); - fprintf(proxy, "\n"); - print_proxy( "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n"); - print_proxy( "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n"); - print_proxy( "\n"); -} - -static void write_formatstring( int proc ) -{ - const char *t, *n; - if( !proc ) - { - t = "TYPE"; - n = "Type"; - } - else - { - t = "PROC"; - n = "Proc"; - } - print_proxy( "static const MIDL_%s_FORMAT_STRING __MIDL_%sFormatString =\n", t, n); - print_proxy( "{\n"); + print_proxy( "static const MIDL_STUB_DESC Object_StubDesc =\n{\n"); indent++; print_proxy( "0,\n"); - print_proxy( "{\n"); - indent++; - print_proxy( "0\n"); - indent--; - print_proxy( "}\n"); + print_proxy( "NdrOleAllocate,\n"); + print_proxy( "NdrOleFree,\n"); + print_proxy( "{0}, 0, 0, 0, 0,\n"); + print_proxy( "__MIDL_TypeFormatString.Format,\n"); + print_proxy( "1, /* -error bounds_check flag */\n"); + print_proxy( "0x10001, /* Ndr library version */\n"); + print_proxy( "0,\n"); + print_proxy( "0x50100a4, /* MIDL Version 5.1.164 */\n"); + print_proxy( "0,\n"); + print_proxy( "0,\n"); + print_proxy( "0, /* notify & notify_flag routine table */\n"); + print_proxy( "1, /* Flags */\n"); + print_proxy( "0, /* Reserved3 */\n"); + print_proxy( "0, /* Reserved4 */\n"); + print_proxy( "0 /* Reserved5 */\n"); indent--; print_proxy( "};\n"); print_proxy( "\n"); } -static void init_proxy(void) +static void init_proxy(ifref_list_t *ifaces) { if (proxy) return; if(!(proxy = fopen(proxy_name, "w"))) error("Could not open %s for output\n", proxy_name); - print_proxy( "/*** Autogenerated by WIDL %s - Do not edit ***/\n", WIDL_FULLVERSION); + print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name); print_proxy( "\n"); print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n"); print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ 440\n"); print_proxy( "#endif /* __REDQ_RPCPROXY_H_VERSION__ */\n"); print_proxy( "\n"); + print_proxy( "#define __midl_proxy\n"); + print_proxy( "#include \"objbase.h\"\n"); print_proxy( "#include \"rpcproxy.h\"\n"); print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n"); print_proxy( "#error This code needs a newer version of rpcproxy.h\n"); @@ -160,349 +116,102 @@ static void init_proxy(void) print_proxy( "\n"); print_proxy( "#include \"%s\"\n", header_name); print_proxy( "\n"); - write_formatstringsdecl(); + write_formatstringsdecl(proxy, indent, ifaces, 1); write_stubdescproto(); } -static void clear_output_vars( var_t *arg ) +static void clear_output_vars( const var_list_t *args ) { - END_OF_LIST(arg); - while (arg) { + const var_t *arg; + + if (!args) return; + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + { if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) { print_proxy( "if(%s)\n", arg->name ); indent++; - print_proxy( "MIDL_memset( %s, 0, sizeof( ", arg->name ); + print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name ); indent--; - write_type(proxy, arg->type, arg, arg->tname); - fprintf( proxy, " ));\n" ); } - arg = PREV_LINK(arg); } } -static int is_pointer(var_t *arg) +int is_var_ptr(const var_t *v) { - if (arg->ptr_level) - return 1; - if (arg->type->type == RPC_FC_FP ) - return 1; - return 0; + return is_ptr(v->type); } -static void proxy_check_pointers( var_t *arg ) +int cant_be_null(const var_t *v) { - END_OF_LIST(arg); - while (arg) { - if (is_pointer(arg)) { + /* Search backwards for the most recent pointer attribute. */ + const attr_list_t *attrs = v->attrs; + const type_t *type = v->type; + + if (! attrs && type) + { + attrs = type->attrs; + type = type->ref; + } + + while (attrs) + { + int t = get_attrv(attrs, ATTR_POINTERTYPE); + + if (t == RPC_FC_FP || t == RPC_FC_OP || t == RPC_FC_UP) + return 0; + + if (t == RPC_FC_RP) + return 1; + + if (type) + { + attrs = type->attrs; + type = type->ref; + } + else + attrs = NULL; + } + + return 1; /* Default is RPC_FC_RP. */ +} + +static void proxy_check_pointers( const var_list_t *args ) +{ + const var_t *arg; + + if (!args) return; + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + { + if (is_var_ptr(arg) && cant_be_null(arg)) { print_proxy( "if(!%s)\n", arg->name ); indent++; print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n"); indent--; } - arg = PREV_LINK(arg); } } -static void marshall_size_arg( var_t *arg ) -{ - int index = 0; - const type_t *type = get_base_type(arg); - expr_t *expr; - - expr = get_attrp( arg->attrs, ATTR_SIZEIS ); - if (expr) - { - print_proxy( "_StubMsg.MaxCount = ", arg->name ); - write_expr(proxy, expr, 0); - fprintf(proxy, ";\n\n"); - print_proxy( "NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - return; - } - - switch( type->type ) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 1, arg->name ); - break; - - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: - print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 2, arg->name ); - break; - - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 4, arg->name ); - break; - - case RPC_FC_STRUCT: - print_proxy( "NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d] );\n", index ); - break; - - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - case RPC_FC_CARRAY: - print_proxy( "NdrConformantArrayBufferSize( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - break; - - case RPC_FC_BOGUS_STRUCT: - print_proxy( "NdrComplexStructBufferSize(&_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d] );\n", index ); - break; - - case RPC_FC_FP: - { - var_t temp; - memset( &temp, 0, sizeof temp ); - temp.type = type->ref; - temp.name = arg->name; /* FIXME */ -#if 0 - print_proxy( "/* FIXME: %s use the right name for %s */\n", __FUNCTION__, arg->name ); -#endif - marshall_size_arg( &temp ); - } - break; - - case RPC_FC_IP: - print_proxy( "NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - break; - - default: - print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type ); - } -} - -static void proxy_gen_marshall_size( var_t *arg ) -{ - print_proxy( "_StubMsg.BufferLength = 0U;\n" ); - - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_IN)) - { - marshall_size_arg( arg ); - fprintf(proxy, "\n"); - } - arg = PREV_LINK(arg); - } -} - -static void marshall_copy_arg( var_t *arg ) -{ - int index = 0; - type_t *type = get_base_type(arg); - expr_t *expr; - - expr = get_attrp( arg->attrs, ATTR_SIZEIS ); - if (expr) - { - print_proxy( "_StubMsg.MaxCount = ", arg->name ); - write_expr(proxy, expr, 0); - fprintf(proxy, ";\n\n"); - print_proxy( "NdrConformantArrayMarshall( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - return; - } - - switch( type->type ) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - print_proxy( "*("); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy, " *)_StubMsg.Buffer = %s;\n", arg->name ); - print_proxy("_StubMsg.Buffer += sizeof("); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy, ");\n"); - break; - - case RPC_FC_STRUCT: - /* FIXME: add the format string, and set the index below */ - print_proxy( "NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - break; - - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - case RPC_FC_CARRAY: - break; - - case RPC_FC_BOGUS_STRUCT: - print_proxy( "NdrComplexStructMarshall(&_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d] );\n", index ); - break; - - case RPC_FC_FP: - { - var_t temp; - memset( &temp, 0, sizeof temp ); - temp.type = type->ref; - temp.name = arg->name; /* FIXME */ -#if 0 - print_proxy( "/* FIXME: %s use the right name for %s */\n", __FUNCTION__, arg->name ); -#endif - marshall_copy_arg( &temp ); - } - break; - - case RPC_FC_IP: - print_proxy( "NdrPointerMarshall( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - break; - - default: - print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type ); - } -} - -static void gen_marshall_copydata( var_t *arg ) -{ - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_IN)) - { - marshall_copy_arg( arg ); - fprintf(proxy, "\n"); - } - arg = PREV_LINK(arg); - } -} - -static void gen_marshall( var_t *arg ) -{ - /* generated code to determine the size of the buffer required */ - proxy_gen_marshall_size( arg ); - - /* generated code to allocate the buffer */ - print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" ); - - /* generated code to copy the args into the buffer */ - gen_marshall_copydata( arg ); - - print_proxy( "\n"); -} - -static void unmarshall_copy_arg( var_t *arg ) -{ - int index = 0; - type_t *type = get_base_type(arg); - expr_t *expr; - - expr = get_attrp( arg->attrs, ATTR_SIZEIS ); - if (expr) - { - print_proxy( "NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - return; - } - - switch( type->type ) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - print_proxy( "%s = *(", arg->name ); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy," *)_StubMsg.Buffer;\n"); - print_proxy("_StubMsg.Buffer += sizeof("); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy, ");\n"); - break; - - case RPC_FC_STRUCT: - print_proxy( "NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], 0);\n", index ); - break; - - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - case RPC_FC_CARRAY: - print_proxy( "NdrConformantArrayUnmarshall( &_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d]);\n", index ); - break; - - case RPC_FC_BOGUS_STRUCT: - print_proxy( "NdrComplexStructUnmarshall(&_StubMsg, (unsigned char*)%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], 0 );\n", index ); - break; - - case RPC_FC_FP: - { - var_t temp; - memset( &temp, 0, sizeof temp ); - temp.type = type->ref; - temp.name = arg->name; /* FIXME */ -#if 1 - print_proxy( "/* FIXME: %s use the right name for %s */\n", __FUNCTION__, arg->name ); -#endif - unmarshall_copy_arg( &temp ); - } - break; - - case RPC_FC_IP: - print_proxy( "NdrPointerUnmarshall(&_StubMsg, (unsigned char**)&%s, ", arg->name ); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], 0);\n", index ); - break; - - default: - print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type ); - } -} - -static void gen_unmarshall( var_t *arg ) -{ - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_OUT)) - { - unmarshall_copy_arg( arg ); - fprintf(proxy, "\n"); - } - arg = PREV_LINK(arg); - } -} - -static void free_variable( var_t *arg ) +static void free_variable( const var_t *arg ) { + size_t type_offset = arg->type->typestring_offset; var_t *constraint; - int index = 0; /* FIXME */ type_t *type; - expr_t *expr; + expr_list_t *expr; expr = get_attrp( arg->attrs, ATTR_SIZEIS ); if (expr) { - print_proxy( "_StubMsg.MaxCount = ", arg->name ); - write_expr(proxy, expr, 0); + const expr_t *size = LIST_ENTRY( list_head(expr), const expr_t, entry ); + print_proxy( "_StubMsg.MaxCount = " ); + write_expr(proxy, size, 0); fprintf(proxy, ";\n\n"); print_proxy( "NdrClearOutParameters( &_StubMsg, "); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], ", index ); + fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); fprintf(proxy, "(void*)%s );\n", arg->name ); return; } - type = get_base_type(arg); + type = arg->type; switch( type->type ) { case RPC_FC_BYTE: @@ -523,7 +232,7 @@ static void free_variable( var_t *arg ) if( constraint ) print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name); print_proxy( "NdrClearOutParameters( &_StubMsg, "); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%d], ", index ); + fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); fprintf(proxy, "(void*)%s );\n", arg->name ); break; @@ -532,26 +241,27 @@ static void free_variable( var_t *arg ) } } -static void proxy_free_variables( var_t *arg ) +static void proxy_free_variables( var_list_t *args ) { - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_OUT)) + const var_t *arg; + + if (!args) return; + LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) + if (is_attr(arg->attrs, ATTR_OUT)) { free_variable( arg ); fprintf(proxy, "\n"); } - arg = PREV_LINK(arg); - } } -static void gen_proxy(type_t *iface, func_t *cur, int idx) +static void gen_proxy(type_t *iface, const func_t *cur, int idx, + unsigned int proc_offset) { var_t *def = cur->def; - int has_ret = !is_void(def->type, def); + int has_ret = !is_void(def->type); indent = 0; - write_type(proxy, def->type, def, def->tname); + write_type(proxy, def->type); print_proxy( " STDMETHODCALLTYPE %s_", iface->name); write_name(proxy, def); print_proxy( "_Proxy(\n"); @@ -562,10 +272,10 @@ static void gen_proxy(type_t *iface, func_t *cur, int idx) /* local variables */ if (has_ret) { print_proxy( "" ); - write_type(proxy, def->type, def, def->tname); + write_type(proxy, def->type); print_proxy( " _RetVal;\n"); } - print_proxy( "RPC_MESSAGE _Msg;\n" ); + print_proxy( "RPC_MESSAGE _RpcMessage;\n" ); print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n" ); print_proxy( "\n"); @@ -575,39 +285,34 @@ static void gen_proxy(type_t *iface, func_t *cur, int idx) print_proxy( "RpcTryExcept\n" ); print_proxy( "{\n" ); indent++; - print_proxy( "NdrProxyInitialize(This, &_Msg, &_StubMsg, &Object_StubDesc, %d);\n", idx); + print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &_StubMsg, &Object_StubDesc, %d);\n", idx); proxy_check_pointers( cur->args ); print_proxy( "RpcTryFinally\n" ); print_proxy( "{\n" ); indent++; - gen_marshall( cur->args ); + write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_BUFFERSIZE); + + print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" ); + + write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_MARSHAL); print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" ); fprintf(proxy, "\n"); - print_proxy("if ((_Msg.DataRepresentation&0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n"); + print_proxy( "_StubMsg.BufferStart = _RpcMessage.Buffer;\n" ); + print_proxy( "_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" ); + + print_proxy("if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n"); indent++; - print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[0]);\n" ); + print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset ); indent--; fprintf(proxy, "\n"); - gen_unmarshall( cur->args ); - if (has_ret) { - /* - * FIXME: We only need to round the buffer up if it could be unaligned... - * We should calculate how much buffer we used and output the following - * line only if necessary. - */ - print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n"); + write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_UNMARSHAL); - print_proxy( "_RetVal = *(" ); - write_type(proxy, def->type, def, def->tname); - fprintf(proxy, " *)_StubMsg.Buffer;\n"); - print_proxy("_StubMsg.Buffer += sizeof("); - write_type(proxy, def->type, def, def->tname); - fprintf(proxy, ");\n"); - } + if (has_ret) + print_phase_basetype(proxy, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal"); indent--; print_proxy( "}\n"); @@ -639,100 +344,12 @@ static void gen_proxy(type_t *iface, func_t *cur, int idx) print_proxy( "\n"); } -static void stub_write_locals( var_t *arg ) -{ - int n = 0; - while (arg) { - int outptr = is_attr(arg->attrs, ATTR_OUT); - - /* create a temporary variable to store the output */ - if (outptr) { - var_t temp; - memset( &temp, 0, sizeof temp ); - temp.ptr_level = arg->ptr_level - 1; /* dereference once */ - print_proxy(""); - write_type(proxy, arg->type, &temp, arg->tname); - fprintf(proxy, " _M%d;\n",n++); - } - print_proxy(""); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy, " "); - write_name(proxy, arg); - fprintf(proxy, ";\n"); - arg = NEXT_LINK(arg); - } -} - -static void stub_unmarshall( var_t *arg ) -{ - int n = 0; - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_IN)) - { - unmarshall_copy_arg( arg ); - fprintf(proxy,"\n"); - } - else if (is_attr(arg->attrs, ATTR_OUT)) { - type_t *type = get_base_type(arg); - switch( type->type ) - { - case RPC_FC_STRUCT: - print_proxy("MIDL_memset("); - write_name(proxy, arg); - fprintf(proxy,", 0, sizeof("); - write_type(proxy, arg->type, arg, arg->tname); - fprintf(proxy,"));\n"); - break; - default: - print_proxy(""); - write_name(proxy, arg); - fprintf(proxy," = &_M%d;\n", n); - print_proxy("_M%d = 0;\n", n++); - break; - } - } - arg = PREV_LINK(arg); - } -} - -static void stub_gen_marshall_size( var_t *arg ) -{ - print_proxy( "_StubMsg.BufferLength = 0U;\n" ); - - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_OUT)) - marshall_size_arg( arg ); - arg = PREV_LINK(arg); - } -} - -static void stub_gen_marshall_copydata( var_t *arg ) -{ - END_OF_LIST(arg); - while (arg) { - if (is_attr(arg->attrs, ATTR_OUT)) - marshall_copy_arg( arg ); - arg = PREV_LINK(arg); - } -} - -static void stub_genmarshall( var_t *args ) -{ - /* FIXME: size buffer */ - stub_gen_marshall_size( args ); - - print_proxy("NdrStubGetBuffer(This, pRpcChannelBuffer, &_StubMsg);\n"); - - stub_gen_marshall_copydata( args ); -} - -static void gen_stub(type_t *iface, func_t *cur, const char *cas) +static void gen_stub(type_t *iface, const func_t *cur, const char *cas, + unsigned int proc_offset) { var_t *def = cur->def; - var_t *arg; - int has_ret = !is_void(def->type, def); + const var_t *arg; + int has_ret = !is_void(def->type); indent = 0; print_proxy( "void __RPC_STUB %s_", iface->name); @@ -740,89 +357,88 @@ static void gen_stub(type_t *iface, func_t *cur, const char *cas) print_proxy( "_Stub(\n"); indent++; print_proxy( "IRpcStubBuffer* This,\n"); - print_proxy( "IRpcChannelBuffer* pRpcChannelBuffer,\n"); - print_proxy( "PRPC_MESSAGE _Msg,\n"); + print_proxy( "IRpcChannelBuffer *_pRpcChannelBuffer,\n"); + print_proxy( "PRPC_MESSAGE _pRpcMessage,\n"); print_proxy( "DWORD* _pdwStubPhase)\n"); indent--; print_proxy( "{\n"); indent++; - /* local variables */ - if (has_ret) { - print_proxy(""); - write_type(proxy, def->type, def, def->tname); - fprintf(proxy, " _RetVal;\n"); - } print_proxy("%s * _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface->name, iface->name); print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n"); - stub_write_locals( cur->args ); + declare_stub_args( proxy, indent, cur ); fprintf(proxy, "\n"); /* FIXME: trace */ - print_proxy("NdrStubInitialize(_Msg, &_StubMsg, &Object_StubDesc, pRpcChannelBuffer);\n"); + print_proxy("NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n"); fprintf(proxy, "\n"); + if (cur->args) + LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) + print_proxy("%s = 0;\n", arg->name); + print_proxy("RpcTryFinally\n"); print_proxy("{\n"); indent++; - print_proxy("if ((_Msg->DataRepresentation&0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n"); + print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n"); indent++; - print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[0]);\n" ); + print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset ); indent--; fprintf(proxy, "\n"); - stub_unmarshall( cur->args ); + write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_UNMARSHAL); fprintf(proxy, "\n"); + assign_stub_out_args( proxy, indent, cur ); + print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n"); fprintf(proxy, "\n"); print_proxy(""); if (has_ret) fprintf(proxy, "_RetVal = "); - fprintf(proxy, "%s_", iface->name); - if (cas) fprintf(proxy, "%s_Stub", cas); - else write_name(proxy, def); + if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas); + else + { + fprintf(proxy, "_This->lpVtbl->"); + write_name(proxy, def); + } fprintf(proxy, "(_This"); - arg = cur->args; - if (arg) { - END_OF_LIST(arg); - while (arg) { - fprintf(proxy, ", "); - write_name(proxy, arg); - arg = PREV_LINK(arg); - } + + if (cur->args) + { + LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) + { + fprintf(proxy, ", "); + if (arg->array) + fprintf(proxy, "*"); + write_name(proxy, arg); + } } fprintf(proxy, ");\n"); fprintf(proxy, "\n"); print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n"); fprintf(proxy, "\n"); - stub_genmarshall( cur->args ); + write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_BUFFERSIZE); + + print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);\n"); + + write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_MARSHAL); fprintf(proxy, "\n"); - if (has_ret) { - /* - * FIXME: We only need to round the buffer up if it could be unaligned... - * We should calculate how much buffer we used and output the following - * line only if necessary. - */ - print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n"); - - print_proxy( "*(" ); - write_type(proxy, def->type, def, def->tname); - fprintf(proxy, " *)_StubMsg.Buffer = _RetVal;\n"); - print_proxy("_StubMsg.Buffer += sizeof("); - write_type(proxy, def->type, def, def->tname); - fprintf(proxy, ");\n"); - } + if (has_ret) + print_phase_basetype(proxy, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal"); indent--; print_proxy("}\n"); print_proxy("RpcFinally\n"); print_proxy("{\n"); + + write_remoting_arguments(proxy, indent+1, cur, PASS_OUT, PHASE_FREE); + print_proxy("}\n"); print_proxy("RpcEndFinally\n"); - print_proxy("_Msg->BufferLength = _StubMsg.Buffer - (unsigned char *)_Msg->Buffer;\n"); + print_proxy("_pRpcMessage->BufferLength = _StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n"); indent--; print_proxy("}\n"); @@ -831,13 +447,11 @@ static void gen_stub(type_t *iface, func_t *cur, const char *cas) static int write_proxy_methods(type_t *iface) { - func_t *cur = iface->funcs; + const func_t *cur; int i = 0; - END_OF_LIST(cur); - if (iface->ref) i = write_proxy_methods(iface->ref); - while (cur) { + if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) { var_t *def = cur->def; if (!is_callas(def->attrs)) { if (i) fprintf(proxy, ",\n"); @@ -846,21 +460,19 @@ static int write_proxy_methods(type_t *iface) fprintf(proxy, "_Proxy"); i++; } - cur = PREV_LINK(cur); } return i; } static int write_stub_methods(type_t *iface) { - func_t *cur = iface->funcs; + const func_t *cur; int i = 0; - END_OF_LIST(cur); - if (iface->ref) i = write_stub_methods(iface->ref); else return i; /* skip IUnknown */ - while (cur) { + + if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) { var_t *def = cur->def; if (!is_local(def->attrs)) { if (i) fprintf(proxy,",\n"); @@ -869,48 +481,49 @@ static int write_stub_methods(type_t *iface) fprintf(proxy, "_Stub"); i++; } - cur = PREV_LINK(cur); } return i; } -static void write_proxy(type_t *iface) +static void write_proxy(type_t *iface, unsigned int *proc_offset) { int midx = -1, stubs; - func_t *cur = iface->funcs; + const func_t *cur; - if (!cur) return; - - END_OF_LIST(cur); + if (!iface->funcs) return; /* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */ fprintf(proxy, "/*****************************************************************************\n"); fprintf(proxy, " * %s interface\n", iface->name); fprintf(proxy, " */\n"); - while (cur) { + LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) + { const var_t *def = cur->def; if (!is_local(def->attrs)) { const var_t *cas = is_callas(def->attrs); const char *cname = cas ? cas->name : NULL; int idx = cur->idx; if (cname) { - const func_t *m = iface->funcs; - while (m && strcmp(get_name(m->def), cname)) - m = NEXT_LINK(m); - idx = m->idx; + const func_t *m; + LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry ) + if (!strcmp(get_name(m->def), cname)) + { + idx = m->idx; + break; + } } - gen_proxy(iface, cur, idx); - gen_stub(iface, cur, cname); + gen_proxy(iface, cur, idx, *proc_offset); + gen_stub(iface, cur, cname, *proc_offset); + *proc_offset += get_size_procformatstring_func( cur ); if (midx == -1) midx = idx; - else if (midx != idx) yyerror("method index mismatch in write_proxy"); + else if (midx != idx) parser_error("method index mismatch in write_proxy"); midx++; } - cur = PREV_LINK(cur); } /* proxy vtable */ - print_proxy( "const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", midx, iface->name); + print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", midx, iface->name); print_proxy( "{\n"); indent++; print_proxy( "{\n", iface->name); @@ -937,7 +550,7 @@ static void write_proxy(type_t *iface) indent--; fprintf(proxy, "};\n"); print_proxy( "\n"); - print_proxy( "const CInterfaceStubVtbl _%sStubVtbl =\n", iface->name); + print_proxy( "static const CInterfaceStubVtbl _%sStubVtbl =\n", iface->name); print_proxy( "{\n"); indent++; print_proxy( "{\n"); @@ -958,28 +571,23 @@ static void write_proxy(type_t *iface) print_proxy( "\n"); } -void write_proxies(ifref_t *ifaces) +void write_proxies(ifref_list_t *ifaces) { - ifref_t *lcur = ifaces; ifref_t *cur; char *file_id = proxy_token; int c; + unsigned int proc_offset = 0; if (!do_proxies) return; - if (!lcur) return; - END_OF_LIST(lcur); + if (do_everything && !ifaces) return; - init_proxy(); + init_proxy(ifaces); if(!proxy) return; - cur = lcur; - while (cur) { - if (is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) - write_proxy(cur->iface); - cur = PREV_LINK(cur); - } - - if (!proxy) return; + if (ifaces) + LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry ) + if (is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) + write_proxy(cur->iface, &proc_offset); write_stubdesc(); @@ -987,44 +595,39 @@ void write_proxies(ifref_t *ifaces) print_proxy( "#error Currently only Wine and WIN32 are supported.\n"); print_proxy( "#endif\n"); print_proxy( "\n"); - write_formatstring( 1 ); - write_formatstring( 0 ); + write_procformatstring(proxy, ifaces, 1); + write_typeformatstring(proxy, ifaces, 1); - fprintf(proxy, "const CInterfaceProxyVtbl* _%s_ProxyVtblList[] =\n", file_id); + fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id); fprintf(proxy, "{\n"); - cur = lcur; - while (cur) { - if(cur->iface->ref && cur->iface->funcs && - is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) - fprintf(proxy, " (CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", cur->iface->name); - cur = PREV_LINK(cur); - } + if (ifaces) + LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry ) + if(cur->iface->ref && cur->iface->funcs && + is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) + fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", cur->iface->name); + fprintf(proxy, " 0\n"); fprintf(proxy, "};\n"); fprintf(proxy, "\n"); - fprintf(proxy, "const CInterfaceStubVtbl* _%s_StubVtblList[] =\n", file_id); + fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id); fprintf(proxy, "{\n"); - cur = lcur; - while (cur) { - if(cur->iface->ref && cur->iface->funcs && - is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) - fprintf(proxy, " (CInterfaceStubVtbl*)&_%sStubVtbl,\n", cur->iface->name); - cur = PREV_LINK(cur); - } + if (ifaces) + LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry ) + if(cur->iface->ref && cur->iface->funcs && + is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) + fprintf(proxy, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n", cur->iface->name); fprintf(proxy, " 0\n"); fprintf(proxy, "};\n"); fprintf(proxy, "\n"); - fprintf(proxy, "PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id); + fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id); fprintf(proxy, "{\n"); - cur = lcur; - while (cur) { - if(cur->iface->ref && cur->iface->funcs && - is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) - fprintf(proxy, " \"%s\",\n", cur->iface->name); - cur = PREV_LINK(cur); - } + if (ifaces) + LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry ) + if(cur->iface->ref && cur->iface->funcs && + is_object(cur->iface->attrs) && !is_local(cur->iface->attrs)) + fprintf(proxy, " \"%s\",\n", cur->iface->name); fprintf(proxy, " 0\n"); fprintf(proxy, "};\n"); fprintf(proxy, "\n"); @@ -1033,29 +636,27 @@ void write_proxies(ifref_t *ifaces) fprintf(proxy, "\n"); fprintf(proxy, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id); fprintf(proxy, "{\n"); - cur = lcur; c = 0; - while (cur) { - if(cur->iface->ref) - { - 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++; - } - cur = PREV_LINK(cur); - } + if (ifaces) + LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry ) + if(cur->iface->ref) + { + 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++; + } fprintf(proxy, " return 0;\n"); fprintf(proxy, "}\n"); fprintf(proxy, "\n"); fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id); fprintf(proxy, "{\n"); - fprintf(proxy, " (PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id); - fprintf(proxy, " (PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id); - fprintf(proxy, " (const PCInterfaceName*)&_%s_InterfaceNamesList,\n", file_id); + fprintf(proxy, " (const PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id); + fprintf(proxy, " (const PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id); + fprintf(proxy, " _%s_InterfaceNamesList,\n", file_id); fprintf(proxy, " 0,\n"); fprintf(proxy, " &_%s_IID_Lookup,\n", file_id); fprintf(proxy, " %d,\n", c); diff --git a/reactos/tools/widl/server.c b/reactos/tools/widl/server.c index 72d5ae700f2..b293122168c 100644 --- a/reactos/tools/widl/server.c +++ b/reactos/tools/widl/server.c @@ -52,8 +52,9 @@ static int print_server(const char *format, ...) int i, r; va_start(va, format); - for (i = 0; i < indent; i++) - fprintf(server, " "); + if (format[0] != '\n') + for (i = 0; i < indent; i++) + fprintf(server, " "); r = vfprintf(server, format, va); va_end(va); return r; @@ -67,136 +68,26 @@ static void write_parameters_init(const func_t *func) if (!func->args) return; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) if (var->type->type != RPC_FC_BIND_PRIMITIVE) print_server("%s = 0;\n", var->name); - var = PREV_LINK(var); - } fprintf(server, "\n"); } -static void declare_args(const func_t *func) -{ - int in_attr, out_attr; - int i = 0; - var_t *var; - - if (!func->args) - return; - - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS); - int has_size = size_is && (size_is->type != EXPR_VOID); - int is_string = is_attr(var->attrs, ATTR_STRING); - - in_attr = is_attr(var->attrs, ATTR_IN); - out_attr = is_attr(var->attrs, ATTR_OUT); - if (!out_attr && !in_attr) - in_attr = 1; - - if (!in_attr && !has_size && !is_string) - { - int indirection; - print_server(""); - write_type(server, var->type, NULL, var->tname); - for (indirection = 0; indirection < var->ptr_level - 1; indirection++) - fprintf(server, "*"); - fprintf(server, " _W%u;\n", i++); - } - - print_server(""); - write_type(server, var->type, var, var->tname); - fprintf(server, " "); - write_name(server, var); - write_array(server, var->array, 0); - fprintf(server, ";\n"); - - var = PREV_LINK(var); - } -} - - -static void assign_out_args(const func_t *func) -{ - int in_attr, out_attr; - int i = 0, sep = 0; - var_t *var; - const expr_t *size_is; - int has_size; - - if (!func->args) - return; - - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - int is_string = is_attr(var->attrs, ATTR_STRING); - size_is = get_attrp(var->attrs, ATTR_SIZEIS); - has_size = size_is && (size_is->type != EXPR_VOID); - in_attr = is_attr(var->attrs, ATTR_IN); - out_attr = is_attr(var->attrs, ATTR_OUT); - if (!out_attr && !in_attr) - in_attr = 1; - - if (!in_attr) - { - print_server(""); - write_name(server, var); - - if (has_size) - { - unsigned int size; - type_t *type = var->type; - while (type->type == 0 && type->ref) - type = type->ref; - - fprintf(server, " = NdrAllocate(&_StubMsg, "); - write_expr(server, size_is, 1); - size = get_type_memsize(type); - fprintf(server, " * %u);\n", size); - } - else if (!is_string) - { - fprintf(server, " = &_W%u;\n", i); - if (var->ptr_level > 1) - print_server("_W%u = 0;\n", i); - i++; - } - - sep = 1; - } - - var = PREV_LINK(var); - } - - if (sep) - fprintf(server, "\n"); -} - - -static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset) +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 = iface->funcs; + const func_t *func; const var_t *var; const var_t* explicit_handle_var; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - while (func) + if (!iface->funcs) return; + LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry ) { const var_t *def = func->def; - unsigned long buffer_size = 0; - unsigned int type_offset_func; /* check for a defined binding handle */ explicit_handle_var = get_explicit_handle_var(func); @@ -229,16 +120,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "{\n"); indent++; - /* declare return value '_RetVal' */ - if (!is_void(def->type, NULL)) - { - print_server(""); - write_type(server, def->type, def, def->tname); - fprintf(server, " _RetVal;\n"); - } - /* Declare arguments */ - declare_args(func); + declare_stub_args(server, indent, func); print_server("MIDL_STUB_MESSAGE _StubMsg;\n"); print_server("RPC_STATUS _Status;\n"); @@ -280,11 +163,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig indent -= 2; fprintf(server, "\n"); - /* make a copy so we don't increment the type offset twice */ - type_offset_func = *type_offset; - /* unmarshall arguments */ - write_remoting_arguments(server, indent, func, &type_offset_func, PASS_IN, PHASE_UNMARSHAL); + write_remoting_arguments(server, indent, func, PASS_IN, PHASE_UNMARSHAL); } print_server("if (_StubMsg.Buffer > _StubMsg.BufferEnd)\n"); @@ -305,14 +185,14 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "\n"); /* Assign 'out' arguments */ - assign_out_args(func); + assign_stub_out_args(server, indent, func); /* Call the real server function */ - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) print_server("_RetVal = "); else print_server(""); - write_name(server, def); + write_prefix_name(server, prefix_server, def); if (func->args) { @@ -320,17 +200,16 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "(\n"); indent++; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) { if (first_arg) first_arg = 0; else fprintf(server, ",\n"); print_server(""); + if (var->array) + fprintf(server, "*"); write_name(server, var); - var = PREV_LINK(var); } fprintf(server, ");\n"); indent--; @@ -340,37 +219,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "();\n"); } - if (func->args) - { - const var_t *var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - if (is_attr(var->attrs, ATTR_OUT)) - { - unsigned int alignment; - buffer_size += get_required_buffer_size(var, &alignment, PASS_OUT); - buffer_size += alignment; - } - - var = PREV_LINK(var); - } - } - - if (!is_void(def->type, NULL)) - { - unsigned int alignment; - buffer_size += get_required_buffer_size(def, &alignment, PASS_RETURN); - buffer_size += alignment; - } - if (has_out_arg_or_return(func)) { - fprintf(server, "\n"); - print_server("_StubMsg.BufferLength = %u;\n", buffer_size); - - type_offset_func = *type_offset; - write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_BUFFERSIZE); + write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_BUFFERSIZE); print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n"); fprintf(server, "\n"); @@ -384,13 +235,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "\n"); } - type_offset_func = *type_offset; - /* marshall arguments */ - write_remoting_arguments(server, indent, func, type_offset, PASS_OUT, PHASE_MARSHAL); + write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_MARSHAL); /* marshall the return value */ - if (!is_void(def->type, NULL)) + if (!is_void(def->type)) print_phase_basetype(server, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal"); indent--; @@ -399,7 +248,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig print_server("{\n"); indent++; - write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_FREE); + write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_FREE); indent--; print_server("}\n"); @@ -416,22 +265,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig fprintf(server, "\n"); /* update proc_offset */ - if (func->args) - { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - *proc_offset += get_size_procformatstring_var(var); - var = PREV_LINK(var); - } - } - if (!is_void(def->type, NULL)) - *proc_offset += get_size_procformatstring_var(def); - else - *proc_offset += 2; /* FC_END and FC_PAD */ - - func = PREV_LINK(func); + *proc_offset += get_size_procformatstring_func( func ); } } @@ -440,13 +274,13 @@ static void write_dispatchtable(type_t *iface) { unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); unsigned long method_count = 0; - func_t *func = iface->funcs; + const func_t *func; print_server("static RPC_DISPATCH_FUNCTION %s_table[] =\n", iface->name); print_server("{\n"); indent++; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - while (func) + + if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry ) { var_t *def = func->def; @@ -455,7 +289,6 @@ static void write_dispatchtable(type_t *iface) fprintf(server, ",\n"); method_count++; - func = PREV_LINK(func); } print_server("0\n"); indent--; @@ -520,6 +353,9 @@ static void write_serverinterfacedecl(type_t *iface) { unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); + const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT); + + if (endpoints) write_endpoints( server, iface->name, endpoints ); print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, LOWORD(ver), HIWORD(ver)); fprintf(server, "\n"); @@ -533,8 +369,16 @@ static void write_serverinterfacedecl(type_t *iface) uuid->Data4[7], LOWORD(ver), HIWORD(ver)); print_server("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */ print_server("&%s_v%d_%d_DispatchTable,\n", iface->name, LOWORD(ver), HIWORD(ver)); - print_server("0,\n"); - print_server("0,\n"); + if (endpoints) + { + print_server("%u,\n", list_count(endpoints)); + print_server("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name); + } + else + { + print_server("0,\n"); + print_server("0,\n"); + } print_server("0,\n"); print_server("0,\n"); print_server("0,\n"); @@ -544,41 +388,11 @@ static void write_serverinterfacedecl(type_t *iface) print_server("RPC_IF_HANDLE %s_ServerIfHandle = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", iface->name, iface->name); else - print_server("RPC_IF_HANDLE %s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", - iface->name, LOWORD(ver), HIWORD(ver), iface->name); + print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n", + prefix_server, iface->name, LOWORD(ver), HIWORD(ver), iface->name); fprintf(server, "\n"); } -static void write_formatdesc( const char *str ) -{ - print_server("typedef struct _MIDL_%s_FORMAT_STRING\n", str ); - print_server("{\n"); - indent++; - print_server("short Pad;\n"); - print_server("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str); - indent--; - print_server("} MIDL_%s_FORMAT_STRING;\n", str); - print_server("\n"); -} - - -static void write_formatstringsdecl(ifref_t *ifaces) -{ - print_server("#define TYPE_FORMAT_STRING_SIZE %d\n", - get_size_typeformatstring(ifaces)); - - print_server("#define PROC_FORMAT_STRING_SIZE %d\n", - get_size_procformatstring(ifaces)); - - fprintf(server, "\n"); - write_formatdesc("TYPE"); - write_formatdesc("PROC"); - fprintf(server, "\n"); - print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n"); - print_server("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n"); - print_server("\n"); -} - static void init_server(void) { @@ -587,7 +401,7 @@ static void init_server(void) if (!(server = fopen(server_name, "w"))) error("Could not open %s for output\n", server_name); - print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name); + print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name); print_server("#include \n"); fprintf(server, "\n"); print_server("#include \"%s\"\n", header_name); @@ -595,25 +409,23 @@ static void init_server(void) } -void write_server(ifref_t *ifaces) +void write_server(ifref_list_t *ifaces) { unsigned int proc_offset = 0; - unsigned int type_offset = 2; - ifref_t *iface = ifaces; + ifref_t *iface; if (!do_server) return; - if (!ifaces) + if (do_everything && !ifaces) return; - END_OF_LIST(iface); init_server(); if (!server) return; - write_formatstringsdecl(ifaces); + write_formatstringsdecl(server, indent, ifaces, 0); - for (; iface; iface = PREV_LINK(iface)) + if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry ) { if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) continue; @@ -630,7 +442,7 @@ void write_server(ifref_t *ifaces) write_serverinterfacedecl(iface->iface); write_stubdescdecl(iface->iface); - write_function_stubs(iface->iface, &proc_offset, &type_offset); + write_function_stubs(iface->iface, &proc_offset); print_server("#if !defined(__RPC_WIN32__)\n"); print_server("#error Invalid build platform for this stub.\n"); @@ -649,8 +461,8 @@ void write_server(ifref_t *ifaces) fprintf(server, "\n"); - write_procformatstring(server, ifaces); - write_typeformatstring(server, ifaces); + write_procformatstring(server, ifaces, 0); + write_typeformatstring(server, ifaces, 0); fclose(server); } diff --git a/reactos/tools/widl/typegen.c b/reactos/tools/widl/typegen.c index 68941b361ee..ed4c16e116d 100644 --- a/reactos/tools/widl/typegen.c +++ b/reactos/tools/widl/typegen.c @@ -59,8 +59,56 @@ struct expr_eval_routine const expr_t *expr; }; -static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array); -static size_t fields_memsize(const var_t *v); +static size_t type_memsize(const type_t *t, const array_dims_t *array, unsigned int *align); +static size_t fields_memsize(const var_list_t *fields, unsigned int *align); +static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, + unsigned int *typestring_offset); +const char *string_of_type(unsigned char type) +{ + switch (type) + { + case RPC_FC_BYTE: return "FC_BYTE"; + case RPC_FC_CHAR: return "FC_CHAR"; + case RPC_FC_SMALL: return "FC_SMALL"; + case RPC_FC_USMALL: return "FC_USMALL"; + case RPC_FC_WCHAR: return "FC_WCHAR"; + case RPC_FC_SHORT: return "FC_SHORT"; + case RPC_FC_USHORT: return "FC_USHORT"; + case RPC_FC_LONG: return "FC_LONG"; + case RPC_FC_ULONG: return "FC_ULONG"; + case RPC_FC_FLOAT: return "FC_FLOAT"; + case RPC_FC_HYPER: return "FC_HYPER"; + case RPC_FC_DOUBLE: return "FC_DOUBLE"; + case RPC_FC_ENUM16: return "FC_ENUM16"; + case RPC_FC_ENUM32: return "FC_ENUM32"; + case RPC_FC_IGNORE: return "FC_IGNORE"; + case RPC_FC_ERROR_STATUS_T: return "FC_ERROR_STATUS_T"; + case RPC_FC_RP: return "FC_RP"; + case RPC_FC_UP: return "FC_UP"; + case RPC_FC_OP: return "FC_OP"; + case RPC_FC_FP: return "FC_FP"; + case RPC_FC_BIND_PRIMITIVE: return "FC_BIND_PRIMITIVE"; + default: + error("string_of_type: unknown type 0x%02x\n", type); + return NULL; + } +} + +static int is_struct(unsigned char type) +{ + switch (type) + { + case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: + case RPC_FC_CSTRUCT: + case RPC_FC_CPSTRUCT: + case RPC_FC_CVSTRUCT: + case RPC_FC_BOGUS_STRUCT: + return 1; + default: + return 0; + } +} static int compare_expr(const expr_t *a, const expr_t *b) { @@ -132,9 +180,45 @@ static int print_file(FILE *file, int indent, const char *format, ...) return r; } -static inline int type_has_ref(const type_t *type) +static void write_formatdesc(FILE *f, int indent, const char *str) { - return (type->type == 0 && type->ref); + print_file(f, indent, "typedef struct _MIDL_%s_FORMAT_STRING\n", str); + print_file(f, indent, "{\n"); + print_file(f, indent + 1, "short Pad;\n"); + print_file(f, indent + 1, "unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str); + print_file(f, indent, "} MIDL_%s_FORMAT_STRING;\n", str); + print_file(f, indent, "\n"); +} + +void write_formatstringsdecl(FILE *f, int indent, ifref_list_t *ifaces, int for_objects) +{ + print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n", + get_size_typeformatstring(ifaces, for_objects)); + + print_file(f, indent, "#define PROC_FORMAT_STRING_SIZE %d\n", + get_size_procformatstring(ifaces, for_objects)); + + fprintf(f, "\n"); + write_formatdesc(f, indent, "TYPE"); + write_formatdesc(f, indent, "PROC"); + fprintf(f, "\n"); + print_file(f, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n"); + print_file(f, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n"); + print_file(f, indent, "\n"); +} + +static int is_user_derived(const var_t *v) +{ + const type_t *type = v->type; + + if (v->attrs && is_attr( v->attrs, ATTR_WIREMARSHAL )) return 1; + + while (type) + { + if (type->attrs && is_attr( type->attrs, ATTR_WIREMARSHAL )) return 1; + type = type->ref; + } + return 0; } static inline int is_base_type(unsigned char type) @@ -166,10 +250,9 @@ static inline int is_base_type(unsigned char type) } static size_t write_procformatstring_var(FILE *file, int indent, - const var_t *var, int is_return, unsigned int *type_offset) + const var_t *var, int is_return) { size_t size; - int ptr_level = var->ptr_level; const type_t *type = var->type; int is_in = is_attr(var->attrs, ATTR_IN); @@ -177,46 +260,25 @@ static size_t write_procformatstring_var(FILE *file, int indent, if (!is_in && !is_out) is_in = TRUE; - if (ptr_level == 0 && type_has_ref(type)) - type = type->ref; - - if (ptr_level == 0 && !var->array && is_base_type(type->type)) + if (!var->array && is_base_type(type->type)) { if (is_return) print_file(file, indent, "0x53, /* FC_RETURN_PARAM_BASETYPE */\n"); else print_file(file, indent, "0x4e, /* FC_IN_PARAM_BASETYPE */\n"); - switch(type->type) + if (is_base_type(type->type)) + { + print_file(file, indent, "0x%02x, /* %s */\n", type->type, string_of_type(type->type)); + size = 2; /* includes param type prefix */ + } + else if (type->type == RPC_FC_BIND_PRIMITIVE) { -#define CASE_BASETYPE(fctype) \ - case RPC_##fctype: \ - print_file(file, indent, "0x%02x, /* " #fctype " */\n", RPC_##fctype); \ - size = 2; /* includes param type prefix */ \ - break - - CASE_BASETYPE(FC_BYTE); - CASE_BASETYPE(FC_CHAR); - CASE_BASETYPE(FC_WCHAR); - CASE_BASETYPE(FC_USHORT); - CASE_BASETYPE(FC_SHORT); - CASE_BASETYPE(FC_ULONG); - CASE_BASETYPE(FC_LONG); - CASE_BASETYPE(FC_HYPER); - CASE_BASETYPE(FC_IGNORE); - CASE_BASETYPE(FC_USMALL); - CASE_BASETYPE(FC_SMALL); - CASE_BASETYPE(FC_FLOAT); - CASE_BASETYPE(FC_DOUBLE); - CASE_BASETYPE(FC_ERROR_STATUS_T); -#undef CASE_BASETYPE - - case RPC_FC_BIND_PRIMITIVE: print_file(file, indent, "0x%02x, /* FC_IGNORE */\n", RPC_FC_IGNORE); size = 2; /* includes param type prefix */ - break; - - default: + } + else + { error("Unknown/unsupported type: %s (0x%02x)\n", var->name, type->type); size = 0; } @@ -233,19 +295,17 @@ static size_t write_procformatstring_var(FILE *file, int indent, print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n"); print_file(file, indent, "0x01,\n"); - print_file(file, indent, "NdrFcShort(0x%x),\n", *type_offset); + print_file(file, indent, "NdrFcShort(0x%x),\n", type->typestring_offset); size = 4; /* includes param type prefix */ } - *type_offset += get_size_typeformatstring_var(var); return size; } -void write_procformatstring(FILE *file, const ifref_t *ifaces) +void write_procformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects) { - const ifref_t *iface = ifaces; + const ifref_t *iface; int indent = 0; - var_t *var; - unsigned int type_offset = 2; + const var_t *var; print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n"); print_file(file, indent, "{\n"); @@ -254,43 +314,33 @@ void write_procformatstring(FILE *file, const ifref_t *ifaces) print_file(file, indent, "{\n"); indent++; - END_OF_LIST(iface); - - for (; iface; iface = PREV_LINK(iface)) + if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry ) { - if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) + if (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) continue; if (iface->iface->funcs) { - func_t *func = iface->iface->funcs; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - for (; func; func = PREV_LINK(func)) + const func_t *func; + LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry ) { + if (is_local(func->def->attrs)) continue; /* emit argument data */ if (func->args) { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - write_procformatstring_var(file, indent, var, FALSE, - &type_offset); - - var = PREV_LINK(var); - } + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + write_procformatstring_var(file, indent, var, FALSE); } /* emit return value data */ var = func->def; - if (is_void(var->type, NULL)) + if (is_void(var->type)) { print_file(file, indent, "0x5b, /* FC_END */\n"); print_file(file, indent, "0x5c, /* FC_PAD */\n"); } else - write_procformatstring_var(file, indent, var, TRUE, - &type_offset); + write_procformatstring_var(file, indent, var, TRUE); } } } @@ -303,16 +353,33 @@ void write_procformatstring(FILE *file, const ifref_t *ifaces) print_file(file, indent, "\n"); } +static int write_base_type(FILE *file, const type_t *type, unsigned int *typestring_offset) +{ + if (is_base_type(type->type)) + { + print_file(file, 2, "0x%02x,\t/* %s */\n", type->type, string_of_type(type->type)); + *typestring_offset += 1; + return 1; + } + + return 0; +} + /* write conformance / variance descriptor */ -static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_t *structure, const expr_t *expr) +static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_t *structure, const expr_list_t *expr_list) { unsigned char operator_type = 0; const char *operator_string = "no operators"; - const expr_t *subexpr = expr; + const expr_t *expr, *subexpr; unsigned char correlation_type; if (!file) return 4; /* optimisation for sizing pass */ + if (list_count(expr_list) > 1) + error("write_conf_or_var_desc: multi-dimensional arrays not supported yet\n"); + + expr = subexpr = LIST_ENTRY( list_head(expr_list), const expr_t, entry ); + if (expr->is_const) { if (expr->cval > UCHAR_MAX * (USHRT_MAX + 1) + USHRT_MAX) @@ -374,6 +441,7 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ if (subexpr->type == EXPR_IDENTIFIER) { const type_t *correlation_variable = NULL; + unsigned char correlation_variable_type; unsigned char param_type = 0; const char *param_type_string = NULL; size_t offset; @@ -382,9 +450,12 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ { const var_t *var; - for (offset = 0, var = structure->fields; var; var = NEXT_LINK(var)) + offset = 0; + if (structure->fields) LIST_FOR_EACH_ENTRY( var, structure->fields, const var_t, entry ) { - offset -= type_memsize(var->type, var->ptr_level, var->array); + unsigned int align = 0; + offset -= type_memsize(var->type, var->array, &align); + /* FIXME: take alignment into account */ if (!strcmp(var->name, subexpr->u.sval)) { correlation_variable = var->type; @@ -399,17 +470,18 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ } else { - const var_t *var = func->args; + const var_t *var; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - /* FIXME: not all stack variables are sizeof(void *) */ - for (offset = 0; var; offset += sizeof(void *), var = PREV_LINK(var)) + offset = sizeof(void *); + if (func->args) LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) { if (!strcmp(var->name, subexpr->u.sval)) { correlation_variable = var->type; break; } + /* FIXME: not all stack variables are sizeof(void *) */ + offset += sizeof(void *); } if (!correlation_variable) error("write_conf_or_var_desc: couldn't find variable %s in function\n", @@ -418,10 +490,9 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ correlation_type = RPC_FC_TOP_LEVEL_CONFORMANCE; } - while (type_has_ref(correlation_variable)) - correlation_variable = correlation_variable->ref; + correlation_variable_type = correlation_variable->type; - switch (correlation_variable->type) + switch (correlation_variable_type) { case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -450,9 +521,24 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ param_type = RPC_FC_ULONG; param_type_string = "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; + param_type_string = "FC_LONG"; + } + else + { + param_type = RPC_FC_HYPER; + param_type_string = "FC_HYPER"; + } + break; default: error("write_conf_or_var_desc: conformance variable type not supported 0x%x\n", - correlation_variable->type); + correlation_variable_type); } print_file(file, 2, "0x%x, /* Corr desc: %s%s */\n", @@ -487,9 +573,10 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ if (!found) { + unsigned int align = 0; eval = xmalloc(sizeof(*eval)); eval->structure = structure; - eval->structure_size = fields_memsize(structure->fields); + eval->structure_size = fields_memsize(structure->fields, &align); eval->expr = expr; list_add_tail(&expr_eval_routines, &eval->entry); } @@ -514,43 +601,58 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ return 4; } -static size_t fields_memsize(const var_t *v) +static size_t fields_memsize(const var_list_t *fields, unsigned int *align) { size_t size = 0; - const var_t *first = v; - if (!v) return 0; - while (NEXT_LINK(v)) v = NEXT_LINK(v); - while (v) { - size += type_memsize(v->type, v->ptr_level, v->array); - if (v == first) break; - v = PREV_LINK(v); - } + const var_t *v; + + if (!fields) return 0; + LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry ) + size += type_memsize(v->type, v->array, align); + return size; } -static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array) +static size_t get_array_size( const array_dims_t *array ) +{ + size_t size = 1; + const expr_t *dim; + + if (!array) return 0; + + LIST_FOR_EACH_ENTRY( dim, array, expr_t, entry ) + { + if (!dim->is_const) return 0; + size *= dim->cval; + } + + return size; +} + +static size_t type_memsize(const type_t *t, const array_dims_t *array, unsigned int *align) { size_t size = 0; - if (ptr_level) - return sizeof(void *); - - if (type_has_ref(t)) - return type_memsize(t->ref, 0 /* FIXME */, NULL); - - switch (t->type) + if (is_ptr(t)) + { + size = sizeof(void *); + if (size > *align) *align = size; + } + else switch (t->type) { case RPC_FC_BYTE: case RPC_FC_CHAR: case RPC_FC_USMALL: case RPC_FC_SMALL: size = 1; + if (size > *align) *align = size; break; case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: case RPC_FC_ENUM16: size = 2; + if (size > *align) *align = size; break; case RPC_FC_ULONG: case RPC_FC_LONG: @@ -558,10 +660,12 @@ static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array) case RPC_FC_ENUM32: case RPC_FC_FLOAT: size = 4; + if (size > *align) *align = size; break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: size = 8; + if (size > *align) *align = size; break; case RPC_FC_STRUCT: case RPC_FC_CVSTRUCT: @@ -571,157 +675,191 @@ static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array) case RPC_FC_BOGUS_STRUCT: case RPC_FC_ENCAPSULATED_UNION: case RPC_FC_NON_ENCAPSULATED_UNION: - size = fields_memsize(t->fields); + size = fields_memsize(t->fields, align); break; default: error("type_memsize: Unknown type %d\n", t->type); size = 0; } - if (array) - { - if (array->is_const) - size *= array->cval; - else - size = 0; - } - + if (array) size *= get_array_size( array ); return size; } -size_t get_type_memsize(const type_t *type) +static size_t write_nonsimple_pointer(FILE *file, const type_t *type, size_t offset) { - return type_memsize(type, 0, NULL); + short absoff = type->ref->typestring_offset; + short reloff = absoff - (offset + 2); + int ptr_attr = is_ptr(type->ref) ? 0x10 : 0x0; + + print_file(file, 2, "0x%02x, 0x%x,\t/* %s */\n", + type->type, ptr_attr, string_of_type(type->type)); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%hd) */\n", + reloff, reloff, absoff); + return 4; } -static int write_pointers(FILE *file, const attr_t *attrs, - const type_t *type, int ptr_level, - const expr_t *array, int level, +static size_t write_simple_pointer(FILE *file, const type_t *type) +{ + print_file(file, 2, "0x%02x, 0x8,\t/* %s [simple_pointer] */\n", + type->type, string_of_type(type->type)); + print_file(file, 2, "0x%02x,\t/* %s */\n", type->ref->type, + string_of_type(type->ref->type)); + print_file(file, 2, "0x5c,\t/* FC_PAD */\n"); + return 4; +} + +static size_t write_pointer_tfs(FILE *file, type_t *type, size_t *typestring_offset) +{ + size_t offset = *typestring_offset; + + print_file(file, 0, "/* %d */\n", offset); + type->typestring_offset = offset; + + if (type->ref->typestring_offset) + *typestring_offset += write_nonsimple_pointer(file, type, offset); + else if (is_base_type(type->ref->type)) + *typestring_offset += write_simple_pointer(file, type); + + return offset; +} + +static int has_known_tfs(const type_t *type) +{ + return type->typestring_offset || is_base_type(type->type); +} + +static int write_pointers(FILE *file, const attr_list_t *attrs, + type_t *type, const char *name, + const array_dims_t *array, int level, unsigned int *typestring_offset) { - int pointers_written = 0; const var_t *v; /* don't generate a pointer for first-level arrays since we want to * descend into them to write their pointers, not stop here */ - if ((level == 0 || ptr_level == 0) && is_array_type(attrs, ptr_level, array)) + if ((level == 0 || !is_ptr(type)) && is_array_type(attrs, type, array)) { - return write_pointers(file, NULL, type, 0, NULL, level + 1, typestring_offset); + return write_pointers(file, NULL, type, name, NULL, level + 1, typestring_offset); } - - if (ptr_level != 0) + else if (is_ptr(type)) { - /* FIXME: only general algorithm implemented, not the actual writing */ - error("write_pointers: Writing type format string for pointer is unimplemented\n"); + type_t *ref = type->ref; + + if (!has_known_tfs(ref)) + { + if (is_ptr(ref)) + { + write_pointers(file, attrs, ref, name, array, level + 1, + typestring_offset); + } + else if (is_struct(ref->type)) + { + write_struct_tfs(file, ref, name, typestring_offset); + } + else + { + error("write_pointers: type format string unknown for %s (0x%02x)\n", + name, ref->type); + } + } + + /* top-level pointers are handled by write_pointer_description */ + if (1 < level) + write_pointer_tfs(file, type, typestring_offset); + return 1; } - - /* FIXME: search through all refs for pointers too */ - while(type_has_ref(type)) - type = type->ref; - - switch (type->type) + else if (is_struct(type->type)) { - /* note: don't descend into complex structures or unions since these - * will always be generated as a separate type */ - case RPC_FC_STRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_PSTRUCT: - v = type->fields; - if (!v) break; - while (NEXT_LINK(v)) v = NEXT_LINK(v); - for (; v; v = PREV_LINK(v)) + int pointers_written = 0; + if (type->fields) + { + LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry ) pointers_written += write_pointers(file, v->attrs, v->type, - v->ptr_level, v->array, + v->name, v->array, level + 1, typestring_offset); - - break; - - default: - /* nothing to do */ - break; + } + return pointers_written; } - - return pointers_written; + else return 0; } -static size_t write_pointer_description(FILE *file, const attr_t *attrs, - const type_t *type, int ptr_level, - const expr_t *array, int level, - size_t typestring_offset) +static size_t write_pointer_description(FILE *file, const attr_list_t *attrs, + type_t *type, size_t mem_offset, + const array_dims_t *array, int level, + size_t *typestring_offset) { - size_t size = 0; const var_t *v; + unsigned int align = 0; /* don't generate a pointer for first-level arrays since we want to * descend into them to write their pointers, not stop here */ - if ((level == 0 || ptr_level == 0) && is_array_type(attrs, ptr_level, array)) + if ((level == 0 || !is_ptr(type)) && is_array_type(attrs, type, array)) { - return write_pointer_description(file, NULL, type, 0, NULL, - level + 1, typestring_offset); + write_pointer_description(file, NULL, type, mem_offset, NULL, + level + 1, typestring_offset); + } + else if (is_ptr(type)) + { + print_file(file, 2, "0x46,\t/* FC_NO_REPEAT */\n"); + print_file(file, 2, "0x5c,\t/* FC_PAD */\n"); + print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", mem_offset, mem_offset); + print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", mem_offset, mem_offset); + *typestring_offset += 6; + + if (has_known_tfs(type->ref)) + write_pointer_tfs(file, type, typestring_offset); + else + error("write_pointer_description: type format string unknown\n"); + } + else if (level == 0 && is_struct(type->type)) + { + if (type->fields) + { + LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry ) + mem_offset + += write_pointer_description(file, v->attrs, v->type, + mem_offset, v->array, + level + 1, + typestring_offset); + } } - if (ptr_level != 0) - { - /* FIXME: only general algorithm implemented, not the actual writing */ - error("write_pointer_description: Writing pointer description is unimplemented\n"); - return 0; - } - - /* FIXME: search through all refs for pointers too */ - - switch (type->type) - { - /* note: don't descend into complex structures or unions since these - * will always be generated as a separate type */ - case RPC_FC_STRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_PSTRUCT: - v = type->fields; - if (!v) break; - while (NEXT_LINK(v)) v = NEXT_LINK(v); - for (; v; v = PREV_LINK(v)) - size += write_pointer_description(file, v->attrs, v->type, - v->ptr_level, v->array, - level + 1, - typestring_offset); - - break; - - default: - /* nothing to do */ - break; - } - - return size; + return type_memsize(type, array, &align); } -static size_t write_string_tfs(FILE *file, const attr_t *attrs, - const type_t *type, const expr_t *array, +static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, + const type_t *type, const array_dims_t *array, const char *name, unsigned int *typestring_offset) { - const expr_t *size_is = get_attrp(attrs, ATTR_SIZEIS); - int has_size = size_is && (size_is->type != EXPR_VOID); + const expr_list_t *size_is = get_attrp(attrs, ATTR_SIZEIS); + int has_size = is_non_void(size_is); size_t start_offset = *typestring_offset; unsigned char flags = 0; - int pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); + int pointer_type; + unsigned char rtype; + + if (is_ptr(type)) + { + pointer_type = type->type; + type = type->ref; + } + else + pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); + if (!pointer_type) pointer_type = RPC_FC_RP; if (!get_attrp(attrs, ATTR_SIZEIS)) flags |= RPC_FC_P_SIMPLEPOINTER; - while (type_has_ref(type)) - type = type->ref; + rtype = type->type; - if ((type->type != RPC_FC_BYTE) && (type->type != RPC_FC_CHAR) && (type->type != RPC_FC_WCHAR)) + if ((rtype != RPC_FC_BYTE) && (rtype != RPC_FC_CHAR) && (rtype != RPC_FC_WCHAR)) { - error("write_string_tfs: Unimplemented for type 0x%x of name: %s\n", type->type, name); + error("write_string_tfs: Unimplemented for type 0x%x of name: %s\n", rtype, name); return start_offset; } @@ -737,27 +875,29 @@ static size_t write_string_tfs(FILE *file, const attr_t *attrs, *typestring_offset += 2; } - if (array && array->is_const) + if (array && !is_conformant_array(array)) { - if (array->cval > USHRT_MAX) + /* FIXME: multi-dimensional array */ + const expr_t *dim = LIST_ENTRY( list_head( array ), expr_t, entry ); + if (dim->cval > USHRT_MAX) error("array size for parameter %s exceeds %d bytes by %ld bytes\n", - name, USHRT_MAX, array->cval - USHRT_MAX); + name, USHRT_MAX, dim->cval - USHRT_MAX); - if (type->type == RPC_FC_CHAR) + if (rtype == RPC_FC_CHAR) WRITE_FCTYPE(file, FC_CSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_WSTRING, *typestring_offset); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", array->cval, array->cval); + print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", dim->cval, dim->cval); *typestring_offset += 2; return start_offset; } else if (has_size) { - if (type->type == RPC_FC_CHAR) + if (rtype == RPC_FC_CHAR) WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); @@ -770,7 +910,7 @@ static size_t write_string_tfs(FILE *file, const attr_t *attrs, } else { - if (type->type == RPC_FC_CHAR) + if (rtype == RPC_FC_CHAR) WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); @@ -781,14 +921,14 @@ static size_t write_string_tfs(FILE *file, const attr_t *attrs, } } -static size_t write_array_tfs(FILE *file, const attr_t *attrs, - const type_t *type, const expr_t *array, +static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, const array_dims_t *array, const char *name, unsigned int *typestring_offset) { - const expr_t *length_is = get_attrp(attrs, ATTR_LENGTHIS); - const expr_t *size_is = get_attrp(attrs, ATTR_SIZEIS); - int has_length = length_is && (length_is->type != EXPR_VOID); - int has_size = (size_is && (size_is->type != EXPR_VOID)) || !array->is_const; + const expr_list_t *length_is = get_attrp(attrs, ATTR_LENGTHIS); + const expr_list_t *size_is = get_attrp(attrs, ATTR_SIZEIS); + int has_length = is_non_void(length_is); + int has_size = is_non_void(size_is) || is_conformant_array(array); size_t start_offset; int pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); if (!pointer_type) @@ -800,17 +940,17 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, print_file(file, 2, "NdrFcShort(0x2),\n"); *typestring_offset += 4; - if (array && NEXT_LINK(array)) /* multi-dimensional array */ + if (array && list_count(array) > 1) /* multi-dimensional array */ { error("write_array_tfs: Multi-dimensional arrays not implemented yet (param %s)\n", name); return 0; } else { - size_t pointer_start_offset = *typestring_offset; + const expr_t *dim = array ? LIST_ENTRY( list_head( array ), expr_t, entry ) : NULL; int has_pointer = 0; - if (write_pointers(file, attrs, type, 0, array, 0, typestring_offset) > 0) + if (write_pointers(file, attrs, type, name, array, 0, typestring_offset) > 0) has_pointer = 1; start_offset = *typestring_offset; @@ -818,12 +958,13 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, if (!has_length && !has_size) { /* fixed array */ - size_t size = type_memsize(type, 0, array); + unsigned int align = 0; + size_t size = type_memsize(type, array, &align); if (size < USHRT_MAX) { WRITE_FCTYPE(file, FC_SMFARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* size */ print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", size, size); *typestring_offset += 4; @@ -832,7 +973,7 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, { WRITE_FCTYPE(file, FC_LGFARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* size */ print_file(file, 2, "NdrFcLong(0x%x), /* %d */\n", size, size); *typestring_offset += 6; @@ -843,30 +984,34 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset = write_pointer_description(file, attrs, - type, 0, array, 0, pointer_start_offset); + write_pointer_description(file, attrs, type, 0, array, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } - print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + if (!write_base_type( file, type, typestring_offset )) + { + print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + *typestring_offset += 1; + } print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); - *typestring_offset += 2; + *typestring_offset += 1; return start_offset; } else if (has_length && !has_size) { /* varying array */ - size_t element_size = type_memsize(type, 0, NULL); - size_t elements = array->cval; + unsigned int align = 0; + size_t element_size = type_memsize(type, NULL, &align); + size_t elements = dim->cval; size_t total_size = element_size * elements; if (total_size < USHRT_MAX) { WRITE_FCTYPE(file, FC_SMVARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* total size */ print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", total_size, total_size); /* number of elements */ @@ -877,7 +1022,7 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, { WRITE_FCTYPE(file, FC_LGVARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* total size */ print_file(file, 2, "NdrFcLong(0x%x), /* %d */\n", total_size, total_size); /* number of elements */ @@ -897,26 +1042,30 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, attrs, - type, 0, array, 0, pointer_start_offset); + write_pointer_description(file, attrs, type, 0, array, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } - print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + if (!write_base_type( file, type, typestring_offset )) + { + print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + *typestring_offset += 1; + } print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); - *typestring_offset += 2; + *typestring_offset += 1; return start_offset; } else if (!has_length && has_size) { /* conformant array */ - size_t element_size = type_memsize(type, 0, NULL); + unsigned int align = 0; + size_t element_size = type_memsize(type, NULL, &align); WRITE_FCTYPE(file, FC_CARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* element size */ print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", element_size, element_size); *typestring_offset += 4; @@ -930,26 +1079,30 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, attrs, - type, 0, array, 0, pointer_start_offset); + write_pointer_description(file, attrs, type, 0, array, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } - print_file(file, 2, "0x%x, /* FIXME: write out conversion data */\n", type->type); + if (!write_base_type( file, type, typestring_offset )) + { + print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + *typestring_offset += 1; + } print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); - *typestring_offset += 2; + *typestring_offset += 1; return start_offset; } else { /* conformant varying array */ - size_t element_size = type_memsize(type, 0, NULL); + unsigned int align = 0; + size_t element_size = type_memsize(type, NULL, &align); WRITE_FCTYPE(file, FC_CVARRAY, *typestring_offset); /* alignment */ - print_file(file, 2, "0x%x, /* 0 */\n", 0); + print_file(file, 2, "0x%02x,\n", align - 1); /* element size */ print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", element_size, element_size); *typestring_offset += 4; @@ -966,15 +1119,18 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, attrs, - type, 0, array, 0, pointer_start_offset); + write_pointer_description(file, attrs, type, 0, array, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } - print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + if (!write_base_type( file, type, typestring_offset )) + { + print_file(file, 2, "0x0, /* FIXME: write out conversion data */\n"); + *typestring_offset += 1; + } print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); - *typestring_offset += 2; + *typestring_offset += 1; return start_offset; } @@ -983,9 +1139,9 @@ static size_t write_array_tfs(FILE *file, const attr_t *attrs, static const var_t *find_array_or_string_in_struct(const type_t *type) { - /* last field is the first in the fields linked list */ - const var_t *last_field = type->fields; - if (is_array_type(last_field->attrs, last_field->ptr_level, last_field->array)) + const var_t *last_field = LIST_ENTRY( list_tail(type->fields), const var_t, entry ); + + if (is_array_type(last_field->attrs, last_field->type, last_field->array)) return last_field; assert((last_field->type->type == RPC_FC_CSTRUCT) || @@ -995,94 +1151,68 @@ static const var_t *find_array_or_string_in_struct(const type_t *type) return find_array_or_string_in_struct(last_field->type); } -static size_t write_struct_members(FILE *file, const type_t *type) +static void write_struct_members(FILE *file, const type_t *type, unsigned int *typestring_offset) { - size_t typestring_size = 0; - var_t *field; + const var_t *field; - field = type->fields; - while (NEXT_LINK(field)) field = NEXT_LINK(field); - for (; field; field = PREV_LINK(field)) + if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry ) { - if (is_base_type(field->type->type)) + unsigned char rtype = field->type->type; + + if (field->array) + write_array_tfs( file, field->attrs, field->type, field->array, + field->name, typestring_offset ); + else if (is_ptr( field->type )) { - switch (field->type->type) - { -#define CASE_BASETYPE(fctype) \ - case RPC_##fctype: \ - print_file(file, 2, "0x%02x,\t\t/* " #fctype " */\n", RPC_##fctype); \ - typestring_size++; \ - break; - CASE_BASETYPE(FC_BYTE); - CASE_BASETYPE(FC_CHAR); - CASE_BASETYPE(FC_SMALL); - CASE_BASETYPE(FC_USMALL); - CASE_BASETYPE(FC_WCHAR); - CASE_BASETYPE(FC_SHORT); - CASE_BASETYPE(FC_USHORT); - CASE_BASETYPE(FC_LONG); - CASE_BASETYPE(FC_ULONG); - CASE_BASETYPE(FC_FLOAT); - CASE_BASETYPE(FC_HYPER); - CASE_BASETYPE(FC_DOUBLE); - CASE_BASETYPE(FC_ENUM16); - CASE_BASETYPE(FC_ENUM32); - CASE_BASETYPE(FC_IGNORE); - CASE_BASETYPE(FC_ERROR_STATUS_T); - default: - break; -#undef CASE_BASETYPE - } + /* pointers are handled in detail earlier, here just treat them like longs */ + print_file( file, 2, "0x8,\t/* FC_LONG */\n" ); + *typestring_offset += 1; } - else - error("Unsupported member type 0x%x\n", field->type->type); + else if (!write_base_type( file, field->type, typestring_offset )) + error("Unsupported member type 0x%x\n", rtype); } - if (typestring_size % 1) + if (!(*typestring_offset % 2)) { print_file(file, 2, "0x%x,\t\t/* FC_PAD */\n", RPC_FC_PAD); - typestring_size++; + *typestring_offset += 1; } print_file(file, 2, "0x%x,\t\t/* FC_END */\n", RPC_FC_END); - typestring_size++; - - return typestring_size; + *typestring_offset += 1; } -static size_t write_struct_tfs(FILE *file, const type_t *type, +static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *typestring_offset) { unsigned int total_size; const var_t *array; size_t start_offset; size_t array_offset; - size_t pointer_offset; + int has_pointers; + unsigned int align = 0; switch (type->type) { case RPC_FC_STRUCT: case RPC_FC_PSTRUCT: - total_size = type_memsize(type, 0, NULL); + total_size = type_memsize(type, NULL, &align); if (total_size > USHRT_MAX) - error("structure size for parameter %s exceeds %d bytes by %d bytes\n", + error("structure size for %s exceeds %d bytes by %d bytes\n", name, USHRT_MAX, total_size - USHRT_MAX); if (type->type == RPC_FC_PSTRUCT) - { - pointer_offset = *typestring_offset; - write_pointers(file, NULL, type, 0, NULL, 0, typestring_offset); - } - else pointer_offset = 0; /* silence warning */ + write_pointers(file, NULL, type, name, NULL, 0, typestring_offset); start_offset = *typestring_offset; + type->typestring_offset = start_offset; if (type->type == RPC_FC_STRUCT) WRITE_FCTYPE(file, FC_STRUCT, *typestring_offset); else WRITE_FCTYPE(file, FC_PSTRUCT, *typestring_offset); /* alignment */ - print_file(file, 2, "0x3,\n"); /* FIXME */ + print_file(file, 2, "0x%02x,\n", align - 1); /* total size */ print_file(file, 2, "NdrFcShort(0x%x), /* %u */\n", total_size, total_size); *typestring_offset += 4; @@ -1092,21 +1222,20 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, NULL, - type, 0, NULL, 0, pointer_offset); + write_pointer_description(file, NULL, type, 0, NULL, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } /* member layout */ - *typestring_offset += write_struct_members(file, type); + write_struct_members(file, type, typestring_offset); return start_offset; case RPC_FC_CSTRUCT: case RPC_FC_CPSTRUCT: - total_size = type_memsize(type, 0, NULL); + total_size = type_memsize(type, NULL, &align); if (total_size > USHRT_MAX) - error("structure size for parameter %s exceeds %d bytes by %d bytes\n", + error("structure size for %s exceeds %d bytes by %d bytes\n", name, USHRT_MAX, total_size - USHRT_MAX); array = find_array_or_string_in_struct(type); @@ -1117,19 +1246,16 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, current_structure = NULL; if (type->type == RPC_FC_CPSTRUCT) - { - pointer_offset = *typestring_offset; - write_pointers(file, NULL, type, 0, NULL, 0, typestring_offset); - } - else pointer_offset = 0; /* silence warning */ + write_pointers(file, NULL, type, name, NULL, 0, typestring_offset); start_offset = *typestring_offset; + type->typestring_offset = start_offset; if (type->type == RPC_FC_CSTRUCT) WRITE_FCTYPE(file, FC_CSTRUCT, *typestring_offset); else WRITE_FCTYPE(file, FC_CPSTRUCT, *typestring_offset); /* alignment */ - print_file(file, 2, "0x0,\n"); + print_file(file, 2, "0x%02x,\n", align - 1); /* total size */ print_file(file, 2, "NdrFcShort(0x%x), /* %u */\n", total_size, total_size); *typestring_offset += 4; @@ -1144,8 +1270,7 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, NULL, - type, 0, NULL, 0, pointer_offset); + write_pointer_description(file, NULL, type, 0, NULL, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } @@ -1155,10 +1280,10 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, return start_offset; case RPC_FC_CVSTRUCT: - total_size = type_memsize(type, 0, NULL); + total_size = type_memsize(type, NULL, &align); if (total_size > USHRT_MAX) - error("structure size for parameter %s exceeds %d bytes by %d bytes\n", + error("structure size for %s exceeds %d bytes by %d bytes\n", name, USHRT_MAX, total_size - USHRT_MAX); array = find_array_or_string_in_struct(type); @@ -1173,14 +1298,13 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, typestring_offset); current_structure = NULL; - pointer_offset = *typestring_offset; - if (!write_pointers(file, NULL, type, 0, NULL, 0, typestring_offset)) - pointer_offset = 0; + has_pointers = write_pointers(file, NULL, type, name, NULL, 0, typestring_offset); start_offset = *typestring_offset; + type->typestring_offset = start_offset; WRITE_FCTYPE(file, FC_CVSTRUCT, *typestring_offset); /* alignment */ - print_file(file, 2, "0x0,\n"); + print_file(file, 2, "0x%02x,\n", align - 1); /* total size */ print_file(file, 2, "NdrFcShort(0x%x), /* %u */\n", total_size, total_size); *typestring_offset += 4; @@ -1190,13 +1314,12 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, array_offset); *typestring_offset += 2; - if (pointer_offset != 0) + if (has_pointers) { print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - *typestring_offset += write_pointer_description(file, NULL, - type, 0, NULL, 0, pointer_offset); + write_pointer_description(file, NULL, type, 0, NULL, 0, typestring_offset); print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } @@ -1211,12 +1334,13 @@ static size_t write_struct_tfs(FILE *file, const type_t *type, } } -static void write_pointer_only_tfs(FILE *file, const attr_t *attrs, size_t offset, unsigned int *typeformat_offset) +static size_t write_pointer_only_tfs(FILE *file, const attr_list_t *attrs, int pointer_type, + unsigned char flags, size_t offset, + unsigned int *typeformat_offset) { + size_t start_offset = *typeformat_offset; + short reloff = offset - (*typeformat_offset + 2); int in_attr, out_attr; - unsigned char flags = 0; - int pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); - if (!pointer_type) pointer_type = RPC_FC_RP; in_attr = is_attr(attrs, ATTR_IN); out_attr = is_attr(attrs, ATTR_OUT); if (!in_attr && !out_attr) in_attr = 1; @@ -1224,16 +1348,26 @@ static void write_pointer_only_tfs(FILE *file, const attr_t *attrs, size_t offse if (out_attr && !in_attr && pointer_type == RPC_FC_RP) flags |= 0x04; - print_file(file, 2, "0x%x, 0x%x,\t\t/* %s%s */\n", + print_file(file, 2, "0x%x, 0x%x,\t\t/* %s", pointer_type, flags, - pointer_type == RPC_FC_FP ? "FC_FP" : (pointer_type == RPC_FC_UP ? "FC_UP" : "FC_RP"), - (flags & 0x04) ? " [allocated_on_stack]" : ""); - print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", offset, offset); + string_of_type(pointer_type)); + if (file) + { + if (flags & 0x04) + fprintf(file, " [allocated_on_stack]"); + if (flags & 0x10) + fprintf(file, " [pointer_deref]"); + fprintf(file, " */\n"); + } + + print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", reloff, offset); *typeformat_offset += 4; + + return start_offset; } -static size_t write_union_tfs(FILE *file, const attr_t *attrs, +static size_t write_union_tfs(FILE *file, const attr_list_t *attrs, const type_t *type, const char *name, unsigned int *typeformat_offset) { @@ -1241,118 +1375,232 @@ static size_t write_union_tfs(FILE *file, const attr_t *attrs, return *typeformat_offset; } -static size_t write_typeformatstring_var(FILE *file, int indent, - const var_t *var, unsigned int *typeformat_offset) +static size_t write_ip_tfs(FILE *file, const func_t *func, const type_t *type, const var_t *var, + unsigned int *typeformat_offset) { - const type_t *type = var->type; - int ptr_level = var->ptr_level; + size_t i; + size_t start_offset = *typeformat_offset; + const var_t *iid = get_attrp(var->attrs, ATTR_IIDIS); - chat("write_typeformatstring_var: %s\n", var->name); - - while (TRUE) + if (iid) { - chat("write_typeformatstring: type->type = 0x%x, type->name = %s, ptr_level = %d\n", type->type, type->name, ptr_level); + expr_t expr; + expr_list_t expr_list; - if (is_string_type(var->attrs, ptr_level, var->array)) - return write_string_tfs(file, var->attrs, type, var->array, var->name, typeformat_offset); + expr.type = EXPR_IDENTIFIER; + expr.ref = NULL; + expr.u.sval = iid->name; + expr.is_const = FALSE; + list_init( &expr_list ); + list_add_head( &expr_list, &expr.entry ); + print_file(file, 2, "0x2f, /* FC_IP */\n"); + print_file(file, 2, "0x5c, /* FC_PAD */\n"); + *typeformat_offset += write_conf_or_var_desc(file, func, NULL, &expr_list) + 2; + } + else + { + const type_t *base = is_ptr(type) ? type->ref : type; + const UUID *uuid = get_attrp(base->attrs, ATTR_UUID); - if (is_array_type(var->attrs, ptr_level, var->array)) - return write_array_tfs(file, var->attrs, type, var->array, var->name, typeformat_offset); + if (! uuid) + error("%s: interface %s missing UUID\n", __FUNCTION__, base->name); - if (ptr_level == 0) - { - /* follow reference if the type has one */ - if (type_has_ref(type)) - { - type = type->ref; - /* FIXME: get new ptr_level from type */ - continue; - } - - /* basic types don't need a type format string */ - if (is_base_type(type->type)) - return 0; - - switch (type->type) - { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: - return write_struct_tfs(file, type, var->name, typeformat_offset); - case RPC_FC_ENCAPSULATED_UNION: - case RPC_FC_NON_ENCAPSULATED_UNION: - return write_union_tfs(file, var->attrs, type, var->name, typeformat_offset); - case RPC_FC_IGNORE: - case RPC_FC_BIND_PRIMITIVE: - /* nothing to do */ - return 0; - default: - error("write_typeformatstring_var: Unsupported type 0x%x for variable %s\n", type->type, var->name); - } - } - else if (ptr_level == 1 && !type_has_ref(type)) - { - size_t start_offset = *typeformat_offset; - int in_attr = is_attr(var->attrs, ATTR_IN); - int out_attr = is_attr(var->attrs, ATTR_OUT); - int pointer_type = get_attrv(var->attrs, ATTR_POINTERTYPE); - if (!pointer_type) pointer_type = RPC_FC_RP; - - /* special case for pointers to base types */ - switch (type->type) - { -#define CASE_BASETYPE(fctype) \ - case RPC_##fctype: \ - print_file(file, indent, "0x%x, 0x%x, /* %s %s[simple_pointer] */\n", \ - pointer_type, \ - (!in_attr && out_attr) ? 0x0C : 0x08, \ - pointer_type == RPC_FC_FP ? "FC_FP" : (pointer_type == RPC_FC_UP ? "FC_UP" : "FC_RP"), \ - (!in_attr && out_attr) ? "[allocated_on_stack] " : ""); \ - print_file(file, indent, "0x%02x, /* " #fctype " */\n", RPC_##fctype); \ - print_file(file, indent, "0x5c, /* FC_PAD */\n"); \ - *typeformat_offset += 4; \ - return start_offset - CASE_BASETYPE(FC_BYTE); - CASE_BASETYPE(FC_CHAR); - CASE_BASETYPE(FC_SMALL); - CASE_BASETYPE(FC_USMALL); - CASE_BASETYPE(FC_WCHAR); - CASE_BASETYPE(FC_SHORT); - CASE_BASETYPE(FC_USHORT); - CASE_BASETYPE(FC_LONG); - CASE_BASETYPE(FC_ULONG); - CASE_BASETYPE(FC_FLOAT); - CASE_BASETYPE(FC_HYPER); - CASE_BASETYPE(FC_DOUBLE); - CASE_BASETYPE(FC_ENUM16); - CASE_BASETYPE(FC_ENUM32); - CASE_BASETYPE(FC_IGNORE); - CASE_BASETYPE(FC_ERROR_STATUS_T); - default: - break; - } - } - - assert(ptr_level > 0); + print_file(file, 2, "0x2f,\t/* FC_IP */\n"); + print_file(file, 2, "0x5a,\t/* FC_CONSTANT_IID */\n"); + print_file(file, 2, "NdrFcLong(0x%08lx),\n", uuid->Data1); + print_file(file, 2, "NdrFcShort(0x%04x),\n", uuid->Data2); + print_file(file, 2, "NdrFcShort(0x%04x),\n", uuid->Data3); + for (i = 0; i < 8; ++i) + print_file(file, 2, "0x%02x,\n", uuid->Data4[i]); if (file) - fprintf(file, "/* %2u */\n", *typeformat_offset); - write_pointer_only_tfs(file, var->attrs, 2, typeformat_offset); + fprintf(file, "\n"); - ptr_level--; + *typeformat_offset += 18; + } + return start_offset; +} + +static int get_ptr_attr(const type_t *t, int def_type) +{ + while (TRUE) + { + int ptr_attr = get_attrv(t->attrs, ATTR_POINTERTYPE); + if (ptr_attr) + return ptr_attr; + if (t->kind != TKIND_ALIAS) + return def_type; + t = t->orig; } } +static size_t write_typeformatstring_var(FILE *file, int indent, const func_t *func, + type_t *type, const var_t *var, + unsigned int *typeformat_offset) +{ + int pointer_type; + size_t offset; -void write_typeformatstring(FILE *file, const ifref_t *ifaces) + if (type == var->type) /* top-level pointers */ + { + int pointer_attr = get_attrv(var->attrs, ATTR_POINTERTYPE); + if (pointer_attr != 0 && !is_ptr(type)) + error("'%s': pointer attribute applied to non-pointer type\n", var->name); + + if (pointer_attr == 0) + pointer_attr = get_ptr_attr(type, RPC_FC_RP); + + pointer_type = pointer_attr; + } + else + pointer_type = get_ptr_attr(type, RPC_FC_UP); + + if (((last_ptr(type) && var->array == NULL) + || (!is_ptr(type) && var->array != NULL)) + && is_ptrchain_attr(var, ATTR_STRING)) + { + return write_string_tfs(file, var->attrs, type, var->array, var->name, typeformat_offset); + } + + if (is_array_type(var->attrs, type, var->array)) + return write_array_tfs(file, var->attrs, type, var->array, var->name, typeformat_offset); + + if (!is_ptr(type)) + { + /* basic types don't need a type format string */ + if (is_base_type(type->type)) + return 0; + + switch (type->type) + { + case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: + case RPC_FC_CSTRUCT: + case RPC_FC_CPSTRUCT: + case RPC_FC_CVSTRUCT: + case RPC_FC_BOGUS_STRUCT: + return write_struct_tfs(file, type, var->name, typeformat_offset); + case RPC_FC_ENCAPSULATED_UNION: + case RPC_FC_NON_ENCAPSULATED_UNION: + return write_union_tfs(file, var->attrs, type, var->name, typeformat_offset); + case RPC_FC_IGNORE: + case RPC_FC_BIND_PRIMITIVE: + /* nothing to do */ + return 0; + default: + error("write_typeformatstring_var: Unsupported type 0x%x for variable %s\n", type->type, var->name); + } + } + else if (last_ptr(type)) + { + size_t start_offset = *typeformat_offset; + int in_attr = is_attr(var->attrs, ATTR_IN); + int out_attr = is_attr(var->attrs, ATTR_OUT); + const type_t *base = type->ref; + + if (base->type == RPC_FC_IP) + { + return write_ip_tfs(file, func, type, var, typeformat_offset); + } + + /* special case for pointers to base types */ + if (is_base_type(base->type)) + { + print_file(file, indent, "0x%x, 0x%x, /* %s %s[simple_pointer] */\n", + pointer_type, (!in_attr && out_attr) ? 0x0C : 0x08, + string_of_type(pointer_type), + (!in_attr && out_attr) ? "[allocated_on_stack] " : ""); + print_file(file, indent, "0x%02x, /* %s */\n", base->type, string_of_type(base->type)); + print_file(file, indent, "0x5c, /* FC_PAD */\n"); + *typeformat_offset += 4; + return start_offset; + } + } + + assert(is_ptr(type)); + + offset = write_typeformatstring_var(file, indent, func, type->ref, var, typeformat_offset); + if (file) + fprintf(file, "/* %2u */\n", *typeformat_offset); + return write_pointer_only_tfs(file, var->attrs, pointer_type, + !last_ptr(type) ? 0x10 : 0, + offset, typeformat_offset); +} + +static void clear_tfsoff(type_t *type) +{ + for (;;) + { + type->typestring_offset = 0; + + if (type->kind == TKIND_ALIAS) + type = type->orig; + else if (is_ptr(type)) + type = type->ref; + else + { + if (type->fields) + { + var_t *v; + LIST_FOR_EACH_ENTRY( v, type->fields, var_t, entry ) + clear_tfsoff(v->type); + } + + return; + } + } +} + +static void clear_all_tfsoffs(const ifref_list_t *ifaces) +{ + const ifref_t * iface; + const func_t *func; + const var_t *var; + + if (ifaces) + LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry ) + if (iface->iface->funcs) + LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry ) + if (func->args) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + clear_tfsoff(var->type); +} + +static size_t process_tfs(FILE *file, const ifref_list_t *ifaces, int for_objects) +{ + const var_t *var; + const ifref_t *iface; + size_t typeformat_offset = 2; + + if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry ) + { + if (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) + continue; + + if (iface->iface->funcs) + { + const func_t *func; + LIST_FOR_EACH_ENTRY( func, iface->iface->funcs, const func_t, entry ) + { + if (is_local(func->def->attrs)) continue; + + current_func = func; + if (func->args) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + var->type->typestring_offset + = write_typeformatstring_var(file, 2, func, var->type, + var, &typeformat_offset); + } + } + } + + return typeformat_offset + 1; +} + + +void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects) { int indent = 0; - var_t *var; - unsigned int typeformat_offset; - const ifref_t *iface = ifaces; print_file(file, indent, "static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =\n"); print_file(file, indent, "{\n"); @@ -1361,36 +1609,9 @@ void write_typeformatstring(FILE *file, const ifref_t *ifaces) print_file(file, indent, "{\n"); indent++; print_file(file, indent, "NdrFcShort(0x0),\n"); - typeformat_offset = 2; - END_OF_LIST(iface); - - for (; iface; iface = PREV_LINK(iface)) - { - if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) - continue; - - if (iface->iface->funcs) - { - func_t *func = iface->iface->funcs; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - for (; func; func = PREV_LINK(func)) - { - current_func = func; - if (func->args) - { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - write_typeformatstring_var(file, indent, var, - &typeformat_offset); - var = PREV_LINK(var); - } - } - } - } - } + clear_all_tfsoffs(ifaces); + process_tfs(file, ifaces, for_objects); print_file(file, indent, "0x0\n"); indent--; @@ -1401,11 +1622,13 @@ void write_typeformatstring(FILE *file, const ifref_t *ifaces) } static unsigned int get_required_buffer_size_type( - const type_t *type, int ptr_level, const expr_t *array, + const type_t *type, const array_dims_t *array, const char *name, unsigned int *alignment) { + size_t size = 0; + *alignment = 0; - if (ptr_level == 0 && !array && !type_has_ref(type)) + if (!is_ptr(type)) { switch (type->type) { @@ -1414,58 +1637,67 @@ static unsigned int get_required_buffer_size_type( case RPC_FC_USMALL: case RPC_FC_SMALL: *alignment = 4; - return 1; + size = 1; + break; case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: *alignment = 4; - return 2; + size = 2; + break; case RPC_FC_ULONG: case RPC_FC_LONG: case RPC_FC_FLOAT: case RPC_FC_ERROR_STATUS_T: *alignment = 4; - return 4; + size = 4; + break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: *alignment = 8; - return 8; + size = 8; + break; case RPC_FC_IGNORE: case RPC_FC_BIND_PRIMITIVE: return 0; case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: { - size_t size = 0; const var_t *field; - for (field = type->fields; field; field = NEXT_LINK(field)) + if (!type->fields) return 0; + LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry ) { unsigned int alignment; size += get_required_buffer_size_type( - field->type, field->ptr_level, field->array, field->name, + field->type, field->array, field->name, &alignment); } - return size; + break; } + case RPC_FC_RP: + if (is_base_type( type->ref->type ) || type->ref->type == RPC_FC_STRUCT) + size = get_required_buffer_size_type( type->ref, NULL, name, alignment ); + break; + default: error("get_required_buffer_size: Unknown/unsupported type: %s (0x%02x)\n", name, type->type); return 0; } + if (array) size *= get_array_size( array ); } - if (ptr_level == 0 && type_has_ref(type)) - return get_required_buffer_size_type(type->ref, 0 /* FIXME */, array, name, alignment); - return 0; + return size; } -unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass) +static unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass) { - expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS); - int has_size = (size_is && (size_is->type != EXPR_VOID)); + expr_list_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS); + int has_size = is_non_void(size_is); int in_attr = is_attr(var->attrs, ATTR_IN); int out_attr = is_attr(var->attrs, ATTR_OUT); @@ -1476,27 +1708,25 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, if (pass == PASS_OUT) { - if (out_attr && var->ptr_level > 0) + if (out_attr && is_ptr(var->type)) { type_t *type = var->type; - while (type->type == 0 && type->ref) - type = type->ref; if (type->type == RPC_FC_STRUCT) { const var_t *field; unsigned int size = 36; - for (field = type->fields; field; field = NEXT_LINK(field)) + + if (!type->fields) return size; + LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry ) { unsigned int align; size += get_required_buffer_size_type( - field->type, field->ptr_level, field->array, field->name, + field->type, field->array, field->name, &align); } return size; } - else - return get_required_buffer_size_type(var->type, 0 /* FIXME */, var->array, var->name, alignment); } return 0; } @@ -1504,11 +1734,9 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, { if ((!out_attr || in_attr) && !has_size && !is_attr(var->attrs, ATTR_STRING) && !var->array) { - if (var->ptr_level > 0 || (var->ptr_level == 0 && type_has_ref(var->type))) + if (is_ptr(var->type)) { type_t *type = var->type; - while (type->type == 0 && type->ref) - type = type->ref; if (is_base_type(type->type)) { @@ -1518,11 +1746,13 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, { unsigned int size = 36; const var_t *field; - for (field = type->fields; field; field = NEXT_LINK(field)) + + if (!type->fields) return size; + LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry ) { unsigned int align; size += get_required_buffer_size_type( - field->type, field->ptr_level, field->array, field->name, + field->type, field->array, field->name, &align); } return size; @@ -1530,10 +1760,32 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, } } - return get_required_buffer_size_type(var->type, var->ptr_level, var->array, var->name, alignment); + return get_required_buffer_size_type(var->type, var->array, var->name, alignment); } } +static unsigned int get_function_buffer_size( const func_t *func, enum pass pass ) +{ + const var_t *var; + unsigned int total_size = 0, alignment; + + if (func->args) + { + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + { + total_size += get_required_buffer_size(var, &alignment, pass); + total_size += alignment; + } + } + + if (pass == PASS_OUT && !is_void(func->def->type)) + { + total_size += get_required_buffer_size(func->def, &alignment, PASS_RETURN); + total_size += alignment; + } + return total_size; +} + static void print_phase_function(FILE *file, int indent, const char *type, enum remoting_phase phase, const char *varname, unsigned int type_offset) @@ -1575,18 +1827,18 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname) { - const type_t *type = var->type; + type_t *type = var->type; unsigned int size; unsigned int alignment = 0; + unsigned char rtype; /* no work to do for other phases, buffer sizing is done elsewhere */ if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL) return; - while (type_has_ref(type)) - type = type->ref; + rtype = is_ptr(type) ? type->ref->type : type->type; - switch (type->type) + switch (rtype) { case RPC_FC_BYTE: case RPC_FC_CHAR: @@ -1623,7 +1875,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, return; default: - error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n", var->name, type->type); + error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n", var->name, rtype); size = 0; } @@ -1633,8 +1885,8 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, if (phase == PHASE_MARSHAL) { print_file(file, indent, "*("); - write_type(file, var->type, NULL, var->tname); - if (var->ptr_level) + write_type(file, is_ptr(type) ? type->ref : type); + if (is_ptr(type)) fprintf(file, " *)_StubMsg.Buffer = *"); else fprintf(file, " *)_StubMsg.Buffer = "); @@ -1648,16 +1900,16 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, else print_file(file, indent, "*"); fprintf(file, varname); - if (pass == PASS_IN && var->ptr_level) + if (pass == PASS_IN && is_ptr(type)) fprintf(file, " = ("); else fprintf(file, " = *("); - write_type(file, var->type, NULL, var->tname); + write_type(file, is_ptr(type) ? type->ref : type); fprintf(file, " *)_StubMsg.Buffer;\n"); } print_file(file, indent, "_StubMsg.Buffer += sizeof("); - write_type(file, var->type, NULL, var->tname); + write_type(file, var->type); fprintf(file, ");\n"); } @@ -1669,26 +1921,32 @@ static inline int is_size_needed_for_phase(enum remoting_phase phase) } void write_remoting_arguments(FILE *file, int indent, const func_t *func, - unsigned int *type_offset, enum pass pass, - enum remoting_phase phase) + enum pass pass, enum remoting_phase phase) { - const expr_t *length_is; - const expr_t *size_is; + const expr_list_t *length_is; + const expr_list_t *size_is; int in_attr, out_attr, has_length, has_size, pointer_type; - var_t *var; + const var_t *var; if (!func->args) return; - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - for (; var; *type_offset += get_size_typeformatstring_var(var), var = PREV_LINK(var)) + if (phase == PHASE_BUFFERSIZE) + { + unsigned int size = get_function_buffer_size( func, pass ); + print_file(file, indent, "_StubMsg.BufferLength = %u;\n", size); + } + + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) { const type_t *type = var->type; + unsigned char rtype; + size_t start_offset = type->typestring_offset; + length_is = get_attrp(var->attrs, ATTR_LENGTHIS); size_is = get_attrp(var->attrs, ATTR_SIZEIS); - has_length = length_is && (length_is->type != EXPR_VOID); - has_size = (size_is && (size_is->type != EXPR_VOID)) || (var->array && !var->array->is_const); + has_length = is_non_void(length_is); + has_size = is_non_void(size_is) || (var->array && is_conformant_array(var->array)); pointer_type = get_attrv(var->attrs, ATTR_POINTERTYPE); if (!pointer_type) @@ -1702,45 +1960,47 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, switch (pass) { case PASS_IN: - if (!in_attr) - continue; + if (!in_attr) continue; break; case PASS_OUT: - if (!out_attr) - continue; + if (!out_attr) continue; break; case PASS_RETURN: break; } - while (type_has_ref(type)) - type = type->ref; + rtype = type->type; - if (is_string_type(var->attrs, var->ptr_level, var->array)) + if (is_user_derived( var )) { - if (var->array && var->array->is_const) - print_phase_function(file, indent, "NonConformantString", phase, var->name, *type_offset); + print_phase_function(file, indent, "UserMarshal", phase, var->name, start_offset); + } + else if (is_string_type(var->attrs, var->type, var->array)) + { + if (var->array && !is_conformant_array(var->array)) + print_phase_function(file, indent, "NonConformantString", phase, var->name, start_offset); else { if (size_is && is_size_needed_for_phase(phase)) { + const expr_t *size = LIST_ENTRY( list_head(size_is), const expr_t, entry ); print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)"); - write_expr(file, size_is, 1); + write_expr(file, size, 1); fprintf(file, ";\n"); } if ((phase == PHASE_FREE) || (pointer_type == RPC_FC_UP)) - print_phase_function(file, indent, "Pointer", phase, var->name, *type_offset); + print_phase_function(file, indent, "Pointer", phase, var->name, start_offset); else print_phase_function(file, indent, "ConformantString", phase, var->name, - *type_offset + (has_size ? 4 : 2)); + start_offset + (has_size ? 4 : 2)); } } - else if (is_array_type(var->attrs, var->ptr_level, var->array)) + else if (is_array_type(var->attrs, var->type, var->array)) { const char *array_type; - if (var->array && NEXT_LINK(var->array)) /* multi-dimensional array */ + if (var->array && list_count(var->array) > 1) /* multi-dimensional array */ array_type = "ComplexArray"; else { @@ -1750,9 +2010,10 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, { if (is_size_needed_for_phase(phase)) { + const expr_t *length = LIST_ENTRY( list_head(length_is), const expr_t, entry ); print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */ print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)"); - write_expr(file, length_is, 1); + write_expr(file, length, 1); fprintf(file, ";\n\n"); } array_type = "VaryingArray"; @@ -1761,8 +2022,10 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, { if (is_size_needed_for_phase(phase) && phase != PHASE_FREE) { + const expr_t *size = LIST_ENTRY( list_head(size_is ? size_is : var->array), + const expr_t, entry ); print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)"); - write_expr(file, size_is ? size_is : var->array, 1); + write_expr(file, size, 1); fprintf(file, ";\n\n"); } array_type = "ConformantArray"; @@ -1771,12 +2034,15 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, { if (is_size_needed_for_phase(phase)) { + const expr_t *length = LIST_ENTRY( list_head(length_is), const expr_t, entry ); + const expr_t *size = LIST_ENTRY( list_head(size_is ? size_is : var->array), + const expr_t, entry ); print_file(file, indent, "_StubMsg.MaxCount = (unsigned long)"); - write_expr(file, size_is ? size_is : var->array, 1); + write_expr(file, size, 1); fprintf(file, ";\n"); print_file(file, indent, "_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */ print_file(file, indent, "_StubMsg.ActualCount = (unsigned long)"); - write_expr(file, length_is, 1); + write_expr(file, length, 1); fprintf(file, ";\n\n"); } array_type = "ConformantVaryingArray"; @@ -1792,56 +2058,72 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, else if (phase != PHASE_FREE) { if (pointer_type == RPC_FC_UP) - print_phase_function(file, indent, "Pointer", phase, var->name, *type_offset); + print_phase_function(file, indent, "Pointer", phase, var->name, start_offset); else - print_phase_function(file, indent, array_type, phase, var->name, *type_offset + 4); + print_phase_function(file, indent, array_type, phase, var->name, start_offset); } } - else if (var->ptr_level == 0 && is_base_type(type->type)) + else if (!is_ptr(var->type) && is_base_type(rtype)) { print_phase_basetype(file, indent, phase, pass, var, var->name); } - else if (var->ptr_level == 0) + else if (!is_ptr(var->type)) { - const char *ndrtype; - - switch (type->type) + switch (rtype) { case RPC_FC_STRUCT: - ndrtype = "SimpleStruct"; + case RPC_FC_PSTRUCT: + print_phase_function(file, indent, "SimpleStruct", phase, var->name, start_offset); break; case RPC_FC_CSTRUCT: case RPC_FC_CPSTRUCT: - ndrtype = "ConformantStruct"; + print_phase_function(file, indent, "ConformantStruct", phase, var->name, start_offset); break; case RPC_FC_CVSTRUCT: - ndrtype = "ConformantVaryingStruct"; + print_phase_function(file, indent, "ConformantVaryingStruct", phase, var->name, start_offset); break; case RPC_FC_BOGUS_STRUCT: - ndrtype = "ComplexStruct"; + print_phase_function(file, indent, "ComplexStruct", phase, var->name, start_offset); + break; + case RPC_FC_RP: + if (is_base_type( var->type->ref->type )) + { + print_phase_basetype(file, indent, phase, pass, var, var->name); + } + else if (var->type->ref->type == RPC_FC_STRUCT) + { + if (phase != PHASE_BUFFERSIZE && phase != PHASE_FREE) + print_phase_function(file, indent, "SimpleStruct", phase, var->name, start_offset + 4); + } + else + { + const var_t *iid; + if ((iid = get_attrp( var->attrs, ATTR_IIDIS ))) + print_file( file, indent, "_StubMsg.MaxCount = (unsigned long)%s;\n", iid->name ); + print_phase_function(file, indent, "Pointer", phase, var->name, start_offset); + } break; default: - error("write_remoting_arguments: Unsupported type: %s (0x%02x, ptr_level: %d)\n", - var->name, type->type, var->ptr_level); - ndrtype = NULL; + error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, rtype); } - - print_phase_function(file, indent, ndrtype, phase, var->name, *type_offset); } else { - if ((var->ptr_level == 1) && (pointer_type == RPC_FC_RP) && is_base_type(type->type)) + if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && is_base_type(rtype)) { print_phase_basetype(file, indent, phase, pass, var, var->name); } - else if ((var->ptr_level == 1) && (pointer_type == RPC_FC_RP) && (type->type == RPC_FC_STRUCT)) + else if (last_ptr(var->type) && (pointer_type == RPC_FC_RP) && (rtype == RPC_FC_STRUCT)) { if (phase != PHASE_BUFFERSIZE && phase != PHASE_FREE) - print_phase_function(file, indent, "SimpleStruct", phase, var->name, *type_offset + 4); + print_phase_function(file, indent, "SimpleStruct", phase, var->name, start_offset + 4); } else { - print_phase_function(file, indent, "Pointer", phase, var->name, *type_offset); + const var_t *iid; + if ((iid = get_attrp( var->attrs, ATTR_IIDIS ))) + print_file( file, indent, "_StubMsg.MaxCount = (unsigned long)%s;\n", iid->name ); + print_phase_function(file, indent, "Pointer", phase, var->name, start_offset); } } fprintf(file, "\n"); @@ -1851,111 +2133,61 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func, size_t get_size_procformatstring_var(const var_t *var) { - unsigned int type_offset = 2; - return write_procformatstring_var(NULL, 0, var, FALSE, &type_offset); + return write_procformatstring_var(NULL, 0, var, FALSE); } -size_t get_size_typeformatstring_var(const var_t *var) +size_t get_size_procformatstring_func(const func_t *func) { - unsigned int type_offset = 0; - write_typeformatstring_var(NULL, 0, var, &type_offset); - return type_offset; + const var_t *var; + size_t size = 0; + + /* argument list size */ + if (func->args) + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + size += get_size_procformatstring_var(var); + + /* return value size */ + if (is_void(func->def->type)) + size += 2; /* FC_END and FC_PAD */ + else + size += get_size_procformatstring_var(func->def); + + return size; } -size_t get_size_procformatstring(const ifref_t *ifaces) +size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects) { - const ifref_t *iface = ifaces; + const ifref_t *iface; size_t size = 1; - func_t *func; - var_t *var; + const func_t *func; - END_OF_LIST(iface); - - for (; iface; iface = PREV_LINK(iface)) + if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry ) { - if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) + if (for_objects != is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) continue; if (iface->iface->funcs) - { - func = iface->iface->funcs; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - while (func) - { - /* argument list size */ - if (func->args) - { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - size += get_size_procformatstring_var(var); - var = PREV_LINK(var); - } - } - - var = func->def; - /* return value size */ - if (is_void(var->type, NULL)) - size += 2; - else - size += get_size_procformatstring_var(var); - - func = PREV_LINK(func); - } - } + LIST_FOR_EACH_ENTRY( func, iface->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_t *ifaces) +size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects) { - const ifref_t *iface = ifaces; - size_t size = 3; - func_t *func; - var_t *var; - - END_OF_LIST(iface); - - for (; iface; iface = PREV_LINK(iface)) - { - if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs)) - continue; - - if (iface->iface->funcs) - { - func = iface->iface->funcs; - while (NEXT_LINK(func)) func = NEXT_LINK(func); - while (func) - { - /* argument list size */ - if (func->args) - { - var = func->args; - while (NEXT_LINK(var)) var = NEXT_LINK(var); - while (var) - { - size += get_size_typeformatstring_var(var); - var = PREV_LINK(var); - } - } - - func = PREV_LINK(func); - } - } - } - return size; + return process_tfs(NULL, ifaces, for_objects); } static void write_struct_expr(FILE *h, const expr_t *e, int brackets, - const var_t *fields, const char *structvar) + const var_list_t *fields, const char *structvar) { switch (e->type) { case EXPR_VOID: break; case EXPR_NUM: - fprintf(h, "%ld", e->u.lval); + fprintf(h, "%lu", e->u.lval); break; case EXPR_HEXNUM: fprintf(h, "0x%lx", e->u.lval); @@ -1969,15 +2201,14 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets, case EXPR_IDENTIFIER: { const var_t *field; - for (field = fields; field; field = NEXT_LINK(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) error("no field found for identifier %s\n", e->u.sval); + + if (&field->entry == fields) error("no field found for identifier %s\n", e->u.sval); break; } case EXPR_NEG: @@ -1994,13 +2225,13 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets, break; case EXPR_CAST: fprintf(h, "("); - write_type(h, e->u.tref->ref, NULL, e->u.tref->name); + write_type(h, e->u.tref); fprintf(h, ")"); write_struct_expr(h, e->ref, 1, fields, structvar); break; case EXPR_SIZEOF: fprintf(h, "sizeof("); - write_type(h, e->u.tref->ref, NULL, e->u.tref->name); + write_type(h, e->u.tref); fprintf(h, ")"); break; case EXPR_SHL: @@ -2039,6 +2270,116 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets, } } + +void declare_stub_args( FILE *file, int indent, const func_t *func ) +{ + int in_attr, out_attr; + int i = 0; + const var_t *def = func->def; + const var_t *var; + + /* declare return value '_RetVal' */ + if (!is_void(def->type)) + { + print_file(file, indent, ""); + write_type(file, def->type); + fprintf(file, " _RetVal;\n"); + } + + if (!func->args) + return; + + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + { + const expr_list_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS); + int has_size = is_non_void(size_is); + int is_string = is_attr(var->attrs, ATTR_STRING); + + in_attr = is_attr(var->attrs, ATTR_IN); + out_attr = is_attr(var->attrs, ATTR_OUT); + if (!out_attr && !in_attr) + in_attr = 1; + + if (!in_attr && !has_size && !is_string) + { + print_file(file, indent, ""); + write_type(file, var->type->ref); + fprintf(file, " _W%u;\n", i++); + } + + print_file(file, indent, ""); + write_type(file, var->type); + fprintf(file, " "); + if (var->array) { + fprintf(file, "( *"); + write_name(file, var); + fprintf(file, " )"); + } else + write_name(file, var); + write_array(file, var->array, 0); + fprintf(file, ";\n"); + } +} + + +void assign_stub_out_args( FILE *file, int indent, const func_t *func ) +{ + int in_attr, out_attr; + int i = 0, sep = 0; + const var_t *var; + const expr_list_t *size_is; + int has_size; + + if (!func->args) + return; + + LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry ) + { + int is_string = is_attr(var->attrs, ATTR_STRING); + size_is = get_attrp(var->attrs, ATTR_SIZEIS); + has_size = is_non_void(size_is); + in_attr = is_attr(var->attrs, ATTR_IN); + out_attr = is_attr(var->attrs, ATTR_OUT); + if (!out_attr && !in_attr) + in_attr = 1; + + if (!in_attr) + { + print_file(file, indent, ""); + write_name(file, var); + + if (has_size) + { + const expr_t *expr; + unsigned int size, align = 0; + type_t *type = var->type; + + fprintf(file, " = NdrAllocate(&_StubMsg, "); + LIST_FOR_EACH_ENTRY( expr, size_is, const expr_t, entry ) + { + if (expr->type == EXPR_VOID) continue; + write_expr( file, expr, 1 ); + fprintf(file, " * "); + } + size = type_memsize(type, NULL, &align); + fprintf(file, "%u);\n", size); + } + else if (!is_string) + { + fprintf(file, " = &_W%u;\n", i); + if (is_ptr(var->type) && !last_ptr(var->type)) + print_file(file, indent, "_W%u = 0;\n", i); + i++; + } + + sep = 1; + } + } + if (sep) + fprintf(file, "\n"); +} + + int write_expr_eval_routines(FILE *file, const char *iface) { int result = 0; @@ -2088,3 +2429,38 @@ void write_expr_eval_routine_list(FILE *file, const char *iface) fprintf(file, "};\n\n"); } + + +void write_endpoints( FILE *f, const char *prefix, const str_list_t *list ) +{ + const struct str_list_entry_t *endpoint; + const char *p; + + /* this should be an array of RPC_PROTSEQ_ENDPOINT but we want const strings */ + print_file( f, 0, "static const unsigned char * %s__RpcProtseqEndpoint[][2] =\n{\n", prefix ); + LIST_FOR_EACH_ENTRY( endpoint, list, const struct str_list_entry_t, entry ) + { + print_file( f, 1, "{ (const unsigned char *)\"" ); + for (p = endpoint->str; *p && *p != ':'; p++) + { + if (*p == '"' || *p == '\\') fputc( '\\', f ); + fputc( *p, f ); + } + if (!*p) goto error; + if (p[1] != '[') goto error; + + fprintf( f, "\", (const unsigned char *)\"" ); + for (p += 2; *p && *p != ']'; p++) + { + if (*p == '"' || *p == '\\') fputc( '\\', f ); + fputc( *p, f ); + } + if (*p != ']') goto error; + fprintf( f, "\" },\n" ); + } + print_file( f, 0, "};\n\n" ); + return; + +error: + error("Invalid endpoint syntax '%s'\n", endpoint->str); +} diff --git a/reactos/tools/widl/typegen.h b/reactos/tools/widl/typegen.h index eb4c4c7689b..5ed5bc94af3 100644 --- a/reactos/tools/widl/typegen.h +++ b/reactos/tools/widl/typegen.h @@ -35,15 +35,17 @@ enum remoting_phase PHASE_FREE }; -void write_procformatstring(FILE *file, const ifref_t *ifaces); -void write_typeformatstring(FILE *file, const ifref_t *ifaces); -size_t get_type_memsize(const type_t *type); -unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass); +void write_formatstringsdecl(FILE *f, int indent, ifref_list_t *ifaces, int for_objects); +void write_procformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects); +void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects); 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, unsigned int *type_offset, enum pass pass, enum remoting_phase phase); +void write_remoting_arguments(FILE *file, int indent, const func_t *func, enum pass pass, enum remoting_phase phase); size_t get_size_procformatstring_var(const var_t *var); -size_t get_size_typeformatstring_var(const var_t *var); -size_t get_size_procformatstring(const ifref_t *ifaces); -size_t get_size_typeformatstring(const ifref_t *ifaces); +size_t get_size_procformatstring_func(const func_t *func); +size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects); +size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects); +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); void write_expr_eval_routine_list(FILE *file, const char *iface); +void write_endpoints( FILE *f, const char *prefix, const str_list_t *list ); diff --git a/reactos/tools/widl/typelib.c b/reactos/tools/widl/typelib.c index 5ff101beeb6..3bdbcf3b600 100644 --- a/reactos/tools/widl/typelib.c +++ b/reactos/tools/widl/typelib.c @@ -50,6 +50,38 @@ int in_typelib = 0; static typelib_t *typelib; +type_t *duptype(type_t *t, int dupname) +{ + type_t *d = xmalloc(sizeof *d); + + *d = *t; + if (dupname && t->name) + d->name = xstrdup(t->name); + + d->orig = t; + return d; +} + +type_t *alias(type_t *t, const char *name) +{ + type_t *a = duptype(t, 0); + + a->name = xstrdup(name); + a->kind = TKIND_ALIAS; + a->attrs = NULL; + + return a; +} + +int is_ptr(const type_t *t) +{ + unsigned char c = t->type; + return c == RPC_FC_RP + || c == RPC_FC_UP + || c == RPC_FC_FP + || c == RPC_FC_OP; +} + /* List of oleauto types that should be recognized by name. * (most of) these seem to be intrinsic types in mktyplib. */ @@ -114,6 +146,9 @@ unsigned short get_type_vt(type_t *t) if (vt) return vt; } + if (t->kind == TKIND_ALIAS && t->attrs) + return VT_USERDEFINED; + switch (t->type) { case RPC_FC_BYTE: case RPC_FC_USMALL: @@ -128,14 +163,14 @@ unsigned short get_type_vt(type_t *t) case RPC_FC_USHORT: return VT_UI2; case RPC_FC_LONG: - if (t->ref && match(t->ref->name, "int")) return VT_INT; + if (match(t->name, "int")) return VT_INT; return VT_I4; case RPC_FC_ULONG: - if (t->ref && match(t->ref->name, "int")) return VT_UINT; + if (match(t->name, "int")) return VT_UINT; return VT_UI4; case RPC_FC_HYPER: if (t->sign < 0) return VT_UI8; - if (t->ref && match(t->ref->name, "MIDL_uhyper")) return VT_UI8; + if (match(t->name, "MIDL_uhyper")) return VT_UI8; return VT_I8; case RPC_FC_FLOAT: return VT_R4; @@ -146,7 +181,11 @@ unsigned short get_type_vt(type_t *t) case RPC_FC_OP: case RPC_FC_FP: if(t->ref) + { + if (match(t->ref->name, "SAFEARRAY")) + return VT_SAFEARRAY; return VT_PTR; + } error("get_type_vt: unknown-deref-type: %d\n", t->ref->type); break; @@ -166,29 +205,14 @@ unsigned short get_type_vt(type_t *t) case RPC_FC_BOGUS_STRUCT: return VT_USERDEFINED; case 0: - if(t->attrs) - return VT_USERDEFINED; - return 0; + return t->kind == TKIND_PRIMITIVE ? VT_VOID : VT_USERDEFINED; default: error("get_type_vt: unknown type: 0x%02x\n", t->type); } return 0; } -unsigned short get_var_vt(var_t *v) -{ - unsigned short vt; - - chat("get_var_vt: %p tname %s\n", v, v->tname); - if (v->tname) { - vt = builtin_vt(v->tname); - if (vt) return vt; - } - - return get_type_vt(v->type); -} - -void start_typelib(char *name, attr_t *attrs) +void start_typelib(char *name, attr_list_t *attrs) { in_typelib++; if (!do_typelib) return; @@ -197,6 +221,8 @@ void start_typelib(char *name, attr_t *attrs) typelib->name = xstrdup(name); typelib->filename = xstrdup(typelib_name); typelib->attrs = attrs; + list_init( &typelib->entries ); + list_init( &typelib->importlibs ); } void end_typelib(void) @@ -208,90 +234,18 @@ void end_typelib(void) return; } -void add_interface(type_t *iface) +void add_typelib_entry(type_t *t) { typelib_entry_t *entry; if (!typelib) return; - chat("add interface: %s\n", iface->name); + chat("add kind %i: %s\n", t->kind, t->name); entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_INTERFACE; - entry->u.interface = iface; - LINK(entry, typelib->entry); - typelib->entry = entry; + entry->type = t; + list_add_tail( &typelib->entries, &entry->entry ); } -void add_coclass(type_t *cls) -{ - typelib_entry_t *entry; - - if (!typelib) return; - - chat("add coclass: %s\n", cls->name); - - entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_COCLASS; - entry->u.class = cls; - LINK(entry, typelib->entry); - typelib->entry = entry; -} - -void add_module(type_t *module) -{ - typelib_entry_t *entry; - if (!typelib) return; - - chat("add module: %s\n", module->name); - entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_MODULE; - entry->u.module = module; - LINK(entry, typelib->entry); - typelib->entry = entry; -} - -void add_struct(type_t *structure) -{ - typelib_entry_t *entry; - if (!typelib) return; - - chat("add struct: %s\n", structure->name); - entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_RECORD; - entry->u.structure = structure; - LINK(entry, typelib->entry); - typelib->entry = entry; -} - -void add_enum(type_t *enumeration) -{ - typelib_entry_t *entry; - if (!typelib) return; - - chat("add enum: %s\n", enumeration->name); - entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_ENUM; - entry->u.enumeration = enumeration; - LINK(entry, typelib->entry); - typelib->entry = entry; -} - -void add_typedef(type_t *tdef, var_t *name) -{ - typelib_entry_t *entry; - if (!typelib) return; - - chat("add typedef: %s\n", name->name); - entry = xmalloc(sizeof(*entry)); - entry->kind = TKIND_ALIAS; - entry->u.tdef = xmalloc(sizeof(*entry->u.tdef)); - memcpy(entry->u.tdef, name, sizeof(*name)); - entry->u.tdef->type = tdef; - entry->u.tdef->name = xstrdup(name->name); - LINK(entry, typelib->entry); - typelib->entry = entry; -} - -static void tlb_read(int fd, void *buf, size_t count) +static void tlb_read(int fd, void *buf, int count) { if(read(fd, buf, count) < count) error("error while reading importlib.\n"); @@ -350,6 +304,7 @@ static void read_msft_importlib(importlib_t *importlib, int fd) importlib->importinfos[i].flags |= MSFT_IMPINFO_OFFSET_IS_GUID; msft_read_guid(fd, &segdir, base.posguid, &importlib->importinfos[i].guid); } + else memset( &importlib->importinfos[i].guid, 0, sizeof(importlib->importinfos[i].guid)); tlb_lseek(fd, segdir.pNametab.offset + base.NameOffset); tlb_read(fd, &nameintro, sizeof(nameintro)); @@ -400,18 +355,16 @@ void add_importlib(const char *name) if(!typelib) return; - for(importlib = typelib->importlibs; importlib; importlib = NEXT_LINK(importlib)) { + LIST_FOR_EACH_ENTRY( importlib, &typelib->importlibs, importlib_t, entry ) if(!strcmp(name, importlib->name)) return; - } chat("add_importlib: %s\n", name); importlib = xmalloc(sizeof(*importlib)); + memset( importlib, 0, sizeof(*importlib) ); importlib->name = xstrdup(name); read_importlib(importlib); - - LINK(importlib, typelib->importlibs); - typelib->importlibs = importlib; + list_add_head( &typelib->importlibs, &importlib->entry ); } diff --git a/reactos/tools/widl/typelib.h b/reactos/tools/widl/typelib.h index 9fb5bdd9345..b17387dfc39 100644 --- a/reactos/tools/widl/typelib.h +++ b/reactos/tools/widl/typelib.h @@ -22,14 +22,9 @@ #define __WIDL_TYPELIB_H extern int in_typelib; -extern void start_typelib(char *name, attr_t *attrs); +extern void start_typelib(char *name, attr_list_t *attrs); extern void end_typelib(void); -extern void add_interface(type_t *iface); -extern void add_coclass(type_t *cls); -extern void add_module(type_t *module); -extern void add_struct(type_t *structure); -extern void add_enum(type_t *enumeration); -extern void add_typedef(type_t *tdef, var_t *name); +extern void add_typelib_entry(type_t *t); extern void add_importlib(const char *name); /* Copied from wtypes.h. Not included directly because that would create a @@ -87,7 +82,6 @@ enum VARENUM { VT_TYPEMASK = 0xfff }; extern unsigned short get_type_vt(type_t *t); -extern unsigned short get_var_vt(var_t *v); extern int create_msft_typelib(typelib_t *typelib); #endif diff --git a/reactos/tools/widl/typelib_struct.h b/reactos/tools/widl/typelib_struct.h index d3b2ab5b2ba..e16387c8dcd 100644 --- a/reactos/tools/widl/typelib_struct.h +++ b/reactos/tools/widl/typelib_struct.h @@ -148,7 +148,7 @@ typedef struct tagMSFT_TypeInfoBase { /*050*/ INT size; /* size in bytes, at least for structures */ /* FIXME: name of this field */ INT datatype1; /* position in type description table */ - /* or in base intefaces */ + /* or in base interfaces */ /* if coclass: offset in reftable */ /* if interface: reference to inherited if */ INT datatype2; /* for interfaces: hiword is num of inherited funcs */ @@ -286,7 +286,7 @@ typedef struct { /* 0x3800 if name is typeinfo name */ /* upper 16 bits are hash code */ } MSFT_NameIntro; -/* the custom data table directory has enties like this */ +/* the custom data table directory has entries like this */ typedef struct { INT GuidOffset; INT DataOffset; diff --git a/reactos/tools/widl/utils.c b/reactos/tools/widl/utils.c index 9f82184cd94..007d1cb0311 100644 --- a/reactos/tools/widl/utils.c +++ b/reactos/tools/widl/utils.c @@ -34,10 +34,9 @@ #include "utils.h" #include "parser.h" -/* #define WANT_NEAR_INDICATION */ +static const int want_near_indication = 0; -#ifdef WANT_NEAR_INDICATION -void make_print(char *str) +static void make_print(char *str) { while(*str) { @@ -46,13 +45,13 @@ void make_print(char *str) str++; } } -#endif static void generic_msg(const char *s, const char *t, const char *n, va_list ap) { fprintf(stderr, "%s:%d: %s: ", input_name ? input_name : "stdin", line_number, t); vfprintf(stderr, s, ap); -#ifdef WANT_NEAR_INDICATION + + if (want_near_indication) { char *cpy; if(n) @@ -63,26 +62,26 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap) free(cpy); } } -#endif + fprintf(stderr, "\n"); } -int yyerror(const char *s, ...) +int parser_error(const char *s, ...) { va_list ap; va_start(ap, s); - generic_msg(s, "Error", yytext, ap); + generic_msg(s, "Error", parser_text, ap); va_end(ap); exit(1); return 1; } -int yywarning(const char *s, ...) +int parser_warning(const char *s, ...) { va_list ap; va_start(ap, s); - generic_msg(s, "Warning", yytext, ap); + generic_msg(s, "Warning", parser_text, ap); va_end(ap); return 0; } @@ -145,7 +144,7 @@ char *dup_basename(const char *name, const char *ext) namelen = strlen(name); /* +4 for later extension and +1 for '\0' */ - base = (char *)xmalloc(namelen +4 +1); + base = xmalloc(namelen +4 +1); strcpy(base, name); if(!strcasecmp(name + namelen-extlen, ext)) { @@ -164,12 +163,7 @@ void *xmalloc(size_t size) { error("Virtual memory exhausted.\n"); } - /* - * We set it to 0. - * This is *paramount* because we depend on it - * just about everywhere in the rest of the code. - */ - memset(res, 0, size); + memset(res, 0x55, size); return res; } @@ -192,6 +186,6 @@ char *xstrdup(const char *str) char *s; assert(str != NULL); - s = (char *)xmalloc(strlen(str)+1); + s = xmalloc(strlen(str)+1); return strcpy(s, str); } diff --git a/reactos/tools/widl/utils.h b/reactos/tools/widl/utils.h index 089607dd538..3641aaecae1 100644 --- a/reactos/tools/widl/utils.h +++ b/reactos/tools/widl/utils.h @@ -33,8 +33,8 @@ char *xstrdup(const char *str); #define __attribute__(X) #endif -int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2))); -int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2))); +int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2))); +int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4))); void error(const char *s, ...) __attribute__((format (printf, 1, 2))); void warning(const char *s, ...) __attribute__((format (printf, 1, 2))); diff --git a/reactos/tools/widl/widl.c b/reactos/tools/widl/widl.c index c6c4a1cd84c..ed09b32089a 100644 --- a/reactos/tools/widl/widl.c +++ b/reactos/tools/widl/widl.c @@ -22,6 +22,7 @@ #include "config.h" #include "wine/port.h" +#include #include #include #ifdef HAVE_UNISTD_H @@ -46,8 +47,6 @@ /* A = ACF input filename */ /* J = do not search standard include path */ /* O = generate interpreted stubs */ -/* u = UUID file only? */ -/* U = UUID filename */ /* w = select win16/win32 output (?) */ static char usage[] = @@ -64,10 +63,15 @@ static char usage[] = " --oldnames Use old naming conventions\n" " -p Generate proxy\n" " -P file Name of proxy file (default is infile_p.c)\n" +" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" +" --prefix-client=p Prefix names of client stubs with 'p'\n" +" --prefix-server=p Prefix names of server functions with 'p'\n" " -s Generate server stub\n" " -S file Name of server stub file (default is infile_s.c)\n" " -t Generate typelib\n" " -T file Name of typelib file (default is infile.tlb)\n" +" -u Generate interface identifiers file\n" +" -U file Name of interface identifiers file (default is infile_i.c)\n" " -V Print version and exit\n" " -W Enable pedantic warnings\n" "Debug level 'n' is a bitmask with following meaning:\n" @@ -84,16 +88,17 @@ static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSIO int win32 = 1; int debuglevel = DEBUGLEVEL_NONE; -int yy_flex_debug; +int parser_debug, yy_flex_debug; int pedantic = 0; -static int do_everything = 1; +int do_everything = 1; int preprocess_only = 0; int do_header = 0; int do_typelib = 0; int do_proxies = 0; int do_client = 0; int do_server = 0; +int do_idfile = 0; int no_preprocess = 0; int old_names = 0; @@ -107,19 +112,34 @@ char *client_name; char *client_token; char *server_name; char *server_token; +char *idfile_name; +char *idfile_token; char *temp_name; +const char *prefix_client = ""; +const char *prefix_server = ""; int line_number = 1; FILE *header; FILE *proxy; +FILE *idfile; time_t now; +enum { + OLDNAMES_OPTION = CHAR_MAX + 1, + PREFIX_ALL_OPTION, + PREFIX_CLIENT_OPTION, + PREFIX_SERVER_OPTION +}; + static const char *short_options = - "cC:d:D:EhH:I:NpP:sS:tT:VW"; + "cC:d:D:EhH:I:NpP:sS:tT:uU:VW"; static struct option long_options[] = { - { "oldnames", 0, 0, 1 }, + { "oldnames", no_argument, 0, OLDNAMES_OPTION }, + { "prefix-all", required_argument, 0, PREFIX_ALL_OPTION }, + { "prefix-client", required_argument, 0, PREFIX_CLIENT_OPTION }, + { "prefix-server", required_argument, 0, PREFIX_SERVER_OPTION }, { 0, 0, 0, 0 } }; @@ -177,15 +197,25 @@ int main(int argc,char *argv[]) while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF) { switch(optc) { - case 1: + case OLDNAMES_OPTION: old_names = 1; break; + case PREFIX_ALL_OPTION: + prefix_client = xstrdup(optarg); + prefix_server = xstrdup(optarg); + break; + case PREFIX_CLIENT_OPTION: + prefix_client = xstrdup(optarg); + break; + case PREFIX_SERVER_OPTION: + prefix_server = xstrdup(optarg); + break; case 'c': do_everything = 0; do_client = 1; break; case 'C': - client_name = strdup(optarg); + client_name = xstrdup(optarg); break; case 'd': debuglevel = strtol(optarg, NULL, 0); @@ -202,7 +232,7 @@ int main(int argc,char *argv[]) do_header = 1; break; case 'H': - header_name = strdup(optarg); + header_name = xstrdup(optarg); break; case 'I': wpp_add_include_path(optarg); @@ -215,21 +245,28 @@ int main(int argc,char *argv[]) do_proxies = 1; break; case 'P': - proxy_name = strdup(optarg); + proxy_name = xstrdup(optarg); break; case 's': do_everything = 0; do_server = 1; break; case 'S': - server_name = strdup(optarg); + server_name = xstrdup(optarg); break; case 't': do_everything = 0; do_typelib = 1; break; case 'T': - typelib_name = strdup(optarg); + typelib_name = xstrdup(optarg); + break; + case 'u': + do_everything = 0; + do_idfile = 1; + break; + case 'U': + idfile_name = xstrdup(optarg); break; case 'V': printf(version_string); @@ -244,7 +281,7 @@ int main(int argc,char *argv[]) } if(do_everything) { - do_header = do_typelib = do_proxies = do_client = do_server = 1; + do_header = do_typelib = do_proxies = do_client = do_server = do_idfile = 1; } if(optind < argc) { input_name = xstrdup(argv[optind]); @@ -260,7 +297,7 @@ int main(int argc,char *argv[]) setbuf(stderr,0); } - yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; + parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0; wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0, @@ -292,6 +329,11 @@ int main(int argc,char *argv[]) strcat(server_name, "_s.c"); } + if (!idfile_name && do_idfile) { + idfile_name = dup_basename(input_name, ".idl"); + strcat(idfile_name, "_i.c"); + } + if (do_proxies) proxy_token = dup_basename_token(proxy_name,"_p.c"); if (do_client) client_token = dup_basename_token(client_name,"_c.c"); if (do_server) server_token = dup_basename_token(server_name,"_s.c"); @@ -314,13 +356,13 @@ int main(int argc,char *argv[]) if(ret) exit(1); if(preprocess_only) exit(0); - if(!(yyin = fopen(temp_name, "r"))) { + if(!(parser_in = fopen(temp_name, "r"))) { fprintf(stderr, "Could not open %s for input\n", temp_name); return 1; } } else { - if(!(yyin = fopen(input_name, "r"))) { + if(!(parser_in = fopen(input_name, "r"))) { fprintf(stderr, "Could not open %s for input\n", input_name); return 1; } @@ -343,7 +385,28 @@ int main(int argc,char *argv[]) fprintf(header, "#endif\n"); } - ret = yyparse(); + if (do_idfile) { + idfile_token = make_token(idfile_name); + + idfile = fopen(idfile_name, "w"); + if (! idfile) { + fprintf(stderr, "Could not open %s for output\n", idfile_name); + return 1; + } + + fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION); + fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name); + fprintf(idfile, "#include \n"); + fprintf(idfile, "#include \n\n"); + fprintf(idfile, "#define INITGUID\n"); + fprintf(idfile, "#include \n\n"); + fprintf(idfile, "#ifdef __cplusplus\n"); + fprintf(idfile, "extern \"C\" {\n"); + fprintf(idfile, "#endif\n\n"); + } + + init_types(); + ret = parser_parse(); if(do_header) { fprintf(header, "/* Begin additional prototypes for all interfaces */\n"); @@ -359,7 +422,16 @@ int main(int argc,char *argv[]) fclose(header); } - fclose(yyin); + if (do_idfile) { + fprintf(idfile, "\n"); + fprintf(idfile, "#ifdef __cplusplus\n"); + fprintf(idfile, "}\n"); + fprintf(idfile, "#endif\n"); + + fclose(idfile); + } + + fclose(parser_in); if(ret) { exit(1); @@ -367,6 +439,7 @@ int main(int argc,char *argv[]) header_name = NULL; client_name = NULL; server_name = NULL; + idfile_name = NULL; return 0; } diff --git a/reactos/tools/widl/widl.h b/reactos/tools/widl/widl.h index d41ca7074a4..a2b905c2225 100644 --- a/reactos/tools/widl/widl.h +++ b/reactos/tools/widl/widl.h @@ -25,8 +25,6 @@ #include -#define WIDL_FULLVERSION "0.1" - extern int debuglevel; #define DEBUGLEVEL_NONE 0x0000 #define DEBUGLEVEL_CHAT 0x0001 @@ -38,11 +36,13 @@ extern int debuglevel; extern int win32; extern int pedantic; +extern int do_everything; extern int do_header; extern int do_typelib; extern int do_proxies; extern int do_client; extern int do_server; +extern int do_idfile; extern int old_names; extern char *input_name; @@ -54,15 +54,18 @@ extern char *client_name; extern char *client_token; extern char *server_name; extern char *server_token; +extern const char *prefix_client; +extern const char *prefix_server; extern time_t now; extern int line_number; extern int char_number; extern FILE* header; +extern FILE* idfile; -extern void write_proxies(ifref_t *ifaces); -extern void write_client(ifref_t *ifaces); -extern void write_server(ifref_t *ifaces); +extern void write_proxies(ifref_list_t *ifaces); +extern void write_client(ifref_list_t *ifaces); +extern void write_server(ifref_list_t *ifaces); #endif diff --git a/reactos/tools/widl/widl.man.in b/reactos/tools/widl/widl.man.in index 2d9ac8034e8..be534451427 100644 --- a/reactos/tools/widl/widl.man.in +++ b/reactos/tools/widl/widl.man.in @@ -34,6 +34,13 @@ Generate a type library. Define the name of the type library to be generated. The default filename is infile.tlb. .PP +.B UUID file options: +.IP "\fB-u\fR" +Generate a UUID file. +.IP "\fB-U \fIfile\fR" +Define the name of the UUID file to be generated. +The default filename is infile_i.c. +.PP .B Proxy/stub generation options: .IP "\fB-c\fR" Generate client stub. diff --git a/reactos/tools/widl/widltypes.h b/reactos/tools/widl/widltypes.h index 7bf22291994..18a976a8752 100644 --- a/reactos/tools/widl/widltypes.h +++ b/reactos/tools/widl/widltypes.h @@ -24,6 +24,7 @@ #include #include "guiddef.h" #include "wine/rpcfc.h" +#include "wine/list.h" #ifndef UUID_DEFINED #define UUID_DEFINED @@ -38,6 +39,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 _func_t func_t; typedef struct _ifref_t ifref_t; typedef struct _typelib_entry_t typelib_entry_t; @@ -45,23 +47,14 @@ typedef struct _importlib_t importlib_t; typedef struct _importinfo_t importinfo_t; typedef struct _typelib_t typelib_t; -#define DECL_LINK(type) \ - type *l_next; \ - type *l_prev - -#define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0) - -#define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0) -#define NEXT_LINK(x) ((x)->l_next) -#define PREV_LINK(x) ((x)->l_prev) - -#define END_OF_LIST(list) \ - do { \ - if (list) { \ - while (NEXT_LINK(list)) \ - list = NEXT_LINK(list); \ - } \ - } while(0) +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 ifref_list_t; +typedef struct list array_dims_t; enum attr_type { @@ -171,7 +164,13 @@ enum type_kind TKIND_UNION, TKIND_MAX }; - + +struct str_list_entry_t +{ + char *str; + struct list entry; +}; + struct _attr_t { enum attr_type type; union { @@ -179,7 +178,7 @@ struct _attr_t { void *pval; } u; /* parser-internal */ - DECL_LINK(attr_t); + struct list entry; }; struct _expr_t { @@ -189,13 +188,13 @@ struct _expr_t { long lval; const char *sval; const expr_t *ext; - const typeref_t *tref; + type_t *tref; } u; const expr_t *ext2; int is_const; long cval; /* parser-internal */ - DECL_LINK(expr_t); + struct list entry; }; struct _type_t { @@ -203,65 +202,57 @@ struct _type_t { enum type_kind kind; unsigned char type; struct _type_t *ref; - const attr_t *attrs; - func_t *funcs; /* interfaces and modules */ - var_t *fields; /* interfaces, structures and enumerations */ - ifref_t *ifaces; /* coclasses */ + const attr_list_t *attrs; + func_list_t *funcs; /* interfaces and modules */ + var_list_t *fields; /* interfaces, structures and enumerations */ + ifref_list_t *ifaces; /* coclasses */ + type_t *orig; /* dup'd types */ + unsigned int typestring_offset; int ignore, is_const, sign; int defined, written, user_types_registered; int typelib_idx; - /* parser-internal */ - DECL_LINK(type_t); -}; - -struct _typeref_t { - char *name; - type_t *ref; - int uniq; }; struct _var_t { char *name; - int ptr_level; - expr_t *array; + array_dims_t *array; type_t *type; - var_t *args; /* for function pointers */ - const char *tname; - attr_t *attrs; + var_list_t *args; /* for function pointers */ + attr_list_t *attrs; expr_t *eval; /* parser-internal */ - DECL_LINK(var_t); + struct list entry; +}; + +struct _pident_t { + var_t *var; + int ptr_level; + + /* parser-internal */ + struct list entry; }; struct _func_t { var_t *def; - var_t *args; + var_list_t *args; int ignore, idx; /* parser-internal */ - DECL_LINK(func_t); + struct list entry; }; struct _ifref_t { type_t *iface; - attr_t *attrs; + attr_list_t *attrs; /* parser-internal */ - DECL_LINK(ifref_t); + struct list entry; }; struct _typelib_entry_t { - enum type_kind kind; - union { - type_t *class; - type_t *interface; - type_t *module; - type_t *structure; - type_t *enumeration; - var_t *tdef; - } u; - DECL_LINK(typelib_entry_t); + type_t *type; + struct list entry; }; struct _importinfo_t { @@ -286,15 +277,24 @@ struct _importlib_t { int allocated; - DECL_LINK(importlib_t); + struct list entry; }; struct _typelib_t { char *name; char *filename; - attr_t *attrs; - typelib_entry_t *entry; - importlib_t *importlibs; + attr_list_t *attrs; + struct list entries; + struct list importlibs; }; +void init_types(void); + +type_t *duptype(type_t *t, int dupname); +type_t *alias(type_t *t, const char *name); + +int is_ptr(const type_t *t); +int is_var_ptr(const var_t *v); +int cant_be_null(const var_t *v); + #endif diff --git a/reactos/tools/widl/write_msft.c b/reactos/tools/widl/write_msft.c index 8148a93dd70..02422e75865 100644 --- a/reactos/tools/widl/write_msft.c +++ b/reactos/tools/widl/write_msft.c @@ -49,6 +49,7 @@ #include "typelib.h" #include "typelib_struct.h" #include "utils.h" +#include "header.h" #include "hash.h" enum MSFT_segment_index { @@ -329,7 +330,6 @@ static int ctl2_encode_name( * safe in the slightest. */ static int ctl2_encode_string( - msft_typelib_t *typelib, /* [I] The typelib to operate against (not used?). */ const char *string, /* [I] The string to encode. */ char **result) /* [O] A pointer to a pointer to receive the encoded string. */ { @@ -362,7 +362,6 @@ static int ctl2_encode_string( * RETURNS * * Success: The offset within the segment of the new data area. - * Failure: -1 (this is invariably an out of memory condition). * * BUGS * @@ -389,8 +388,7 @@ static int ctl2_alloc_segment( char *block; block_size = typelib->typelib_segment_block_length[segment]; - block = realloc(typelib->typelib_segment_data[segment], block_size << 1); - if (!block) return -1; + block = xrealloc(typelib->typelib_segment_data[segment], block_size << 1); if (segment == MSFT_SEG_TYPEINFO) { /* TypeInfos have a direct pointer to their memory space, so we have to fix them up. */ @@ -430,7 +428,6 @@ static int ctl2_alloc_typeinfo( MSFT_TypeInfoBase *typeinfo; offset = ctl2_alloc_segment(typelib, MSFT_SEG_TYPEINFO, sizeof(MSFT_TypeInfoBase), 0); - if (offset == -1) return -1; typelib->typelib_typeinfo_offsets[typelib->typelib_header.nrtypeinfos++] = offset; @@ -475,7 +472,6 @@ static int ctl2_alloc_typeinfo( * RETURNS * * Success: The offset of the new GUID. - * Failure: -1 (this is invariably an out of memory condition). */ static int ctl2_alloc_guid( msft_typelib_t *typelib, /* [I] The type library to allocate in. */ @@ -491,7 +487,6 @@ static int ctl2_alloc_guid( if (offset != -1) return offset; offset = ctl2_alloc_segment(typelib, MSFT_SEG_GUID, sizeof(MSFT_GuidEntry), 0); - if (offset == -1) return -1; guid_space = (void *)(typelib->typelib_segment_data[MSFT_SEG_GUID] + offset); *guid_space = *guid; @@ -528,7 +523,6 @@ static int ctl2_alloc_name( if (offset != -1) return offset; offset = ctl2_alloc_segment(typelib, MSFT_SEG_NAME, length + 8, 0); - if (offset == -1) return -1; name_space = (void *)(typelib->typelib_segment_data[MSFT_SEG_NAME] + offset); name_space->hreftype = -1; @@ -565,7 +559,7 @@ static int ctl2_alloc_string( char *string_space; char *encoded_string; - length = ctl2_encode_string(typelib, string, &encoded_string); + length = ctl2_encode_string(string, &encoded_string); for (offset = 0; offset < typelib->typelib_segdir[MSFT_SEG_STRING].length; offset += ((((typelib->typelib_segment_data[MSFT_SEG_STRING][offset + 1] << 8) & 0xff) @@ -574,7 +568,6 @@ static int ctl2_alloc_string( } offset = ctl2_alloc_segment(typelib, MSFT_SEG_STRING, length, 0); - if (offset == -1) return -1; string_space = typelib->typelib_segment_data[MSFT_SEG_STRING] + offset; memcpy(string_space, encoded_string, length); @@ -611,7 +604,6 @@ static int alloc_msft_importinfo( impinfo->flags |= typelib->typelib_header.nimpinfos++; offset = ctl2_alloc_segment(typelib, MSFT_SEG_IMPORTINFO, sizeof(MSFT_ImpInfo), 0); - if (offset == -1) return -1; impinfo_space = (void *)(typelib->typelib_segment_data[MSFT_SEG_IMPORTINFO] + offset); *impinfo_space = *impinfo; @@ -641,7 +633,7 @@ static int alloc_importfile( MSFT_ImpFile *importfile; char *encoded_string; - length = ctl2_encode_string(typelib, filename, &encoded_string); + length = ctl2_encode_string(filename, &encoded_string); encoded_string[0] <<= 2; encoded_string[0] |= 1; @@ -653,7 +645,6 @@ static int alloc_importfile( } offset = ctl2_alloc_segment(typelib, MSFT_SEG_IMPORTFILES, length + 0xc, 0); - if (offset == -1) return -1; importfile = (MSFT_ImpFile *)&typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset]; importfile->guid = guidoffset; @@ -725,7 +716,8 @@ static importinfo_t *find_importinfo(msft_typelib_t *typelib, const char *name) if(!name) return NULL; - for(importlib = typelib->typelib->importlibs; importlib; importlib = NEXT_LINK(importlib)) { + LIST_FOR_EACH_ENTRY( importlib, &typelib->typelib->importlibs, importlib_t, entry ) + { for(i=0; i < importlib->ntypeinfos; i++) { if(!strcmp(name, importlib->importinfos[i].name)) { chat("Found %s in importlib.\n", name); @@ -741,6 +733,7 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure); static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface); static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration); static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls); +static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface); /**************************************************************************** @@ -836,6 +829,7 @@ static int encode_type( break; case VT_CY: + case VT_DATE: *encoded_type = default_type; *width = 8; *alignment = 8; @@ -909,14 +903,22 @@ static int encode_type( *decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size; break; } -#if 0 case VT_SAFEARRAY: - /* FIXME: Make with the error checking. */ - FIXME("SAFEARRAY vartype, may not work correctly.\n"); + { + int next_vt; - ctl2_encode_typedesc(typelib, tdesc->u.lptdesc, &target_type, NULL, NULL, &child_size); + /* skip over SAFEARRAY type straight to element type */ + type = type->ref; + + for(next_vt = 0; type->ref; type = type->ref) { + next_vt = get_type_vt(type->ref); + if (next_vt != 0) + break; + } + + encode_type(typelib, next_vt, type->ref, &target_type, NULL, NULL, &child_size); for (typeoffset = 0; typeoffset < typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) { typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset]; @@ -940,19 +942,23 @@ static int encode_type( typedata[1] = target_type; } - *encoded_tdesc = typeoffset; + *encoded_type = typeoffset; *width = 4; *alignment = 4; - *decoded_size = sizeof(TYPEDESC) + child_size; + *decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size; break; + } -#endif - case VT_USERDEFINED: { 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) + type = type->orig; + chat("encode_type: VT_USERDEFINED - type %p name = %s type->type %d idx %d\n", type, type->name, type->type, type->typelib_idx); @@ -976,6 +982,8 @@ static int encode_type( case 0: if (type->kind == TKIND_COCLASS) add_coclass_typeinfo(typelib, type); + else 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"); break; @@ -1041,7 +1049,8 @@ static void dump_type(type_t *t) static int encode_var( msft_typelib_t *typelib, /* [I] The type library in which to encode the TYPEDESC. */ - var_t *var, /* [I] The type description to encode. */ + type_t *type, /* [I] The type description to encode. */ + var_t *var, /* [I] The var to encode. */ int *encoded_type, /* [O] The encoded type description. */ int *width, /* [O] The width of the type, or NULL. */ int *alignment, /* [O] The alignment of the type, or NULL. */ @@ -1053,19 +1062,18 @@ static int encode_var( int child_size; int vt; int scratch; - type_t *type; if (!width) width = &scratch; if (!alignment) alignment = &scratch; if (!decoded_size) decoded_size = &scratch; *decoded_size = 0; - chat("encode_var: var %p var->tname %s var->type %p var->ptr_level %d var->type->ref %p\n", var, var->tname, var->type, var->ptr_level, var->type->ref); - if(var->ptr_level) { - int skip_ptr; - var->ptr_level--; - skip_ptr = encode_var(typelib, var, &target_type, NULL, NULL, &child_size); - var->ptr_level++; + chat("encode_var: var %p type %p type->name %s type->ref %p\n", + var, type, type->name ? type->name : "NULL", type->ref); + + vt = get_type_vt(type); + if (vt == VT_PTR) { + int skip_ptr = encode_var(typelib, type->ref, var, &target_type, NULL, NULL, &child_size); if(skip_ptr == 2) { chat("encode_var: skipping ptr\n"); @@ -1107,19 +1115,15 @@ static int encode_var( } if(var->array) { - expr_t *dim = var->array; - expr_t *array_save; - int num_dims = 1, elements = 1, arrayoffset; + expr_t *dim; + array_dims_t *array_save; + int num_dims = list_count( var->array ), elements = 1, arrayoffset; int *arraydata; - while(NEXT_LINK(dim)) { - dim = NEXT_LINK(dim); - num_dims++; - } chat("array with %d dimensions\n", num_dims); array_save = var->array; var->array = NULL; - encode_var(typelib, var, &target_type, width, alignment, NULL); + encode_var(typelib, type, var, &target_type, width, alignment, NULL); var->array = array_save; arrayoffset = ctl2_alloc_segment(typelib, MSFT_SEG_ARRAYDESC, (2 + 2 * num_dims) * sizeof(long), 0); arraydata = (void *)&typelib->typelib_segment_data[MSFT_SEG_ARRAYDESC][arrayoffset]; @@ -1129,12 +1133,12 @@ static int encode_var( arraydata[1] |= ((num_dims * 2 * sizeof(long)) << 16); arraydata += 2; - while(dim) { + LIST_FOR_EACH_ENTRY( dim, var->array, expr_t, entry ) + { arraydata[0] = dim->cval; arraydata[1] = 0; arraydata += 2; elements *= dim->cval; - dim = PREV_LINK(dim); } typeoffset = ctl2_alloc_segment(typelib, MSFT_SEG_TYPEDESC, 8, 0); @@ -1148,18 +1152,8 @@ static int encode_var( *decoded_size = 20 /*sizeof(ARRAYDESC)*/ + (num_dims - 1) * 8 /*sizeof(SAFEARRAYBOUND)*/; return 0; } - dump_type(var->type); + dump_type(type); - vt = get_var_vt(var); - type = var->type; - while(!vt) { - if(type->ref == NULL) { - vt = VT_VOID; - break; - } - type = type->ref; - vt = get_type_vt(type); - } encode_type(typelib, vt, type, encoded_type, width, alignment, decoded_size); if(type->type == RPC_FC_IP) return 2; return 0; @@ -1180,6 +1174,7 @@ static void write_value(msft_typelib_t* typelib, int *out, int vt, void *value) case VT_INT: case VT_UINT: case VT_HRESULT: + case VT_PTR: { unsigned long *lv = value; if((*lv & 0x3ffffff) == *lv) { @@ -1233,11 +1228,9 @@ static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid, guidentry.next_hash = -1; guidoffset = ctl2_alloc_guid(typelib, &guidentry); - if (guidoffset == -1) return E_OUTOFMEMORY; write_value(typelib, &data_out, vt, value); custoffset = ctl2_alloc_segment(typelib, MSFT_SEG_CUSTDATAGUID, 12, 0); - if (custoffset == -1) return E_OUTOFMEMORY; custdata = (int *)&typelib->typelib_segment_data[MSFT_SEG_CUSTDATAGUID][custoffset]; custdata[0] = guidoffset; @@ -1248,14 +1241,14 @@ static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid, return S_OK; } -static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) +static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int index) { int offset, name_offset; int *typedata, typedata_size; int i, id, next_idx; int decoded_size, extra_attr = 0; int num_params = 0, num_defaults = 0; - var_t *arg, *last_arg = NULL; + var_t *arg; char *namedata; const attr_t *attr; unsigned int funcflags = 0, callconv = 4 /* CC_STDCALL */; @@ -1279,30 +1272,29 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) break; } - for(attr = func->def->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_LOCAL) { - chat("add_func_desc: skipping local function\n"); - return S_FALSE; - } + if (is_local( func->def->attrs )) { + chat("add_func_desc: skipping local function\n"); + return S_FALSE; } - for(arg = func->args; arg; arg = NEXT_LINK(arg)) { - last_arg = arg; + if (func->args) + LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry ) + { num_params++; - for(attr = arg->attrs; attr; attr = NEXT_LINK(attr)) { + 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) { num_defaults++; break; } } - } + } chat("add_func_desc: num of params %d\n", num_params); name_offset = ctl2_alloc_name(typeinfo->typelib, func->def->name); - for(attr = func->def->attrs; attr; attr = NEXT_LINK(attr)) { - expr_t *expr = attr->u.pval; + if (func->def->attrs) LIST_FOR_EACH_ENTRY( attr, func->def->attrs, const attr_t, entry ) { + expr_t *expr = attr->u.pval; switch(attr->type) { case ATTR_ENTRY_ORDINAL: extra_attr = max(extra_attr, 3); @@ -1354,25 +1346,6 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) } } - switch(invokekind) { - case 0x2: /* INVOKE_PROPERTYGET */ - if((num_params != 0 && typeinfo->typekind == TKIND_DISPATCH) - || (num_params != 1 && typeinfo->typekind == TKIND_INTERFACE)) { - error("expecting no args on a propget func\n"); - return S_FALSE; - } - break; - case 0x4: /* INVOKE_PROPERTYPUT */ - case 0x8: /* INVOKE_PROPERTYPUTREF */ - if(num_params != 1) { - error("expecting one arg on a propput func\n"); - return S_FALSE; - } - break; - default: - break; - } - /* allocate type data space for us */ typedata_size = 0x18 + extra_attr * sizeof(int) + (num_params * (num_defaults ? 16 : 12)); @@ -1414,7 +1387,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) /* fill out the basic type information */ typedata[0] = typedata_size | (index << 16); - encode_var(typeinfo->typelib, func->def, &typedata[1], NULL, NULL, &decoded_size); + encode_var(typeinfo->typelib, func->def->type, func->def, &typedata[1], NULL, NULL, &decoded_size); typedata[2] = funcflags; typedata[3] = ((52 /*sizeof(FUNCDESC)*/ + decoded_size) << 16) | typeinfo->typeinfo->cbSizeVft; typedata[4] = (next_idx << 16) | (callconv << 8) | (invokekind << 3) | funckind; @@ -1440,7 +1413,11 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) warning("unknown number of optional attrs\n"); } - for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) { + if (func->args) + { + i = 0; + LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry ) + { const attr_t *attr; int paramflags = 0; int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3; @@ -1448,8 +1425,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) if(defaultdata) *defaultdata = -1; - encode_var(typeinfo->typelib, arg, paramdata, NULL, NULL, &decoded_size); - for(attr = arg->attrs; attr; attr = NEXT_LINK(attr)) { + 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: { @@ -1458,7 +1435,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) if (arg->type->type == RPC_FC_ENUM16) vt = VT_INT; else - vt = get_var_vt(arg); + 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); @@ -1471,7 +1448,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) if (arg->type->type == RPC_FC_ENUM16) vt = VT_INT; else - vt = get_var_vt(arg); + 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); @@ -1498,6 +1475,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) paramdata[1] = -1; paramdata[2] = paramflags; typedata[3] += decoded_size << 16; + i++; + } } if(typeinfo->funcs_allocated == 0) { @@ -1546,12 +1525,19 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index) if(typeinfo->typekind == TKIND_MODULE) namedata[9] |= 0x20; - if(invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */) { - /* don't give the arg of a [propput*] func a name */ - for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) { - int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3; - offset = ctl2_alloc_name(typeinfo->typelib, arg->name); - paramdata[1] = offset; + if (func->args) + { + i = 0; + LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry ) + { + /* don't give the last arg of a [propput*] func a name */ + if(i != num_params - 1 || (invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */)) + { + int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3; + offset = ctl2_alloc_name(typeinfo->typelib, arg->name); + paramdata[1] = offset; + } + i++; } } return S_OK; @@ -1575,8 +1561,8 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var) id = 0x40000000 + index; - for(attr = var->attrs; attr; attr = NEXT_LINK(attr)) { - expr_t *expr = attr->u.pval; + if (var->attrs) LIST_FOR_EACH_ENTRY( attr, var->attrs, const attr_t, entry ) { + expr_t *expr = attr->u.pval; switch(attr->type) { case ATTR_HIDDEN: varflags |= 0x40; /* VARFLAG_FHIDDEN */ @@ -1641,7 +1627,7 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var) typeinfo->var_offsets[var_num] = offset; /* figure out type widths and whatnot */ - encode_var(typeinfo->typelib, var, &typedata[1], &var_datawidth, + encode_var(typeinfo->typelib, var->type, var, &typedata[1], &var_datawidth, &var_alignment, &var_type_size); /* pad out starting position to data width */ @@ -1734,8 +1720,9 @@ static HRESULT add_impl_type(msft_typeinfo_t *typeinfo, type_t *ref, importinfo_ } static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_kind kind, - const char *name, const attr_t *attr, int idx) + const char *name, const attr_list_t *attrs) { + const attr_t *attr; msft_typeinfo_t *msft_typeinfo; int nameoffset; int typeinfo_offset; @@ -1745,6 +1732,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_ chat("create_msft_typeinfo: name %s kind %d\n", name, kind); msft_typeinfo = xmalloc(sizeof(*msft_typeinfo)); + memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) ); msft_typeinfo->typelib = typelib; @@ -1763,7 +1751,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_ if(kind == TKIND_COCLASS) typeinfo->flags |= 0x2; /* TYPEFLAG_FCANCREATE */ - for( ; attr; attr = NEXT_LINK(attr)) { + if (attrs) LIST_FOR_EACH_ENTRY( attr, attrs, const attr_t, entry ) { switch(attr->type) { case ATTR_AGGREGATABLE: if (kind == TKIND_COCLASS) @@ -1900,9 +1888,9 @@ static void add_dispatch(msft_typelib_t *typelib) } static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface) -{ +{ int idx = 0; - func_t *func; + const func_t *func; var_t *var; msft_typeinfo_t *msft_typeinfo; @@ -1911,7 +1899,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte dispinterface->typelib_idx = typelib->typelib_header.nrtypeinfos; msft_typeinfo = create_msft_typeinfo(typelib, TKIND_DISPATCH, dispinterface->name, - dispinterface->attrs, typelib->typelib_header.nrtypeinfos); + dispinterface->attrs); msft_typeinfo->typeinfo->size = 4; msft_typeinfo->typeinfo->typekind |= 0x2100; @@ -1920,50 +1908,38 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte add_dispatch(typelib); msft_typeinfo->typeinfo->cImplTypes = 1; - /* count the no of funcs, as the variable indicies come after the funcs */ - if((func = dispinterface->funcs)) { - idx++; - while(NEXT_LINK(func)) { - func = NEXT_LINK(func); - idx++; - } - } + /* count the no of funcs, as the variable indices come after the funcs */ + if (dispinterface->funcs) + LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++; - if((var = dispinterface->fields)) { - while(NEXT_LINK(var)) var = NEXT_LINK(var); - while(var) { - add_var_desc(msft_typeinfo, idx, var); - idx++; - var = PREV_LINK(var); - } - } + if (dispinterface->fields) + LIST_FOR_EACH_ENTRY( var, dispinterface->fields, var_t, entry ) + add_var_desc(msft_typeinfo, idx++, var); - idx = 0; - /* the func count above has already left us pointing at the first func */ - while(func) { - if(add_func_desc(msft_typeinfo, func, idx) == S_OK) - idx++; - func = PREV_LINK(func); + if (dispinterface->funcs) + { + idx = 0; + LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) + if(add_func_desc(msft_typeinfo, func, idx) == S_OK) + idx++; } } static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) { int idx = 0; - func_t *func; + const func_t *func; type_t *ref; msft_typeinfo_t *msft_typeinfo; importinfo_t *ref_importinfo = NULL; int num_parents = 0, num_funcs = 0; - const attr_t *attr; const type_t *derived; if (-1 < interface->typelib_idx) return; - for(attr = interface->attrs; attr; attr = NEXT_LINK(attr)) - if(attr->type == ATTR_DISPINTERFACE) - return add_dispinterface_typeinfo(typelib, interface); + if (is_attr(interface->attrs, ATTR_DISPINTERFACE)) + return add_dispinterface_typeinfo(typelib, interface); /* midl adds the parent interface first, unless the parent itself has no parent (i.e. it stops before IUnknown). */ @@ -1976,8 +1952,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) } interface->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_INTERFACE, interface->name, interface->attrs, - typelib->typelib_header.nrtypeinfos); + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_INTERFACE, interface->name, interface->attrs); msft_typeinfo->typeinfo->size = 4; msft_typeinfo->typeinfo->typekind |= 0x2200; @@ -1995,86 +1970,64 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) /* count the number of inherited interfaces and non-local functions */ for(ref = interface->ref; ref; ref = ref->ref) { num_parents++; - for(func = ref->funcs; func; func = NEXT_LINK(func)) { - const attr_t *attr; - for(attr = func->def->attrs; attr; attr = NEXT_LINK(attr)) - if(attr->type == ATTR_LOCAL) - break; - if(!attr) - num_funcs++; - } + if (ref->funcs) + LIST_FOR_EACH_ENTRY( func, ref->funcs, const func_t, entry ) + if (!is_local(func->def->attrs)) num_funcs++; } msft_typeinfo->typeinfo->datatype2 = num_funcs << 16 | num_parents; msft_typeinfo->typeinfo->cbSizeVft = num_funcs * 4; - if((func = interface->funcs)) { - while(NEXT_LINK(func)) func = NEXT_LINK(func); - while(func) { + if (interface->funcs) + LIST_FOR_EACH_ENTRY( func, interface->funcs, const func_t, entry ) if(add_func_desc(msft_typeinfo, func, idx) == S_OK) idx++; - func = PREV_LINK(func); - } - } } static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure) { int idx = 0; - var_t *cur = structure->fields; + var_t *cur; msft_typeinfo_t *msft_typeinfo; if (-1 < structure->typelib_idx) return; structure->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs, - typelib->typelib_header.nrtypeinfos); + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs); msft_typeinfo->typeinfo->size = 0; - while(NEXT_LINK(cur)) cur = NEXT_LINK(cur); - while(cur) { - add_var_desc(msft_typeinfo, idx, cur); - idx++; - cur = PREV_LINK(cur); - } + if (structure->fields) + LIST_FOR_EACH_ENTRY( cur, structure->fields, var_t, entry ) + add_var_desc(msft_typeinfo, idx++, cur); } static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration) { int idx = 0; - var_t *cur = enumeration->fields; + var_t *cur; msft_typeinfo_t *msft_typeinfo; enumeration->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs, - typelib->typelib_header.nrtypeinfos); + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs); msft_typeinfo->typeinfo->size = 0; - while(NEXT_LINK(cur)) cur = NEXT_LINK(cur); - while(cur) { - add_var_desc(msft_typeinfo, idx, cur); - idx++; - cur = PREV_LINK(cur); - } + if (enumeration->fields) + LIST_FOR_EACH_ENTRY( cur, enumeration->fields, var_t, entry ) + add_var_desc(msft_typeinfo, idx++, cur); } -static void add_typedef_typeinfo(msft_typelib_t *typelib, var_t *tdef) +static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef) { msft_typeinfo_t *msft_typeinfo; int alignment; - const attr_t *attrs; - if (-1 < tdef->type->typelib_idx) + if (-1 < tdef->typelib_idx) return; - tdef->type->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->type->attrs, - typelib->typelib_header.nrtypeinfos); - attrs = tdef->type->attrs; - tdef->type->attrs = NULL; - encode_var(typelib, tdef, &msft_typeinfo->typeinfo->datatype1, &msft_typeinfo->typeinfo->size, + tdef->typelib_idx = typelib->typelib_header.nrtypeinfos; + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs); + encode_type(typelib, get_type_vt(tdef->orig), tdef->orig, &msft_typeinfo->typeinfo->datatype1, &msft_typeinfo->typeinfo->size, &alignment, &msft_typeinfo->typeinfo->datatype2); - tdef->type->attrs = attrs; msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6); } @@ -2091,20 +2044,15 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls) return; cls->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_COCLASS, cls->name, cls->attrs, - typelib->typelib_header.nrtypeinfos); + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_COCLASS, cls->name, cls->attrs); - if((iref = cls->ifaces)) { - num_ifaces++; - while(NEXT_LINK(iref)) { - iref = NEXT_LINK(iref); - num_ifaces++; - } - } + if (cls->ifaces) LIST_FOR_EACH_ENTRY( iref, cls->ifaces, ifref_t, entry ) num_ifaces++; offset = msft_typeinfo->typeinfo->datatype1 = ctl2_alloc_segment(typelib, MSFT_SEG_REFERENCES, num_ifaces * sizeof(*ref), 0); - for(i = 0; i < num_ifaces; i++) { + + i = 0; + if (cls->ifaces) LIST_FOR_EACH_ENTRY( iref, cls->ifaces, ifref_t, entry ) { if(iref->iface->typelib_idx == -1) add_interface_typeinfo(typelib, iref->iface); ref = (MSFT_RefRecord*) (typelib->typelib_segment_data[MSFT_SEG_REFERENCES] + offset + i * sizeof(*ref)); @@ -2115,7 +2063,7 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls) if(i < num_ifaces - 1) ref->onext = offset + (i + 1) * sizeof(*ref); - for(attr = iref->attrs; attr; attr = NEXT_LINK(attr)) { + if (iref->attrs) LIST_FOR_EACH_ENTRY( attr, iref->attrs, const attr_t, entry ) { switch(attr->type) { case ATTR_DEFAULT: ref->flags |= 0x1; /* IMPLTYPEFLAG_FDEFAULT */ @@ -2147,7 +2095,7 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls) else if(!first) first = ref; } - iref = PREV_LINK(iref); + i++; } /* If we haven't had a default interface, then set the default flags on the @@ -2165,57 +2113,54 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls) static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module) { int idx = 0; - func_t *func; + const func_t *func; msft_typeinfo_t *msft_typeinfo; if (-1 < module->typelib_idx) return; module->typelib_idx = typelib->typelib_header.nrtypeinfos; - msft_typeinfo = create_msft_typeinfo(typelib, TKIND_MODULE, module->name, module->attrs, - typelib->typelib_header.nrtypeinfos); + msft_typeinfo = create_msft_typeinfo(typelib, TKIND_MODULE, module->name, module->attrs); msft_typeinfo->typeinfo->typekind |= 0x0a00; - if((func = module->funcs)) { - while(NEXT_LINK(func)) func = NEXT_LINK(func); - while(func) { + if (module->funcs) + LIST_FOR_EACH_ENTRY( func, module->funcs, const func_t, entry ) if(add_func_desc(msft_typeinfo, func, idx) == S_OK) idx++; - func = PREV_LINK(func); - } - } + msft_typeinfo->typeinfo->size = idx; } static void add_entry(msft_typelib_t *typelib, typelib_entry_t *entry) { - switch(entry->kind) { + switch(entry->type->kind) { case TKIND_INTERFACE: - add_interface_typeinfo(typelib, entry->u.interface); + case TKIND_DISPATCH: + add_interface_typeinfo(typelib, entry->type); break; case TKIND_RECORD: - add_structure_typeinfo(typelib, entry->u.structure); + add_structure_typeinfo(typelib, entry->type); break; case TKIND_ENUM: - add_enum_typeinfo(typelib, entry->u.enumeration); + add_enum_typeinfo(typelib, entry->type); break; case TKIND_ALIAS: - add_typedef_typeinfo(typelib, entry->u.tdef); + add_typedef_typeinfo(typelib, entry->type); break; case TKIND_COCLASS: - add_coclass_typeinfo(typelib, entry->u.class); + add_coclass_typeinfo(typelib, entry->type); break; case TKIND_MODULE: - add_module_typeinfo(typelib, entry->u.module); + add_module_typeinfo(typelib, entry->type); break; default: - error("add_entry: unhandled type %d\n", entry->kind); + error("add_entry: unhandled type %d\n", entry->type->kind); break; } } @@ -2232,39 +2177,24 @@ static void set_name(msft_typelib_t *typelib) static void set_version(msft_typelib_t *typelib) { - long version = MAKELONG(0,0); - const attr_t *attr; - - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_VERSION) { - version = attr->u.ival; - } - } - typelib->typelib_header.version = version; - return; + typelib->typelib_header.version = get_attrv( typelib->typelib->attrs, ATTR_VERSION ); } static void set_guid(msft_typelib_t *typelib) { MSFT_GuidEntry guidentry; int offset; - const attr_t *attr; + void *ptr; GUID guid = {0,0,0,{0,0,0,0,0,0}}; guidentry.guid = guid; guidentry.hreftype = -2; guidentry.next_hash = -1; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_UUID) { - guidentry.guid = *(GUID*)(attr->u.pval); - } - } + ptr = get_attrp( typelib->typelib->attrs, ATTR_UUID ); + if (ptr) guidentry.guid = *(GUID *)ptr; offset = ctl2_alloc_guid(typelib, &guidentry); - - if (offset == -1) return; - typelib->typelib_header.posguid = offset; return; @@ -2272,71 +2202,55 @@ static void set_guid(msft_typelib_t *typelib) static void set_doc_string(msft_typelib_t *typelib) { - const attr_t *attr; - int offset; + char *str = get_attrp( typelib->typelib->attrs, ATTR_HELPSTRING ); - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_HELPSTRING) { - offset = ctl2_alloc_string(typelib, attr->u.pval); - if (offset == -1) return; - typelib->typelib_header.helpstring = offset; - } + if (str) + { + int offset = ctl2_alloc_string(typelib, str); + if (offset != -1) typelib->typelib_header.helpstring = offset; } - return; } static void set_help_file_name(msft_typelib_t *typelib) { - int offset; - const attr_t *attr; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_HELPFILE) { - offset = ctl2_alloc_string(typelib, attr->u.pval); - if (offset == -1) return; + char *str = get_attrp( typelib->typelib->attrs, ATTR_HELPFILE ); + + if (str) + { + int offset = ctl2_alloc_string(typelib, str); + if (offset != -1) + { typelib->typelib_header.helpfile = offset; typelib->typelib_header.varflags |= 0x10; } } - return; } static void set_help_context(msft_typelib_t *typelib) { - const attr_t *attr; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_HELPCONTEXT) { - const expr_t *expr = (expr_t *)attr->u.pval; - typelib->typelib_header.helpcontext = expr->cval; - } - } - return; + const expr_t *expr = get_attrp( typelib->typelib->attrs, ATTR_HELPCONTEXT ); + if (expr) typelib->typelib_header.helpcontext = expr->cval; } static void set_help_string_dll(msft_typelib_t *typelib) { - int offset; - const attr_t *attr; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_HELPSTRINGDLL) { - offset = ctl2_alloc_string(typelib, attr->u.pval); - if (offset == -1) return; + char *str = get_attrp( typelib->typelib->attrs, ATTR_HELPSTRINGDLL ); + + if (str) + { + int offset = ctl2_alloc_string(typelib, str); + if (offset != -1) + { typelib->help_string_dll_offset = offset; typelib->typelib_header.varflags |= 0x100; } } - return; } static void set_help_string_context(msft_typelib_t *typelib) { - const attr_t *attr; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { - if(attr->type == ATTR_HELPSTRINGCONTEXT) { - const expr_t *expr = (expr_t *)attr->u.pval; - typelib->typelib_header.helpstringcontext = expr->cval; - } - } - return; + const expr_t *expr = get_attrp( typelib->typelib->attrs, ATTR_HELPSTRINGCONTEXT ); + if (expr) typelib->typelib_header.helpstringcontext = expr->cval; } static void set_lcid(msft_typelib_t *typelib) @@ -2350,7 +2264,9 @@ static void set_lib_flags(msft_typelib_t *typelib) const attr_t *attr; typelib->typelib_header.flags = 0; - for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) { + if (!typelib->typelib->attrs) return; + LIST_FOR_EACH_ENTRY( attr, typelib->typelib->attrs, const attr_t, entry ) + { switch(attr->type) { case ATTR_CONTROL: typelib->typelib_header.flags |= 0x02; /* LIBFLAG_FCONTROL */ @@ -2527,8 +2443,7 @@ int create_msft_typelib(typelib_t *typelib) GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; - msft = malloc(sizeof(*msft)); - if (!msft) return 0; + msft = xmalloc(sizeof(*msft)); memset(msft, 0, sizeof(*msft)); msft->typelib = typelib; @@ -2544,7 +2459,11 @@ int create_msft_typelib(typelib_t *typelib) if (ctl2_alloc_segment(msft, MSFT_SEG_GUIDHASH, 0x80, 0x80)) { failed = 1; } if (ctl2_alloc_segment(msft, MSFT_SEG_NAMEHASH, 0x200, 0x200)) { failed = 1; } - if(failed) return 0; + if(failed) + { + free(msft); + return 0; + } msft->typelib_guidhash_segment = (int *)msft->typelib_segment_data[MSFT_SEG_GUIDHASH]; msft->typelib_namehash_segment = (int *)msft->typelib_segment_data[MSFT_SEG_NAMEHASH]; @@ -2569,12 +2488,10 @@ int create_msft_typelib(typelib_t *typelib) set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset); set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset); - for(entry = typelib->entry; entry && NEXT_LINK(entry); entry = NEXT_LINK(entry)) - ; - - for( ; entry; entry = PREV_LINK(entry)) + LIST_FOR_EACH_ENTRY( entry, &typelib->entries, typelib_entry_t, entry ) add_entry(msft, entry); save_all_changes(msft); + free(msft); return 1; }