Chicken test suite now runs with no errors
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10054 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c6b4403b40
commit
4ace915a56
7 changed files with 95 additions and 15 deletions
|
|
@ -275,6 +275,43 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
free(temp);
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE (CLASS::*) {
|
||||
char err_msg[256];
|
||||
|
||||
if (C_swig_is_pair($input)) {
|
||||
/* try and convert pointer object */
|
||||
void *result;
|
||||
if (!SWIG_ConvertPtr(C_block_item($input,1), &result, $descriptor, 0)) {
|
||||
C_word ptr = C_block_item($input,0);
|
||||
if (C_swig_is_string(ptr)) {
|
||||
SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($type));
|
||||
} else {
|
||||
snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
|
||||
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
|
||||
}
|
||||
} else {
|
||||
snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
|
||||
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
|
||||
}
|
||||
} else {
|
||||
snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
|
||||
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(varout) SWIGTYPE (CLASS::*) {
|
||||
size_t ptr_size = sizeof($type);
|
||||
C_word *known_space = C_alloc(C_SIZEOF_PAIR + C_SIZEOF_STRING(2*ptr_size) + C_SIZEOF_SWIG_POINTER);
|
||||
char *temp = (char *)malloc(2*ptr_size);
|
||||
C_word ptr = SWIG_NewPointerObj((void *) known_space, $descriptor, 0);
|
||||
|
||||
SWIG_PackData(temp, (void *) &$varname, ptr_size);
|
||||
$result = C_pair(&known_space, C_string(&known_space, 2*ptr_size, temp), ptr);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Pass-by-value */
|
||||
|
||||
%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE($&1_ltype argp) {
|
||||
|
|
@ -499,9 +536,6 @@ $result = C_SCHEME_UNDEFINED;
|
|||
%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
|
||||
"static const void *$result = (void*) $value;"
|
||||
|
||||
%typemap(constcode) SWIGTYPE (CLASS::*)
|
||||
"static const void *$result = (void*) &$value;"
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue