widl: Get simple enums working.

This commit is contained in:
Dan Hipschman 2007-06-25 18:24:11 -07:00 committed by Alexandre Julliard
parent ab22b4b3d4
commit 512c36cae6
3 changed files with 32 additions and 0 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;