From 321cc1bf33c007a9f69853ea70307b373f115caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DAVID?= Date: Fri, 31 Mar 2023 10:02:08 +0200 Subject: scilab: detect version 2023 correctly --- .github/workflows/ci.yml | 2 ++ CHANGES.current | 3 +++ Doc/Manual/Scilab.html | 3 +-- Lib/scilab/scirun.swg | 33 ++++++++++++++++----------------- Tools/CI-linux-install.sh | 9 +++++++-- configure.ac | 10 +++++----- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9ce5ea03..7b8d16faf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,6 +181,8 @@ jobs: VER: '6.0.2' - SWIGLANG: scilab os: ubuntu-22.04 # scilab 6.1.1 + - SWIGLANG: scilab + VER: '2023.0.0' - SWIGLANG: tcl # c++11 testing - SWIGLANG: csharp diff --git a/CHANGES.current b/CHANGES.current index cbfe89da9..ff60f6a03 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.2.0 (in progress) =========================== +2023-04-19: davidcl + [Scilab] Add support for Scilab 2023.x + 2023-04-19: mmomtchev https://sourceforge.net/p/swig/bugs/1163/ #2525 Fix preprocessor expansion when a macro expands to the name of another macro which diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html index 95eea340f..650d52158 100644 --- a/Doc/Manual/Scilab.html +++ b/Doc/Manual/Scilab.html @@ -96,8 +96,7 @@ SWIG for Scilab supports Linux. Other operating systems haven't been tested.

-Scilab is supported from version 5.3.3 onwards. -The forthcoming version 6, as of January 2015, is also supported. +Scilab is supported from version 5.3.3 onwards, the SWIG generated code is supported on both Scilab 5, Scilab 6 and more recent versions.

diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg index 586d5f16f..481aac7ac 100644 --- a/Lib/scilab/scirun.swg +++ b/Lib/scilab/scirun.swg @@ -5,7 +5,6 @@ /* Scilab version macro */ #include "version.h" -#define SWIG_SCILAB_VERSION (SCI_VERSION_MAJOR * 100) + (SCI_VERSION_MINOR * 10) + SCI_VERSION_MAINTENANCE /* Scilab standard headers */ @@ -13,11 +12,11 @@ extern "C" { #endif #include "api_scilab.h" -#if SWIG_SCILAB_VERSION < 540 +#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4 #define __USE_DEPRECATED_STACK_FUNCTIONS__ #include "stack-c.h" #endif -#if SWIG_SCILAB_VERSION < 600 +#if SCI_VERSION_MAJOR < 6 #include "MALLOC.h" #endif #include "Scierror.h" @@ -31,12 +30,12 @@ extern "C" { /* Gateway signature */ -#if SWIG_SCILAB_VERSION >= 600 -#define SWIG_GatewayParameters char* fname, void *pvApiCtx -#define SWIG_GatewayArguments fname, pvApiCtx -#else +#if SCI_VERSION_MAJOR < 6 #define SWIG_GatewayParameters char* fname, unsigned long fname_len #define SWIG_GatewayArguments fname, fname_len +# else +#define SWIG_GatewayParameters char* fname, void *pvApiCtx +#define SWIG_GatewayArguments fname, pvApiCtx #endif /* Function name management functions */ @@ -58,29 +57,29 @@ static void SWIG_Scilab_SetFuncName(char *funcName) { /* Api context management functions */ -#if SWIG_SCILAB_VERSION >= 600 +#if SCI_VERSION_MAJOR < 6 +#define SWIG_Scilab_SetApiContext(apiCtx) +#else static void *pvApiCtx = NULL; static void SWIG_Scilab_SetApiContext(void *apiCtx) { pvApiCtx = apiCtx; } -#else -#define SWIG_Scilab_SetApiContext(apiCtx) #endif /* Argument management functions */ -#if SWIG_SCILAB_VERSION >= 540 -#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) -#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) -#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) -#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx) -#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos -#else +#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4 #define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument) #define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckRhs(minInputArgument, 256) #define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument) #define SWIG_NbInputArgument(pvApiCtx) Rhs #define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) LhsVar(outputArgumentPos) = argumentPos +#else +#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) +#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) +#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) +#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx) +#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos #endif typedef int SwigSciObject; diff --git a/Tools/CI-linux-install.sh b/Tools/CI-linux-install.sh index 93bb46412..5352eb3fa 100644 --- a/Tools/CI-linux-install.sh +++ b/Tools/CI-linux-install.sh @@ -152,10 +152,15 @@ case "$SWIGLANG" in if [[ -z "$VER" ]]; then $RETRY sudo apt-get -qq install scilab else - $RETRY wget --progress=dot:giga "https://www.scilab.org/download/$VER/scilab-$VER.bin.linux-x86_64.tar.gz" + # Download was .gz but switched to .xz for version 2023.0.0. + case $VER in + 20*) scilab_tarball=scilab-$VER.bin.linux-x86_64.tar.xz ;; + *) scilab_tarball=scilab-$VER.bin.linux-x86_64.tar.gz ;; + esac + $RETRY wget --progress=dot:giga "https://www.scilab.org/download/$VER/$scilab_tarball" # $HOME/.local/bin is in PATH and writeable mkdir -p "$HOME/.local" - tar -xzf "scilab-$VER.bin.linux-x86_64.tar.gz" --strip-components=1 -C "$HOME/.local" + tar -xzf "$scilab_tarball" --strip-components=1 -C "$HOME/.local" fi ;; "tcl") diff --git a/configure.ac b/configure.ac index c0f57571f..050d97533 100644 --- a/configure.ac +++ b/configure.ac @@ -2404,13 +2404,13 @@ else # Check for Scilab version (needs api_scilab so needs version 5.3.3 or higher) SCILAB_VERSION=`$SCILAB -nwni -version | head -1 | sed -e 's|Scilab version \"\(.*\)\"|\1|g'` - AC_MSG_CHECKING(Scilab version is 5.3.3 or higher) + AC_MSG_CHECKING(Scilab version is higher than 5.3.2) SCILAB_MAJOR_VERSION=`echo $SCILAB_VERSION | cut -d. -f1` SCILAB_MINOR_VERSION=`echo $SCILAB_VERSION | cut -d. -f2` SCILAB_MAINTENANCE_VERSION=`echo $SCILAB_VERSION | cut -d. -f3` - SCILAB_VERSION_NO_DOTS="$SCILAB_MAJOR_VERSION$SCILAB_MINOR_VERSION$SCILAB_MAINTENANCE_VERSION" + SCILAB_VERSION_NO_DOTS=`printf '%04d%02d%02d' "$SCILAB_MAJOR_VERSION" "$SCILAB_MINOR_VERSION" "$SCILAB_MAINTENANCE_VERSION"` - if test -n "$SCILAB_VERSION_NO_DOTS" && test "$SCILAB_VERSION_NO_DOTS" -ge 533; then + if test "$SCILAB_VERSION_NO_DOTS" -ge 00050303; then AC_MSG_RESULT(yes - $SCILAB_VERSION) else AC_MSG_RESULT(no - $SCILAB_VERSION) @@ -2421,10 +2421,10 @@ else # Set Scilab startup options depending on version AC_MSG_CHECKING(for Scilab startup options) SCILABOPT="-nwni -nb" - if test $SCILAB_VERSION_NO_DOTS -ge 540; then + if test "$SCILAB_VERSION_NO_DOTS" -ge 00050400; then SCILABOPT+=" -noatomsautoload" fi - if test $SCILAB_VERSION_NO_DOTS -ge 600; then + if test "$SCILAB_VERSION_NO_DOTS" -ge 00060000; then SCILABOPT+=" -quit" fi AC_MSG_RESULT($SCILABOPT) -- cgit v1.2.1