Scilab: fix scilab primitve typemaps

This commit is contained in:
Simon Marchetto 2013-09-26 16:54:55 +02:00
commit 4cf15d9c1e
8 changed files with 202 additions and 156 deletions

View file

@ -4,6 +4,8 @@ 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
@ -29,14 +31,7 @@ if typeof(returnDouble()) <> "constant" then swigtesterror(); end
if returnDouble() <> 42.42 then swigtesterror(); end
if typeof(returnFloat()) <> "constant" then swigtesterror(); end
if returnFloat() <> 42 then swigtesterror(); end
if typeof(returnInt()) <> "constant" then swigtesterror(); end
if returnInt() <> 42 then swigtesterror(); end
if typeof(returnLong()) <> "constant" then swigtesterror(); end
if returnLong() <> 42 then swigtesterror(); end
if typeof(returnShort()) <> "constant" then swigtesterror(); end
if returnShort() <> 42 then swigtesterror(); end
if typeof(returnChar()) <> "string" then swigtesterror(); end
if returnChar() <> "a" then swigtesterror(); end
exec("swigtest.quit", -1);

View file

@ -1,6 +1,12 @@
%module scilab_typemaps
%inline %{
/* Scilab string */
char returnChar()
{
return 'a';
}
/* Scilab [u]int8 */
signed char returnSignedChar()
{
@ -12,11 +18,11 @@
}
/* Scilab [u]int16 */
SCI_INT16_FROM_SHORT returnShortAsInt16()
short returnShortAsInt16()
{
return 42;
}
SCI_INT16_FROM_SIGNED_SHORT returnSignedShortAsInt16()
signed short returnSignedShortAsInt16()
{
return (signed short) 42;
}
@ -26,19 +32,19 @@
}
/* Scilab [u]int32 */
SCI_INT32_FROM_INT returnIntAsInt32()
int returnIntAsInt32()
{
return 42;
}
SCI_INT32_FROM_LONG returnLongAsInt32()
long returnLongAsInt32()
{
return (long) 42;
}
SCI_INT32_FROM_SIGNED_INT returnSignedIntAsInt32()
signed int returnSignedIntAsInt32()
{
return (signed int) 42;
}
SCI_INT32_FROM_SIGNED_LONG returnSignedLongAsInt32()
signed long returnSignedLongAsInt32()
{
return (signed long) 42;
}
@ -60,34 +66,5 @@
{
return (float) 42;
}
int returnInt()
{
return 42;
}
signed int returnSignedInt()
{
return (signed int) 42;
}
long returnLong()
{
return (long) 42;
}
signed long returnSignedLong()
{
return (signed long) 42;
}
char returnChar()
{
return 'a';
}
short returnShort()
{
return (short) 42;
}
signed short returnSignedShort()
{
return (signed short) 42;
}
%}