Merge pull request #78 from smarchetto/gsoc2012-scilab

Scilab: support of Scilab 5.3.3 + improve the test suite
This commit is contained in:
Sylvestre Ledru 2013-08-26 08:32:46 -07:00
commit 9f08e04428
32 changed files with 231 additions and 157 deletions

View file

@ -1576,8 +1576,7 @@ SCILAB_INCLUDE = $(DEFS) @SCILABINCLUDE@
SCILAB_LIB = @SCILABLIB@ SCILAB_LIB = @SCILABLIB@
SCILAB = @SCILAB@ SCILAB = @SCILAB@
SCILABOPT = SCILABOPT =
SCILAB_START_OPT = @SCILABSTARTOPT@ SCILAB_STARTOPT = @SCILABSTARTOPT@
SCILAB_VERSION = @SCILABVERSION@
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# Build a C dynamically loadable module # Build a C dynamically loadable module
@ -1598,7 +1597,7 @@ scilab: $(SRCS)
fi \ fi \
fi fi
@if [ -f builder.sce ]; then \ @if [ -f builder.sce ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH echo 'exit(1)' |$(SCILAB) $(SCILAB_START_OPT) -f builder.sce; \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH echo 'exit(1)' |$(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
fi fi
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -1620,7 +1619,7 @@ scilab_cpp: $(SRCS)
fi \ fi \
fi fi
@if [ -f builder.sce ]; then \ @if [ -f builder.sce ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH echo 'exit(1)' |$(SCILAB) $(SCILAB_START_OPT) -f builder.sce; \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH echo 'exit(1)' |$(SCILAB) $(SCILAB_STARTOPT) -f builder.sce; \
fi fi
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@ -1628,21 +1627,22 @@ scilab_cpp: $(SRCS)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
scilab_run: scilab_run:
@env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -noatomsautoload -nb -f runme.sci @env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) $(SCILAB_STARTOPT) -f runme.sci
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Debugging a scilab example # Debugging a scilab example
# ----------------------------------------------------------------- # -----------------------------------------------------------------
scilab_debug: scilab_debug:
@env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -noatomsautoload -nb -debug -f runme.sci @env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) $(SCILAB_STARTOPT) -f runme.sci
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Version display # Scilab version
# ----------------------------------------------------------------- # -----------------------------------------------------------------
scilab_version: scilab_version:
echo $(SCILAB_VERSION) echo `$(SCILAB) -version|head -1|sed -e 's|Scilab version \"\(.*\)\"|\1|g'`
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Cleaning the scilab examples # Cleaning the scilab examples

View file

@ -8,7 +8,6 @@ matrix
matrix2 matrix2
pointer pointer
simple simple
std_set
std_vector/std_vector std_vector/std_vector
std_vector/std_vector_as_function_argument std_vector/std_vector_as_function_argument
struct struct

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
// ----- Object creation ----- // ----- Object creation -----

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
printf("ICONST = %i (should be 42)\n", ICONST_get()); printf("ICONST = %i (should be 42)\n", ICONST_get());

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
// Call our gcd() function // Call our gcd() function

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
// Print out the value of some enums // Print out the value of some enums

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
a = 37 a = 37

View file

@ -1,5 +1,5 @@
// loader the *.so lines(0);
exec loader.sce exec loader.sce;
// create a new matrix // create a new matrix
x = new_matrix(); x = new_matrix();

View file

@ -1,4 +1,5 @@
exec loader.sce lines(0);
exec loader.sce;
// Test lib double matrix functions // Test lib double matrix functions
disp("Call lib function getDoubleMatrix()"); disp("Call lib function getDoubleMatrix()");

View file

@ -1,5 +1,5 @@
// loader the *.so lines(0);
exec loader.sce exec loader.sce;
// First create some objects using the pointer library. // First create some objects using the pointer library.
printf("Testing the pointer library\n") printf("Testing the pointer library\n")

View file

@ -1,4 +1,4 @@
// loader the *.so lines(0);
exec loader.sce; exec loader.sce;
// Call our gcd() function // Call our gcd() function

View file

@ -1,3 +1,4 @@
lines(0);
exec loader.sce; exec loader.sce;
SWIG_Init(); SWIG_Init();
@ -29,3 +30,5 @@ disp("concat this list with the list of string {''cc'', ''dd'', ''ee'', ''ff''}
ss3 = concat_string_list(ss, ss2); ss3 = concat_string_list(ss, ss2);
disp(ss3); disp(ss3);
exit

View file

@ -1,3 +1,4 @@
lines(0);
exec loader.sce; exec loader.sce;
SWIG_Init(); SWIG_Init();

View file

@ -1,4 +1,4 @@
// file: runme.sci lines(0);
exec loader.sce; exec loader.sce;
SWIG_Init(); SWIG_Init();

View file

@ -1,3 +1,4 @@
lines(0);
exec loader.sce; exec loader.sce;
SWIG_Init(); SWIG_Init();

View file

@ -1,5 +1,5 @@
//loader the *.so lines(0);
exec loader.sce exec loader.sce;
//create a struct //create a struct
a=new_Bar(); a=new_Bar();

View file

@ -1,3 +1,6 @@
lines(0);
exec loader.sce;
function printShape(shape, name) function printShape(shape, name)
printf("\nShape %s position:\n", name); printf("\nShape %s position:\n", name);
printf(" (x, y) = (%f, %f)\n", ShapeDouble_x_get(shape), ShapeDouble_y_get(shape)) printf(" (x, y) = (%f, %f)\n", ShapeDouble_x_get(shape), ShapeDouble_y_get(shape))
@ -9,8 +12,6 @@ function printShape(shape, name)
printf("\n"); printf("\n");
endfunction endfunction
exec loader.sce;
printf("Creating some objects:\n"); printf("Creating some objects:\n");
c = new_CircleDouble(10); c = new_CircleDouble(10);
s = new_SquareDouble(10); s = new_SquareDouble(10);

View file

@ -1,7 +1,5 @@
lines(0); lines(0);
exec loader.sce;
//loader the *.so
exec loader.sce
// Try to set the values of some global variables // Try to set the values of some global variables
ivar_set(42); ivar_set(42);

View file

@ -1,5 +1,11 @@
%module constructor_exception %module constructor_exception
#ifdef SWIGSCILAB
%inline %{
#undef Error
%}
#endif
%inline %{ %inline %{
class Error { class Error {
}; };

View file

@ -15,21 +15,45 @@ top_builddir = @top_builddir@
# - member_pointer (C++) # - member_pointer (C++)
# - typemap_variables (C++) # - typemap_variables (C++)
# configure cache to speed up test run
CONF_CACHE=$(CURDIR)/test-suite.config.cache
CONFIG_SITE=$(CURDIR)/test-suite.config.site
export CONFIG_SITE
enable_config_cache = \
echo 'cache_file=$(CONF_CACHE)' > $(CONFIG_SITE)
disable_config_cache:
rm -f $(CONF_CACHE)
rm -f $(CONFIG_SITE)
CONFIG_SITE=
# need reset cache before multicpptest
reset_config_cache = \
rm -f $(CONF_CACHE)
# disable cache at the end of test-suite
# use trick for this: 'extra test cases' end target
EXTRA_TEST_CASES = disable_config_cache
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:
$(setup) $(setup)
$(enable_config_cache)
+$(swig_and_compile_cpp) +$(swig_and_compile_cpp)
$(run_testcase) $(run_testcase)
%.ctest: %.ctest:
$(setup) $(setup)
$(enable_config_cache)
+$(swig_and_compile_c) +$(swig_and_compile_c)
$(run_testcase) $(run_testcase)
%.multicpptest: %.multicpptest:
$(setup) $(setup)
$(reset_config_cache)
+$(swig_and_compile_multi_cpp) +$(swig_and_compile_multi_cpp)
$(run_testcase) $(run_testcase)
@ -42,7 +66,7 @@ run_testcase = \
# Clean: remove the generated files # Clean: remove the generated files
%.clean: %.clean:
@rm -f builder.sce loader.sce cleaner.sce $*_wrap.c $*_wrap.cxx lib$*lib.* @rm -f builder.sce loader.sce cleaner.sce $*_wrap.c $*_wrap.cxx lib$*lib.* $(CONFIG_SITE) $(CONF_CACHE)
clean: clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile scilab_clean $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile scilab_clean

View file

@ -12,6 +12,12 @@
%warnfilter(SWIGWARN_PARSE_KEYWORD) Namespace; %warnfilter(SWIGWARN_PARSE_KEYWORD) Namespace;
#endif #endif
#ifdef SWIGSCILAB
%inline %{
#undef Error
%}
#endif
// Tests SWIG's automatic exception mechanism // Tests SWIG's automatic exception mechanism
%inline %{ %inline %{

View file

@ -102,10 +102,6 @@ SwigScilabStringToCharPtr(void *_pvApiCtx, int _iVar, char *_pcValue, int _iLeng
char* pcTmpValue = NULL; char* pcTmpValue = NULL;
int iRet; int iRet;
if (_pcValue == NULL) {
return SWIG_ERROR;
}
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar); sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
if (sciErr.iErr) { if (sciErr.iErr) {
printError(&sciErr, 0); printError(&sciErr, 0);
@ -117,7 +113,10 @@ SwigScilabStringToCharPtr(void *_pvApiCtx, int _iVar, char *_pcValue, int _iLeng
return SWIG_ERROR; return SWIG_ERROR;
} }
if (_pcValue != NULL) {
strncpy(_pcValue, pcTmpValue, _iLength); strncpy(_pcValue, pcTmpValue, _iLength);
}
free(pcTmpValue); free(pcTmpValue);
return SWIG_OK; return SWIG_OK;
@ -244,12 +243,12 @@ SwigScilabStringFromCharPtrArray(void *_pvApiCtx, int _iVarOut, char **_charPtrA
return SWIG_ERROR; return SWIG_ERROR;
} }
sciErr = createMatrixOfString(_pvApiCtx, nbInputArgument(pvApiCtx) + _iVarOut, _charPtrArraySize, 1, _charPtrArray); sciErr = createMatrixOfString(_pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, _charPtrArraySize, 1, _charPtrArray);
if (sciErr.iErr) { if (sciErr.iErr) {
printError(&sciErr, 0); printError(&sciErr, 0);
return SWIG_ERROR; return SWIG_ERROR;
} }
return nbInputArgument(pvApiCtx) + _iVarOut; return SWIG_NbInputArgument(pvApiCtx) + _iVarOut;
} }
} }

View file

@ -94,7 +94,7 @@ SWIG_From_dec(int)(int _iValue)
double dblDoubleValue = (double) _iValue; double dblDoubleValue = (double) _iValue;
int iRowsOut = 1; int iRowsOut = 1;
int iColsOut = 1; int iColsOut = 1;
int iVarOut = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); int iVarOut = SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &dblDoubleValue); sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
if (sciErr.iErr) if (sciErr.iErr)

