fix some issue and two test-suit:simple_array, li_math
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11503 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b81ec23048
commit
756f2645ce
17 changed files with 223 additions and 83 deletions
|
|
@ -24,4 +24,8 @@
|
||||||
%constant int iconst = 37;
|
%constant int iconst = 37;
|
||||||
%constant double fconst = 3.14;
|
%constant double fconst = 3.14;
|
||||||
|
|
||||||
|
void constant_test(const int x) {
|
||||||
|
printf("%i", x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,28 @@
|
||||||
|
// loader the *.so
|
||||||
|
exec loader.sce;
|
||||||
exec example.sce;
|
exec example.sce;
|
||||||
|
|
||||||
printf("ICONST = %i (should be 42)\n", example.ICONST);
|
printf("ICONST = %i (should be 42)\n", ICONST);
|
||||||
printf("FCONST = %f (should be 2.1828)\n",example. FCONST);
|
printf("FCONST = %f (should be 2.1828)\n", FCONST);
|
||||||
printf("CCONST = %c (should be ''x'')\n", example.CCONST);
|
printf("CCONST = %c (should be ''x'')\n", CCONST);
|
||||||
printf("CCONST2 = %s (this should be on a new line)\n", example.CCONST2);
|
printf("CCONST2 = %s (this should be on a new line)\n", CCONST2);
|
||||||
printf("SCONST = %s (should be ''Hello World'')\n", example.SCONST);
|
printf("SCONST = %s (should be ''Hello World'')\n", SCONST);
|
||||||
printf("SCONST2 = %s (should be "'""Hello World"""')\n", example.SCONST2);
|
printf("SCONST2 = %s (should be "'""Hello World"""')\n", SCONST2);
|
||||||
printf("EXPR = %f (should be 48.5484)\n",example.EXPR);
|
printf("EXPR = %f (should be 48.5484)\n", EXPR);
|
||||||
printf("iconst = %i (should be 37)\n", example.iconst);
|
printf("iconst = %i (should be 37)\n", iconst);
|
||||||
printf("fconst = %f (should be 3.14)\n", example.fconst);
|
printf("fconst = %f (should be 3.14)\n", fconst);
|
||||||
|
|
||||||
try
|
try
|
||||||
printf("EXTERN = %s (Arg! This should not printf(anything)\n", example.EXTERN);
|
printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN);
|
||||||
catch
|
catch
|
||||||
printf("EXTERN is not defined (good)\n");
|
printf("EXTERN is not defined (good)\n");
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
printf("FOO = %i (Arg! This should not printf(anything)\n", example.FOO);
|
printf("FOO = %i (Arg! This should not printf(anything)\n", FOO);
|
||||||
catch
|
catch
|
||||||
printf("FOO is not defined (good)\n");
|
printf("FOO is not defined (good)\n");
|
||||||
end
|
end
|
||||||
|
|
||||||
|
constant_test(iconst);
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce;
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
|
|
||||||
|
|
@ -13,7 +10,7 @@ printf("The gcd of %d and %d is %d\n",x,y,g);
|
||||||
// Call our fact() function
|
// Call our fact() function
|
||||||
x=5;
|
x=5;
|
||||||
g=fact(x);
|
g=fact(x);
|
||||||
printf("The fact of %d is %d",x,g);
|
printf("The fact of %d is %d\n",x,g);
|
||||||
|
|
||||||
// Manipulate the Foo global variable
|
// Manipulate the Foo global variable
|
||||||
|
|
||||||
|
|
@ -26,12 +23,6 @@ Foo_set (3.1415926);
|
||||||
// See if the change took effect
|
// See if the change took effect
|
||||||
printf("Foo = %f\n", Foo_get());
|
printf("Foo = %f\n", Foo_get());
|
||||||
|
|
||||||
//Call our gcd() function to test the contract conditon
|
|
||||||
x=-42;
|
|
||||||
y=105;
|
|
||||||
g=gcd(x,y);
|
|
||||||
printf("The gcd of %d and %d is %d\n",x,y,g);
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce;
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce;
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce;
|
|
||||||
|
|
||||||
// loader the *.so
|
// loader the *.so
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
|
|
||||||
|
|
@ -20,7 +17,7 @@ Foo_get()
|
||||||
Foo_set(3.1415926)
|
Foo_set(3.1415926)
|
||||||
|
|
||||||
// See if the change took effect
|
// See if the change took effect
|
||||||
Foo_get()
|
if Foo_get() <> 3.1415926 then pause,end
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce
|
|
||||||
|
|
||||||
//loader the *.so
|
//loader the *.so
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
// builder the *.so
|
|
||||||
exec example_builder.sce
|
|
||||||
|
|
||||||
//loader the *.so
|
//loader the *.so
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ include $(srcdir)/../common.mk
|
||||||
# a file is found which has _runme.sci appended after the testcase name.
|
# a file is found which has _runme.sci appended after the testcase name.
|
||||||
run_testcase = \
|
run_testcase = \
|
||||||
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
|
||||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni < $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
|
||||||
fi; \
|
fi; \
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
exec enums_builder.sce
|
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
exec enums.sce
|
exec enums.sce
|
||||||
|
|
||||||
|
|
|
||||||
7
Examples/test-suite/scilab/li_math_runme.sci
Normal file
7
Examples/test-suite/scilab/li_math_runme.sci
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
exec loader.sce;
|
||||||
|
exec li_math.sce;
|
||||||
|
|
||||||
|
x = fmod(M_PI, M_1_PI)
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
7
Examples/test-suite/scilab/simple_array_runme.sci
Normal file
7
Examples/test-suite/scilab/simple_array_runme.sci
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
exec loader.sce
|
||||||
|
|
||||||
|
initArray();
|
||||||
|
x_get()
|
||||||
|
y_get()
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
exec struct_rename_builder.sce
|
|
||||||
exec loader.sce
|
exec loader.sce
|
||||||
|
|
||||||
a = new_Bar();
|
a = new_Bar();
|
||||||
Bar_x_set(100);
|
Bar_x_set(a,100);
|
||||||
Bar_x_get();
|
if Bar_x_get(a) <> 100 then pause,end
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,7 @@
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
}
|
}
|
||||||
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
if($1 != NULL) {
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
free($1);
|
|
||||||
}
|
|
||||||
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
|
||||||
for(index = 0; index < iRows * iCols; index++) {
|
|
||||||
$1[index] = ($*1_ltype)_piData[index];
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -114,11 +110,7 @@
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
}
|
}
|
||||||
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
if($1 != NULL) {
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
free($1);
|
|
||||||
}
|
|
||||||
$1 = ($1_ltype)malloc(iRows * iCols * sizeof($*1_ltype));
|
|
||||||
for(index = 0; index < iRows * iCols; index++) {
|
|
||||||
$1[index] = ($*1_ltype)_piData[index];
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -137,11 +129,7 @@
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
}
|
}
|
||||||
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
if($1 != NULL) {
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
free($1);
|
|
||||||
}
|
|
||||||
$1 = ($1_ltype)malloc(iRows * iCols * sizeof($*1_ltype));
|
|
||||||
for(index = 0; index < iRows * iCols; index++) {
|
|
||||||
$1[index] = ($*1_ltype)_piData[index];
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -157,11 +145,7 @@
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
}
|
}
|
||||||
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
|
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
if($1 != NULL) {
|
for(index = 0; index < $1_dim0; index++){
|
||||||
free($1);
|
|
||||||
}
|
|
||||||
$1 = ($1_ltype)malloc(iRows * iCols * sizeof($*1_ltype));
|
|
||||||
for(index = 0; index < iRows * iCols; index++){
|
|
||||||
$1[index] = ($*1_ltype)_piData[index];
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -479,6 +463,114 @@
|
||||||
free(_pstStrings);
|
free(_pstStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) signed char [ANY] {
|
||||||
|
char *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) unsigned char [ANY] {
|
||||||
|
short *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfUnsignedInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) short [ANY] {
|
||||||
|
short *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) unsigned short [ANY] {
|
||||||
|
short *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfUnsignedInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) int [ANY],
|
||||||
|
long [ANY] {
|
||||||
|
int *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) unsigned int [ANY],
|
||||||
|
unsigned long [ANY] {
|
||||||
|
int *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfUnsignedInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++) {
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) double [ANY],
|
||||||
|
float [ANY] {
|
||||||
|
double *_piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_matrix || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++){
|
||||||
|
$1[index] = ($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(varin,noblock=1) signed char *,
|
%typemap(varin,noblock=1) signed char *,
|
||||||
short *,
|
short *,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
|
|
@ -533,6 +625,20 @@
|
||||||
$1 = ($1_ltype)_piData;
|
$1 = ($1_ltype)_piData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(varin,noblock=1) SWIGTYPE [ANY] (int *piAddrVar) {
|
||||||
|
void *_piData = NULL;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_lufact_pointer) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Pointer expected.\n"), fname, $argnum);
|
||||||
|
}
|
||||||
|
getPointer(piAddrVar, &_piData);
|
||||||
|
for(index = 0; index < $1_dim0; index++){
|
||||||
|
$1[index] = (($1_ltype)_piData)[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(varin,nobloack=1) SWIGTYPE {
|
%typemap(varin,nobloack=1) SWIGTYPE {
|
||||||
void *_piData = NULL;
|
void *_piData = NULL;
|
||||||
getVarAddressFromPosition($argnum, &piAddrVar);
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
|
@ -627,6 +733,50 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) signed char [ANY] {
|
||||||
|
createMatrixOfInteger8(iVarOut, 1, $1_dim0, (char *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) unsigned char [ANY] {
|
||||||
|
createMatrixOfUnsignedInteger8(iVarOut, 1, $1_dim0, (unsigned char *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) short [ANY] {
|
||||||
|
createMatrixOfInteger16(iVarOut, 1, $1_dim0, (short *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) unsigned short [ANY] {
|
||||||
|
createMatrixOfUnsignedInteger16(iVarOut, 1, $1_dim0, (unsigned short *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) int [ANY],
|
||||||
|
long [ANY] {
|
||||||
|
createMatrixOfInteger32(iVarOut, 1, $1_dim0, (int *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) unsigned int [ANY],
|
||||||
|
unsigned long [ANY] {
|
||||||
|
createMatrixOfUnsignedInteger32(iVarOut, 1, $1_dim0, (unsigned int *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) double [ANY] {
|
||||||
|
createMatrixOfDouble(iVarOut, 1, $1_dim0, (double *)$result);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(varout,noblock=1) float [ANY] {
|
||||||
|
double temp;
|
||||||
|
temp = (double)$result;
|
||||||
|
createMatrixOfDouble(iVarOut, 1, $1_dim0, (double *)&temp);
|
||||||
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(varout,noblock=1) char ** {
|
%typemap(varout,noblock=1) char ** {
|
||||||
char **pstData = NULL;
|
char **pstData = NULL;
|
||||||
pstData = (char **)malloc(iRowsOut * iColsOut * sizeof(char*));
|
pstData = (char **)malloc(iRowsOut * iColsOut * sizeof(char*));
|
||||||
|
|
@ -640,7 +790,6 @@
|
||||||
LhsVar(iOutNum) = iVarOut;
|
LhsVar(iOutNum) = iVarOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
%typemap(varout,noblock=1) SWIGTYPE {
|
%typemap(varout,noblock=1) SWIGTYPE {
|
||||||
createPointer(iVarOut, (void *)&$result);
|
createPointer(iVarOut, (void *)&$result);
|
||||||
LhsVar(iOutNum) = iVarOut;
|
LhsVar(iOutNum) = iVarOut;
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,9 @@ public:
|
||||||
Printf(f_runtime, "#include \"localization.h\"\n");
|
Printf(f_runtime, "#include \"localization.h\"\n");
|
||||||
|
|
||||||
/* Initialize the builder.sce file code */
|
/* Initialize the builder.sce file code */
|
||||||
Printf(f_builder_code,"ilib_name = \"%slib\";\n",module);
|
Printf(f_builder_code, "ilib_name = \"%slib\";\n", module);
|
||||||
Printf(f_builder_code,"files = [\"%s\",\"%s.o\"];\n", outfile,module);
|
Printf(f_builder_code, "files = [\"%s\",\"%s.o\"];\n", outfile, module);
|
||||||
Printf(f_builder_code,"libs = [];\n");
|
Printf(f_builder_code, "libs = [];\n");
|
||||||
Printf(f_builder_code, "table = [");
|
Printf(f_builder_code, "table = [");
|
||||||
|
|
||||||
/* Emit code for children */
|
/* Emit code for children */
|
||||||
|
|
@ -114,10 +114,11 @@ public:
|
||||||
|
|
||||||
/* create the file to generate the module: "builder.sce" */
|
/* create the file to generate the module: "builder.sce" */
|
||||||
if(hasfunction_flag) {
|
if(hasfunction_flag) {
|
||||||
Printf(f_builder_code,"];\n");
|
Printf(f_builder_code, "];\n");
|
||||||
Printf(f_builder_code,"ilib_build(ilib_name,table,files,libs);");
|
Printf(f_builder_code, "ilib_build(ilib_name,table,files,libs);\n");
|
||||||
File *f_builder=NewFile(NewStringf("%s%s_builder.sce",SWIG_output_directory(),module),"w",SWIG_output_files());
|
Printf(f_builder_code, "exit");
|
||||||
Printv(f_builder,f_builder_code,NIL);
|
File *f_builder=NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
|
||||||
|
Printv(f_builder, f_builder_code, NIL);
|
||||||
Close(f_builder);
|
Close(f_builder);
|
||||||
Delete(f_builder);
|
Delete(f_builder);
|
||||||
Delete(f_builder_code);
|
Delete(f_builder_code);
|
||||||
|
|
@ -128,8 +129,8 @@ public:
|
||||||
|
|
||||||
/* create the file for constants: "module.sce" */
|
/* create the file for constants: "module.sce" */
|
||||||
if(hasconstant_flag) {
|
if(hasconstant_flag) {
|
||||||
File *f_example=NewFile(NewStringf("%s%s.sce",SWIG_output_directory(),module),"w",SWIG_output_files());
|
File *f_example = NewFile(NewStringf("%s%s.sce", SWIG_output_directory(), module), "w", SWIG_output_files());
|
||||||
Printv(f_example,f_example_code,NIL);
|
Printv(f_example, f_example_code, NIL);
|
||||||
Close(f_example);
|
Close(f_example);
|
||||||
Delete(f_example);
|
Delete(f_example);
|
||||||
Delete(f_example_code);
|
Delete(f_example_code);
|
||||||
|
|
@ -363,8 +364,8 @@ public:
|
||||||
String *getname = Swig_name_get(iname);
|
String *getname = Swig_name_get(iname);
|
||||||
String *setname = Swig_name_set(iname);
|
String *setname = Swig_name_set(iname);
|
||||||
|
|
||||||
Printf(globalVar, "int %s = 0;\n", rowname);
|
Printf(globalVar, "int %s = 1;\n", rowname);
|
||||||
Printf(globalVar, "int %s = 0;\n", colname);
|
Printf(globalVar, "int %s = 1;\n", colname);
|
||||||
if(!Strcmp(t, "p.double"))
|
if(!Strcmp(t, "p.double"))
|
||||||
Printf(globalVar, "int %s = 0;\n\n", iscomplexname);
|
Printf(globalVar, "int %s = 0;\n\n", iscomplexname);
|
||||||
else
|
else
|
||||||
|
|
@ -372,8 +373,8 @@ public:
|
||||||
Printv(setf->def, "int ", setname, " (char *fname,unsigned long fname_len) {\n", NIL);
|
Printv(setf->def, "int ", setname, " (char *fname,unsigned long fname_len) {\n", NIL);
|
||||||
|
|
||||||
/* Check the number of input and output */
|
/* Check the number of input and output */
|
||||||
Printf(setf->def, "CheckRhs(1,1);\n");
|
Printf(setf->def, "CheckRhs(1, 1);\n");
|
||||||
Printf(setf->def, "CheckLhs(1,1);\n");
|
Printf(setf->def, "CheckLhs(1, 1);\n");
|
||||||
|
|
||||||
/* add the local variable */
|
/* add the local variable */
|
||||||
Wrapper_add_local(setf, "piAddrVar", "int *piAddrVar");
|
Wrapper_add_local(setf, "piAddrVar", "int *piAddrVar");
|
||||||
|
|
@ -467,7 +468,7 @@ public:
|
||||||
value = Getattr(n, "rawvalue");
|
value = Getattr(n, "rawvalue");
|
||||||
char *temp = (Char(value));
|
char *temp = (Char(value));
|
||||||
tempvalue = NewString("ascii");
|
tempvalue = NewString("ascii");
|
||||||
Printf(tempvalue, "(%i)", (int)*temp);
|
Printf(tempvalue, "(%d)", (unsigned int)*temp);
|
||||||
value = Copy(tempvalue);
|
value = Copy(tempvalue);
|
||||||
Delete(tempvalue);
|
Delete(tempvalue);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue