widl: Output endpoint information in client and server files.

This commit is contained in:
Alexandre Julliard 2007-02-07 17:55:09 +01:00
parent cc9a07f194
commit 94ee8e8fac
4 changed files with 62 additions and 4 deletions

View File

@ -330,6 +330,9 @@ static void write_clientinterfacedecl(type_t *iface)
{ {
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); 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("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name );
print_client("{\n"); print_client("{\n");
@ -341,8 +344,16 @@ static void write_clientinterfacedecl(type_t *iface)
uuid->Data4[7], LOWORD(ver), HIWORD(ver)); 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("{{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("0,\n"); {
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"); print_client("0,\n");
print_client("0,\n"); print_client("0,\n");

View File

@ -358,6 +358,9 @@ static void write_serverinterfacedecl(type_t *iface)
{ {
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); 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)); print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, LOWORD(ver), HIWORD(ver));
fprintf(server, "\n"); fprintf(server, "\n");
@ -371,8 +374,16 @@ static void write_serverinterfacedecl(type_t *iface)
uuid->Data4[7], LOWORD(ver), HIWORD(ver)); 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("{{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, LOWORD(ver), HIWORD(ver));
print_server("0,\n"); if (endpoints)
print_server("0,\n"); {
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"); print_server("0,\n");
print_server("0,\n"); print_server("0,\n");

View File

@ -2417,3 +2417,38 @@ void write_expr_eval_routine_list(FILE *file, const char *iface)
fprintf(file, "};\n\n"); 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);
}

View File

@ -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 ); void declare_stub_args( FILE *file, int indent, const func_t *func );
int write_expr_eval_routines(FILE *file, const char *iface); int write_expr_eval_routines(FILE *file, const char *iface);
void write_expr_eval_routine_list(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 );