scilab: roll back on primitive typemaps: return Scilab double on signed integers
This commit is contained in:
parent
ec2d851f4f
commit
a6f824a9a8
5 changed files with 81 additions and 106 deletions
|
|
@ -1,32 +1,32 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
// Char
|
||||
if typeof(returnChar()) <> "string" then swigtesterror(); end
|
||||
if returnChar() <> "a" then swigtesterror(); end
|
||||
if typeof(returnSignedChar()) <> "int8" then swigtesterror(); end
|
||||
if returnSignedChar() <> int8(42) then swigtesterror(); end
|
||||
if typeof(returnUnsignedChar()) <> "uint8" then swigtesterror(); end
|
||||
if returnUnsignedChar() <> uint8(42) then swigtesterror(); end
|
||||
if typeof(returnChar()) <> "string" then swigtesterror(); end
|
||||
if returnChar() <> "a" then swigtesterror(); end
|
||||
|
||||
if typeof(returnShortAsInt16()) <> "int16" then swigtesterror(); end
|
||||
if returnShortAsInt16() <> int16(42) then swigtesterror(); end
|
||||
if typeof(returnSignedShortAsInt16()) <> "int16" then swigtesterror(); end
|
||||
if returnSignedShortAsInt16() <> int16(42) then swigtesterror(); end
|
||||
// Short
|
||||
if typeof(returnShort()) <> "constant" then swigtesterror(); end
|
||||
if returnShort() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedShort()) <> "uint16" then swigtesterror(); end
|
||||
if returnUnsignedShort() <> uint16(42) then swigtesterror(); end
|
||||
|
||||
if typeof(returnIntAsInt32()) <> "int32" then swigtesterror(); end
|
||||
if returnIntAsInt32() <> int32(42) then swigtesterror(); end
|
||||
if typeof(returnSignedIntAsInt32()) <> "int32" then swigtesterror(); end
|
||||
if returnSignedIntAsInt32() <> int32(42) then swigtesterror(); end
|
||||
if typeof(returnLongAsInt32()) <> "int32" then swigtesterror(); end
|
||||
if returnLongAsInt32() <> int32(42) then swigtesterror(); end
|
||||
if typeof(returnSignedLongAsInt32()) <> "int32" then swigtesterror(); end
|
||||
if returnSignedLongAsInt32() <> int32(42) then swigtesterror(); end
|
||||
// Int
|
||||
if typeof(returnInt()) <> "constant" then swigtesterror(); end
|
||||
if returnInt() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedInt()) <> "uint32" then swigtesterror(); end
|
||||
if returnUnsignedInt() <> uint32(42) then swigtesterror(); end
|
||||
|
||||
// Long
|
||||
if typeof(returnLong()) <> "constant" then swigtesterror(); end
|
||||
if returnLong() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedLong()) <> "uint32" then swigtesterror(); end
|
||||
if returnUnsignedLong() <> uint32(42) then swigtesterror(); end
|
||||
|
||||
// Double & float
|
||||
if typeof(returnDouble()) <> "constant" then swigtesterror(); end
|
||||
if returnDouble() <> 42.42 then swigtesterror(); end
|
||||
if typeof(returnFloat()) <> "constant" then swigtesterror(); end
|
||||
|
|
|
|||
|
|
@ -1,70 +1,60 @@
|
|||
%module scilab_typemaps
|
||||
|
||||
%inline %{
|
||||
/* Scilab string */
|
||||
char returnChar()
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
// Char
|
||||
char returnChar()
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
signed char returnSignedChar()
|
||||
{
|
||||
return (signed char)42;
|
||||
}
|
||||
unsigned char returnUnsignedChar()
|
||||
{
|
||||
return (unsigned char) 42;
|
||||
}
|
||||
|
||||
/* Scilab [u]int8 */
|
||||
signed char returnSignedChar()
|
||||
{
|
||||
return (signed char)42;
|
||||
}
|
||||
unsigned char returnUnsignedChar()
|
||||
{
|
||||
return (unsigned char) 42;
|
||||
}
|
||||
// Short
|
||||
short returnShort()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
unsigned short returnUnsignedShort()
|
||||
{
|
||||
return (unsigned short) 42;
|
||||
}
|
||||
|
||||
/* Scilab [u]int16 */
|
||||
short returnShortAsInt16()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
signed short returnSignedShortAsInt16()
|
||||
{
|
||||
return (signed short) 42;
|
||||
}
|
||||
unsigned short returnUnsignedShort()
|
||||
{
|
||||
return (unsigned short) 42;
|
||||
}
|
||||
// Int
|
||||
int returnInt()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
/* Scilab [u]int32 */
|
||||
int returnIntAsInt32()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
long returnLongAsInt32()
|
||||
{
|
||||
return (long) 42;
|
||||
}
|
||||
signed int returnSignedIntAsInt32()
|
||||
{
|
||||
return (signed int) 42;
|
||||
}
|
||||
signed long returnSignedLongAsInt32()
|
||||
{
|
||||
return (signed long) 42;
|
||||
}
|
||||
unsigned int returnUnsignedInt()
|
||||
{
|
||||
return (unsigned int) 42;
|
||||
}
|
||||
unsigned long returnUnsignedLong()
|
||||
{
|
||||
return (unsigned long) 42;
|
||||
}
|
||||
unsigned int returnUnsignedInt()
|
||||
{
|
||||
return (unsigned int) 42;
|
||||
}
|
||||
|
||||
/* Scilab double */
|
||||
double returnDouble()
|
||||
{
|
||||
return 42.42;
|
||||
}
|
||||
float returnFloat()
|
||||
{
|
||||
return (float) 42;
|
||||
}
|
||||
// Long
|
||||
long returnLong()
|
||||
{
|
||||
return (long) 42;
|
||||
}
|
||||
unsigned long returnUnsignedLong()
|
||||
{
|
||||
return (unsigned long) 42;
|
||||
}
|
||||
|
||||
|
||||
// Double & float
|
||||
double returnDouble()
|
||||
{
|
||||
return 42.42;
|
||||
}
|
||||
float returnFloat()
|
||||
{
|
||||
return (float) 42;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue