Commit 512c36ca authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Get simple enums working.

parent ab22b4b3
...@@ -272,6 +272,20 @@ s_sum_pcarr(int *a[], int n) ...@@ -272,6 +272,20 @@ s_sum_pcarr(int *a[], int n)
return s; 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 void
s_stop(void) s_stop(void)
{ {
...@@ -385,6 +399,11 @@ basic_tests(void) ...@@ -385,6 +399,11 @@ basic_tests(void)
ok(dot_copy_vectors(vec1, vec2) == -21, "RPC dot_copy_vectors\n"); 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_fixed_array(f) == -2, "RPC sum_fixed_array\n");
ok(sum_sp(&sp) == 29, "RPC sum_sp\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 static void
......
...@@ -157,8 +157,17 @@ interface IServer ...@@ -157,8 +157,17 @@ interface IServer
case ENCU_F: float f; case ENCU_F: float f;
} encu_t; } encu_t;
typedef enum
{
E1 = 23,
E2 = 4,
E3 = 0,
E4 = 64
} e_t;
double square_encu(encu_t *eu); double square_encu(encu_t *eu);
int sum_parr(int *a[3]); int sum_parr(int *a[3]);
int sum_pcarr([size_is(n)] int *a[], int n); int sum_pcarr([size_is(n)] int *a[], int n);
int enum_ord(e_t e);
void stop(void); void stop(void);
} }
...@@ -2122,12 +2122,14 @@ static unsigned int get_required_buffer_size_type( ...@@ -2122,12 +2122,14 @@ static unsigned int get_required_buffer_size_type(
case RPC_FC_WCHAR: case RPC_FC_WCHAR:
case RPC_FC_USHORT: case RPC_FC_USHORT:
case RPC_FC_SHORT: case RPC_FC_SHORT:
case RPC_FC_ENUM16:
*alignment = 4; *alignment = 4;
size = 2; size = 2;
break; break;
case RPC_FC_ULONG: case RPC_FC_ULONG:
case RPC_FC_LONG: case RPC_FC_LONG:
case RPC_FC_ENUM32:
case RPC_FC_FLOAT: case RPC_FC_FLOAT:
case RPC_FC_ERROR_STATUS_T: case RPC_FC_ERROR_STATUS_T:
*alignment = 4; *alignment = 4;
...@@ -2344,12 +2346,14 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, ...@@ -2344,12 +2346,14 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase,
case RPC_FC_WCHAR: case RPC_FC_WCHAR:
case RPC_FC_USHORT: case RPC_FC_USHORT:
case RPC_FC_SHORT: case RPC_FC_SHORT:
case RPC_FC_ENUM16:
size = 2; size = 2;
alignment = 2; alignment = 2;
break; break;
case RPC_FC_ULONG: case RPC_FC_ULONG:
case RPC_FC_LONG: case RPC_FC_LONG:
case RPC_FC_ENUM32:
case RPC_FC_FLOAT: case RPC_FC_FLOAT:
case RPC_FC_ERROR_STATUS_T: case RPC_FC_ERROR_STATUS_T:
size = 4; size = 4;
......
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