Commit e644c2cd authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Add support for generating old-style interpreted stubs for servers.

parent 9c4d01f3
...@@ -49,18 +49,15 @@ static void print_server(const char *format, ...) ...@@ -49,18 +49,15 @@ static void print_server(const char *format, ...)
va_end(va); va_end(va);
} }
static void write_function_stubs(type_t *iface, unsigned int *proc_offset) static void write_function_stub(const type_t *iface, const var_t *func, unsigned int proc_offset)
{ {
const statement_t *stmt;
const var_t *var; const var_t *var;
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
{
unsigned char explicit_fc, implicit_fc; unsigned char explicit_fc, implicit_fc;
var_t *func = stmt->u.var;
int has_full_pointer = is_full_pointer_function(func); int has_full_pointer = is_full_pointer_function(func);
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc ); const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
if (is_interpreted_func( iface, func )) return;
print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(func)); print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(func));
indent++; indent++;
print_server("__DECL_EXCEPTION_FRAME\n"); print_server("__DECL_EXCEPTION_FRAME\n");
...@@ -128,7 +125,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) ...@@ -128,7 +125,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n"); print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
indent++; indent++;
print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
*proc_offset); proc_offset);
indent--; indent--;
fprintf(server, "\n"); fprintf(server, "\n");
...@@ -239,6 +236,18 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) ...@@ -239,6 +236,18 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent--; indent--;
fprintf(server, "}\n"); fprintf(server, "}\n");
fprintf(server, "\n"); fprintf(server, "\n");
}
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
{
const statement_t *stmt;
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
{
var_t *func = stmt->u.var;
write_function_stub( iface, func, *proc_offset );
/* update proc_offset */ /* update proc_offset */
func->procstring_offset = *proc_offset; func->procstring_offset = *proc_offset;
...@@ -260,6 +269,9 @@ static void write_dispatchtable(type_t *iface) ...@@ -260,6 +269,9 @@ static void write_dispatchtable(type_t *iface)
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
{ {
var_t *func = stmt->u.var; var_t *func = stmt->u.var;
if (is_interpreted_func( iface, func ))
print_server("NdrServerCall,\n");
else
print_server("%s_%s,\n", iface->name, get_name(func)); print_server("%s_%s,\n", iface->name, get_name(func));
method_count++; method_count++;
} }
...@@ -288,7 +300,7 @@ static void write_routinetable(type_t *iface) ...@@ -288,7 +300,7 @@ static void write_routinetable(type_t *iface)
{ {
var_t *func = stmt->u.var; var_t *func = stmt->u.var;
if (is_local( func->attrs )) continue; if (is_local( func->attrs )) continue;
print_server( "(SERVER_ROUTINE)%s,\n", func->name ); print_server( "(SERVER_ROUTINE)%s%s,\n", prefix_server, get_name(func));
} }
indent--; indent--;
print_server( "};\n\n" ); print_server( "};\n\n" );
...@@ -468,6 +480,8 @@ static void write_server_routines(const statement_list_t *stmts) ...@@ -468,6 +480,8 @@ static void write_server_routines(const statement_list_t *stmts)
unsigned int proc_offset = 0; unsigned int proc_offset = 0;
int expr_eval_routines; int expr_eval_routines;
if (need_inline_stubs_file( stmts ))
{
write_exceptions( server ); write_exceptions( server );
print_server("\n"); print_server("\n");
print_server("struct __server_frame\n"); print_server("struct __server_frame\n");
...@@ -484,6 +498,7 @@ static void write_server_routines(const statement_list_t *stmts) ...@@ -484,6 +498,7 @@ static void write_server_routines(const statement_list_t *stmts)
print_server( " (__frame->code == RPC_S_INVALID_BOUND);\n"); print_server( " (__frame->code == RPC_S_INVALID_BOUND);\n");
print_server( "}\n"); print_server( "}\n");
print_server( "\n"); print_server( "\n");
}
write_formatstringsdecl(server, indent, stmts, need_stub); write_formatstringsdecl(server, indent, stmts, need_stub);
expr_eval_routines = write_expr_eval_routines(server, server_token); expr_eval_routines = write_expr_eval_routines(server, server_token);
......
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