View file

@ -39,7 +39,7 @@
{ {
if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2) != SWIG_ERROR) if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -73,7 +73,7 @@
{ {
if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$1) != SWIG_ERROR) if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$1) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {

View file

@ -82,7 +82,7 @@
{ {
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR) if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -107,7 +107,7 @@
{ {
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR) if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -140,7 +140,7 @@
{ {
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR) if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -172,7 +172,7 @@
{ {
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR) if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {

View file

@ -77,7 +77,7 @@
{ {
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR) if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -111,7 +111,7 @@
{ {
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR) if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -144,7 +144,7 @@
{ {
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR) if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {
@ -176,7 +176,7 @@
{ {
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR) if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR)
{ {
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
} }
else else
{ {

View file

@ -38,12 +38,12 @@ SWIGINTERN int
SwigScilabInt32FromEnum(void *_pvApiCtx, int _iVarOut, int _enumValue) SwigScilabInt32FromEnum(void *_pvApiCtx, int _iVarOut, int _enumValue)
{ {
int iRet; int iRet;
iRet = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + _iVarOut, _enumValue); iRet = createScalarInteger32(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, _enumValue);
if (iRet) if (iRet)
{ {
return SWIG_ERROR; return SWIG_ERROR;
} }
AssignOutputVariable(pvApiCtx, _iVarOut) = nbInputArgument(pvApiCtx) + _iVarOut; SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut);
return SWIG_OK; return SWIG_OK;
} }
} }

View file

@ -66,7 +66,10 @@ SWIG_Scilab_ErrorMsg(int code, const char *mesg)
sciprint(_("SWIG/Scilab Error : %s\n%s"),SWIG_Scilab_ErrorType(code),mesg); sciprint(_("SWIG/Scilab Error : %s\n%s"),SWIG_Scilab_ErrorType(code),mesg);
} }
#define SCILAB_VERSION_54_OR_HIGHER (SCI_VERSION_MAJOR > 5) || ((SCI_VERSION_MAJOR == 5) && (SCI_VERSION_MINOR >= 4))
#if !SCILAB_VERSION_54_OR_HIGHER
#include "stack-c.h"
#endif
#define SWIG_fail return SWIG_ERROR; #define SWIG_fail return SWIG_ERROR;
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) #define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
@ -75,6 +78,20 @@ SWIG_Scilab_ErrorMsg(int code, const char *mesg)
/* Used for C++ enums */ /* Used for C++ enums */
//#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, valuePointer, fname) //#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, valuePointer, fname)
#if SCILAB_VERSION_54_OR_HIGHER
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
#else
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument)
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument)
#define SWIG_NbInputArgument(pvApiCtx) Rhs
#endif
SWIGINTERN int SWIGINTERN int
SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_info *_descriptor, int _flags, char *_fname) { SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_info *_descriptor, int _flags, char *_fname) {
SciErr sciErr; SciErr sciErr;
@ -214,7 +231,11 @@ SWIG_Scilab_SetOutput(void *_pvApiCtx, SciObject _output) {
if (outputPosition < 0 || _output < 0) { if (outputPosition < 0 || _output < 0) {
return SWIG_ERROR; return SWIG_ERROR;
} }
AssignOutputVariable(_pvApiCtx, outputPosition) = _output; #if SCILAB_VERSION_54_OR_HIGHER
AssignOutputVariable(pvApiCtx, outputPosition) = _output;
#else
LhsVar(outputPosition) = _output;
#endif
return SWIG_OK; return SWIG_OK;
} }

View file

@ -49,7 +49,7 @@ SWIG_FromSet_Sequence_dec(ptr)(int _size, long long *_sequence) {
SciErr sciErr; SciErr sciErr;
int *piListAddr; int *piListAddr;
int iVarOut = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); int iVarOut = SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
sciErr = createList(pvApiCtx, iVarOut, _size, &piListAddr); sciErr = createList(pvApiCtx, iVarOut, _size, &piListAddr);
if (sciErr.iErr) if (sciErr.iErr)

View file

@ -285,9 +285,10 @@ public:
int minInputArguments = emit_num_required(functionParamsList); int minInputArguments = emit_num_required(functionParamsList);
int minOutputArguments = 0; int minOutputArguments = 0;
int maxOutputArguments = 0; int maxOutputArguments = 0;
/* Insert calls to CheckInputArgument and CheckOutputArgument */ /* Insert calls to CheckInputArgument and CheckOutputArgument */
Printf(wrapper->code, "CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n"); Printf(wrapper->code, "SWIG_CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n");
Printf(wrapper->code, "CheckOutputArgument(pvApiCtx, $minoutputarguments, $maxoutputarguments);\n"); Printf(wrapper->code, "SWIG_CheckOutputArgument(pvApiCtx, $minoutputarguments, $maxoutputarguments);\n");
Printf(wrapper->code, "SWIG_Scilab_SetFname(fname);\n"); Printf(wrapper->code, "SWIG_Scilab_SetFname(fname);\n");
for (paramIndex = 0, param = functionParamsList; paramIndex < maxInputArguments; ++paramIndex) { for (paramIndex = 0, param = functionParamsList; paramIndex < maxInputArguments; ++paramIndex) {
@ -314,7 +315,7 @@ public:
} }
if (paramIndex >= minInputArguments) { /* Optional input argument management */ if (paramIndex >= minInputArguments) { /* Optional input argument management */
Printf(wrapper->code, "if (Rhs > %d) {\n%s\n}\n", paramIndex, paramTypemap); Printf(wrapper->code, "if (SWIG_NbInputArgument(pvApiCtx) > %d) {\n%s\n}\n", paramIndex, paramTypemap);
} else { } else {
Printf(wrapper->code, "%s\n", paramTypemap); Printf(wrapper->code, "%s\n", paramTypemap);
} }
@ -461,7 +462,7 @@ public:
Printv(wrapper->def, "int ", wrapperName, " (char *fname, unsigned long fname_len) {\n", NIL); Printv(wrapper->def, "int ", wrapperName, " (char *fname, unsigned long fname_len) {\n", NIL);
/* Get the number of the parameters */ /* Get the number of the parameters */
Wrapper_add_local(wrapper, "argc", "int argc = Rhs"); Wrapper_add_local(wrapper, "argc", "int argc = SWIG_NbInputArgument(pvApiCtx)");
Printf(tmp, "int argv[%d] = {", maxargs); Printf(tmp, "int argv[%d] = {", maxargs);
for (int j = 0; j < maxargs; ++j) { for (int j = 0; j < maxargs; ++j) {
Printf(tmp, "%s%d", j ? "," : " ", j + 1); Printf(tmp, "%s%d", j ? "," : " ", j + 1);
@ -499,8 +500,8 @@ public:
Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL); Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
/* Check the number of input and output */ /* Check the number of input and output */
Printf(getFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 0, 0);\n"); Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
Printf(getFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n"); Printf(getFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
String *varoutTypemap = Swig_typemap_lookup("varout", node, origVariableName, 0); String *varoutTypemap = Swig_typemap_lookup("varout", node, origVariableName, 0);
if (varoutTypemap != NULL) { if (varoutTypemap != NULL) {
@ -526,8 +527,8 @@ public:
Printv(setFunctionWrapper->def, "int ", setFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL); Printv(setFunctionWrapper->def, "int ", setFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
/* Check the number of input and output */ /* Check the number of input and output */
Printf(setFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 1, 1);\n"); Printf(setFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 1, 1);\n");
Printf(setFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n"); Printf(setFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
String *varinTypemap = Swig_typemap_lookup("varin", node, origVariableName, 0); String *varinTypemap = Swig_typemap_lookup("varin", node, origVariableName, 0);
if (varinTypemap != NULL) { if (varinTypemap != NULL) {
@ -575,8 +576,8 @@ public:
Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL); Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
/* Check the number of input and output */ /* Check the number of input and output */
Printf(getFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 0, 0);\n"); Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
Printf(getFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n"); Printf(getFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
constantTypemap = Swig_typemap_lookup("constcode", node, nodeName, 0); constantTypemap = Swig_typemap_lookup("constcode", node, nodeName, 0);
if (constantTypemap != NULL) { if (constantTypemap != NULL) {

View file

@ -986,7 +986,6 @@ AC_SUBST(OCTAVE_LDFLAGS)
SCILABBIN= SCILABBIN=
SCILABDYNAMICLINKING= SCILABDYNAMICLINKING=
AC_ARG_WITH(scilab, AS_HELP_STRING([--without-scilab], [Disable Scilab]) AC_ARG_WITH(scilab, AS_HELP_STRING([--without-scilab], [Disable Scilab])
AS_HELP_STRING([--with-scilab=path], [Set location of Scilab executable]),[SCILABBIN="$withval"], [SCILABBIN=yes]) AS_HELP_STRING([--with-scilab=path], [Set location of Scilab executable]),[SCILABBIN="$withval"], [SCILABBIN=yes])
AC_ARG_WITH(scilabincl,[ --with-scilabincl=path Set location of Scilab include directory],[SCILABINCDIR="$withval"], [SCILABINCDIR="/usr/include"]) AC_ARG_WITH(scilabincl,[ --with-scilabincl=path Set location of Scilab include directory],[SCILABINCDIR="$withval"], [SCILABINCDIR="/usr/include"])
@ -998,21 +997,47 @@ SCILAB=
else else
# Check Scilab executable # Check for Scilab executable
AC_MSG_CHECKING(for Scilab executable)
if test "x$SCILABBIN" = xyes; then if test "x$SCILABBIN" = xyes; then
AC_CHECK_PROGS(SCILAB, scilab) AC_CHECK_PROGS(SCILAB, scilab)
else else
AC_MSG_CHECKING(for scilab)
if test -f "$SCILABBIN"; then
AC_MSG_RESULT($SCILABBIN)
SCILAB="$SCILABBIN" SCILAB="$SCILABBIN"
else
AC_MSG_RESULT(not found)
fi fi
fi
if test -n "$SCILAB"; then if test -n "$SCILAB"; then
AC_MSG_RESULT([$SCILAB found]) # Check for Scilab version (needs api_scilab so needs version 5.2 or higher)
SCILAB_FULL_VERSION=`$SCILAB -version|head -1|sed -e 's|Scilab version \"\(.*\)\"|\1|g'`
AC_MSG_NOTICE([Scilab version: $SCILAB_FULL_VERSION])
AC_MSG_CHECKING(for Scilab version is 5.2 or higher)
SCILAB_MAJOR_VERSION=`echo $SCILAB_FULL_VERSION | cut -d. -f1`
SCILAB_MINOR_VERSION=`echo $SCILAB_FULL_VERSION | cut -d. -f2`
SCILAB_VERSION="$SCILAB_MAJOR_VERSION$SCILAB_MINOR_VERSION"
if test $SCILAB_VERSION -ge 52; then
AC_MSG_RESULT(yes)
else else
AC_MSG_RESULT([$SCILAB not found]) AC_MSG_RESULT(no)
fi fi
# Check Scilab header files # Set Scilab startup options depending on version
AC_MSG_CHECKING(for Scilab startup options)
SCILABSTARTOPT="-nwni -nb"
if test $SCILAB_VERSION -ge 54; then
SCILABSTARTOPT+=" -noatomsautoload"
fi
AC_MSG_RESULT($SCILABSTARTOPT)
fi
# Check for Scilab header files
AC_MSG_CHECKING(for Scilab header files) AC_MSG_CHECKING(for Scilab header files)
if test "$SCILABINCDIR" != ""; then if test "$SCILABINCDIR" != ""; then
dirs="$SCILABINCDIR" dirs="$SCILABINCDIR"
@ -1032,24 +1057,12 @@ if test "$SCILABINCDIR" != ""; then
else else
AC_MSG_RESULT($SCILABEXT) AC_MSG_RESULT($SCILABEXT)
fi fi
AC_MSG_CHECKING(for Scilab compiler options)
SCILABCCFLAGS=""
AC_MSG_RESULT($SCILABCCFLAGS)
fi fi
# Get Scilab version
AC_MSG_CHECKING(for Scilab version)
SCILABVERSION=`$SCILAB -version|sed -e 's|Scilab version \"\(.*\)\"|\1|g'|head -1`
AC_MSG_RESULT($SCILABVERSION)
SCILAB_MAJOR_VERSION=`echo $SCILABVERSION | cut -d. -f1`
SCILAB_MINOR_VERSION=`echo $SCILAB_VERSION | cut -d. -f2`
# Set Scilab startup options depending on version
AC_MSG_CHECKING(for Scilab startup options)
SCILABSTARTOPT="-nwni -nb"
if test "$SCILAB_MAJOR_VERSION" -ge 5 ; then
if test "$SCILAB_MINOR_VERSION" -ge 4 ; then
SCILABSTARTOPT+=" -noatomsautoload"
fi
fi
AC_MSG_RESULT($SCILABSTARTOPT)
fi fi
@ -1059,7 +1072,7 @@ AC_SUBST(SCILABDYNAMICLINKING)
AC_SUBST(SCILABLIB) AC_SUBST(SCILABLIB)
AC_SUBST(SCILABCCFLAGS) AC_SUBST(SCILABCCFLAGS)
AC_SUBST(SCILABSTARTOPT) AC_SUBST(SCILABSTARTOPT)
AC_SUBST(SCILABVERSION)
#---------------------------------------------------------------- #----------------------------------------------------------------
# Look for java # Look for java