widl: Remove some confusion in how version numbers are packed into an attribute by defining some macros for this purpose.
Remove unneeded includes.
This commit is contained in:
parent
e12b487e26
commit
9741751962
|
@ -29,16 +29,12 @@
|
|||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
|
||||
#include "widltypes.h"
|
||||
#include "typelib.h"
|
||||
#include "typelib_struct.h"
|
||||
#include "typegen.h"
|
||||
|
||||
static FILE* client;
|
||||
|
@ -337,7 +333,7 @@ static void write_clientinterfacedecl(type_t *iface)
|
|||
print_client("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
||||
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], LOWORD(ver), HIWORD(ver));
|
||||
uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
|
||||
print_client("0,\n");
|
||||
if (endpoints)
|
||||
|
@ -360,7 +356,7 @@ static void write_clientinterfacedecl(type_t *iface)
|
|||
iface->name, iface->name);
|
||||
else
|
||||
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);
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
|
@ -942,7 +941,7 @@ static void write_com_interface(type_t *iface)
|
|||
|
||||
static void write_rpc_interface(const type_t *iface)
|
||||
{
|
||||
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
static int allocate_written = 0;
|
||||
|
||||
|
@ -954,7 +953,7 @@ static void write_rpc_interface(const type_t *iface)
|
|||
}
|
||||
|
||||
fprintf(header, "/*****************************************************************************\n");
|
||||
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, LOWORD(ver), HIWORD(ver));
|
||||
fprintf(header, " * %s interface (v%d.%d)\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(header, " */\n");
|
||||
fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
|
||||
fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
|
||||
|
@ -970,9 +969,9 @@ static void write_rpc_interface(const type_t *iface)
|
|||
else
|
||||
{
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec;\n",
|
||||
prefix_client, iface->name, LOWORD(ver), HIWORD(ver));
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(header, "extern RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec;\n",
|
||||
prefix_server, iface->name, LOWORD(ver), HIWORD(ver));
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
}
|
||||
write_function_protos(iface);
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
|
@ -929,8 +927,8 @@ uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATE
|
|||
;
|
||||
|
||||
version:
|
||||
aNUM { $$ = MAKELONG($1, 0); }
|
||||
| aNUM '.' aNUM { $$ = MAKELONG($1, $3); }
|
||||
aNUM { $$ = MAKEVERSION($1, 0); }
|
||||
| aNUM '.' aNUM { $$ = MAKEVERSION($1, $3); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
|
|
@ -35,10 +35,7 @@
|
|||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
#include "windef.h"
|
||||
|
||||
#include "typelib.h"
|
||||
#include "typelib_struct.h"
|
||||
#include "typegen.h"
|
||||
|
||||
static FILE* server;
|
||||
|
@ -285,7 +282,7 @@ static void write_dispatchtable(type_t *iface)
|
|||
print_server("0\n");
|
||||
indent--;
|
||||
print_server("};\n");
|
||||
print_server("RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, LOWORD(ver), HIWORD(ver));
|
||||
print_server("RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
print_server("%u,\n", method_count);
|
||||
|
@ -349,7 +346,7 @@ static void write_serverinterfacedecl(type_t *iface)
|
|||
|
||||
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));
|
||||
print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(server, "\n");
|
||||
print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name );
|
||||
print_server("{\n");
|
||||
|
@ -358,9 +355,9 @@ static void write_serverinterfacedecl(type_t *iface)
|
|||
print_server("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
||||
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], LOWORD(ver), HIWORD(ver));
|
||||
uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(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("&%s_v%d_%d_DispatchTable,\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
if (endpoints)
|
||||
{
|
||||
print_server("%u,\n", list_count(endpoints));
|
||||
|
@ -381,7 +378,7 @@ static void write_serverinterfacedecl(type_t *iface)
|
|||
iface->name, iface->name);
|
||||
else
|
||||
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);
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
#include "windef.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include "typegen.h"
|
||||
|
|
|
@ -46,4 +46,8 @@ size_t widl_getline(char **linep, size_t *lenp, FILE *fp);
|
|||
UUID *parse_uuid(const char *u);
|
||||
int is_valid_uuid(const char *s);
|
||||
|
||||
#define MAKEVERSION(major, minor) ((((major) & 0xffff) << 16) | ((minor) & 0xffff))
|
||||
#define MAJORVERSION(version) (((version) >> 16) & 0xffff)
|
||||
#define MINORVERSION(version) ((version) & 0xffff)
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue