Alexandre Julliard : widl:
Output endpoint information in client and server files.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 7 16:00:00 CST 2007
Module: wine
Branch: master
Commit: 94ee8e8fac3cf0988127a779ee7bf17c01b54a26
URL: http://source.winehq.org/git/wine.git/?a=commit;h=94ee8e8fac3cf0988127a779ee7bf17c01b54a26
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Feb 7 17:55:09 2007 +0100
widl: Output endpoint information in client and server files.
---
tools/widl/client.c | 15 +++++++++++++--
tools/widl/server.c | 15 +++++++++++++--
tools/widl/typegen.c | 35 +++++++++++++++++++++++++++++++++++
tools/widl/typegen.h | 1 +
4 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/tools/widl/client.c b/tools/widl/client.c
index 5fcffeb..3322a07 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -330,6 +330,9 @@ static void write_clientinterfacedecl(ty
{
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");
@@ -341,8 +344,16 @@ static void write_clientinterfacedecl(ty
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");
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 75b9647..831d7ac 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -358,6 +358,9 @@ static void write_serverinterfacedecl(ty
{
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");
@@ -371,8 +374,16 @@ static void write_serverinterfacedecl(ty
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");
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 72d32fc..b72e87b 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2417,3 +2417,38 @@ void write_expr_eval_routine_list(FILE *
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/tools/widl/typegen.h b/tools/widl/typegen.h
index 2fa4728..eda259b 100644
--- a/tools/widl/typegen.h
+++ b/tools/widl/typegen.h
@@ -49,3 +49,4 @@ void assign_stub_out_args( FILE *file, i
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 );
More information about the wine-cvs
mailing list