From 512c36cae62fa0d45ac1997abf4eb0149ce264cd Mon Sep 17 00:00:00 2001 From: Dan Hipschman Date: Mon, 25 Jun 2007 18:24:11 -0700 Subject: [PATCH] widl: Get simple enums working. --- dlls/rpcrt4/tests/server.c | 19 +++++++++++++++++++ dlls/rpcrt4/tests/server.idl | 9 +++++++++ tools/widl/typegen.c | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index ceb083bde4b..538f2aa7c24 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -272,6 +272,20 @@ s_sum_pcarr(int *a[], int n) return s; } +int +s_enum_ord(e_t e) +{ + switch (e) + { + case E1: return 1; + case E2: return 2; + case E3: return 3; + case E4: return 4; + default: + return 0; + } +} + void s_stop(void) { @@ -385,6 +399,11 @@ basic_tests(void) ok(dot_copy_vectors(vec1, vec2) == -21, "RPC dot_copy_vectors\n"); ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n"); ok(sum_sp(&sp) == 29, "RPC sum_sp\n"); + + ok(enum_ord(E1) == 1, "RPC enum_ord\n"); + ok(enum_ord(E2) == 2, "RPC enum_ord\n"); + ok(enum_ord(E3) == 3, "RPC enum_ord\n"); + ok(enum_ord(E4) == 4, "RPC enum_ord\n"); } static void diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index d409c53efa5..935c4bb33b4 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -157,8 +157,17 @@ interface IServer case ENCU_F: float f; } encu_t; + typedef enum + { + E1 = 23, + E2 = 4, + E3 = 0, + E4 = 64 + } e_t; + double square_encu(encu_t *eu); int sum_parr(int *a[3]); int sum_pcarr([size_is(n)] int *a[], int n); + int enum_ord(e_t e); void stop(void); } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 8dedd8d6ddf..5fec7c702d9 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2122,12 +2122,14 @@ static unsigned int get_required_buffer_size_type( case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: + case RPC_FC_ENUM16: *alignment = 4; size = 2; break; case RPC_FC_ULONG: case RPC_FC_LONG: + case RPC_FC_ENUM32: case RPC_FC_FLOAT: case RPC_FC_ERROR_STATUS_T: *alignment = 4; @@ -2344,12 +2346,14 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: + case RPC_FC_ENUM16: size = 2; alignment = 2; break; case RPC_FC_ULONG: case RPC_FC_LONG: + case RPC_FC_ENUM32: case RPC_FC_FLOAT: case RPC_FC_ERROR_STATUS_T: size = 4;