* New version for Scilab module using fragments
* A C and CPP tests generate and compile except tests using vectors (to be done) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12698 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6db40d8378
commit
a8b8b6c5d4
41 changed files with 2679 additions and 2557 deletions
|
|
@ -1155,7 +1155,19 @@ SCILAB = @SCILAB@
|
|||
# ----------------------------------------------------------------
|
||||
|
||||
scilab: $(SRCS)
|
||||
@$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH)
|
||||
@if test ! -z "$(SRCS)"; then \
|
||||
if test ! -z "$(INCLUDES)"; then \
|
||||
$(SWIG) -scilab -addsrc $(SRCS) -addcflag $(INCLUDES) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
else \
|
||||
$(SWIG) -scilab -addsrc $(SRCS) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
fi \
|
||||
else \
|
||||
if test ! -z "$(INCLUDES)"; then \
|
||||
$(SWIG) -scilab -addcflag $(INCLUDES) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
else \
|
||||
$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH); \
|
||||
fi \
|
||||
fi
|
||||
@if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
|
||||
fi
|
||||
|
|
@ -1165,7 +1177,19 @@ scilab: $(SRCS)
|
|||
# ----------------------------------------------------------------
|
||||
|
||||
scilab_cpp: $(SRCS)
|
||||
@$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH)
|
||||
@if test ! -z "$(SRCS)"; then \
|
||||
if test ! -z "$(INCLUDES)"; then \
|
||||
$(SWIG) -scilab -c++ -addsrc $(SRCS) -addcflag $(INCLUDES) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
else \
|
||||
$(SWIG) -scilab -c++ -addsrc $(SRCS) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
fi \
|
||||
else \
|
||||
if test ! -z "$(INCLUDES)"; then \
|
||||
$(SWIG) -scilab -c++ -addcflag $(INCLUDES) $(SWIGOPT) $(INTERFACEPATH); \
|
||||
else \
|
||||
$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH); \
|
||||
fi \
|
||||
fi
|
||||
@if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
|
||||
fi
|
||||
|
|
@ -1176,14 +1200,14 @@ scilab_cpp: $(SRCS)
|
|||
|
||||
scilab_run:
|
||||
@env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f runme.sci
|
||||
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Cleaning the scilab examples
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
scilab_clean:
|
||||
rm -f *.sce *.so lib*lib.c
|
||||
|
||||
|
||||
##################################################################
|
||||
##### Go ######
|
||||
##################################################################
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ contract
|
|||
enum
|
||||
funcptr
|
||||
matrix
|
||||
matrix2
|
||||
#matrix2
|
||||
pointer
|
||||
simple
|
||||
struct
|
||||
|
|
|
|||
|
|
@ -1,19 +1,42 @@
|
|||
// loader the *.so
|
||||
exec loader.sce
|
||||
|
||||
//Now try the typemap library
|
||||
//This should be much easier. Now how it is no longer
|
||||
//necessary to manufacture pointers.
|
||||
// First create some objects using the pointer library.
|
||||
printf("Testing the pointer library\n")
|
||||
a = new_intp();
|
||||
b = new_intp();
|
||||
c = new_intp(); // Memory for result
|
||||
|
||||
intp_assign(a, 37);
|
||||
intp_assign(b, 42);
|
||||
|
||||
printf(" a = %d\n", intp_value(a));
|
||||
printf(" b = %d\n", intp_value(b));
|
||||
printf(" c = %d\n", intp_value(c));
|
||||
|
||||
// Call the add() function with some pointers
|
||||
add(a, b, c);
|
||||
|
||||
// Now get the result
|
||||
r = intp_value(c);
|
||||
printf(" 37 + 42 = %d\n", r);
|
||||
|
||||
// Clean up the pointers
|
||||
delete_intp(a);
|
||||
delete_intp(b);
|
||||
delete_intp(c);
|
||||
|
||||
// Now try the typemap library
|
||||
// This should be much easier. Now how it is no longer
|
||||
// necessary to manufacture pointers.
|
||||
printf("Trying the typemap library\n");
|
||||
r = sub(37,42);
|
||||
printf(" 37 - 42 = %i\n",r);
|
||||
|
||||
//Now try the version with multiple return values
|
||||
r = sub(37, 42);
|
||||
printf(" 37 - 42 = %d\n", r);
|
||||
|
||||
// Now try the version with multiple return values
|
||||
printf("Testing multiple return values\n");
|
||||
[q,r] = divide(42,37);
|
||||
printf(" 42/37 = %d remainder %d\n",q,r);
|
||||
[q, r] = divide(42, 37);
|
||||
printf(" 42/37 = %d remainder %d\n", q, r);
|
||||
|
||||
exit
|
||||
|
||||
|
|
|
|||
|
|
@ -8,15 +8,11 @@ y = 105;
|
|||
g = gcd(x,y);
|
||||
printf("The gcd of %d and %d is %d\n",x,y,g);
|
||||
|
||||
x = [42 43];
|
||||
y = 105;
|
||||
g = gcd(x,y);
|
||||
printf("The gcd of %d and %d is %d\n",x,y,g);
|
||||
|
||||
// Manipulate the Foo global variable
|
||||
|
||||
// Output its current value
|
||||
Foo_get()
|
||||
// Get its default value (see in example.c)
|
||||
defaultValue = Foo_get()
|
||||
if defaultValue <> 3 then pause; end
|
||||
|
||||
// Change its value
|
||||
Foo_set(3.1415926)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ exec loader.sce
|
|||
//create a struct
|
||||
a=new_Bar();
|
||||
Bar_x_set(a,100);
|
||||
Bar_x_get(a)
|
||||
printf("a.x = %d (Sould be 100)\n", Bar_x_get(a));
|
||||
|
||||
exit
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ void print_vars() {
|
|||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)");
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("iptrvar = %i\n", value_int(iptrvar));
|
||||
printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]);
|
||||
//printf("ptptr = %p %s\n", ptptr, Point_print( ptptr ) );
|
||||
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr->x, ptptr->y);
|
||||
printf("pt = (%d, %d)\n", pt.x, pt.y);
|
||||
printf("status = %d\n", status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
extern float fvar;
|
||||
extern double dvar;
|
||||
extern char *strvar;
|
||||
// extern const char cstrvar[];
|
||||
extern const char cstrvar[];
|
||||
extern int *iptrvar;
|
||||
extern char name[256];
|
||||
|
||||
|
|
@ -45,6 +45,7 @@ extern char path[256];
|
|||
%inline %{
|
||||
extern void print_vars();
|
||||
extern int *new_int(int value);
|
||||
extern int value_int(int *value);
|
||||
extern Point *new_Point(int x, int y);
|
||||
extern char *Point_print(Point *p);
|
||||
extern void pt_print();
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
lines(0);
|
||||
|
||||
//loader the *.so
|
||||
exec loader.sce
|
||||
|
||||
// Try to set the values of some global variables
|
||||
|
||||
ivar_set (42);
|
||||
svar_set (31000);
|
||||
lvar_set (65537);
|
||||
uivar_set (123456);
|
||||
usvar_set (61000);
|
||||
ulvar_set (654321);
|
||||
scvar_set (-13);
|
||||
ucvar_set (251);
|
||||
cvar_set ("S");
|
||||
fvar_set (3.14159);
|
||||
dvar_set (2.1828);
|
||||
ivar_set(42);
|
||||
svar_set(-31000);
|
||||
lvar_set(65537);
|
||||
uivar_set(uint32(123456));
|
||||
usvar_set(uint16(61000));
|
||||
ulvar_set(654321);
|
||||
scvar_set(int8(-13));
|
||||
ucvar_set(uint8(251));
|
||||
cvar_set("S");
|
||||
fvar_set(3.14159);
|
||||
dvar_set(2.1828);
|
||||
strvar_set("Hello World");
|
||||
iptrvar_set(new_int(37));
|
||||
ptptr_set(new_Point(37,42));
|
||||
name_set("Bill");
|
||||
|
||||
//iptrvar= new_int(37);
|
||||
ptptr = new_Point(37,42);
|
||||
name_set ("Bill");
|
||||
// Now print out the values of the variables
|
||||
|
||||
printf("Variables (values printed from Scilab)\n");
|
||||
|
||||
printf("ivar = %i\n", ivar_get());
|
||||
printf("svar = %i\n", svar_get());
|
||||
printf("lvar = %i\n", lvar_get());
|
||||
|
|
@ -35,13 +34,37 @@ printf("fvar = %f\n", fvar_get());
|
|||
printf("dvar = %f\n", dvar_get());
|
||||
printf("cvar = %s\n", cvar_get());
|
||||
printf("strvar = %s\n", strvar_get());
|
||||
|
||||
//iptrvar
|
||||
printf("cstrvar = %s\n", cstrvar_get());
|
||||
printf("iptrvar = %i\n", value_int(iptrvar_get()));
|
||||
printf("name = %s\n", name_get());
|
||||
printf("ptptr = %s\n", Point_print(ptptr));
|
||||
printf("\nVariables (values printed from C)\n");
|
||||
printf("ptptr = %s\n", Point_print(ptptr_get()));
|
||||
printf("pt = %s\n", Point_print(pt_get()));
|
||||
printf("status = %d\n", status_get());
|
||||
|
||||
printf("\nVariables (values printed from C)\n");
|
||||
print_vars()
|
||||
|
||||
// Immutable variables
|
||||
printf("\nNow I''m going to try and modify some read only variables\n");
|
||||
printf(" Tring to set ''path''\n");
|
||||
try
|
||||
path_set("Whoa!");
|
||||
printf("Hey, what''s going on?!?! This shouldn''t work\n");
|
||||
catch
|
||||
printf("Good.\n");
|
||||
end
|
||||
printf(" Trying to set ''status''\n");
|
||||
try
|
||||
status_set(0);
|
||||
printf("Hey, what''s going on?!?! This shouldn''t work\n");
|
||||
catch
|
||||
printf("Good.\n");
|
||||
end
|
||||
|
||||
// Structure
|
||||
printf("\nI''m going to try and update a structure variable.\n");
|
||||
pt_set(ptptr_get());
|
||||
printf("The new value is %s\n", Point_print(pt_get()));
|
||||
|
||||
exit
|
||||
|
||||
|
|
|
|||
|
|
@ -9,34 +9,51 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Overridden variables here
|
||||
# none!
|
||||
# None!
|
||||
# - constructor_copy (Vectors/C++)
|
||||
# - dynamic_cast (Vectors/C++)
|
||||
# - li_boost_shared_ptr_bits (Vectors/C++)
|
||||
# - member_funcptr_galore (Vectors/C++)
|
||||
# - member_pointer (Vectors/C++)
|
||||
# - minherit (Vectors/C++)
|
||||
# - typemap_variables (weird error/C++)
|
||||
# - director_string (Vectors/C++)
|
||||
# - ignore_template_constructor (Vectors/C++)
|
||||
# - li_std_combinations (std_pair.i/C++)
|
||||
# - li_std_deque (std_deque.i/C++)
|
||||
# - li_std_except (This version of std_except.i should not be used/C++)
|
||||
# - li_std_map (std_pair.i/std_map.i/C++)
|
||||
# - li_std_pair (std_pair.i/C++)
|
||||
# - li_std_vector (Vectors/C++)
|
||||
# - smart_pointer_inherit (Vectors/C++)
|
||||
# - template_typedef_fnc (Vectors/C++)
|
||||
# - template_type_namespace (Vectors/C++)
|
||||
# - template_opaque (Vectors/C++)
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
@$(setup)
|
||||
+$(swig_and_compile_cpp) > scilab.log
|
||||
@+$(swig_and_compile_cpp) #> scilab.log
|
||||
@$(run_testcase)
|
||||
|
||||
%.ctest:
|
||||
@$(setup)
|
||||
@+$(swig_and_compile_c) > scilab.log
|
||||
@+$(swig_and_compile_c) #> scilab.log
|
||||
@$(run_testcase)
|
||||
|
||||
%.multicpptest:
|
||||
@$(setup)
|
||||
@+$(swig_and_compile_multi_cpp) > scilab.log
|
||||
@+$(swig_and_compile_multi_cpp) > #scilab.log
|
||||
@$(run_testcase)
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
# a file is found which has _runme.sci appended after the testcase name.
|
||||
run_testcase = \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
||||
else \
|
||||
(echo "*** RUNME FILE NOT FOUND: $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ***") \
|
||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
||||
fi; \
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
if UP_get()<>int32(1) then swigtesterror(); end
|
||||
if typeof(UP_get())<>"int32" then swigtesterror(); end
|
||||
if UP_get()<>1 then swigtesterror(); end
|
||||
if typeof(UP_get())<>"constant" then pause; end
|
||||
|
||||
if DOWN_get()<>int32(2) then swigtesterror(); end
|
||||
if typeof(DOWN_get())<>"int32" then swigtesterror(); end
|
||||
if DOWN_get()<>2 then swigtesterror(); end
|
||||
if typeof(DOWN_get())<>"constant" then pause; end
|
||||
|
||||
if LEFT_get()<>int32(3) then swigtesterror(); end
|
||||
if typeof(LEFT_get())<>"int32" then swigtesterror(); end
|
||||
if LEFT_get()<>3 then swigtesterror(); end
|
||||
if typeof(LEFT_get())<>"constant" then pause; end
|
||||
|
||||
if RIGHT_get()<>int32(4) then swigtesterror(); end
|
||||
if typeof(RIGHT_get())<>"int32" then swigtesterror(); end
|
||||
if RIGHT_get()<>4 then swigtesterror(); end
|
||||
if typeof(RIGHT_get())<>"constant" then pause; end
|
||||
|
||||
// TODO: move is a Scilab function...
|
||||
//result = move(UP_get());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ end
|
|||
if Foo_y_get(foo)<>5 then swigtesterror(); end
|
||||
|
||||
try
|
||||
Foo_f_set(foo, 5);
|
||||
Foo_f_set(foo, uint32(5));
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
|
|
@ -50,7 +50,7 @@ end
|
|||
if Foo_z_get(foo)<>13 then swigtesterror(); end
|
||||
|
||||
try
|
||||
Foo_seq_set(foo, 3);
|
||||
Foo_seq_set(foo, uint32(3));
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
smallnum = -127;
|
||||
smallnum = int8(-127);
|
||||
if CharValFunction(smallnum) <> smallnum then swigtesterror(); end
|
||||
if CCharValFunction(smallnum) <> smallnum then swigtesterror(); end
|
||||
if CCharRefFunction(smallnum) <> smallnum then swigtesterror(); end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,70 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
a = [1, 2, 3, 4]
|
||||
if arr_double(a, 4) <> 10 then swigtesterror(); end
|
||||
// bool
|
||||
a = [%T %F %F %T %F %T %T %T];
|
||||
if arr_bool(a, 8) <> 5 then swigtesterror(); end
|
||||
if typeof(arr_bool(a, 8)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// char
|
||||
a = ["charptr"]
|
||||
if arr_char(a, 7) <> 756 then swigtesterror(); end
|
||||
if typeof(arr_char(a, 7)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// signed char
|
||||
a = int8([1, 2, 3, 4]);
|
||||
if arr_schar(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_schar(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// unsigned char
|
||||
a = uint8([1, 2, 3, 4]);
|
||||
if arr_uchar(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_uchar(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// short
|
||||
a = int16([1, 2, 3, 4]);
|
||||
if arr_short(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_short(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// unsigned short
|
||||
a = uint16([1, 2, 3, 4]);
|
||||
if arr_ushort(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_ushort(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// int
|
||||
a = int32([1, 2, 3, 4]);
|
||||
if arr_int(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_int(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// unsigned int
|
||||
a = uint32([1, 2, 3, 4]);
|
||||
if arr_uint(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_uint(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// long
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_long(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_long(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// unsigned long
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_ulong(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_ulong(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// long long
|
||||
// No equivalent in Scilab 5
|
||||
|
||||
// unsigned long long
|
||||
// No equivalent in Scilab 5
|
||||
|
||||
// float
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_float(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_float(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
// double
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_double(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_double(a, 4)) <> "constant" then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ if BeginString_FIX44f_get() <> "FIX.f.f" then swigtesterror(); end
|
|||
if test_a("hello","hi","chello","chi") <> "hi" then swigtesterror(); end
|
||||
|
||||
if test_b("1234567","hi") <> "1234567" then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ exec("swigtest.start", -1);
|
|||
|
||||
a = [1, 2, 3, 4; 5, 6, 7, 8;]
|
||||
|
||||
try
|
||||
array_d_set(a);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if array_d_get() <> a then swigtesterror(); end
|
||||
//try
|
||||
// array_d_set(a);
|
||||
//catch
|
||||
// swigtesterror();
|
||||
//end
|
||||
//if array_d_get() <> a then swigtesterror(); end
|
||||
|
||||
exec("swigtest.start", -1);
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
exec("swigtest.start", -1);
|
||||
// Do nothing
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
try
|
||||
x = new_Foo();
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if Foo_test(x) <> 0 then swigtesterror(); end
|
||||
if Foo_test(x, 1) <> 1 then swigtesterror(); end
|
||||
if Foo_test(x, 2, 3) <> 5 then swigtesterror(); end
|
||||
if Foo_test(x, "Hello, swig!") <> 2 then swigtesterror(); end
|
||||
//try
|
||||
// x = new_Foo();
|
||||
//catch
|
||||
// swigtesterror();
|
||||
//end
|
||||
//if Foo_test(x) <> 0 then swigtesterror(); end
|
||||
//if Foo_test(x, 1) <> 1 then swigtesterror(); end
|
||||
//if Foo_test(x, 2, 3) <> 5 then swigtesterror(); end
|
||||
//if Foo_test(x, "Hello, swig!") <> 2 then swigtesterror(); end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,7 @@
|
|||
// Vectors
|
||||
|
||||
%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
|
||||
%fragment("StdVectorTraits","header")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class T>
|
||||
struct traits_asptr<std::vector<T> > {
|
||||
static int asptr(const octave_value& obj, std::vector<T> **vec) {
|
||||
return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_from<std::vector<T> > {
|
||||
static octave_value from(const std::vector<T>& vec) {
|
||||
return traits_from_stdseq<std::vector<T> >::from(vec);
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
|
||||
|
|
|
|||
86
Lib/scilab/scibool.swg
Normal file
86
Lib/scilab/scibool.swg
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* C-type: bool
|
||||
* Scilab type: boolean scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(bool), "header", fragment="SWIG_SciBoolean_AsBool") {
|
||||
#define SWIG_AsVal_bool(scilabValue, valuePointer) SWIG_SciBoolean_AsBool(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciBoolean_AsBool", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciBoolean_AsBool(void *_pvApiCtx, int _iVar, bool *_pbValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRet = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (!isBooleanType(_pvApiCtx, piAddrVar)) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A boolean expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (!isScalar(_pvApiCtx, piAddrVar)) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A boolean expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
iRet = getScalarBoolean(_pvApiCtx, piAddrVar, (int*)_pbValue);
|
||||
if (iRet) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(bool), "header", fragment="SWIG_SciBoolean_FromBool") {
|
||||
#define SWIG_From_bool(value) SWIG_SciBoolean_FromBool(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciBoolean_FromBool", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciBoolean_FromBool(void *_pvApiCtx, int _iVarOut, bool _bValue) {
|
||||
int iRet = 0;
|
||||
|
||||
iRet = createScalarBoolean(_pvApiCtx, Rhs + _iVarOut, _bValue);
|
||||
if (iRet) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: bool[]
|
||||
* Scilab type: boolean vector (but converted to int first because can not cast bool** to int **
|
||||
*/
|
||||
%fragment("SWIG_SciBoolean_AsIntArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciBoolean_AsIntArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, int **_piValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (isBooleanType(_pvApiCtx, piAddrVar)) {
|
||||
sciErr = getMatrixOfBoolean(_pvApiCtx, piAddrVar, _iRows, _iCols, _piValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A boolean vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
238
Lib/scilab/scichar.swg
Normal file
238
Lib/scilab/scichar.swg
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* C-type: char
|
||||
* Scilab type: string
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(char), "header", fragment="SwigScilabStringToChar") {
|
||||
#define SWIG_AsVal_char(scilabValue, valuePointer) SwigScilabStringToChar(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SwigScilabStringToChar", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringToChar(void *_pvApiCtx, int _iVar, char *_pcValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *_pstStrings = NULL;
|
||||
int _piLength = 0;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_strings) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
_pstStrings = (char *)MALLOC(sizeof(char));
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &_piLength, (char **)&_pstStrings);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_pcValue = _pstStrings[0];
|
||||
|
||||
FREE(_pstStrings);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(char), "header", fragment="SwigScilabStringFromChar") {
|
||||
#define SWIG_From_char(value) SwigScilabStringFromChar(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SwigScilabStringFromChar", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringFromChar(void *_pvApiCtx, int _iVarOut, char _chValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
char *pchValue = (char*)MALLOC(sizeof(char) * 2);
|
||||
pchValue[0] = _chValue;
|
||||
pchValue[1] = '\0';
|
||||
|
||||
sciErr = createMatrixOfString(_pvApiCtx, Rhs + _iVarOut, 1, 1, &pchValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
FREE(pchValue);
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* CHAR *
|
||||
*/
|
||||
%fragment("SWIG_AsCharArray", "header", fragment = "SwigScilabStringToCharPtr") {
|
||||
#define SWIG_AsCharArray(scilabValue, charPtrPointer, charPtrLength) SwigScilabStringToCharPtr(pvApiCtx, scilabValue, charPtrPointer, charPtrLength, fname)
|
||||
}
|
||||
%fragment("SWIG_AsCharPtrAndSize", "header", fragment = "SwigScilabStringToCharPtrAndSize") {
|
||||
#define SWIG_AsCharPtrAndSize(scilabValue, charPtrPointer, charPtrLength, allocMemory) SwigScilabStringToCharPtrAndSize(pvApiCtx, scilabValue, charPtrPointer, charPtrLength, allocMemory, fname)
|
||||
}
|
||||
%fragment("SWIG_FromCharPtr", "header", fragment = "SwigScilabStringFromCharPtr") {
|
||||
#define SWIG_FromCharPtr(charPtr) SwigScilabStringFromCharPtr(pvApiCtx, $result, charPtr)
|
||||
}
|
||||
%fragment("SWIG_FromCharPtrAndSize", "header", fragment = "SwigScilabStringFromCharPtrAndSize") {
|
||||
#define SWIG_FromCharPtrAndSize(charPtr, charPtrLength) SwigScilabStringFromCharPtrAndSize(pvApiCtx, $result, charPtr)
|
||||
}
|
||||
%fragment("SwigScilabStringToCharPtr", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringToCharPtr(void *_pvApiCtx, int _iVar, char *_pcValue, int _iLength, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iType = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *pstStrings = NULL;
|
||||
int piLength = 0;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_strings) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, NULL);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
pstStrings = (char *)MALLOC(sizeof(char) * (piLength + 1));
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, (char **)&pstStrings);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
strcpy(_pcValue, pstStrings);
|
||||
|
||||
FREE(pstStrings);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SwigScilabStringToCharPtrAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringToCharPtrAndSize(void *_pvApiCtx, int _iVar, char **_pcValue, size_t *_piLength, int *alloc, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iType = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *_pstStrings = NULL;
|
||||
int piLength = 0;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_strings) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, NULL);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
_pstStrings = (char *)MALLOC(sizeof(char) * (piLength + 1));
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, (char **)&_pstStrings);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (_pcValue != NULL) {
|
||||
*_pcValue = strdup(_pstStrings);
|
||||
}
|
||||
|
||||
FREE(_pstStrings);
|
||||
|
||||
if (_piLength != NULL) {
|
||||
*_piLength = (size_t) piLength;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SwigScilabStringFromCharPtr", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringFromCharPtr(void *_pvApiCtx, int _iVarOut, const char *_pchValue) {
|
||||
SciErr sciErr;
|
||||
char **pstData = NULL;
|
||||
|
||||
pstData = (char **)MALLOC(sizeof(char *));
|
||||
pstData[0] = strdup(_pchValue);
|
||||
|
||||
sciErr = createMatrixOfString(_pvApiCtx, Rhs + _iVarOut, 1, 1, (char **)pstData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
freeArrayOfString(pstData, 1);
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
%fragment("SwigScilabStringFromCharPtrAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringFromCharPtrAndSize(void *_pvApiCtx, int _iVarOut, const char *_pchValue) {
|
||||
SciErr sciErr;
|
||||
char **pstData = NULL;
|
||||
|
||||
pstData = (char **)MALLOC(sizeof(char *));
|
||||
pstData[0] = strdup(_pchValue);
|
||||
|
||||
sciErr = createMatrixOfString(_pvApiCtx, Rhs + _iVarOut, 1, 1, (char **)pstData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
FREE(pstData);
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
127
Lib/scilab/scidouble.swg
Normal file
127
Lib/scilab/scidouble.swg
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* DOUBLE SCALAR
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(double), "header", fragment="SwigScilabDoubleToDouble") {
|
||||
#define SWIG_AsVal_double(scilabValue, valuePointer) SwigScilabDoubleToDouble(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment(SWIG_From_frag(double), "header", fragment="SwigScilabDoubleFromDouble") {
|
||||
#define SWIG_From_double(value) SwigScilabDoubleFromDouble(pvApiCtx, $result, value)
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleToDouble", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleToDouble(void *_pvApiCtx, int _iVar, double *_pdblValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRet = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (!isDoubleType(_pvApiCtx, piAddrVar) || isVarComplex(_pvApiCtx, piAddrVar)) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (!isScalar(_pvApiCtx, piAddrVar)) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
iRet = getScalarDouble(_pvApiCtx, piAddrVar, _pdblValue);
|
||||
if (iRet) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleFromDouble", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleFromDouble(void *_pvApiCtx, int _iVarOut, double _dblValue) {
|
||||
int iRet;
|
||||
|
||||
iRet = createScalarDouble(_pvApiCtx, Rhs + _iVarOut, _dblValue);
|
||||
if (iRet) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DOUBLE ARRAY
|
||||
*/
|
||||
%fragment("SwigScilabDoubleToDoubleArray", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleToDoubleArray(void *_pvApiCtx, int _iVar, double **_pdblDoubleValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (isDoubleType(_pvApiCtx, piAddrVar) && !isVarComplex(_pvApiCtx, piAddrVar)) {
|
||||
sciErr = getMatrixOfDouble(_pvApiCtx, piAddrVar, &iRows, &iCols, _pdblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciDouble_AsDoubleArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_AsDoubleArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, double **_pdblDoubleValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
if (isDoubleType(_pvApiCtx, piAddrVar) && !isVarComplex(_pvApiCtx, piAddrVar)) {
|
||||
sciErr = getMatrixOfDouble(_pvApiCtx, piAddrVar, _iRows, _iCols, _pdblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciDouble_FromDoubleArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_FromDoubleArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, double *_pdblValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _pdblValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
40
Lib/scilab/scifloat.swg
Normal file
40
Lib/scilab/scifloat.swg
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* FLOAT SCALAR
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(float), "header", fragment="SwigScilabDoubleToFloat") {
|
||||
#define SWIG_AsVal_float(scilabValue, valuePointer) SwigScilabDoubleToFloat(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(float), "header", fragment="SwigScilabDoubleFromFloat") {
|
||||
#define SWIG_From_float(value) SwigScilabDoubleFromFloat(pvApiCtx, $result, value)
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleToFloat", "header", fragment="SwigScilabDoubleToDouble") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleToFloat(void *_pvApiCtx, int _iVar, float *_pfValue, char *_fname) {
|
||||
double dblValue = 0.0;
|
||||
if(SwigScilabDoubleToDouble(_pvApiCtx, _iVar, &dblValue, _fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_pfValue = (float) dblValue;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleFromFloat", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleFromFloat(void *_pvApiCtx, int _iVarOut, float _flValue) {
|
||||
SciErr sciErr;
|
||||
double dblDoubleValue = (double) _flValue;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
106
Lib/scilab/sciint.swg
Normal file
106
Lib/scilab/sciint.swg
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* C-type: int
|
||||
* Scilab type: double scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(int), "header", fragment="SWIG_SciDouble_AsInt") {
|
||||
#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment(SWIG_AsVal_frag(size_t), "header", fragment="SWIG_SciDouble_AsInt") {
|
||||
#define SWIG_AsVal_size_t(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, (int*)valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciDouble_AsInt", "header", fragment="SwigScilabDoubleToDouble") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_AsInt(void *_pvApiCtx, int _iVar, int *_piValue, char *_fname) {
|
||||
double dblValue = 0.0;
|
||||
if(SwigScilabDoubleToDouble(_pvApiCtx, _iVar, &dblValue, _fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_piValue = (int) dblValue;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(int), "header", fragment="SWIG_SciDouble_FromInt") {
|
||||
#define SWIG_From_int(value) SWIG_SciDouble_FromInt(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment(SWIG_From_frag(size_t), "header", fragment="SWIG_SciDouble_FromInt") {
|
||||
#define SWIG_From_size_t(value) SWIG_SciDouble_FromInt(pvApiCtx, $result, (int)value)
|
||||
}
|
||||
%fragment("SWIG_SciDouble_FromInt", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_FromInt(void *_pvApiCtx, int _iVarOut, int _iValue) {
|
||||
SciErr sciErr;
|
||||
double dblDoubleValue = (double) _iValue;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* C-type: int[ANY]
|
||||
* Scilab type: int32 vector
|
||||
*/
|
||||
%fragment("SWIG_SciInt32_AsIntArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt32_AsIntArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, int **_piValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit signed integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_INT32) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit signed integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfInteger32(_pvApiCtx, piAddrVar, _iRows, _iCols, _piValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciInt32_FromIntArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt32_FromIntArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, const int *_piData) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfInteger32(_pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _piData);
|
||||
if(sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
83
Lib/scilab/scilong.swg
Normal file
83
Lib/scilab/scilong.swg
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* C-type: long
|
||||
* Scilab type: double scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(long), "header", fragment="SwigScilabDoubleToLong") {
|
||||
#define SWIG_AsVal_long(scilabValue, valuePointer) SwigScilabDoubleToLong(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(long), "header", fragment="SwigScilabDoubleFromLong") {
|
||||
#define SWIG_From_long(value) SwigScilabDoubleFromLong(pvApiCtx, $result, value)
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: unsigned long
|
||||
* Scilab type: double scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(unsigned long), "header", fragment="SwigScilabDoubleToUnsignedLong") {
|
||||
#define SWIG_AsVal_unsigned_SS_long(scilabValue, valuePointer) SwigScilabDoubleToUnsignedLong(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(unsigned long), "header", fragment="SwigScilabDoubleFromUnsignedLong") {
|
||||
#define SWIG_From_unsigned_SS_long(value) SwigScilabDoubleFromUnsignedLong(pvApiCtx, $result, value)
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleToLong", "header", fragment="SwigScilabDoubleToDouble") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleToLong(void *_pvApiCtx, int _iVar, long *_plValue, char *_fname) {
|
||||
double dblValue = 0.0;
|
||||
if(SwigScilabDoubleToDouble(_pvApiCtx, _iVar, &dblValue, _fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_plValue = (long) dblValue;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleToUnsignedLong", "header", fragment="SwigScilabDoubleToDouble") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleToUnsignedLong(void *_pvApiCtx, int _iVar, unsigned long *_pulValue, char *_fname) {
|
||||
double dblValue = 0.0;
|
||||
if(SwigScilabDoubleToDouble(_pvApiCtx, _iVar, &dblValue, _fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_pulValue = (unsigned long) dblValue;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleFromLong", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleFromLong(void *_pvApiCtx, int _iVarOut, long _lValue) {
|
||||
SciErr sciErr;
|
||||
double dblDoubleValue = (double) _lValue;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabDoubleFromUnsignedLong", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabDoubleFromUnsignedLong(void *_pvApiCtx, int _iVarOut, unsigned long _ulValue) {
|
||||
SciErr sciErr;
|
||||
double dblDoubleValue = (double) _ulValue;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
54
Lib/scilab/scilonglong.swg
Normal file
54
Lib/scilab/scilonglong.swg
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* C-type: long
|
||||
* Scilab 5 type: NONE
|
||||
* Scilab 6 type: int64
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(long long), "header", fragment="SWIG_SciInt64_ToLongLong") {
|
||||
#define SWIG_AsVal_long_SS_long(scilabValue, valuePointer) SWIG_SciInt64_ToLongLong(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciInt64_ToLongLong", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt64_ToLongLong(void *_pvApiCtx, int _iVar, long long *_pllValue, char *_fname) {
|
||||
Scierror(999, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciInt64_ToLongLong", "int64");
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(long long), "header", fragment="SWIG_SciInt64_FromLongLong") {
|
||||
#define SWIG_From_long_SS_long(value) SWIG_SciInt64_FromLongLong(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciInt64_FromLongLong", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt64_FromLongLong(void *_pvApiCtx, int _iVarOut, long long _llValue) {
|
||||
Scierror(999, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciInt64_ToLongLong", "int64");
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: unsigned long long
|
||||
* Scilab 5 type: NONE
|
||||
* Scilab 6 type: uint64
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(unsigned long long), "header", fragment="SWIG_SciUint64_ToUnsignedLongLong") {
|
||||
#define SWIG_AsVal_unsigned_SS_long_SS_long(scilabValue, valuePointer) SWIG_SciUint64_ToUnsignedLongLong(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciUint64_ToUnsignedLongLong", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint64_ToUnsignedLongLong(void *_pvApiCtx, int _iVar, unsigned long long *_pullValue, char *_fname) {
|
||||
Scierror(999, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciUint64_ToLongLong", "uint64");
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(unsigned long long), "header", fragment="SWIG_SciUint64_FromUnsignedLongLong") {
|
||||
#define SWIG_From_unsigned_SS_long_SS_long(value) SWIG_SciUint64_FromUnsignedLongLong(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciUint64_FromUnsignedLongLong", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint64_FromUnsignedLongLong(void *_pvApiCtx, int _iVarOut, unsigned long long _llValue) {
|
||||
Scierror(999, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciUint64_ToLongLong", "uint64");
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
32
Lib/scilab/scipointer.swg
Normal file
32
Lib/scilab/scipointer.swg
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* POINTER
|
||||
*/
|
||||
%fragment("SWIG_ConvertPtr", "header") {
|
||||
#define SWIG_ConvertPtr(scilabValue, voidPointer, pointerDescriptor, flags) SwigScilabPtrToObject(pvApiCtx, scilabValue, voidPointer, pointerDescriptor, flags, fname)
|
||||
}
|
||||
|
||||
%fragment("SWIG_NewPointerObj", "header") {
|
||||
#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, $result, pointer, pointerDescriptor, flags)
|
||||
}
|
||||
|
||||
/*
|
||||
* FUNCTION POINTER
|
||||
*/
|
||||
%fragment("SWIG_ConvertFunctionPtr", "header") {
|
||||
#define SWIG_ConvertFunctionPtr(scilabValue, voidPointer, pointerDescriptor) SwigScilabPtrToObject(pvApiCtx, scilabValue, voidPointer, pointerDescriptor, 0, fname)
|
||||
}
|
||||
|
||||
%fragment("SWIG_NewFunctionPtrObj", "header") {
|
||||
#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, $result, pointer, pointerDescriptor, 0)
|
||||
}
|
||||
// No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg
|
||||
|
||||
/*
|
||||
* C++ member pointers, ie, member methods
|
||||
*/
|
||||
%fragment("SWIG_NewMemberObj", "header") {
|
||||
#define SWIG_NewMemberObj(ptr, sz, tp) SWIG_Scilab_NewMemberObj(pvApiCtx, $result, ptr, sz, tp)
|
||||
}
|
||||
%fragment("SWIG_ConvertMember", "header") {
|
||||
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Scilab_ConvertPacked(pvApiCtx, obj, ptr, sz, ty, fname)
|
||||
}
|
||||
|
|
@ -1,183 +1,75 @@
|
|||
%fragment("SWIG_AsCharPtrAndSize","header") {
|
||||
%include <scidouble.swg>
|
||||
%include <scilong.swg>
|
||||
%include <scifloat.swg>
|
||||
|
||||
%include <scilonglong.swg>
|
||||
|
||||
%include <sciint.swg>
|
||||
%include <sciunsignedint.swg>
|
||||
|
||||
%include <scishort.swg>
|
||||
%include <sciunsignedshort.swg>
|
||||
|
||||
%include <scichar.swg>
|
||||
%include <scisignedchar.swg>
|
||||
%include <sciunsignedchar.swg>
|
||||
|
||||
%include <scipointer.swg>
|
||||
%include <scibool.swg>
|
||||
|
||||
%fragment("SwigScilabInt32ToEnum", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsCharPtrAndSize(int iPos, char** cptr, size_t* psize, int *alloc)
|
||||
{
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *_pstStrings = NULL;
|
||||
int _piLength = 0;
|
||||
int iCols = 0;
|
||||
int iRows = 0;
|
||||
SwigScilabInt32ToEnum(void *_pvApiCtx, int _iVar, int *_enumValue, char* _fname) {
|
||||
SciErr sciErr;
|
||||
int iPrec = 0;
|
||||
int iRows = 1;
|
||||
int iCols = 1;
|
||||
int *piAddrVar = NULL;
|
||||
int *piData = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, iPos, &piAddrVar);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr || iType != sci_strings)
|
||||
{
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), "SWIG_AsCharPtrAndSize", iPos);
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &_piLength, NULL);
|
||||
if (sciErr.iErr || iRows * iCols != 1)
|
||||
{
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), "SWIG_AsCharPtrAndSize", iPos);
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
_pstStrings = (char *)malloc(sizeof(char) * _piLength + 1);
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &_piLength, (char**)&_pstStrings);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (cptr)
|
||||
{
|
||||
*cptr = _pstStrings;
|
||||
}
|
||||
if (psize)
|
||||
{
|
||||
*psize = _piLength + 1;
|
||||
}
|
||||
if (alloc)
|
||||
{
|
||||
*alloc = SWIG_OLDOBJ;
|
||||
}
|
||||
return SWIG_OK;
|
||||
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_FromCharPtrAndSize","header") {
|
||||
SWIGINTERNINLINE int
|
||||
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
||||
{
|
||||
SciErr sciErr;
|
||||
int iVarOut = Rhs + 1; // TODO is this always true?
|
||||
sciErr = createMatrixOfString(pvApiCtx, iVarOut, 1, 1, (char **)&carray);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_AsVal_frag(long),"header") {
|
||||
SWIGINTERN int SWIG_AsVal_dec(long)(int iPos, long* val)
|
||||
{
|
||||
SciErr sciErr;
|
||||
int iRows = 1;
|
||||
int iCols = 1;
|
||||
int iType = 0;
|
||||
int* piAddrVar = NULL;
|
||||
double* piData = NULL;
|
||||
double v = 0.0;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, iPos, &piAddrVar);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if (iType != sci_matrix)
|
||||
{
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
if (isVarComplex(pvApiCtx, piAddrVar))
|
||||
{
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, (double **)&piData);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
if (iRows * iCols != 1)
|
||||
{
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
v = piData[0];
|
||||
if (v != floor(v))
|
||||
{
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
if (val != NULL)
|
||||
{
|
||||
*val = (long) piData[0];
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(long),"header") {
|
||||
SWIGINTERNINLINE int SWIG_From_dec(long) (long value)
|
||||
{
|
||||
double dblValue = (double) value;
|
||||
if (createScalarDouble(pvApiCtx, Rhs + 1, dblValue) == 0)
|
||||
{
|
||||
return SWIG_OK;
|
||||
}
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*%fragment(SWIG_AsPtr_frag(std::string),"header") {
|
||||
sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_INT32) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfInteger32(pvApiCtx, piAddrVar, &iRows, &iCols, &piData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*_enumValue = (int)piData[0];
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SwigScilabInt32FromEnum", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_AsPtr_std_string(int iPos, std::string **val)
|
||||
{
|
||||
char* buf = 0;
|
||||
size_t size = 0;
|
||||
int alloc = SWIG_OLDOBJ;
|
||||
SwigScilabInt32FromEnum(void *_pvApiCtx, int _iVarOut, int _enumValue) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfInteger32(pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &_enumValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
LhsVar(_iVarOut) = Rhs + _iVarOut;
|
||||
|
||||
return SWIG_OK;
|
||||
|
||||
if (SWIG_IsOK((SWIG_AsCharPtrAndSize(iPos, &buf, &size, &alloc))))
|
||||
{
|
||||
if (buf)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
*val = new std::string(buf, size - 1);
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ)
|
||||
{
|
||||
delete[] buf;
|
||||
}
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
*val = 0;
|
||||
}
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,81 +1,178 @@
|
|||
%insert(runtime) "swigrun.swg";
|
||||
%insert(runtime) "swigerrors.swg";
|
||||
|
||||
// Error message will be displayed inside Scilab fragment functions
|
||||
// and the following line Will not work because code is not an int
|
||||
//#define SWIG_Error(code, msg) Scierror(code, _("%s\n"), msg);
|
||||
|
||||
%insert(runtime) %{
|
||||
/* Scilab standard headers */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stack-c.h"
|
||||
#include "MALLOC.h"
|
||||
|
||||
/* Typedefs for integers mapping */
|
||||
typedef short SCI_INT16_FROM_SHORT;
|
||||
typedef signed short SCI_INT16_FROM_SIGNED_SHORT;
|
||||
typedef int SCI_INT32_FROM_INT;
|
||||
typedef long SCI_INT32_FROM_LONG;
|
||||
typedef signed int SCI_INT32_FROM_SIGNED_INT;
|
||||
typedef signed long SCI_INT32_FROM_SIGNED_LONG;
|
||||
|
||||
void SWIG_Error(int code, const char *msg)
|
||||
{
|
||||
Scierror(code, _("%s\n"), msg);
|
||||
}
|
||||
#include "sciprint.h"
|
||||
#include "Scierror.h"
|
||||
#include "api_scilab.h"
|
||||
#include "localization.h"
|
||||
#include "freeArrayOfString.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(999, msg); } else
|
||||
#define SWIG_fail return 0
|
||||
#undef Max
|
||||
#undef Min
|
||||
|
||||
#define SWIG_ConvertPtr(obj, vptr, descriptor, flags) SWIG_Scilab_ConvertPtr(pvApiCtx, obj, vptr, descriptor, flags)
|
||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Scilab_NewPointerObj(pvApiCtx, iVarOut, ptr, type, flags)
|
||||
#define SWIG_fail return SWIG_ERROR;
|
||||
#define SWIG_Error return SWIG_ERROR;
|
||||
|
||||
/* Convert a pointer value */
|
||||
SWIGRUNTIMEINLINE int
|
||||
SWIG_Scilab_ConvertPtr(StrCtx* pvApiCtx, int obj, void **ptr, swig_type_info* descriptor, int flags) {
|
||||
SciErr sciErr;
|
||||
int* piAddrVar = NULL;
|
||||
int iType = 0;
|
||||
void *_piData = NULL;
|
||||
/* Used for C++ enums */
|
||||
#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
SWIGINTERN int
|
||||
SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_info *_descriptor, int _flags, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_pointer)
|
||||
{
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: Pointer expected.\n"), "SWIG_Scilab_ConvertPtr", obj);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getPointer(pvApiCtx, piAddrVar, ptr);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
return SWIG_OK;
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_pointer) {
|
||||
//Scierror(999, _("%s: Wrong type for input argument #%d: A pointer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getPointer(_pvApiCtx, piAddrVar, _pObjValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/* Create a new pointer object */
|
||||
SWIGRUNTIMEINLINE int
|
||||
SWIG_Scilab_NewPointerObj(StrCtx* pvApiCtx, int iVarOut, void *ptr, swig_type_info *type, int flags) {
|
||||
SciErr sciErr;
|
||||
sciErr = createPointer(pvApiCtx, iVarOut, (void *)ptr);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
return iVarOut;
|
||||
SwigScilabPtrFromObject(void *_pvApiCtx, int _iVarOut, void *_object, swig_type_info *_descriptor, int _flags) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createPointer(pvApiCtx, Rhs + _iVarOut, (void *)_object);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Scilab_ConvertPacked(void *_pvApiCtx, int _iVar, void *_ptr, int sz, swig_type_info *ty, char *_fname) {
|
||||
swig_cast_info *tc;
|
||||
|
||||
SciErr sciErr;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iType = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *pstStrings = NULL;
|
||||
int piLength = 0;
|
||||
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_strings) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, NULL);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
pstStrings = (char *)MALLOC(sizeof(char) * (piLength + 1));
|
||||
sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &piLength, (char **)&pstStrings);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
/* Pointer values must start with leading underscore */
|
||||
if (*pstStrings != '_') {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
pstStrings++;
|
||||
pstStrings = (char*)SWIG_UnpackData(pstStrings, _ptr, sz);
|
||||
if (ty) {
|
||||
tc = SWIG_TypeCheck(pstStrings, ty);
|
||||
if (!tc) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
FREE(pstStrings);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Scilab_NewMemberObj(void *_pvApiCtx, int _iVarOut, void *_ptr, int _sz, swig_type_info *_type) {
|
||||
char result[1024];
|
||||
char *r = result;
|
||||
|
||||
SciErr sciErr;
|
||||
char **pstData = NULL;
|
||||
if ((2*_sz + 1 + strlen(_type->name)) > 1000) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*(r++) = '_';
|
||||
r = SWIG_PackData(r, _ptr, _sz);
|
||||
strcpy(r, _type->name);
|
||||
|
||||
pstData = (char **)MALLOC(sizeof(char *));
|
||||
pstData[0] = strdup(r);
|
||||
|
||||
sciErr = createMatrixOfString(_pvApiCtx, Rhs + _iVarOut, 1, 1, (char **)pstData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
freeArrayOfString(pstData, 1);
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
|
||||
#define SwigScilabSetOutput(outputNumber, outputPosition)\
|
||||
{\
|
||||
/* Create a temporary variable to avoid calling function given as outputPosition two times */\
|
||||
int stackPosition = outputPosition;\
|
||||
if (stackPosition < 0) {\
|
||||
return SWIG_ERROR;\
|
||||
}\
|
||||
LhsVar(outputNumber) = stackPosition;\
|
||||
return SWIG_OK; \
|
||||
}
|
||||
|
||||
#define SwigScilabRaise(OBJ, TYPE, DESC) Scierror(999, "C++ side threw an exception of type %s.\n", TYPE)
|
||||
%}
|
||||
|
|
|
|||
97
Lib/scilab/scishort.swg
Normal file
97
Lib/scilab/scishort.swg
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* C-type: short
|
||||
* Scilab type: double scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(short), "header", fragment="SWIG_SciDouble_AsShort") {
|
||||
#define SWIG_AsVal_short(scilabValue, valuePointer) SWIG_SciDouble_AsShort(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciDouble_AsShort", "header", fragment="SWIG_SciDouble_AsInt") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_AsShort(void *_pvApiCtx, int _iVar, short *_pshValue, char *_fname) {
|
||||
int iValue = 0.0;
|
||||
if(SWIG_SciDouble_AsInt(_pvApiCtx, _iVar, &iValue, _fname) != SWIG_OK) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
*_pshValue = (short) iValue;
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(short), "header", fragment="SWIG_SciDouble_FromShort") {
|
||||
#define SWIG_From_short(value) SWIG_SciDouble_FromShort(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciDouble_FromShort", "header", fragment="SWIG_SciDouble_FromInt") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_FromShort(void *_pvApiCtx, int _iVarOut, short _shValue) {
|
||||
int iValue = (int) _shValue;
|
||||
return SWIG_SciDouble_FromInt(pvApiCtx, _iVarOut, iValue);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: short[]
|
||||
* Scilab type: int16 vector
|
||||
* See in scitypemaps.swg
|
||||
*/
|
||||
/*
|
||||
* C-type: short[ANY]
|
||||
* Scilab type: int16 vector
|
||||
*/
|
||||
%fragment("SWIG_SciInt16_AsShortArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt16_AsShortArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, short **_psValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_INT16) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfInteger16(_pvApiCtx, piAddrVar, _iRows, _iCols, _psValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciInt16_FromShortArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt16_FromShortArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, short *_psValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfInteger16(_pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _psValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
141
Lib/scilab/scisignedchar.swg
Normal file
141
Lib/scilab/scisignedchar.swg
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* C-type: signed char
|
||||
* Scilab type: int8 scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(signed char), "header", fragment="SwigScilabInt8ToSignedChar") {
|
||||
#define SWIG_AsVal_signed_SS_char(scilabValue, valuePointer) SwigScilabInt8ToSignedChar(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SwigScilabInt8ToSignedChar", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabInt8ToSignedChar(void *_pvApiCtx, int _iVar, signed char *_pscValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
char *pcData = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_INT8) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfInteger8(_pvApiCtx, piAddrVar, &iRows, &iCols, &pcData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A 8-bit integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*_pscValue = *pcData;
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(signed char), "header", fragment="SwigScilabInt8FromSignedChar") {
|
||||
#define SWIG_From_signed_SS_char(value) SwigScilabInt8FromSignedChar(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SwigScilabInt8FromSignedChar", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabInt8FromSignedChar(void *_pvApiCtx, int _iVarOut, signed char _scValue) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfInteger8(pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, (char *)&_scValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: signed char[]
|
||||
* Scilab type: int8 vector
|
||||
*/
|
||||
%fragment("SWIG_SciInt8_AsSignedCharArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt8_AsSignedCharArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, signed char **_pscValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_INT8) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfInteger8(_pvApiCtx, piAddrVar, _iRows, _iCols, (char **)_pscValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciInt8_FromSignedCharArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt8_FromSignedCharArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, const signed char *_pscValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfInteger8(pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, (const char *)_pscValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
141
Lib/scilab/sciunsignedchar.swg
Normal file
141
Lib/scilab/sciunsignedchar.swg
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* C-type: unsigned char
|
||||
* Scilab type: uint8 scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(unsigned char), "header", fragment="SWIG_SciUint8_AsUnsignedChar") {
|
||||
#define SWIG_AsVal_unsigned_SS_char(scilabValue, valuePointer) SWIG_SciUint8_AsUnsignedChar(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciUint8_AsUnsignedChar", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint8_AsUnsignedChar(void *_pvApiCtx, int _iVar, unsigned char *_pucValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
unsigned char *pucData = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT8) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger8(_pvApiCtx, piAddrVar, &iRows, &iCols, &pucData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A 8-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*_pucValue = *pucData;
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(unsigned char), "header", fragment="SWIG_SciUint8_FromUnsignedChar") {
|
||||
#define SWIG_From_unsigned_SS_char(value) SWIG_SciUint8_FromUnsignedChar(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciUint8_FromUnsignedChar", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint8_FromUnsignedChar(void *_pvApiCtx, int _iVarOut, unsigned char _ucValue) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &_ucValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: unsigned char[]
|
||||
* Scilab type: uint8 vector
|
||||
*/
|
||||
%fragment("SWIG_SciUint8_AsUnsignedCharArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint8_AsUnsignedCharArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, unsigned char **_pucValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT8) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger8(_pvApiCtx, piAddrVar, _iRows, _iCols, _pucValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciUint8_FromUnsignedCharArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint8_FromUnsignedCharArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, const unsigned char *_puscValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _puscValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
141
Lib/scilab/sciunsignedint.swg
Normal file
141
Lib/scilab/sciunsignedint.swg
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* C-type: unsigned int
|
||||
* Scilab type: uint32 scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(unsigned int), "header", fragment="SwigScilabUint32ToUnsignedInt") {
|
||||
#define SWIG_AsVal_unsigned_SS_int(scilabValue, valuePointer) SwigScilabUint32ToUnsignedInt(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SwigScilabUint32ToUnsignedInt", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabUint32ToUnsignedInt(void *_pvApiCtx, int _iVar, unsigned int *_puiValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
unsigned int *puiData = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT32) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger32(_pvApiCtx, piAddrVar, &iRows, &iCols, &puiData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A 32-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*_puiValue = *puiData;
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment(SWIG_From_frag(unsigned int), "header", fragment="SwigScilabUint32FromUnsignedInt") {
|
||||
#define SWIG_From_unsigned_SS_int(value) SwigScilabUint32FromUnsignedInt(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SwigScilabUint32FromUnsignedInt", "header") {
|
||||
SWIGINTERN int
|
||||
SwigScilabUint32FromUnsignedInt(void *_pvApiCtx, int _iVarOut, unsigned int _uiValue) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger32(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &_uiValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: unsigned int[]
|
||||
* Scilab type: uint32 vector
|
||||
*/
|
||||
%fragment("SWIG_SciUint32_AsUnsignedIntArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint32_AsUnsignedIntArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, unsigned int **_puiValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT32) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger32(_pvApiCtx, piAddrVar, _iRows, _iCols, _puiValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciUint32_FromUnsignedIntArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint32_FromUnsignedIntArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, unsigned int *_puiValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger32(_pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _puiValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
141
Lib/scilab/sciunsignedshort.swg
Normal file
141
Lib/scilab/sciunsignedshort.swg
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* C-type: unsigned short
|
||||
* Scilab type: uint16 scalar
|
||||
*/
|
||||
%fragment(SWIG_AsVal_frag(unsigned short), "header", fragment="SWIG_SciUint16_AsUnsignedShort") {
|
||||
#define SWIG_AsVal_unsigned_SS_short(scilabValue, valuePointer) SWIG_SciUint16_AsUnsignedShort(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
}
|
||||
%fragment("SWIG_SciUint16_AsUnsignedShort", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint16_AsUnsignedShort(void *_pvApiCtx, int _iVar, unsigned short *_pusValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iRows = 0;
|
||||
int iCols = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
unsigned short *pusData = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT16) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger16(_pvApiCtx, piAddrVar, &iRows, &iCols, &pusData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A 32-bit unsigned integer expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
*_pusValue = *pusData;
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(unsigned short), "header", fragment="SWIG_SciUint16_FromUnsignedShort") {
|
||||
#define SWIG_From_unsigned_SS_short(value) SWIG_SciUint16_FromUnsignedShort(pvApiCtx, $result, value)
|
||||
}
|
||||
%fragment("SWIG_SciUint16_FromUnsignedShort", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint16_FromUnsignedShort(void *_pvApiCtx, int _iVarOut, unsigned short _usValue) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger16(_pvApiCtx, Rhs + _iVarOut, iRowsOut, iColsOut, &_usValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C-type: unsigned short[]
|
||||
* Scilab type: uint16 vector
|
||||
*/
|
||||
%fragment("SWIG_SciUint16_AsUnsignedShortArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint16_AsUnsignedShortArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, unsigned short **_pusValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iType = 0;
|
||||
int iPrec = 0;
|
||||
int *piAddrVar = NULL;
|
||||
|
||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getVarType(_pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iType != sci_ints) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if (iPrec != SCI_UINT16) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer vector expected.\n"), _fname, _iVar);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfUnsignedInteger16(_pvApiCtx, piAddrVar, _iRows, _iCols, _pusValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
%fragment("SWIG_SciUint16_FromUnsignedShortArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint16_FromUnsignedShortArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, unsigned short *_pusValue) {
|
||||
SciErr sciErr;
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger16(_pvApiCtx, Rhs + _iVarOut, _iRows, _iCols, _pusValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return Rhs + _iVarOut;
|
||||
}
|
||||
}
|
||||
2
Lib/scilab/std_alloc.i
Normal file
2
Lib/scilab/std_alloc.i
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
%include <std/std_alloc.i>
|
||||
|
||||
2
Lib/scilab/std_common.i
Normal file
2
Lib/scilab/std_common.i
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
%include <std/std_common.i>
|
||||
|
||||
2
Lib/scilab/std_container.i
Normal file
2
Lib/scilab/std_container.i
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
%include <std/std_container.i>
|
||||
|
||||
|
|
@ -1 +1,47 @@
|
|||
/*
|
||||
* POINTER
|
||||
*/
|
||||
|
||||
%fragment(SWIG_AsPtr_frag(std::string), "header", fragment="SwigScilabStringToString") {
|
||||
#define SWIG_AsPtr_std_string(scilabValue, stringPointer) SwigScilabStringToString(pvApiCtx, scilabValue, stringPointer, fname)
|
||||
}
|
||||
%fragment(SWIG_From_frag(std::string), "header", fragment="SwigScilabStringFromString") {
|
||||
#define SWIG_From_std_string(stringPointer) SwigScilabStringFromString(pvApiCtx, $result, stringPointer)
|
||||
}
|
||||
|
||||
%fragment("SwigScilabStringToString", "header", fragment="SwigScilabStringToCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringToString(void *_pvApiCtx, int _iVar, std::string **_pstValue, char *_fname) {
|
||||
char* buf = 0;
|
||||
size_t size = 0;
|
||||
int alloc = SWIG_OLDOBJ;
|
||||
|
||||
if (SWIG_IsOK((SwigScilabStringToCharPtrAndSize(_pvApiCtx, _iVar, &buf, &size, &alloc, _fname)))) {
|
||||
if (buf) {
|
||||
if (_pstValue) {
|
||||
*_pstValue = new std::string(buf, size);
|
||||
}
|
||||
if (alloc == SWIG_NEWOBJ) {
|
||||
delete[] buf;
|
||||
}
|
||||
return SWIG_NEWOBJ;
|
||||
} else {
|
||||
if (_pstValue) {
|
||||
*_pstValue = NULL;
|
||||
}
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SwigScilabStringFromString", "header", fragment="SwigScilabStringFromCharPtrAndSize") {
|
||||
SWIGINTERN int
|
||||
SwigScilabStringFromString(void *_pvApiCtx, int _iVarOut, std::string _pstValue) {
|
||||
return SwigScilabStringFromCharPtrAndSize(_pvApiCtx, _iVarOut, _pstValue.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
%include <typemaps/std_string.swg>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
%fragment("StdVectorTraits","header")
|
||||
%{
|
||||
%}
|
||||
%fragment(SWIG_AsVal_frag(std::vector< int >), "header") {
|
||||
#define SWIG_AsPtr_std_vector(scilabValue, stringPointer) SwigScilabStringToString(pvApiCtx, scilabValue, stringPointer, fname)
|
||||
}
|
||||
|
||||
#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
|
||||
#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type);
|
||||
//#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
|
||||
//#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type);
|
||||
|
||||
|
||||
|
||||
%include <std/std_vector.i>
|
||||
%include <std/std_vector.i>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ you would use a real value instead.
|
|||
bool *INPUT
|
||||
float *INPUT
|
||||
double *INPUT
|
||||
|
||||
|
||||
To use these, suppose you had a C function like this :
|
||||
|
||||
double fadd(double *a, double *b) {
|
||||
|
|
@ -38,7 +38,7 @@ To use these, suppose you had a C function like this :
|
|||
}
|
||||
|
||||
You could wrap it with SWIG as follows :
|
||||
|
||||
|
||||
%include typemaps.i
|
||||
double fadd(double *INPUT, double *INPUT);
|
||||
|
||||
|
|
@ -49,44 +49,31 @@ or you can use the %apply directive :
|
|||
double fadd(double *a, double *b);
|
||||
|
||||
*/
|
||||
|
||||
%typemap(in) signed char *INPUT (int *piAddrVar, int iRows, int iCols, signed char temp),
|
||||
unsigned char *INPUT (int *piAddrVar, int iRows, int iCols, unsigned char temp),
|
||||
short *INPUT (int *piAddrVar, int iRows, int iCols, short temp),
|
||||
unsigned short *INPUT (int *piAddrVar, int iRows, int iCols, unsigned short temp),
|
||||
int *INPUT (int *piAddrVar, int iRows, int iCols, int temp),
|
||||
unsigned int *INPUT (int *piAddrVar, int iRows, int iCols, unsigned int temp),
|
||||
long *INPUT (int *piAddrVar, int iRows, int iCols, long temp),
|
||||
unsigned long *INPUT (int *piAddrVar, int iRows, int iCols, unsigned long temp),
|
||||
float *INPUT (int *piAddrVar, int iRows, int iCols, float temp),
|
||||
double *INPUT (int *piAddrVar, int iRows, int iCols, double temp) {
|
||||
int iType;
|
||||
double *_piData;
|
||||
int typearg;
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, $input, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsInt") int *INPUT(int temp), int &INPUT(int temp) {
|
||||
if (SWIG_SciDouble_AsInt(pvApiCtx, $input, &temp, fname) != SWIG_OK) {
|
||||
SWIG_fail;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr || iType != sci_matrix) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, $argnum);
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &_piData);
|
||||
if (sciErr.iErr || iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, $argnum);
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
temp = ($*1_ltype)*_piData;
|
||||
$1 = &temp;
|
||||
}
|
||||
#undef INPUT_TYPEMAP
|
||||
|
||||
//short *INPUT
|
||||
//long *INPUT
|
||||
//long long *INPUT
|
||||
//unsigned int *INPUT
|
||||
//unsigned short *INPUT
|
||||
//unsigned long *INPUT
|
||||
//unsigned long long *INPUT
|
||||
//unsigned char *INPUT
|
||||
//bool *INPUT
|
||||
//float *INPUT
|
||||
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDouble") double *INPUT(double temp), double &INPUT(double temp) {
|
||||
if (SWIG_SciDouble_AsDouble(pvApiCtx, $input, &temp, fname) != SWIG_OK) {
|
||||
SWIG_fail;
|
||||
}
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// OUTPUT typemaps. These typemaps are used for parameters that
|
||||
// are output only. The output value is appended to the result as
|
||||
// a list element.
|
||||
|
|
@ -95,7 +82,7 @@ or you can use the %apply directive :
|
|||
The following methods can be applied to turn a pointer into an "output"
|
||||
value. When calling a function, no input value would be given for
|
||||
a parameter, but an output value would be returned. In the case of
|
||||
multiple output values, functions will return a Perl array.
|
||||
multiple output values, functions will return a Scilab array.
|
||||
|
||||
int *OUTPUT
|
||||
short *OUTPUT
|
||||
|
|
@ -109,7 +96,7 @@ multiple output values, functions will return a Perl array.
|
|||
bool *OUTPUT
|
||||
float *OUTPUT
|
||||
double *OUTPUT
|
||||
|
||||
|
||||
For example, suppose you were trying to wrap the modf() function in the
|
||||
C math library which splits x into integral and fractional parts (and
|
||||
returns the integer part in one of its parameters).:
|
||||
|
|
@ -127,84 +114,29 @@ or you can use the %apply directive :
|
|||
%apply double *OUTPUT { double *ip };
|
||||
double modf(double x, double *ip);
|
||||
|
||||
The Perl output of the function would be an array containing both
|
||||
output values.
|
||||
The Scilab output of the function would be an array containing both
|
||||
output values.
|
||||
|
||||
*/
|
||||
|
||||
// Force the argument to be ignored.
|
||||
|
||||
%typemap(in,numinputs=0) signed char *OUTPUT (signed temp),
|
||||
unsigned char *OUTPUT (unsigned temp),
|
||||
short *OUTPUT (short temp),
|
||||
unsigned short *OUTPUT (unsigned short temp),
|
||||
int *OUTPUT (int temp),
|
||||
unsigned int *OUTPUT (unsigned int temp),
|
||||
long *OUTPUT (long temp),
|
||||
unsigned long *OUTPUT (unsigned long temp),
|
||||
float *OUTPUT (float temp),
|
||||
double *OUTPUT (double temp) {
|
||||
$1 = ($1_ltype)&temp;
|
||||
%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromInt") int *OUTPUT, int &OUTPUT {
|
||||
SwigScilabSetOutput($result, SWIG_SciDouble_FromInt(pvApiCtx, $result, *$1));
|
||||
}
|
||||
|
||||
%typemap(argout) signed char *OUTPUT(int iRowsOut, int iColsOut) {
|
||||
iRowsOut = 1;
|
||||
iColsOut = 1;
|
||||
sciErr = createMatrixOfInteger8(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
//short *OUTPUT
|
||||
//long *OUTPUT
|
||||
//long long *OUTPUT
|
||||
//unsigned int *OUTPUT
|
||||
//unsigned short *OUTPUT
|
||||
//unsigned long *OUTPUT
|
||||
//unsigned long long *OUTPUT
|
||||
//unsigned char *OUTPUT
|
||||
//bool *OUTPUT
|
||||
//float *OUTPUT
|
||||
//double *OUTPUT
|
||||
%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromDouble") double *OUTPUT, double &OUTPUT {
|
||||
SwigScilabSetOutput($result, SWIG_SciDouble_FromDouble(pvApiCtx, $result, *$1));
|
||||
}
|
||||
|
||||
%typemap(argout) short *OUTPUT(int iRowsOut, int iColsOut),
|
||||
unsigned char *OUTPUT(int iRowsOut, int iColsOut) {
|
||||
iRowsOut = 1;
|
||||
iColsOut = 1;
|
||||
sciErr = createMatrixOfInteger16(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
%typemap(argout) int *OUTPUT(int iRowsOut,int iColsOut),
|
||||
unsigned int *OUTPUT(int iRowsOut,int iColsOut),
|
||||
unsigned short *OUTPUT(int iRowsOut,int iColsOut),
|
||||
unsigned long *OUTPUT(int iRowsOut,int iColsOut),
|
||||
long *OUTPUT(int iRowsOut,int iColsOut) {
|
||||
iRowsOut=1;
|
||||
iColsOut=1;
|
||||
sciErr = createMatrixOfInteger32(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
|
||||
%typemap(argout) double *OUTPUT(int iRowsOut, int iColsOut),
|
||||
float *OUTPUT(int iRowsOut, int iColsOut) {
|
||||
double temp;
|
||||
temp = (double)(*$result);
|
||||
iRowsOut = 1;
|
||||
iColsOut = 1;
|
||||
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
|
||||
// INOUT
|
||||
// Mappings for an argument that is both an input and output
|
||||
// parameter
|
||||
|
|
@ -213,7 +145,7 @@ output values.
|
|||
The following methods can be applied to make a function parameter both
|
||||
an input and output value. This combines the behavior of both the
|
||||
"INPUT" and "OUTPUT" methods described earlier. Output values are
|
||||
returned in the form of a Perl array.
|
||||
returned in the form of a Scilab array.
|
||||
|
||||
int *INOUT
|
||||
short *INOUT
|
||||
|
|
@ -227,7 +159,7 @@ returned in the form of a Perl array.
|
|||
bool *INOUT
|
||||
float *INOUT
|
||||
double *INOUT
|
||||
|
||||
|
||||
For example, suppose you were trying to wrap the following function :
|
||||
|
||||
void neg(double *x) {
|
||||
|
|
@ -247,7 +179,7 @@ or you can use the %apply directive :
|
|||
|
||||
Unlike C, this mapping does not directly modify the input value.
|
||||
Rather, the modified input value shows up as the return value of the
|
||||
function. Thus, to apply this function to a Perl variable you might
|
||||
function. Thus, to apply this function to a Scilab variable you might
|
||||
do this :
|
||||
|
||||
$x = neg($x);
|
||||
|
|
@ -275,6 +207,3 @@ do this :
|
|||
%typemap(in) signed char *INOUT = signed char *OUTPUT;
|
||||
%typemap(in) float *INOUT = float *OUTPUT;
|
||||
%typemap(in) double *INOUT = double *OUTPUT;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue