Commit 470d1ebd authored by Jean-Claude Beaudoin's avatar Jean-Claude Beaudoin
Browse files

Remove redundant basic types from set of distinct FFI basic types. Replace them with aliases.

parent 2d206049
......@@ -51,18 +51,12 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
case MKCL_FFI_UNSIGNED_CHAR: i = data->uc; goto INT;
case MKCL_FFI_BYTE: i = data->b; goto INT;
case MKCL_FFI_UNSIGNED_BYTE: i = data->ub; goto INT;
case MKCL_FFI_INT16_T: i = data->i16; goto INT;
case MKCL_FFI_UINT16_T: i = data->u16; goto INT;
case MKCL_FFI_SHORT: i = data->s; goto INT;
case MKCL_FFI_UNSIGNED_SHORT: i = data->us; goto INT;
case MKCL_FFI_INT32_T: i = data->i32; goto INT;
case MKCL_FFI_UINT32_T: i = data->u32; goto INT;
case MKCL_FFI_INT: i = data->i; goto INT;
case MKCL_FFI_UNSIGNED_INT: i = data->ui; goto INT;
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_POINTER_VOID:
......@@ -350,18 +344,12 @@ mkcl_dynamic_callback_execute(long i1, long i2, long i3, long i4, long i5, long
case MKCL_FFI_UNSIGNED_CHAR: val = output.uc; break;
case MKCL_FFI_BYTE: val = output.b; break;
case MKCL_FFI_UNSIGNED_BYTE: val = output.ub; break;
case MKCL_FFI_INT16_T: val = output.i16; break;
case MKCL_FFI_UINT16_T: val = output.u16; break;
case MKCL_FFI_SHORT: val = output.s; break;
case MKCL_FFI_UNSIGNED_SHORT: val = output.us; break;
case MKCL_FFI_INT32_T: val = output.i32; break;
case MKCL_FFI_UINT32_T: val = output.u32; break;
case MKCL_FFI_INT:
case MKCL_FFI_UNSIGNED_INT:
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_POINTER_VOID:
......
......@@ -64,8 +64,6 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
case MKCL_FFI_UNSIGNED_BYTE: i = data->ub; goto INT;
case MKCL_FFI_SHORT: i = data->s; goto INT;
case MKCL_FFI_UNSIGNED_SHORT: i = data->us; goto INT;
case MKCL_FFI_INT16_T: i = data->i16; goto INT;
case MKCL_FFI_UINT16_T: i = data->u16; goto INT;
case MKCL_FFI_INT:
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_INT:
......@@ -92,11 +90,6 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
mkcl_fficall_align4(env);
mkcl_fficall_push_bytes(env, &data->d, sizeof(long double));
break;
case MKCL_FFI_UINT64_T:
case MKCL_FFI_INT64_T:
mkcl_fficall_align4(env);
mkcl_fficall_push_bytes(env, &data->ull, sizeof(mkcl_uint64_t));
break;
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_LONG_LONG:
mkcl_fficall_align4(env);
......@@ -190,23 +183,6 @@ mkcl_fficall_execute(MKCL, void *f_ptr, struct mkcl_fficall *fficall, enum mkcl_
regs->vfp.d[0], regs->vfp.d[1], regs->vfp.d[2], regs->vfp.d[3],
regs->vfp.d[4], regs->vfp.d[5], regs->vfp.d[6], regs->vfp.d[7]);
}
#if 0
else if (return_type == MKCL_FFI_INT16_T) {
fficall->output.i16 = ((mkcl_int16_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT16_T) {
fficall->output.u16 = ((mkcl_uint16_t (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_INT32_T) {
fficall->output.i32 = ((mkcl_int32_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT32_T) {
fficall->output.u32 = ((mkcl_uint32_t (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_INT64_T) {
fficall->output.i64 = ((mkcl_int64_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT64_T) {
fficall->output.u64 = ((mkcl_uint64_t (*)())f_ptr)();
}
#endif
else if ((return_type == MKCL_FFI_LONG_LONG)
|| (return_type == MKCL_FFI_UNSIGNED_LONG_LONG)) {
fficall->output.ll
......@@ -302,11 +278,7 @@ mkcl_dynamic_callback_execute(mkcl_object cbk_info, char *arg_buffer)
case MKCL_FFI_UNSIGNED_CHAR: i = output.uc; goto INT;
case MKCL_FFI_BYTE: i = output.b; goto INT;
case MKCL_FFI_UNSIGNED_BYTE: i = output.ub; goto INT;
case MKCL_FFI_INT16_T:
case MKCL_FFI_SHORT: i = output.s; goto INT;
case MKCL_FFI_UINT16_T:
case MKCL_FFI_UNSIGNED_SHORT: i = output.us; goto INT;
case MKCL_FFI_POINTER_VOID:
......@@ -333,8 +305,6 @@ mkcl_dynamic_callback_execute(mkcl_object cbk_info, char *arg_buffer)
return;
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
#if 0 /* this code is x86 legacy. */
# ifdef _MSC_VER
__asm mov eax,output.l2[0]
......
......@@ -39,14 +39,10 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
case MKCL_FFI_UNSIGNED_BYTE: i = data->ub; goto INT;
case MKCL_FFI_SHORT: i = data->s; goto INT;
case MKCL_FFI_UNSIGNED_SHORT: i = data->us; goto INT;
case MKCL_FFI_INT16_T: i = data->i16; goto INT;
case MKCL_FFI_UINT16_T: i = data->u16; goto INT;
case MKCL_FFI_INT:
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_INT:
case MKCL_FFI_UNSIGNED_LONG:
case MKCL_FFI_INT32_T:
case MKCL_FFI_UINT32_T:
case MKCL_FFI_POINTER_VOID:
case MKCL_FFI_CSTRING:
case MKCL_FFI_OBJECT:
......@@ -67,11 +63,6 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
mkcl_fficall_align4(env);
mkcl_fficall_push_bytes(env, &data->d, sizeof(long double));
break;
case MKCL_FFI_UINT64_T:
case MKCL_FFI_INT64_T:
mkcl_fficall_align4(env);
mkcl_fficall_push_bytes(env, &data->ull, sizeof(mkcl_uint64_t));
break;
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_LONG_LONG:
mkcl_fficall_align4(env);
......@@ -135,21 +126,6 @@ mkcl_fficall_execute(MKCL, void *f_ptr, struct mkcl_fficall *fficall, enum mkcl_
else if (return_type == MKCL_FFI_VOID) {
((void (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_INT16_T) {
fficall->output.i16 = ((mkcl_int16_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT16_T) {
fficall->output.u16 = ((mkcl_uint16_t (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_INT32_T) {
fficall->output.i32 = ((mkcl_int32_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT32_T) {
fficall->output.u32 = ((mkcl_uint32_t (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_INT64_T) {
fficall->output.i64 = ((mkcl_int64_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UINT64_T) {
fficall->output.u64 = ((mkcl_uint64_t (*)())f_ptr)();
}
else if (return_type == MKCL_FFI_LONG_LONG) {
fficall->output.ll = ((mkcl_long_long_t (*)())f_ptr)();
} else if (return_type == MKCL_FFI_UNSIGNED_LONG_LONG) {
......@@ -249,11 +225,7 @@ mkcl_dynamic_callback_execute(mkcl_object cbk_info, char *arg_buffer)
case MKCL_FFI_UNSIGNED_CHAR: i = output.uc; goto INT;
case MKCL_FFI_BYTE: i = output.b; goto INT;
case MKCL_FFI_UNSIGNED_BYTE: i = output.ub; goto INT;
case MKCL_FFI_INT16_T:
case MKCL_FFI_SHORT: i = output.s; goto INT;
case MKCL_FFI_UINT16_T:
case MKCL_FFI_UNSIGNED_SHORT: i = output.us; goto INT;
case MKCL_FFI_POINTER_VOID:
......@@ -278,8 +250,6 @@ mkcl_dynamic_callback_execute(mkcl_object cbk_info, char *arg_buffer)
return;
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
# ifdef _MSC_VER
__asm mov eax,output.l2[0]
__asm mov edx,output.l2[1]
......
......@@ -51,18 +51,12 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
case MKCL_FFI_UNSIGNED_CHAR: i = data->uc; goto INT;
case MKCL_FFI_BYTE: i = data->b; goto INT;
case MKCL_FFI_UNSIGNED_BYTE: i = data->ub; goto INT;
case MKCL_FFI_INT16_T: i = data->i16; goto INT;
case MKCL_FFI_UINT16_T: i = data->u16; goto INT;
case MKCL_FFI_SHORT: i = data->s; goto INT;
case MKCL_FFI_UNSIGNED_SHORT: i = data->us; goto INT;
case MKCL_FFI_INT32_T: i = data->i32; goto INT;
case MKCL_FFI_UINT32_T: i = data->u32; goto INT;
case MKCL_FFI_INT: i = data->i; goto INT;
case MKCL_FFI_UNSIGNED_INT: i = data->ui; goto INT;
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_POINTER_VOID:
......@@ -338,18 +332,12 @@ mkcl_dynamic_callback_execute(long i1, long i2, long i3, long i4, long i5, long
case MKCL_FFI_UNSIGNED_CHAR: val = output.uc; break;
case MKCL_FFI_BYTE: val = output.b; break;
case MKCL_FFI_UNSIGNED_BYTE: val = output.ub; break;
case MKCL_FFI_INT16_T: val = output.i16; break;
case MKCL_FFI_UINT16_T: val = output.u16; break;
case MKCL_FFI_SHORT: val = output.s; break;
case MKCL_FFI_UNSIGNED_SHORT: val = output.us; break;
case MKCL_FFI_INT32_T: val = output.i32; break;
case MKCL_FFI_UINT32_T: val = output.u32; break;
case MKCL_FFI_INT:
case MKCL_FFI_UNSIGNED_INT:
case MKCL_FFI_LONG:
case MKCL_FFI_UNSIGNED_LONG:
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_POINTER_VOID:
......
......@@ -51,18 +51,12 @@ mkcl_fficall_push_arg(MKCL, union mkcl_ffi_values *data, enum mkcl_ffi_tag type)
case MKCL_FFI_UNSIGNED_CHAR: i = data->uc; goto INT;
case MKCL_FFI_BYTE: i = data->b; goto INT;
case MKCL_FFI_UNSIGNED_BYTE: i = data->ub; goto INT;
case MKCL_FFI_INT16_T: i = data->i16; goto INT;
case MKCL_FFI_UINT16_T: i = data->u16; goto INT;
case MKCL_FFI_SHORT: i = data->s; goto INT;
case MKCL_FFI_UNSIGNED_SHORT: i = data->us; goto INT;
case MKCL_FFI_INT32_T: i = data->i32; goto INT;
case MKCL_FFI_UINT32_T: i = data->u32; goto INT;
case MKCL_FFI_INT: i = data->i; goto INT;
case MKCL_FFI_UNSIGNED_INT: i = data->ui; goto INT;
case MKCL_FFI_LONG: i = data->l; goto INT;
case MKCL_FFI_UNSIGNED_LONG: i = data->ul; goto INT;
case MKCL_FFI_INT64_T: i = data->i64; goto INT;
case MKCL_FFI_UINT64_T: i = data->u64; goto INT;
case MKCL_FFI_LONG_LONG: i = data->ll; goto INT;
case MKCL_FFI_UNSIGNED_LONG_LONG: i = data->ull; goto INT;
case MKCL_FFI_POINTER_VOID: i = (intptr_t) data->pv; goto INT;
......@@ -307,19 +301,13 @@ mkcl_dynamic_callback_execute(int64_t i1, int64_t i2, int64_t i3, int64_t i4,
case MKCL_FFI_UNSIGNED_CHAR: val = output.uc; break;
case MKCL_FFI_BYTE: val = output.b; break;
case MKCL_FFI_UNSIGNED_BYTE: val = output.ub; break;
case MKCL_FFI_INT16_T: val = output.i16; break;
case MKCL_FFI_UINT16_T: val = output.u16; break;
case MKCL_FFI_SHORT: val = output.s; break;
case MKCL_FFI_UNSIGNED_SHORT: val = output.us; break;
case MKCL_FFI_INT32_T: val = output.i32; break;
case MKCL_FFI_UINT32_T: val = output.u32; break;
case MKCL_FFI_INT: val = output.i; break;
case MKCL_FFI_UNSIGNED_INT: val = output.ui; break;
case MKCL_FFI_LONG: val = output.l; break;
case MKCL_FFI_UNSIGNED_LONG: val = output.ul; break;
case MKCL_FFI_INT64_T:
case MKCL_FFI_UINT64_T:
case MKCL_FFI_LONG_LONG:
case MKCL_FFI_UNSIGNED_LONG_LONG:
case MKCL_FFI_POINTER_VOID:
......
......@@ -370,18 +370,6 @@ mkcl_foreign_ref_elt(MKCL, void *p, enum mkcl_ffi_tag tag)
return mkcl_make_unsigned_integer(env, *(unsigned int *)p);
case MKCL_FFI_LONG:
return mkcl_make_integer(env, *(long *)p);
case MKCL_FFI_INT16_T:
return mkcl_make_int16_t(env, *(mkcl_int16_t *)p);
case MKCL_FFI_UINT16_T:
return mkcl_make_uint16_t(env, *(mkcl_uint16_t *)p);
case MKCL_FFI_INT32_T:
return mkcl_make_int32_t(env, *(mkcl_int32_t *)p);
case MKCL_FFI_UINT32_T:
return mkcl_make_uint32_t(env, *(mkcl_uint32_t *)p);
case MKCL_FFI_INT64_T:
return mkcl_make_int64_t(env, *(mkcl_int64_t *)p);
case MKCL_FFI_UINT64_T:
return mkcl_make_uint64_t(env, *(mkcl_uint64_t *)p);
case MKCL_FFI_LONG_LONG:
return mkcl_make_long_long(env, *(mkcl_long_long_t *)p);
case MKCL_FFI_UNSIGNED_LONG_LONG:
......@@ -445,24 +433,6 @@ mkcl_foreign_set_elt(MKCL, void *p, enum mkcl_ffi_tag tag, mkcl_object value)
case MKCL_FFI_UNSIGNED_LONG:
*(unsigned long *)p = mkcl_integer_to_index(env, value);
break;
case MKCL_FFI_INT16_T:
*(mkcl_int16_t *)p = mkcl_to_int16_t(env, value);
break;
case MKCL_FFI_UINT16_T:
*(mkcl_uint16_t *)p = mkcl_to_uint16_t(env, value);
break;
case MKCL_FFI_INT32_T:
*(mkcl_int32_t *)p = mkcl_to_int32_t(env, value);
break;
case MKCL_FFI_UINT32_T:
*(mkcl_uint32_t *)p = mkcl_to_uint32_t(env, value);
break;
case MKCL_FFI_INT64_T:
*(mkcl_int64_t *)p = mkcl_to_int64_t(env, value);
break;
case MKCL_FFI_UINT64_T:
*(mkcl_uint64_t *)p = mkcl_to_uint64_t(env, value);
break;
case MKCL_FFI_LONG_LONG:
*(mkcl_long_long_t *)p = mkcl_to_long_long(env, value);
break;
......
......@@ -861,12 +861,6 @@ extern "C" {
MKCL_FFI_UNSIGNED_INT,
MKCL_FFI_LONG,
MKCL_FFI_UNSIGNED_LONG,
MKCL_FFI_INT16_T,
MKCL_FFI_UINT16_T,
MKCL_FFI_INT32_T,
MKCL_FFI_UINT32_T,
MKCL_FFI_INT64_T,
MKCL_FFI_UINT64_T,
MKCL_FFI_LONG_LONG,
MKCL_FFI_UNSIGNED_LONG_LONG,
MKCL_FFI_POINTER_VOID,
......@@ -884,7 +878,20 @@ extern "C" {
MKCL_FFI_DOUBLE_IMAGINARY,
MKCL_FFI_LONG_DOUBLE_IMAGINARY,
#endif
MKCL_FFI_VOID
MKCL_FFI_VOID,
MKCL_FFI_INT8_T = MKCL_FFI_BYTE,
MKCL_FFI_UINT8_T = MKCL_FFI_UNSIGNED_BYTE,
MKCL_FFI_INT16_T = MKCL_FFI_SHORT,
MKCL_FFI_UINT16_T = MKCL_FFI_UNSIGNED_SHORT,
MKCL_FFI_INT32_T = MKCL_FFI_INT,
MKCL_FFI_UINT32_T = MKCL_FFI_UNSIGNED_INT,
#if MKCL_LONG_BITS == 64
MKCL_FFI_INT64_T = MKCL_FFI_LONG,
MKCL_FFI_UINT64_T = MKCL_FFI_UNSIGNED_LONG
#else
MKCL_FFI_INT64_T = MKCL_FFI_LONG_LONG,
MKCL_FFI_UINT64_T = MKCL_FFI_UNSIGNED_LONG_LONG
#endif
};
/* enum MKCL_FFI_VOID is used as a limit marker in a number of locations, beware!
Note also that the order of enums declared in enum mkcl_ffi_tag must
......
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