From 94ee8e8fac3cf0988127a779ee7bf17c01b54a26 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 7 Feb 2007 17:55:09 +0100 Subject: [PATCH] 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 5fcffebb14d..3322a07e21d 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -330,6 +330,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"); @@ -341,8 +344,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"); diff --git a/tools/widl/server.c b/tools/widl/server.c index 75b9647b0d9..831d7acf52d 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -358,6 +358,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"); @@ -371,8 +374,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"); diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 72d32fc686a..b72e87b30fc 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2417,3 +2417,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/tools/widl/typegen.h b/tools/widl/typegen.h index 2fa47280d09..eda259b11b2 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -49,3 +49,4 @@ 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 );