Commit 53626dbd authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Add support for generating 32-bit and/or 64-bit code for proxies/clients/servers.

parent b1ab7d88
......@@ -483,7 +483,7 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
write_stubdescdecl(iface);
write_function_stubs(iface, proc_offset);
print_client("#if !defined(__RPC_WIN32__)\n");
print_client("#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
print_client("#error Invalid build platform for this stub.\n");
print_client("#endif\n");
......@@ -496,22 +496,11 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
}
}
void write_client(const statement_list_t *stmts)
static void write_client_routines(const statement_list_t *stmts)
{
unsigned int proc_offset = 0;
int expr_eval_routines;
if (!do_client)
return;
if (do_everything && !need_stub_files(stmts))
return;
init_client();
if (!client)
return;
pointer_size = sizeof(void*);
write_formatstringsdecl(client, indent, stmts, need_stub);
expr_eval_routines = write_expr_eval_routines(client, client_token);
if (expr_eval_routines)
......@@ -524,6 +513,39 @@ void write_client(const statement_list_t *stmts)
write_procformatstring(client, stmts, need_stub);
write_typeformatstring(client, stmts, need_stub);
}
void write_client(const statement_list_t *stmts)
{
if (!do_client)
return;
if (do_everything && !need_stub_files(stmts))
return;
init_client();
if (!client)
return;
if (do_win32 && do_win64)
{
fprintf(client, "\n#ifndef _WIN64\n\n");
pointer_size = 4;
write_client_routines( stmts );
fprintf(client, "\n#else /* _WIN64 */\n\n");
pointer_size = 8;
write_client_routines( stmts );
fprintf(client, "\n#endif /* _WIN64 */\n");
}
else if (do_win32)
{
pointer_size = 4;
write_client_routines( stmts );
}
else if (do_win64)
{
pointer_size = 8;
write_client_routines( stmts );
}
fclose(client);
}
......@@ -1366,6 +1366,13 @@ void set_all_tfswrite(int val)
node->data.tfswrite = val;
}
void clear_all_offsets(void)
{
type_pool_node_t *node;
LIST_FOR_EACH_ENTRY(node, &type_pool, type_pool_node_t, link)
node->data.typestring_offset = node->data.ptrdesc = 0;
}
type_t *make_type(unsigned char type, type_t *ref)
{
type_t *t = alloc_type();
......
......@@ -741,21 +741,10 @@ static type_t **sort_interfaces( const statement_list_t *stmts, int *count )
return ifaces;
}
void write_proxies(const statement_list_t *stmts)
static void write_proxy_routines(const statement_list_t *stmts)
{
int expr_eval_routines;
char *file_id = proxy_token;
int i, count, have_baseiid;
unsigned int proc_offset = 0;
type_t **interfaces;
if (!do_proxies) return;
if (do_everything && !need_proxy_file(stmts)) return;
init_proxy(stmts);
if(!proxy) return;
pointer_size = sizeof(void*);
write_formatstringsdecl(proxy, indent, stmts, need_proxy);
write_stubdescproto();
......@@ -767,13 +756,48 @@ void write_proxies(const statement_list_t *stmts)
write_user_quad_list(proxy);
write_stubdesc(expr_eval_routines);
print_proxy( "#if !defined(__RPC_WIN32__)\n");
print_proxy( "#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
print_proxy( "#endif\n");
print_proxy( "\n");
write_procformatstring(proxy, stmts, need_proxy);
write_typeformatstring(proxy, stmts, need_proxy);
}
void write_proxies(const statement_list_t *stmts)
{
char *file_id = proxy_token;
int i, count, have_baseiid;
type_t **interfaces;
if (!do_proxies) return;
if (do_everything && !need_proxy_file(stmts)) return;
init_proxy(stmts);
if(!proxy) return;
if (do_win32 && do_win64)
{
fprintf(proxy, "\n#ifndef _WIN64\n\n");
pointer_size = 4;
write_proxy_routines( stmts );
fprintf(proxy, "\n#else /* _WIN64 */\n\n");
pointer_size = 8;
write_proxy_routines( stmts );
fprintf(proxy, "#endif /* _WIN64 */\n\n");
}
else if (do_win32)
{
pointer_size = 4;
write_proxy_routines( stmts );
}
else if (do_win64)
{
pointer_size = 8;
write_proxy_routines( stmts );
}
interfaces = sort_interfaces(stmts, &count);
fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
fprintf(proxy, "{\n");
......
......@@ -424,7 +424,7 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout
write_function_stubs(iface, proc_offset);
print_server("#if !defined(__RPC_WIN32__)\n");
print_server("#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
print_server("#error Invalid build platform for this stub.\n");
print_server("#endif\n");
......@@ -436,22 +436,11 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout
}
}
void write_server(const statement_list_t *stmts)
static void write_server_routines(const statement_list_t *stmts)
{
unsigned int proc_offset = 0;
int expr_eval_routines;
if (!do_server)
return;
if (do_everything && !need_stub_files(stmts))
return;
init_server();
if (!server)
return;
pointer_size = sizeof(void*);
write_formatstringsdecl(server, indent, stmts, need_stub);
expr_eval_routines = write_expr_eval_routines(server, server_token);
if (expr_eval_routines)
......@@ -464,6 +453,39 @@ void write_server(const statement_list_t *stmts)
write_procformatstring(server, stmts, need_stub);
write_typeformatstring(server, stmts, need_stub);
}
void write_server(const statement_list_t *stmts)
{
if (!do_server)
return;
if (do_everything && !need_stub_files(stmts))
return;
init_server();
if (!server)
return;
if (do_win32 && do_win64)
{
fprintf(server, "\n#ifndef _WIN64\n\n");
pointer_size = 4;
write_server_routines( stmts );
fprintf(server, "\n#else /* _WIN64 */\n\n");
pointer_size = 8;
write_server_routines( stmts );
fprintf(server, "\n#endif /* _WIN64 */\n");
}
else if (do_win32)
{
pointer_size = 4;
write_server_routines( stmts );
}
else if (do_win64)
{
pointer_size = 8;
write_server_routines( stmts );
}
fclose(server);
}
......@@ -572,6 +572,8 @@ static void write_formatdesc(FILE *f, int indent, const char *str)
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred)
{
clear_all_offsets();
print_file(f, indent, "#define TYPE_FORMAT_STRING_SIZE %d\n",
get_size_typeformatstring(stmts, pred));
......
......@@ -396,6 +396,7 @@ void check_for_additional_prototype_types(const var_list_t *list);
void init_types(void);
type_t *alloc_type(void);
void set_all_tfswrite(int val);
void clear_all_offsets(void);
type_t *duptype(type_t *t, int dupname);
type_t *alias(type_t *t, const char *name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment