From dbba4749db9bcd769f4c4f37ceaecbfeb150a51f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 27 Feb 2006 12:23:56 +0000 Subject: [PATCH] - Move proc string offset calculation to a separate function. - Replace all __FUNCTION__ by __FILE__. svn path=/trunk/; revision=21213 --- reactos/tools/widl/ChangeLog | 8 +++++ reactos/tools/widl/client.c | 66 ++++++++++++++---------------------- reactos/tools/widl/server.c | 63 ++++++++++++++-------------------- 3 files changed, 59 insertions(+), 78 deletions(-) diff --git a/reactos/tools/widl/ChangeLog b/reactos/tools/widl/ChangeLog index 707fc911d04..b826e2446f5 100644 --- a/reactos/tools/widl/ChangeLog +++ b/reactos/tools/widl/ChangeLog @@ -1,5 +1,13 @@ ChangeLog +2006-02-27 ekohl + + tools/widl/client.c + tools/widl/server.c + +- Move proc string offset calculation to a separate function. +- Replace all __FUNCTION__ by __FILE__. + 2006-01-01 ekohl tools/widl/client.c diff --git a/reactos/tools/widl/client.c b/reactos/tools/widl/client.c index 560649e2914..151d12489e9 100644 --- a/reactos/tools/widl/client.c +++ b/reactos/tools/widl/client.c @@ -104,6 +104,16 @@ get_var_stack_offset_64(func_t *func, char *name) } +static unsigned int +get_var_proc_offset(var_t *var) +{ + if (var->ptr_level == 0 && is_base_type(var->type)) + return 2; + + return 4; +} + + static unsigned int get_var_type_offset(var_t *var) { @@ -250,7 +260,7 @@ static int get_type_size(type_t *type, int alignment) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, type->type); + __FILE__,__LINE__, type->type); return 0; } @@ -289,7 +299,7 @@ static int get_type_alignment(type_t *type) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, type->type); + __FILE__,__LINE__, type->type); return 0; } @@ -356,7 +366,7 @@ static void write_procformatstring(type_t *iface) print_client("0x4d, /* FC_IN_PARAM */\n"); error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -378,7 +388,7 @@ static void write_procformatstring(type_t *iface) else { error("%s:%d Pointer level %d is not supported!\n", - __FUNCTION__,__LINE__, var->ptr_level); + __FILE__,__LINE__, var->ptr_level); return; } @@ -403,7 +413,7 @@ static void write_procformatstring(type_t *iface) else { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -495,7 +505,7 @@ static void write_typeformatstring(type_t *iface) { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -596,7 +606,7 @@ static void write_typeformatstring(type_t *iface) print_client("0x%02x, /* FC_C_WSTRING */\n", RPC_FC_C_WSTRING); else { - error("%s: Invalid type!\n", __FUNCTION__); + error("%s:%d Invalid type!\n", __FILE__, __LINE__); return; } } @@ -728,7 +738,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -790,7 +800,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -1081,7 +1091,7 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1176,7 +1186,7 @@ static void marshall_in_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1346,7 +1356,7 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1417,7 +1427,7 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset) else { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -1456,7 +1466,7 @@ static void unmarshall_out_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, def->type->type); + __FILE__,__LINE__, def->type->type); return; } @@ -1719,18 +1729,7 @@ static void write_function_stubs(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - switch (var->ptr_level) - { - case 0: - if (is_base_type(var->type)) - proc_offset += 2; - break; - - case 1: - if (is_base_type(var->type)) - proc_offset += 4; - break; - } + proc_offset += get_var_proc_offset(var); var = PREV_LINK(var); } @@ -1916,20 +1915,7 @@ static int get_proc_format_string_size(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - switch (var->ptr_level) - { - case 0: - if (is_base_type(var->type)) - size += 2; - else if (var->type->type == RPC_FC_RP) - size += 4; - break; - - case 1: - if (is_base_type(var->type)) - size += 4; - break; - } + size += get_var_proc_offset(var); var = PREV_LINK(var); } diff --git a/reactos/tools/widl/server.c b/reactos/tools/widl/server.c index 10396b6738b..f55f7c0ebab 100644 --- a/reactos/tools/widl/server.c +++ b/reactos/tools/widl/server.c @@ -109,6 +109,16 @@ get_var_stack_offset_64(func_t *func, char *name) } +static unsigned int +get_var_proc_offset(var_t *var) +{ + if (var->ptr_level == 0 && is_base_type(var->type)) + return 2; + + return 4; +} + + static unsigned int get_var_type_offset(var_t *var) { @@ -255,7 +265,7 @@ static int get_type_size(type_t *type, int alignment) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, type->type); + __FILE__,__LINE__, type->type); return 0; } @@ -294,7 +304,7 @@ static int get_type_alignment(type_t *type) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, type->type); + __FILE__,__LINE__, type->type); return 0; } @@ -359,7 +369,7 @@ static void write_procformatstring(type_t *iface) else { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -400,7 +410,7 @@ static void write_procformatstring(type_t *iface) else { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -492,7 +502,7 @@ static void write_typeformatstring(type_t *iface) { error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } } @@ -592,7 +602,7 @@ static void write_typeformatstring(type_t *iface) print_server("0x%02x, /* FC_C_WSTRING */\n", RPC_FC_C_WSTRING); else { - error("%s: Invalid type!\n", __FUNCTION__); + error("%s:%d Invalid type!\n", __FILE__, __LINE__); return; } } @@ -706,7 +716,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -792,7 +802,7 @@ static void print_message_buffer_size(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, func->def->type->type); + __FILE__,__LINE__, func->def->type->type); return; } @@ -1082,7 +1092,7 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1170,7 +1180,7 @@ static void unmarshall_in_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1341,7 +1351,7 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, var->type->type); + __FILE__,__LINE__, var->type->type); return; } @@ -1442,7 +1452,7 @@ static void marshall_out_arguments(func_t *func, unsigned int *type_offset) default: error("%s:%d Unknown/unsupported type 0x%x\n", - __FUNCTION__,__LINE__, def->type->type); + __FILE__,__LINE__, def->type->type); return; } @@ -1862,18 +1872,7 @@ static void write_function_stubs(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - switch (var->ptr_level) - { - case 0: - if (is_base_type(var->type)) - proc_offset += 2; - break; - - case 1: - if (is_base_type(var->type)) - proc_offset += 4; - break; - } + proc_offset += get_var_proc_offset(var); var = PREV_LINK(var); } @@ -2024,6 +2023,7 @@ static int get_type_format_string_size(type_t *iface) while (var) { size += get_var_type_offset(var); + var = PREV_LINK(var); } } @@ -2053,20 +2053,7 @@ static int get_proc_format_string_size(type_t *iface) while (NEXT_LINK(var)) var = NEXT_LINK(var); while (var) { - switch (var->ptr_level) - { - case 0: - if (is_base_type(var->type)) - size += 2; - else if (var->type->type == RPC_FC_RP) - size += 4; - break; - - case 1: - if (is_base_type(var->type)) - size += 4; - break; - } + size += get_var_proc_offset(var); var = PREV_LINK(var); }