api_hypermat removed and hdf5 exit fixed. 91/15491/5
Cedric Delamarre [Thu, 6 Nov 2014 09:23:50 +0000 (10:23 +0100)]
a = h5open(TMPDIR + "/tutu.sod")
exit

a = h5open(TMPDIR + "/test.sod")
x=matrix(1:8,2,2,2)
i=int32(x);

h5write(a, "x", x)
h5write(a, "i", i)
a("/x").data
a("/i").data

Change-Id: I8e38f22e9f8f0de85e151845b66a4ca83a2ffa76

32 files changed:
scilab/modules/api_scilab/Makefile.am
scilab/modules/api_scilab/Makefile.in
scilab/modules/api_scilab/api_scilab.vcxproj
scilab/modules/api_scilab/api_scilab.vcxproj.filters
scilab/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml [deleted file]
scilab/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml [deleted file]
scilab/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml [deleted file]
scilab/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml [deleted file]
scilab/modules/api_scilab/includes/api_common.h
scilab/modules/api_scilab/includes/api_hypermat.h [deleted file]
scilab/modules/api_scilab/includes/api_scilab.h
scilab/modules/api_scilab/src/cpp/api_common.cpp
scilab/modules/api_scilab/src/cpp/api_hypermat.cpp [deleted file]
scilab/modules/api_scilab/src/cpp/api_string.cpp
scilab/modules/api_scilab/src/cpp/returnProperty.cpp
scilab/modules/api_scilab/tests/unit_tests/hypermatExample.c [deleted file]
scilab/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref [deleted file]
scilab/modules/api_scilab/tests/unit_tests/hypermatExample.tst [deleted file]
scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.c [deleted file]
scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref [deleted file]
scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst [deleted file]
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/src/c/getHandleProperty/set_data_property.h
scilab/modules/graphics/src/cpp/set_data_property.cpp [moved from scilab/modules/graphics/src/c/getHandleProperty/set_data_property.c with 58% similarity]
scilab/modules/hdf5/sci_gateway/cpp/hdf5_gw.cpp
scilab/modules/hdf5/src/cpp/H5BasicData.hxx
scilab/modules/hdf5/src/cpp/HDF5Scilab.cpp
scilab/modules/randlib/sci_gateway/c/sci_grand.c [deleted file]

index d36cc4b..9656f76 100644 (file)
@@ -21,7 +21,6 @@ API_SCILAB_CXX_SOURCES = \
     src/cpp/returnProperty.cpp \
     src/cpp/returnPropertyList.cpp \
     src/cpp/api_optional.cpp \
-    src/cpp/api_hypermat.cpp \
     src/cpp/api_boolean_cpp.cpp \
     src/cpp/api_common_cpp.cpp \
     src/cpp/api_double_cpp.cpp \
@@ -97,7 +96,6 @@ includes/api_boolean_sparse.h \
 includes/api_common.h \
 includes/api_error.h \
 includes/api_double.h \
-includes/api_hypermat.h \
 includes/api_int.h \
 includes/api_list.h \
 includes/api_pointer.h \
index 48e79cd..9be9f68 100644 (file)
@@ -183,7 +183,6 @@ am__objects_1 = src/cpp/libsciapi_scilab_la-api_boolean.lo \
        src/cpp/libsciapi_scilab_la-returnProperty.lo \
        src/cpp/libsciapi_scilab_la-returnPropertyList.lo \
        src/cpp/libsciapi_scilab_la-api_optional.lo \
-       src/cpp/libsciapi_scilab_la-api_hypermat.lo \
        src/cpp/libsciapi_scilab_la-api_boolean_cpp.lo \
        src/cpp/libsciapi_scilab_la-api_common_cpp.lo \
        src/cpp/libsciapi_scilab_la-api_double_cpp.lo \
@@ -570,7 +569,6 @@ API_SCILAB_CXX_SOURCES = \
     src/cpp/returnProperty.cpp \
     src/cpp/returnPropertyList.cpp \
     src/cpp/api_optional.cpp \
-    src/cpp/api_hypermat.cpp \
     src/cpp/api_boolean_cpp.cpp \
     src/cpp/api_common_cpp.cpp \
     src/cpp/api_double_cpp.cpp \
@@ -637,7 +635,6 @@ includes/api_boolean_sparse.h \
 includes/api_common.h \
 includes/api_error.h \
 includes/api_double.h \
-includes/api_hypermat.h \
 includes/api_int.h \
 includes/api_list.h \
 includes/api_pointer.h \
@@ -850,8 +847,6 @@ src/cpp/libsciapi_scilab_la-returnPropertyList.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/$(am__dirstamp) \
        src/cpp/$(DEPDIR)/$(am__dirstamp)
-src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/$(am__dirstamp) \
-       src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciapi_scilab_la-api_boolean_cpp.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciapi_scilab_la-api_common_cpp.lo:  \
@@ -892,7 +887,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_error.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_handle_cpp.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_int_cpp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_list.Plo@am__quote@
@@ -1037,13 +1031,6 @@ src/cpp/libsciapi_scilab_la-api_optional.lo: src/cpp/api_optional.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_optional.lo `test -f 'src/cpp/api_optional.cpp' || echo '$(srcdir)/'`src/cpp/api_optional.cpp
 
-src/cpp/libsciapi_scilab_la-api_hypermat.lo: src/cpp/api_hypermat.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_hypermat.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_hypermat.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/api_hypermat.cpp' object='src/cpp/libsciapi_scilab_la-api_hypermat.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciapi_scilab_la-api_hypermat.lo `test -f 'src/cpp/api_hypermat.cpp' || echo '$(srcdir)/'`src/cpp/api_hypermat.cpp
-
 src/cpp/libsciapi_scilab_la-api_boolean_cpp.lo: src/cpp/api_boolean_cpp.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciapi_scilab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciapi_scilab_la-api_boolean_cpp.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_cpp.Tpo -c -o src/cpp/libsciapi_scilab_la-api_boolean_cpp.lo `test -f 'src/cpp/api_boolean_cpp.cpp' || echo '$(srcdir)/'`src/cpp/api_boolean_cpp.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_cpp.Tpo src/cpp/$(DEPDIR)/libsciapi_scilab_la-api_boolean_cpp.Plo
index 82e1889..4fe8baa 100644 (file)
@@ -308,7 +308,6 @@ cd .. >nul
     <ClCompile Include="src\cpp\api_error.cpp" />
     <ClCompile Include="src\cpp\api_handle.cpp" />
     <ClCompile Include="src\cpp\api_handle_cpp.cpp" />
-    <ClCompile Include="src\cpp\api_hypermat.cpp" />
     <ClCompile Include="src\cpp\api_int.cpp" />
     <ClCompile Include="src\cpp\api_int_cpp.cpp" />
     <ClCompile Include="src\cpp\api_list.cpp" />
@@ -336,7 +335,6 @@ cd .. &gt;nul
     <ClInclude Include="includes\api_error.h" />
     <ClInclude Include="includes\api_handle.h" />
     <ClInclude Include="includes\api_handle.hxx" />
-    <ClInclude Include="includes\api_hypermat.h" />
     <ClInclude Include="includes\api_int.h" />
     <ClInclude Include="includes\api_int.hxx" />
     <ClInclude Include="includes\api_list.hxx" />
index f6f0ce1..6c38b00 100644 (file)
@@ -75,9 +75,6 @@
     <ClCompile Include="src\cpp\returnPropertyList.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\cpp\api_hypermat.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\cpp\api_double_cpp.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClInclude Include="includes\returnPropertyList.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="includes\api_hypermat.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="includes\api_scilab.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
diff --git a/scilab/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml b/scilab/modules/api_scilab/help/en_US/hypermat/B_getHypermatOfDouble.xml
deleted file mode 100644 (file)
index 1741626..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013  - Scilab Enterprises - Calixte DENIZET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfDouble" xml:lang="en">
-    <refnamediv>
-        <refname>getHypermatOfDouble</refname>
-        <refpurpose>
-            Get a hypermatrix of double variable.
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Calling Sequence</title>
-        <synopsis>SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double* _pdblReal)</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Arguments</title>
-        <variablelist>
-            <varlistentry>
-                <term>_pvCtx</term>
-                <listitem>
-                    <para>
-                        Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_piAddress</term>
-                <listitem>
-                    <para>
-                        Address of the Scilab variable.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_dims</term>
-                <listitem>
-                    <para>
-                        the hypermatrix dimensions.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_ndims</term>
-                <listitem>
-                    <para>
-                        the number of dimensions.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_pdblReal</term>
-                <listitem>
-                    <para>
-                        Double values.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Return value</title>
-        <para>A SciErr struct, the field iErr would contain the error number (0 if no error).</para>
-    </refsection>
-    <refsection>
-        <title>Gateway Source</title>
-        <programlisting role="code_gateway">
-            <![CDATA[ 
-#include "api_scilab.h"
-
-int hypermatExample(char *fname,unsigned long fname_len)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        double* pdblReal = NULL;
-        double* pdblImg = NULL;
-
-        if (isHypermatComplex(pvApiCtx, piAddr))
-        {
-            sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-        else
-        {
-            sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-
-    return 0;
-}]]>
-        </programlisting>
-    </refsection>
-    <refsection>
-        <title>Scilab test script</title>
-        <programlisting role="code_scilab"><![CDATA[ 
-a = hypermat([1 2 3], ones(1,6));
-b = a + %i*hypermat([1 2 3], 1:6);
-
-hypermatExample(a) == a
-hypermatExample(b) == b
- ]]></programlisting>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml b/scilab/modules/api_scilab/help/en_US/hypermat/C_getHypermatOfInt.xml
deleted file mode 100644 (file)
index a5acc45..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013  - Scilab Enterprises - Calixte DENIZET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfInt" xml:lang="en">
-    <refnamediv>
-        <refname>getHypermatOfInt</refname>
-        <refpurpose>
-            Get a hypermatrix of integer variable.
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Calling Sequence</title>
-        <synopsis>SciErr getHypermatOfInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char* _pcData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char* _pucData)</synopsis>
-        <synopsis>SciErr getHypermatOfInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short* _psData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short* _pusData)</synopsis>
-        <synopsis>SciErr getHypermatOfInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int* _puiData)</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Arguments</title>
-        <variablelist>
-            <varlistentry>
-                <term>_pvCtx</term>
-                <listitem>
-                    <para>
-                        Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_piAddress</term>
-                <listitem>
-                    <para>
-                        Address of the Scilab variable.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_dims</term>
-                <listitem>
-                    <para>
-                        the hypermatrix dimensions.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_ndims</term>
-                <listitem>
-                    <para>
-                        the number of dimensions.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_p*Data</term>
-                <listitem>
-                    <para>
-                        the data.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Return value</title>
-        <para>A SciErr struct, the field iErr would contain the error number (0 if no error).</para>
-    </refsection>
-    <refsection>
-        <title>Gateway Source</title>
-        <programlisting role="code_gateway">
-            <![CDATA[ 
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "sciprint.h"
-#include "MALLOC.h"
-
-int hypermatIntExample(char *fname,unsigned long fname_len)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        void * data = NULL;
-        int htype = 0;
-        int precision;
-
-        sciErr = getHypermatType(pvApiCtx, piAddr, &htype);
-        if (sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return sciErr.iErr;
-        }
-
-        if (htype == sci_ints)
-        {
-            sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            switch (precision)
-            {
-            case SCI_INT8:
-                sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT8:
-                sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_INT16:
-                sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT16:
-                sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_INT32:
-                sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT32:
-                sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-
-                sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            }
-        }
-        else
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1);
-            return 1;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-
-    return 0;
-}]]>
-        </programlisting>
-    </refsection>
-    <refsection>
-        <title>Scilab test script</title>
-        <programlisting role="code_scilab"><![CDATA[ 
-a = hypermat([1 2 3], int8(1:6));
-b = hypermat([1 2 3], uint8(1:6));
-c = hypermat([1 2 3], int16(1:6));
-d = hypermat([1 2 3], uint16(1:6));
-e = hypermat([1 2 3], int32(1:6));
-f = hypermat([1 2 3], uint32(1:6));
-
-hypermatExampleInt(a) == a
-hypermatExampleInt(b) == b
-hypermatExampleInt(c) == c
-hypermatExampleInt(d) == d
-hypermatExampleInt(e) == e
-hypermatExampleInt(f) == f
- ]]></programlisting>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml b/scilab/modules/api_scilab/help/ja_JP/hypermat/B_getHypermatOfDouble.xml
deleted file mode 100644 (file)
index e62ef9a..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013  - Scilab Enterprises - Calixte DENIZET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfDouble" xml:lang="ja">
-    <refnamediv>
-        <refname>getHypermatOfDouble</refname>
-        <refpurpose>
-            double変数のハイパー行列を取得.
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>呼び出し手順</title>
-        <synopsis>SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double* _pdblReal)</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>引数</title>
-        <variablelist>
-            <varlistentry>
-                <term>_pvCtx</term>
-                <listitem>
-                    <para>
-                        Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_piAddress</term>
-                <listitem>
-                    <para>
-                        Scilab 変数のアドレス.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_dims</term>
-                <listitem>
-                    <para>
-                        ハイパー行列の次元
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_ndims</term>
-                <listitem>
-                    <para>
-                        次元の数.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_pdblReal</term>
-                <listitem>
-                    <para>
-                        double値.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>戻り値</title>
-        <para>SciErr構造体, フィールド iErr は
-            エラー番号を保持します (エラーがない場合は 0).
-        </para>
-    </refsection>
-    <refsection>
-        <title>ゲートウェイのソース</title>
-        <programlisting role="code_gateway">
-            <![CDATA[ 
-#include "api_scilab.h"
-int hypermatExample(char *fname,unsigned long fname_len)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        double* pdblReal = NULL;
-        double* pdblImg = NULL;
-        if (isHypermatComplex(pvApiCtx, piAddr))
-        {
-            sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-            sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-        else
-        {
-            sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-            sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-    return 0;
-}]]>
-        </programlisting>
-    </refsection>
-    <refsection>
-        <title>Scilab テストスクリプト</title>
-        <programlisting role="code_scilab"><![CDATA[ 
-a = hypermat([1 2 3], ones(1,6));
-b = a + %i*hypermat([1 2 3], 1:6);
-hypermatExample(a) == a
-hypermatExample(b) == b
- ]]></programlisting>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml b/scilab/modules/api_scilab/help/ja_JP/hypermat/C_getHypermatOfInt.xml
deleted file mode 100644 (file)
index 902eba2..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013  - Scilab Enterprises - Calixte DENIZET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfInt" xml:lang="ja">
-    <refnamediv>
-        <refname>getHypermatOfInt</refname>
-        <refpurpose>
-            整数変数のハイパー行列を取得.
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>呼び出し手順</title>
-        <synopsis>SciErr getHypermatOfInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char* _pcData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char* _pucData)</synopsis>
-        <synopsis>SciErr getHypermatOfInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short* _psData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short* _pusData)</synopsis>
-        <synopsis>SciErr getHypermatOfInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piData)</synopsis>
-        <synopsis>SciErr getHypermatOfUnsignedInt32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int* _puiData)</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>引数</title>
-        <variablelist>
-            <varlistentry>
-                <term>_pvCtx</term>
-                <listitem>
-                    <para>
-                        Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_piAddress</term>
-                <listitem>
-                    <para>
-                        Scilab変数のアドレス.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_dims</term>
-                <listitem>
-                    <para>
-                        ハイパー行列の次元.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_ndims</term>
-                <listitem>
-                    <para>
-                        次元の数.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>_p*Data</term>
-                <listitem>
-                    <para>
-                        データ.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>戻り値</title>
-        <para>SciErr構造体, フィールド iErr は
-            エラー番号を保持します (エラーがない場合は 0).
-        </para>
-    </refsection>
-    <refsection>
-        <title>ゲートウェイのソース</title>
-        <programlisting role="code_gateway">
-            <![CDATA[ 
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "sciprint.h"
-#include "MALLOC.h"
-int hypermatIntExample(char *fname,unsigned long fname_len)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        void * data = NULL;
-        int htype = 0;
-        int precision;
-        sciErr = getHypermatType(pvApiCtx, piAddr, &htype);
-        if (sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return sciErr.iErr;
-        }
-        if (htype == sci_ints)
-        {
-            sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-            switch (precision)
-            {
-            case SCI_INT8:
-                sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT8:
-                sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_INT16:
-                sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT16:
-                sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_INT32:
-                sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            case SCI_UINT32:
-                sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data);
-                if(sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data);
-                if (sciErr.iErr)
-                {
-                    printError(&sciErr, 0);
-                    return sciErr.iErr;
-                }
-                break;
-            }
-        }
-        else
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1);
-            return 1;
-        }
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-    return 0;
-}]]>
-        </programlisting>
-    </refsection>
-    <refsection>
-        <title>Scilab テストスクリプト</title>
-        <programlisting role="code_scilab"><![CDATA[ 
-a = hypermat([1 2 3], int8(1:6));
-b = hypermat([1 2 3], uint8(1:6));
-c = hypermat([1 2 3], int16(1:6));
-d = hypermat([1 2 3], uint16(1:6));
-e = hypermat([1 2 3], int32(1:6));
-f = hypermat([1 2 3], uint32(1:6));
-hypermatExampleInt(a) == a
-hypermatExampleInt(b) == b
-hypermatExampleInt(c) == c
-hypermatExampleInt(d) == d
-hypermatExampleInt(e) == e
-hypermatExampleInt(f) == f
- ]]></programlisting>
-    </refsection>
-</refentry>
index 4d7e57a..34e6ec9 100644 (file)
@@ -364,6 +364,14 @@ extern "C" {
     int checkInputArgumentType(void* _pvCtx, int _iVar, int _iType);
 
     /**
+    * Reshape variable with new size
+    * @param[in] _iDimsArray array of dimensions
+    * @param[in] _iDims number of dimension
+    * @return if the operation succeeded ( 0 ) or not ( !0 )
+    */
+    SciErr reshapeArray(void* _pvCtx, int* _piAddress, int* _iDimsArray, int _iDims);
+
+    /**
      * Check if a matrix is empty
      * @param[in] _piAddress variable address
      * @return 1 for true and 0 for false
diff --git a/scilab/modules/api_scilab/includes/api_hypermat.h b/scilab/modules/api_scilab/includes/api_hypermat.h
deleted file mode 100644 (file)
index 5e36af1..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- */
-
-#ifndef __HYPERMAT_API__
-#define __HYPERMAT_API__
-
-#if !defined(__INTERNAL_API_SCILAB__)
-#error Do not include api_hypermat.h. Include api_scilab.h instead.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**************************************/
-/*   Hypermatrices matrix functions   */
-/**************************************/
-
-/**
- * Check if the variable type is double
- * @param[in] _piAddress variable address
- * @return 1 for true and 0 for false
- */
-int isHypermatType(void* _pvCtx, int* _piAddress);
-
-/**
- * Check if the variable is complex
- * @param[in] _piAddress variable address
- * @return 1 for true and 0 for false
- */
-int isHypermatComplex(void* _pvCtx, int* _piAddress);
-
-/**
- * Get the base type
- * @param[in] _piAddress variable address
- * @param[out] _piType return the base type
- */
-SciErr getHypermatType(void *_pvCtx, int *_piAddress, int *_piType);
-
-/**
- * Get integer precision ( SCI_xINTx )
- * @param[in] _piAddress variable address
- * @param[out] _piPrecison return integer precision ( SCI_xINTx )
- */
-SciErr getHypermatOfIntegerPrecision(void *_pvCtx, int *_piAddress, int *_piPrecision);
-
-/**
- * Get the hypermatrix dimensions
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- */
-SciErr getHypermatDimensions(void *_pvCtx, int *_piAddress, int **_dims, int *_ndims);
-
-/**
- * Get the hypermatrix entries address
- * @param[in] _piAddress variable address
- * @param[out] return _piEntriesAddress entries address
- */
-SciErr getHypermatEntries(void* _pvCtx, int* _piAddress, int ** _piEntriesAddress);
-
-/**
- * Get polynomial variable name
- * @param[in] _piAddress variable address
- * @param[out] _pstVarName return variable name of polynomials
- * @param[out] _piVarNameLen return length of _pstVarName
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr getHypermatPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piNbCoef return number of polynomial coefficients for each element
- * @param[out] _pdblReal return real coefficients
- */
-SciErr getHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piNbCoef return number of polynomial coefficients for each element
- * @param[out] _pdblReal return real coefficients
- * @param[out] _pdblImg return imaginary coefficients
- */
-SciErr getComplexHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piLength return strings lengths
- * @param[out] _pstStrings return the strings data
- */
-SciErr getHypermatOfString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, char** _pstStrings);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piLength return strings lengths
- * @param[out] _pwstStrings return the strings data
- */
-SciErr getHypermatOfWideString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, wchar_t** _pwstStrings);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _pdblReal return the double data
- */
-SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _pdblReal return the real data
- * @param[out] _pdblImg return the imaginary data
- */
-SciErr getComplexHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal, double** _pdblImg);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _pucData8 return the unsigned char data
- */
-SciErr getHypermatOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char** _pucData8);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _pcData8 return the char data
- */
-SciErr getHypermatOfInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char** _pcData8);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _pusData16 return the unsigned short data
- */
-SciErr getHypermatOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short** _pusData16);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _psData16 return the short data
- */
-SciErr getHypermatOfInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short** _psData16);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _puiData32 return the unsigned int data
- */
-SciErr getHypermatOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int** _puiData32);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piData32 return the int data
- */
-SciErr getHypermatOfInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piData32);
-
-/**
- * Get the hypermatrix dimensions and data
- * @param[in] _piAddress variable address
- * @param[out] _dims return the dimensions
- * @param[out] _ndims return the number of dimensions
- * @param[out] _piBool return the boolean data
- */
-SciErr getHypermatOfBoolean(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piBool);
-
-/**
- * Create a polynomial hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _pstVarName polynomial variable name
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _piNbCoef number of polynomial coefficients for each element
- * @param[in] _pdblReal pointer to real coefficients
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int *_dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal);
-
-/**
- * Create a complex polynomial hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _pstVarName polynomial variable name
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _piNbCoef number of polynomial coefficients for each element
- * @param[in] _pdblReal pointer to real coefficients
- * @param[in] _pdblImg pointer to imaginary coefficients
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createComplexHypermatOfPoly(void* _pvCtx, int _iVar, char* _pstVarName, int *_dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg);
-
-/**
- * Create a double hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pdblReal pointer to real data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfDouble(void* _pvCtx, int _iVar, int *_dims, int _ndims, const double* _pdblReal);
-SciErr allocHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, double** _pdblReal);
-
-/**
- * Create a complex hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pdblReal pointer to real data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createComplexHypermatOfDouble(void* _pvCtx, int _iVar, int *_dims, int _ndims, const double* _pdblReal, const double* _pdblImg);
-
-/**
- * Create a boolean hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _piBool pointer to boolean data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfBoolean(void* _pvCtx, int _iVar, int *_dims, int _ndims, const int* _piBool);
-
-/**
- * Create a string hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pstStrings pointer to string data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfString(void* _pvCtx, int _iVar, int *_dims, int _ndims, const char* const* _pstStrings);
-
-/**
- * Create a int8 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pcData8 pointer to char data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfInteger8(void* _pvCtx, int _iVar, int *_dims, int _ndims, const char* _pcData8);
-
-/**
- * Create a uint8 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pucData8 pointer to unsigned char data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfUnsignedInteger8(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned char* _pucData8);
-
-/**
- * Create a int16 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _psData16 pointer to short data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfInteger16(void* _pvCtx, int _iVar, int *_dims, int _ndims, const short* _psData16);
-
-/**
- * Create a uint16 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _pusData16 pointer to unsigned short data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfUnsignedInteger16(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned short* _pusData16);
-
-/**
- * Create a int32 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _piData32 pointer to int data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfInteger32(void* _pvCtx, int _iVar, int *_dims, int _ndims, const int* _piData32);
-
-/**
- * Create a uint32 hypermatrix
- * @param[in] _iVar variable number
- * @param[in] _dims the dimensions
- * @param[in] _ndims the number of dimensions
- * @param[in] _puiData32 pointer to unsigned int data
- * @return if the operation succeeded ( 0 ) or not ( !0 )
- */
-SciErr createHypermatOfUnsignedInteger32(void* _pvCtx, int _iVar, int *_dims, int _ndims, const unsigned int* _puiData32);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __HYPERMAT_API__ */
index caa4228..3a99b55 100644 (file)
@@ -48,7 +48,7 @@
 #include "api_error.h"
 #include "api_handle.h"
 #include "api_optional.h"
-#include "api_hypermat.h"
+
 #undef __INTERNAL_API_SCILAB__
 
 #include "core_math.h"
index a5ae2dc..41826a9 100644 (file)
@@ -152,6 +152,22 @@ int checkInputArgument(void* _pvCtx, int _iMin, int _iMax)
     return 0;
 }
 
+SciErr reshapeArray(void* _pvCtx, int* _piAddress, int* _iDimsArray, int _iDims)
+{
+    SciErr sciErr = sciErrInit();
+
+    InternalType* pIT = ((InternalType*)_piAddress);
+    if (pIT->isGenericType() == false)
+    {
+        addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "resizeArray", _("matrix"));
+        return sciErr;
+    }
+
+    pIT->getAs<GenericType>()->reshape(_iDimsArray, _iDims);
+
+    return sciErr;
+}
+
 /*--------------------------------------------------------------------------*/
 int checkInputArgumentAtLeast(void* _pvCtx, int _iMin)
 {
@@ -403,19 +419,20 @@ static SciErr getinternalVarAddress(void *_pvCtx, int _iVar, int **_piAddress)
     GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
     typed_list in = *pStr->m_pIn;
     optional_list opt = *pStr->m_pOpt;
-    int*    piRetCount = pStr->m_piRetCount;
+    int* piRetCount = pStr->m_piRetCount;
+    int iInputSize = in.size() + opt.size();
 
     /* we accept a call to getVarAddressFromPosition after a create... call */
-    if (_iVar > in.size() + opt.size())
+    if (_iVar > *piRetCount + iInputSize)
     {
         //manage case where _iVar > in.size(), then look in out to get recent create variable.
         addErrorMessage(&sciErr, API_ERROR_INVALID_POSITION, _("%s: bad call to %s! (1rst argument).\n"), pStr->m_pstName, "getVarAddressFromPosition");
         return sciErr;
     }
 
-    if (in.size() == 0)
+    if (_iVar > iInputSize)
     {
-        *_piAddress = NULL;
+        *_piAddress = (int*)pStr->m_pOut[_iVar - iInputSize - 1];
     }
     else if (_iVar > in.size())
     {
diff --git a/scilab/modules/api_scilab/src/cpp/api_hypermat.cpp b/scilab/modules/api_scilab/src/cpp/api_hypermat.cpp
deleted file mode 100644 (file)
index 8cf0198..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- * Please note that piece of code will be rewrited for the Scilab 6 family
- * However, the API (profile of the functions in the header files) will be
- * still available and supported in Scilab 6.
- */
-
-#include <stdio.h>
-#include "api_scilab.h"
-#include "api_internal_common.h"
-#include "api_internal_double.h"
-#include "localization.h"
-
-#include "call_scilab.h"
-
-int isHypermatType(void* _pvCtx, int* _piAddress)
-{
-    if (_piAddress[0] != sci_mlist || _piAddress[1] != 3)
-    {
-        // not a mlist or not containing 3 fields
-        return 0;
-    }
-
-    if (_piAddress[6] != sci_strings || _piAddress[7] != 1 || _piAddress[8] != 3)
-    {
-        // first field is not a matrix 1x3 of strings
-        return 0;
-    }
-
-    if (_piAddress[11] - 1 != 2 || _piAddress[14] != 17 || _piAddress[15] != 22)
-    {
-        // mlist type is not of length 2 or type is not "hm" ("hm" == [17 22])
-        return 0;
-    }
-
-    return 1;
-}
-
-int isHypermatComplex(void* _pvCtx, int* _piAddress)
-{
-    int * _piItemAddress = NULL;
-    SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress);
-    if (sciErr.iErr)
-    {
-        return 0;
-    }
-
-    return isVarComplex(_pvCtx, _piItemAddress);
-}
-
-SciErr getHypermatType(void *_pvCtx, int *_piAddress, int *_piType)
-{
-    int * _piItemAddress = NULL;
-    SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getVarType(_pvCtx, _piItemAddress, _piType);
-}
-
-SciErr getHypermatOfIntegerPrecision(void *_pvCtx, int *_piAddress, int *_piPrecision)
-{
-    int * _piItemAddress = NULL;
-    SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &_piItemAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfIntegerPrecision(_pvCtx, _piItemAddress, _piPrecision);
-}
-
-SciErr getHypermatDimensions(void *_pvCtx, int *_piAddress, int **_dims, int *_ndims)
-{
-    int * _piItemAddress = NULL;
-    int _rows = 0;
-
-    SciErr sciErr = getListItemAddress(_pvCtx, _piAddress, 2, &_piItemAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfInteger32(_pvCtx, _piItemAddress, &_rows, _ndims, _dims);
-}
-
-SciErr getHypermatEntries(void* _pvCtx, int* _piAddress, int ** _piEntriesAddress)
-{
-    return getListItemAddress(_pvCtx, _piAddress, 3, _piEntriesAddress);
-}
-
-SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfDouble(_pvCtx, entries, &_rows, &_cols, _pdblReal);
-}
-
-SciErr getComplexHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double** _pdblReal, double** _pdblImg)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getComplexMatrixOfDouble(_pvCtx, entries, &_rows, &_cols, _pdblReal, _pdblImg);
-}
-
-SciErr getHypermatPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int* _piVarNameLen)
-{
-    int * entries = NULL;
-
-    SciErr sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getPolyVariableName(_pvCtx, entries, _pstVarName, _piVarNameLen);
-}
-
-SciErr getHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfPoly(_pvCtx, entries, &_rows, &_cols, _piNbCoef, _pdblReal);
-}
-
-SciErr getComplexHypermatOfPoly(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getComplexMatrixOfPoly(_pvCtx, entries, &_rows, &_cols, _piNbCoef, _pdblReal, _pdblImg);
-}
-
-SciErr getHypermatOfString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, char** _pstStrings)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfString(_pvCtx, entries, &_rows, &_cols, _piLength, _pstStrings);
-}
-
-SciErr getHypermatOfWideString(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int* _piLength, wchar_t** _pwstStrings)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfWideString(_pvCtx, entries, &_rows, &_cols, _piLength, _pwstStrings);
-}
-
-SciErr getHypermatOfInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, char** _pcData8)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfInteger8(_pvCtx, entries, &_rows, &_cols, _pcData8);
-}
-
-SciErr getHypermatOfUnsignedInteger8(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned char** _pucData8)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfUnsignedInteger8(_pvCtx, entries, &_rows, &_cols, _pucData8);
-}
-
-SciErr getHypermatOfInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, short** _psData16)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfInteger16(_pvCtx, entries, &_rows, &_cols, _psData16);
-}
-
-SciErr getHypermatOfUnsignedInteger16(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned short** _pusData16)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfUnsignedInteger16(_pvCtx, entries, &_rows, &_cols, _pusData16);
-}
-
-SciErr getHypermatOfInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piData32)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfInteger32(_pvCtx, entries, &_rows, &_cols, _piData32);
-}
-
-SciErr getHypermatOfUnsignedInteger32(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, unsigned int** _puiData32)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfUnsignedInteger32(_pvCtx, entries, &_rows, &_cols, _puiData32);
-}
-
-SciErr getHypermatOfBoolean(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, int** _piBool)
-{
-    int * entries = NULL;
-    int _rows = 0;
-    int _cols = 0;
-
-    SciErr sciErr = getHypermatDimensions(_pvCtx, _piAddress, _dims, _ndims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = getHypermatEntries(_pvCtx, _piAddress, &entries);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return getMatrixOfBoolean(_pvCtx, entries, &_rows, &_cols, _piBool);
-}
-
-SciErr createEmptyHypermat(void *_pvCtx, int _iVar, const int * _dims, int _ndims, int ** _piAddress)
-{
-    static const char * fields[3] = {"hm", "dims", "entries"};
-
-    SciErr sciErr = createMList(_pvCtx, _iVar, 3, _piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, *_piAddress, 1, 1, 3, fields);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    sciErr = createMatrixOfInteger32InList(_pvCtx, _iVar, *_piAddress, 2, 1, _ndims, _dims);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfString(void *_pvCtx, int _iVar, int * _dims, int _ndims, const char* const* _pstStrings)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pstStrings);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfPoly(void *_pvCtx, int _iVar, char* _pstVarName, int * _dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfPolyInList(_pvCtx, _iVar, _piAddress, 3, _pstVarName, iNbElements, 1, _piNbCoef, _pdblReal);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createComplexHypermatOfPoly(void *_pvCtx, int _iVar, char* _pstVarName, int * _dims, int _ndims, const int* _piNbCoef, const double* const* _pdblReal, const double* const* _pdblImg)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createComplexMatrixOfPolyInList(_pvCtx, _iVar, _piAddress, 3, _pstVarName, iNbElements, 1, _piNbCoef, _pdblReal, _pdblImg);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr allocHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, double** _pdblReal)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = allocMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, const double * _pdblReal)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createComplexHypermatOfDouble(void *_pvCtx, int _iVar, int * _dims, int _ndims, const double * _pdblReal, const double * _pdblImg)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createComplexMatrixOfDoubleInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pdblReal, _pdblImg);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfBoolean(void *_pvCtx, int _iVar, int * _dims, int _ndims, const int * _piBool)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfBooleanInList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _piBool);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfInteger8(void *_pvCtx, int _iVar, int * _dims, int _ndims, const char * _pcData8)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfInteger8InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pcData8);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfUnsignedInteger8(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned char * _pucData8)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfUnsignedInteger8InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pucData8);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfInteger16(void *_pvCtx, int _iVar, int * _dims, int _ndims, const short * _psData16)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfInteger16InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _psData16);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfUnsignedInteger16(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned short * _pusData16)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfUnsignedInteger16InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _pusData16);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfInteger32(void *_pvCtx, int _iVar, int * _dims, int _ndims, const int * _piData32)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfInteger32InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _piData32);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
-
-SciErr createHypermatOfUnsignedInteger32(void *_pvCtx, int _iVar, int * _dims, int _ndims, const unsigned int * _puiData32)
-{
-    int * _piAddress = NULL;
-    int iNbElements = 1;
-
-    SciErr sciErr = createEmptyHypermat(_pvCtx, _iVar, _dims, _ndims, &_piAddress);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    for (int i = 0; i < _ndims; i++)
-    {
-        iNbElements *= _dims[i];
-    }
-
-    sciErr = createMatrixOfUnsignedInteger32InList(_pvCtx, _iVar, _piAddress, 3, iNbElements, 1, _puiData32);
-    if (sciErr.iErr)
-    {
-        return sciErr;
-    }
-
-    return sciErr;
-}
index 84a401b..93e1467 100644 (file)
@@ -84,30 +84,30 @@ SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCo
     String *pS = ((InternalType*)_piAddress)->getAs<types::String>();
 
     //non cummulative length
-    for (int i = 0 ; i < *_piRows **_piCols ; i++)
-    {
-        char* pstTemp = wide_string_to_UTF8(pS->get(i));
-        _piLength[i] = (int)strlen(pstTemp);
-        FREE(pstTemp);
-    }
-
+    int iSize = pS->getSize();
     if (_pstStrings == NULL || *_pstStrings == NULL)
     {
-        return sciErr;
+        for (int i = 0 ; i < iSize; i++)
+        {
+            char* pstTemp = wide_string_to_UTF8(pS->get(i));
+            _piLength[i] = (int)strlen(pstTemp);
+            FREE(pstTemp);
+        }
     }
-
-    for (int i = 0 ; i < pS->getSize() ; i++)
+    else
     {
-        if (_pstStrings[i] == NULL)
+        for (int i = 0 ; i < iSize; i++)
         {
-            addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString");
-            return sciErr;
-        }
+            if (_pstStrings[i] == NULL)
+            {
+                addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString");
+                return sciErr;
+            }
 
-        char* pstTemp = wide_string_to_UTF8(pS->get(i));
-        strcpy(_pstStrings[i], pstTemp);
-        FREE(pstTemp);
+            strcpy(_pstStrings[i], wide_string_to_UTF8(pS->get(i)));
+        }
     }
+
     return sciErr;
 }
 /*--------------------------------------------------------------------------*/
@@ -253,24 +253,27 @@ SciErr getMatrixOfWideString(void* _pvCtx, int* _piAddress, int* _piRows, int* _
     }
 
     String *pS = ((InternalType*)_piAddress)->getAs<types::String>();
-    for (int i = 0 ; i < pS->getSize() ; i++)
-    {
-        _piwLength[i] = (int)wcslen(pS->get(i));
-    }
 
+    int iSize = pS->getSize();
     if (_pwstStrings == NULL || *_pwstStrings == NULL)
     {
-        return sciErr;
+        for (int i = 0 ; i < iSize; i++)
+        {
+            _piwLength[i] = (int)wcslen(pS->get(i));
+        }
     }
-
-    for (int i = 0 ; i < pS->getSize() ; i++)
+    else
     {
-        if (_pwstStrings[i] == NULL)
+        for (int i = 0 ; i < pS->getSize() ; i++)
         {
-            addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString");
-            return sciErr;
+            if (_pwstStrings[i] == NULL)
+            {
+                addErrorMessage(&sciErr, API_ERROR_INVALID_SUBSTRING_POINTER, _("%s: Invalid argument address"), "getMatrixOfString");
+                return sciErr;
+            }
+
+            _pwstStrings[i] = os_wcsdup(pS->get(i));
         }
-        wcscpy( _pwstStrings[i], pS->get(i));
     }
 
     return sciErr;
index e4d981d..e184442 100644 (file)
 /* desc : a set of functions used to return values in Scilab              */
 /*------------------------------------------------------------------------*/
 
-//#include "api_scilab.h"
 #include "returnProperty.h"
 #include <string.h>
 #include "sci_malloc.h"
 #include "double.hxx"
+#include "int.hxx"
 #include "string.hxx"
 #include "graphichandle.hxx"
 
 /*--------------------------------------------------------------------------*/
 void* sciReturnEmptyMatrix()
 {
-    //createEmptyMatrix(_pvCtx, nbInputArgument(_pvCtx) + 1);
     return types::Double::Empty();
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnString(const char * value)
 {
-    //createSingleString(_pvCtx, nbInputArgument(_pvCtx) + 1, value)
     return new types::String(value);
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnChar(char value)
 {
-    //createSingleString(_pvCtx, nbInputArgument(_pvCtx) + 1, pstValue)
     char pstValue[2] = {value, 0};//createSingleString needs null terminated characters string
     return new types::String(pstValue);
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnDouble(double value)
 {
-    //createScalarDouble(_pvCtx, nbInputArgument(_pvCtx) + 1, value)
     return new types::Double(value);
 }
 /*--------------------------------------------------------------------------*/
@@ -55,15 +51,6 @@ void* sciReturnInt(int value)
 /*--------------------------------------------------------------------------*/
 void* sciReturnRowVector(const double values[], int nbValues)
 {
-    //SciErr sciErr = createMatrixOfDouble(_pvCtx, nbInputArgument(_pvCtx) + 1, 1, nbValues, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //return 0;
-
     double* pdbl = NULL;
     types::Double* pD = new types::Double(1, nbValues, &pdbl);
     for (int i = 0 ; i < nbValues ; i++)
@@ -75,15 +62,6 @@ void* sciReturnRowVector(const double values[], int nbValues)
 /*--------------------------------------------------------------------------*/
 void* sciReturnRowVectorFromInt(const int values[], int nbValues)
 {
-    //SciErr sciErr = createMatrixOfDoubleAsInteger(_pvCtx, nbInputArgument(_pvCtx) + 1, 1, nbValues, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //return 0;
-
     double* pdbl = NULL;
     types::Double* pD = new types::Double(1, nbValues, &pdbl);
     for (int i = 0 ; i < nbValues ; i++)
@@ -105,28 +83,11 @@ void* sciReturnRowStringVector(char * values[], int nbValues)
 /*--------------------------------------------------------------------------*/
 void* sciReturnHandle(long handle)
 {
-    //createScalarHandle(_pvCtx, nbInputArgument(_pvCtx) + 1, handle)
     return new types::GraphicHandle(handle);
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnRowHandleVector(const long handles[], int nbValues)
 {
-    //int i = 0;
-    //long long* pH = NULL;
-    //SciErr sciErr = allocMatrixOfHandle(_pvCtx, nbInputArgument(_pvCtx) + 1, 1, nbValues, &pH);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //for (i = 0 ; i < nbValues ; i++)
-    //{
-    //    pH[i] = handles[i];
-    //}
-
-    //return 0;
-
     types::GraphicHandle* pH = new types::GraphicHandle(1, nbValues);
     long long* pHandle = pH->get();
     for (int i = 0 ; i < nbValues ; i++)
@@ -138,21 +99,6 @@ void* sciReturnRowHandleVector(const long handles[], int nbValues)
 /*--------------------------------------------------------------------------*/
 void* sciReturnColHandleVector(const long handles[], int nbValues)
 {
-    //int i = 0;
-    //long long* pH = NULL;
-    //SciErr sciErr = allocMatrixOfHandle(_pvCtx, nbInputArgument(_pvCtx) + 1, nbValues, 1, &pH);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //for (i = 0 ; i < nbValues ; i++)
-    //{
-    //    pH[i] = handles[i];
-    //}
-
-    //return 0;
     types::GraphicHandle* pH = new types::GraphicHandle(nbValues, 1);
     long long* pHandle = pH->get();
     for (int i = 0 ; i < nbValues ; i++)
@@ -164,14 +110,6 @@ void* sciReturnColHandleVector(const long handles[], int nbValues)
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrix(double values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfDouble(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //return 0;
     double* pdbl = NULL;
     types::Double* pD = new types::Double(nbRow, nbCol, &pdbl);
     for (int i = 0 ; i < nbRow * nbCol ; i++)
@@ -183,15 +121,6 @@ void* sciReturnMatrix(double values[], int nbRow, int nbCol)
 /*--------------------------------------------------------------------------*/
 void* sciReturnStringMatrix(char * values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfString(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    //return 0;
-
     types::String* pS = new types::String(nbRow, nbCol);
     for (int i = 0 ; i < nbRow * nbCol ; i++)
     {
@@ -221,109 +150,73 @@ void* sciReturnUserData(const int * userData, int userDataSize)
 /*--------------------------------------------------------------------------*/
 void* sciReturnHypermatOfDouble(int dims[], int ndims, double values[])
 {
-    //SciErr sciErr = createHypermatOfDouble(_pvCtx, nbInputArgument(_pvCtx) + 1, dims, ndims, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::Double* pOut = new types::Double(ndims, dims);
+    double* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(double));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnHypermatOfInteger8(int dims[], int ndims, char values[])
 {
-    //SciErr sciErr = createHypermatOfInteger8(_pvCtx, nbInputArgument(_pvCtx) + 1, dims, ndims, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::Int8* pOut = new types::Int8(ndims, dims);
+    char* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(char));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnHypermatOfUnsignedInteger8(int dims[], int ndims, unsigned char values[])
 {
-    //SciErr sciErr = createHypermatOfUnsignedInteger8(_pvCtx, nbInputArgument(_pvCtx) + 1, dims, ndims, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::UInt8* pOut = new types::UInt8(ndims, dims);
+    unsigned char* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(unsigned char));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfInteger8(char values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfInteger8(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::Int8* pOut = new types::Int8(nbRow, nbCol);
+    char* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(char));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfUnsignedInteger8(unsigned char values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfUnsignedInteger8(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::UInt8* pOut = new types::UInt8(nbRow, nbCol);
+    unsigned char* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(unsigned char));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfInteger16(short values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfInteger16(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::Int16* pOut = new types::Int16(nbRow, nbCol);
+    short* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(short));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfUnsignedInteger16(unsigned short values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfUnsignedInteger16(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::UInt16* pOut = new types::UInt16(nbRow, nbCol);
+    unsigned short* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(unsigned short));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfInteger32(int values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfInteger32(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::Int32* pOut = new types::Int32(nbRow, nbCol);
+    int* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(int));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
 void* sciReturnMatrixOfUnsignedInteger32(unsigned int values[], int nbRow, int nbCol)
 {
-    //SciErr sciErr = createMatrixOfUnsignedInteger32(_pvCtx, nbInputArgument(_pvCtx) + 1, nbRow, nbCol, values);
-    //if (sciErr.iErr)
-    //{
-    //    printError(&sciErr, 0);
-    //    return 1;
-    //}
-
-    return 0;
+    types::UInt32* pOut = new types::UInt32(nbRow, nbCol);
+    unsigned int* pValues = pOut->get();
+    memcpy(pValues, values, pOut->getSize() * sizeof(unsigned int));
+    return pOut;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.c b/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.c
deleted file mode 100644 (file)
index 448e5dc..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013 - Scilab Enterprises
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "sciprint.h"
-
-int hypermatExample(char *fname, void* pvApiCtx)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        double* pdblReal = NULL;
-        double* pdblImg = NULL;
-
-        if (isHypermatComplex(pvApiCtx, piAddr))
-        {
-            sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-        else
-        {
-            sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-
-    return 0;
-}
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref b/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.dia.ref
deleted file mode 100644 (file)
index 1558ecc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises 
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- CLI SHELL MODE -->
-ilib_verbose(0);
-mkdir(pathconvert(TMPDIR+"/hypermatExample"));
-cd(pathconvert(TMPDIR+"/hypermatExample"));
-copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatExample.c",pathconvert(TMPDIR+"/hypermatExample/hypermatExample.c",%F));
-cflags = "-I"+SCI+"/modules/localization/includes";
-ilib_build("hypermatExample",["hypermatExample","hypermatExample"],"hypermatExample.c",[],"","",cflags);
-exec("loader.sce");
-a = hypermat([1 2 3], ones(1,6));
-b = a + %i*hypermat([1 2 3], 1:6);
-assert_checkequal(hypermatExample(a), a);
-assert_checkequal(hypermatExample(b), b);
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.tst b/scilab/modules/api_scilab/tests/unit_tests/hypermatExample.tst
deleted file mode 100644 (file)
index fb4d195..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises 
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-
-// <-- CLI SHELL MODE -->
-ilib_verbose(0);
-mkdir(pathconvert(TMPDIR+"/hypermatExample"));
-cd(pathconvert(TMPDIR+"/hypermatExample"));
-copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatExample.c",pathconvert(TMPDIR+"/hypermatExample/hypermatExample.c",%F));
-cflags = "-I"+SCI+"/modules/localization/includes";
-ilib_build("gw_hypermatExample",["hypermatExample","hypermatExample"],"hypermatExample.c",[],"","",cflags);
-exec("loader.sce");
-
-a = hypermat([1 2 3], ones(1,6));
-b = a + %i*hypermat([1 2 3], 1:6);
-
-assert_checkequal(hypermatExample(a), a);
-assert_checkequal(hypermatExample(b), b);
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.c b/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.c
deleted file mode 100644 (file)
index 154dc9f..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013 - Scilab Enterprises
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "sciprint.h"
-
-int hypermatIntExample(char *fname, void* pvApiCtx)
-{
-    SciErr sciErr;
-    int* piAddr = NULL;
-    int iType   = 0;
-    int iRet    = 0;
-
-    CheckInputArgument(pvApiCtx, 1, 1);
-    CheckOutputArgument(pvApiCtx, 0, 1);
-
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if (isEmptyMatrix(pvApiCtx, piAddr))
-    {
-        iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
-        if (iRet)
-        {
-            return iRet;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = 0;
-    }
-    else if (isHypermatType(pvApiCtx, piAddr))
-    {
-        int * dims = NULL;
-        int ndims;
-        void * data = NULL;
-        int htype = 0;
-        int precision;
-
-        sciErr = getHypermatType(pvApiCtx, piAddr, &htype);
-        if (sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return sciErr.iErr;
-        }
-
-        if (htype == sci_ints)
-        {
-            sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr, &precision);
-            if (sciErr.iErr)
-            {
-                printError(&sciErr, 0);
-                return sciErr.iErr;
-            }
-
-            switch (precision)
-            {
-                case SCI_INT8:
-                    sciErr = getHypermatOfInteger8(pvApiCtx, piAddr, &dims, &ndims, (char*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const char*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-                case SCI_UINT8:
-                    sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr, &dims, &ndims, (unsigned char*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned char*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-                case SCI_INT16:
-                    sciErr = getHypermatOfInteger16(pvApiCtx, piAddr, &dims, &ndims, (short*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const short*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-                case SCI_UINT16:
-                    sciErr = getHypermatOfUnsignedInteger16(pvApiCtx, piAddr, &dims, &ndims, (unsigned short*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned short*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-                case SCI_INT32:
-                    sciErr = getHypermatOfInteger32(pvApiCtx, piAddr, &dims, &ndims, (int*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const int*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-                case SCI_UINT32:
-                    sciErr = getHypermatOfUnsignedInteger32(pvApiCtx, piAddr, &dims, &ndims, (unsigned int*)&data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-
-                    sciErr = createHypermatOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, (const unsigned int*)data);
-                    if (sciErr.iErr)
-                    {
-                        printError(&sciErr, 0);
-                        return sciErr.iErr;
-                    }
-                    break;
-            }
-        }
-        else
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1);
-            return 1;
-        }
-
-        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
-    }
-
-    return 0;
-}
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref b/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.dia.ref
deleted file mode 100644 (file)
index 6fef267..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises 
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- CLI SHELL MODE -->
-ilib_verbose(0);
-mkdir(pathconvert(TMPDIR+"/hypermatIntExample"));
-cd(pathconvert(TMPDIR+"/hypermatIntExample"));
-copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatIntExample.c",pathconvert(TMPDIR+"/hypermatIntExample/hypermatIntExample.c",%F));
-cflags = "-I"+SCI+"/modules/localization/includes";
-ilib_build("hypermatIntExample",["hypermatIntExample","hypermatIntExample"],"hypermatIntExample.c",[],"","",cflags);
-exec("loader.sce");
-a = hypermat([1 2 3], int8(1:6));
-b = hypermat([1 2 3], uint8(1:6));
-c = hypermat([1 2 3], int16(1:6));
-d = hypermat([1 2 3], uint16(1:6));
-e = hypermat([1 2 3], int32(1:6));
-f = hypermat([1 2 3], uint32(1:6));
-assert_checkequal(hypermatIntExample(a), a);
-assert_checkequal(hypermatIntExample(b), b);
-assert_checkequal(hypermatIntExample(c), c);
-assert_checkequal(hypermatIntExample(d), d);
-assert_checkequal(hypermatIntExample(e), e);
-assert_checkequal(hypermatIntExample(f), f);
diff --git a/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst b/scilab/modules/api_scilab/tests/unit_tests/hypermatIntExample.tst
deleted file mode 100644 (file)
index abb1421..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises 
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-
-// <-- CLI SHELL MODE -->
-ilib_verbose(0);
-mkdir(pathconvert(TMPDIR+"/hypermatIntExample"));
-cd(pathconvert(TMPDIR+"/hypermatIntExample"));
-copyfile(SCI+"/modules/api_scilab/tests/unit_tests/hypermatIntExample.c",pathconvert(TMPDIR+"/hypermatIntExample/hypermatIntExample.c",%F));
-cflags = "-I"+SCI+"/modules/localization/includes";
-ilib_build("gw_hypermatIntExample",["hypermatIntExample","hypermatIntExample"],"hypermatIntExample.c",[],"","",cflags);
-exec("loader.sce");
-
-a = hypermat([1 2 3], int8(1:6));
-b = hypermat([1 2 3], uint8(1:6));
-c = hypermat([1 2 3], int16(1:6));
-d = hypermat([1 2 3], uint16(1:6));
-e = hypermat([1 2 3], int32(1:6));
-f = hypermat([1 2 3], uint32(1:6));
-
-assert_checkequal(hypermatIntExample(a), a);
-assert_checkequal(hypermatIntExample(b), b);
-assert_checkequal(hypermatIntExample(c), c);
-assert_checkequal(hypermatIntExample(d), d);
-assert_checkequal(hypermatIntExample(e), e);
-assert_checkequal(hypermatIntExample(f), f);
index a1966e6..c35bb44 100644 (file)
@@ -379,9 +379,6 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     */
     xmlCleanupParser();
 
-    /* cleanup HDF5 */
-    HDF5cleanup();
-
     /* Cleanup the parser state */
     Parser::cleanup();
 
index 913b8b5..1ac6ac4 100644 (file)
@@ -226,7 +226,6 @@ GRAPHICS_C_SOURCES = \
     src/c/getHandleProperty/set_mark_style_property.c \
     src/c/getHandleProperty/set_mark_background_property.c \
     src/c/getHandleProperty/set_interp_color_mode_property.c \
-    src/c/getHandleProperty/set_data_property.c \
     src/c/getHandleProperty/set_font_angle_property.c \
     src/c/getHandleProperty/set_auto_clear_property.c \
     src/c/getHandleProperty/set_arrow_size_factor_property.c \
@@ -400,7 +399,8 @@ GRAPHICS_C_SOURCES = \
     src/c/addColor.c
 
 GRAPHICS_CXX_SOURCES = \
-    src/cpp/configgraphicvariable.cpp
+    src/cpp/configgraphicvariable.cpp \
+    src/cpp/set_data_property.cpp
 
 GATEWAY_C_SOURCES = \
     sci_gateway/c/sci_swap_handles.c \
index 8d6d52c..ffb0926 100644 (file)
@@ -371,7 +371,6 @@ am__objects_1 = src/c/libscigraphics_algo_la-GetCommandArg.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_mark_style_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_mark_background_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_interp_color_mode_property.lo \
-       src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_font_angle_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_auto_clear_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_arrow_size_factor_property.lo \
@@ -544,7 +543,8 @@ am__objects_1 = src/c/libscigraphics_algo_la-GetCommandArg.lo \
        src/c/libscigraphics_algo_la-name2rgb.lo \
        src/c/libscigraphics_algo_la-addColor.lo
 am__objects_2 =  \
-       src/cpp/libscigraphics_algo_la-configgraphicvariable.lo
+       src/cpp/libscigraphics_algo_la-configgraphicvariable.lo \
+       src/cpp/libscigraphics_algo_la-set_data_property.lo
 am_libscigraphics_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscigraphics_algo_la_OBJECTS = $(am_libscigraphics_algo_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
@@ -1213,7 +1213,6 @@ GRAPHICS_C_SOURCES = \
     src/c/getHandleProperty/set_mark_style_property.c \
     src/c/getHandleProperty/set_mark_background_property.c \
     src/c/getHandleProperty/set_interp_color_mode_property.c \
-    src/c/getHandleProperty/set_data_property.c \
     src/c/getHandleProperty/set_font_angle_property.c \
     src/c/getHandleProperty/set_auto_clear_property.c \
     src/c/getHandleProperty/set_arrow_size_factor_property.c \
@@ -1387,7 +1386,8 @@ GRAPHICS_C_SOURCES = \
     src/c/addColor.c
 
 GRAPHICS_CXX_SOURCES = \
-    src/cpp/configgraphicvariable.cpp
+    src/cpp/configgraphicvariable.cpp \
+    src/cpp/set_data_property.cpp
 
 GATEWAY_C_SOURCES = \
     sci_gateway/c/sci_swap_handles.c \
@@ -2333,9 +2333,6 @@ src/c/getHandleProperty/libscigraphics_algo_la-set_mark_background_property.lo:
 src/c/getHandleProperty/libscigraphics_algo_la-set_interp_color_mode_property.lo:  \
        src/c/getHandleProperty/$(am__dirstamp) \
        src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
-src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo:  \
-       src/c/getHandleProperty/$(am__dirstamp) \
-       src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
 src/c/getHandleProperty/libscigraphics_algo_la-set_font_angle_property.lo:  \
        src/c/getHandleProperty/$(am__dirstamp) \
        src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
@@ -2826,6 +2823,8 @@ src/cpp/$(DEPDIR)/$(am__dirstamp):
        @: > src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libscigraphics_algo_la-configgraphicvariable.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libscigraphics_algo_la-set_data_property.lo:  \
+       src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 
 libscigraphics-algo.la: $(libscigraphics_algo_la_OBJECTS) $(libscigraphics_algo_la_DEPENDENCIES) $(EXTRA_libscigraphics_algo_la_DEPENDENCIES) 
        $(AM_V_CXXLD)$(CXXLINK) $(am_libscigraphics_algo_la_rpath) $(libscigraphics_algo_la_OBJECTS) $(libscigraphics_algo_la_LIBADD) $(LIBS)
@@ -3386,7 +3385,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_current_figure_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_bounds_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_mapping_property.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_datatip_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_datatips_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_default_axes_property.Plo@am__quote@
@@ -3509,6 +3507,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_zoom_box_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_zoom_state_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphics_algo_la-configgraphicvariable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics_gw.Plo@am__quote@
 
@@ -4922,13 +4921,6 @@ src/c/getHandleProperty/libscigraphics_algo_la-set_interp_color_mode_property.lo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_interp_color_mode_property.lo `test -f 'src/c/getHandleProperty/set_interp_color_mode_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_interp_color_mode_property.c
 
-src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo: src/c/getHandleProperty/set_data_property.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo -MD -MP -MF src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Tpo -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo `test -f 'src/c/getHandleProperty/set_data_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_data_property.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Tpo src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/getHandleProperty/set_data_property.c' object='src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_data_property.lo `test -f 'src/c/getHandleProperty/set_data_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_data_property.c
-
 src/c/getHandleProperty/libscigraphics_algo_la-set_font_angle_property.lo: src/c/getHandleProperty/set_font_angle_property.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/getHandleProperty/libscigraphics_algo_la-set_font_angle_property.lo -MD -MP -MF src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_font_angle_property.Tpo -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_font_angle_property.lo `test -f 'src/c/getHandleProperty/set_font_angle_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_font_angle_property.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_font_angle_property.Tpo src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_font_angle_property.Plo
@@ -6570,6 +6562,13 @@ src/cpp/libscigraphics_algo_la-configgraphicvariable.lo: src/cpp/configgraphicva
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscigraphics_algo_la-configgraphicvariable.lo `test -f 'src/cpp/configgraphicvariable.cpp' || echo '$(srcdir)/'`src/cpp/configgraphicvariable.cpp
 
+src/cpp/libscigraphics_algo_la-set_data_property.lo: src/cpp/set_data_property.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscigraphics_algo_la-set_data_property.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Tpo -c -o src/cpp/libscigraphics_algo_la-set_data_property.lo `test -f 'src/cpp/set_data_property.cpp' || echo '$(srcdir)/'`src/cpp/set_data_property.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Tpo src/cpp/$(DEPDIR)/libscigraphics_algo_la-set_data_property.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/set_data_property.cpp' object='src/cpp/libscigraphics_algo_la-set_data_property.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscigraphics_algo_la-set_data_property.lo `test -f 'src/cpp/set_data_property.cpp' || echo '$(srcdir)/'`src/cpp/set_data_property.cpp
+
 src/nographics/libscigraphics_disable_la-nographics_gw.lo: src/nographics/nographics_gw.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_disable_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/nographics/libscigraphics_disable_la-nographics_gw.lo -MD -MP -MF src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics_gw.Tpo -c -o src/nographics/libscigraphics_disable_la-nographics_gw.lo `test -f 'src/nographics/nographics_gw.cpp' || echo '$(srcdir)/'`src/nographics/nographics_gw.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics_gw.Tpo src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics_gw.Plo
index 4efe4a7..7c4c9eb 100644 (file)
@@ -81,7 +81,7 @@
     <ClCompile>
       <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../threads/includes;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@@ -117,7 +117,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../threads/includes;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@@ -153,7 +153,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../threads/includes;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -199,7 +199,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;includes/handleDrawing;src/c;src/c/getHandleProperty;../../libs/intl;../../libs/Eigen/includes;../../java/jdk/include;../../java/jdk/include/win32;../output_stream/includes;../fileio/includes;../gui/includes;../core/includes;../localization/includes;../renderer/includes;../jvm/includes;../action_binding/includes;../graphic_export/includes;../string/includes;../windows_tools/includes;../api_scilab/includes;../elementary_functions/includes;../graphic_objects/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../threads/includes;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHICS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -243,6 +243,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="sci_gateway\c\sci_color.c" />
     <ClCompile Include="sci_gateway\c\sci_light.c" />
     <ClCompile Include="sci_gateway\c\sci_name2rgb.c" />
+    <ClCompile Include="src\cpp\set_data_property.cpp" />
     <ClCompile Include="src\c\addColor.c" />
     <ClCompile Include="src\c\Axes.c" />
     <ClCompile Include="src\c\axesScale.c" />
@@ -570,7 +571,6 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="src\c\getHandleProperty\set_current_figure_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_data_bounds_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_data_mapping_property.c" />
-    <ClCompile Include="src\c\getHandleProperty\set_data_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_datatip_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_default_values_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_event_handler_enable_property.c" />
index 1f84ba5..aa16299 100644 (file)
     <ClCompile Include="src\c\getHandleProperty\set_data_mapping_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\c\getHandleProperty\set_data_property.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="src\c\getHandleProperty\set_datatip_property.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\set_default_values_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\get_border_property.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\set_data_property.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\c\getHandleProperty\set_datatip_property.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\Axes.h">
     <None Include="locales\graphics.pot" />
     <None Include="locales\graphics.pot" />
     <None Include="locales\graphics.pot" />
+    <None Include="locales\graphics.pot" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="graphic.rc">
index d3d0b9c..d7e6423 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef __SET_DATA_PROPERTY_H__
 #define __SET_DATA_PROPERTY_H__
 
+#include "getPropertyAssignedValue.h"
+
 int setchampdata(void* _pvCtx, int iObjUID, AssignedList * tlist);
 
 int setgrayplotdata(void* _pvCtx, int iObjUID, AssignedList * tlist);
@@ -6,6 +6,7 @@
  * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
  * Copyright (C) 2010 - DIGITEO - Bruno JOFRET
  * Copyright (C) 2010-2011 - DIGITEO - Manuel Juliachs
+ * Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
 /*        a handle                                                        */
 /*------------------------------------------------------------------------*/
 
-#include <string.h>
+#include "types.hxx"
+#include "double.hxx"
+#include "int.hxx"
 
-#include "setHandleProperty.h"
+extern "C"
+{
+#include "set_data_property.h"
+#include "setGraphicObjectProperty.h"
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+#include "SetPropertyStatus.h"
 #include "SetProperty.h"
-#include "GetProperty.h"
-#include "getPropertyAssignedValue.h"
 #include "Scierror.h"
 #include "localization.h"
-#include "SetPropertyStatus.h"
+#include "Matplot.h"
+#include "setHandleProperty.h"
 #include "BasicAlgos.h"
-#include "set_data_property.h"
-#include "sci_malloc.h"
-#include "sci_types.h"
-#include "api_scilab.h"
+}
 
-#include "graphicObjectProperties.h"
-#include "setGraphicObjectProperty.h"
-#include "getGraphicObjectProperty.h"
-#include "Matplot.h"
+int set_data_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
+{
+    int type = -1;
+    int *piType = &type;
+
+    getGraphicObjectProperty(iObjUID, __GO_TYPE__, jni_int, (void **)&piType);
+
+    if (type == __GO_CHAMP__)
+    {
+        AssignedList* tlist = NULL;
+        int status = -1;
+
+        if (!(valueType  == sci_tlist))
+        {
+            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
+            return SET_PROPERTY_ERROR;
+        }
+
+        /* we should have 4 properties in the tlist */
+        tlist = createAssignedList(_pvCtx, 3, 4);
+        if (tlist == NULL)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        status = setchampdata(_pvCtx, iObjUID, tlist);
+        destroyAssignedList(tlist);
+        return status;
+    }
+    else if (type == __GO_GRAYPLOT__)
+    {
+        AssignedList * tlist = NULL;
+        int status = -1;
+
+        if (!(valueType  == sci_tlist))
+        {
+            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
+            return SET_PROPERTY_ERROR;
+        }
+
+        /* we should have 3 properties in the tlist */
+        tlist = createAssignedList(_pvCtx, 3, 3);
+        if (tlist == NULL)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        status = setgrayplotdata(_pvCtx, iObjUID, tlist);
+        destroyAssignedList(tlist);
+        return status;
+    }
+    else if (type == __GO_FAC3D__ || type == __GO_PLOT3D__)
+    {
+        AssignedList * tlist = NULL;
+        int status = -1;
+        int listSize = 0;
+
+        if (!(valueType  == sci_tlist))
+        {
+            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
+            return SET_PROPERTY_ERROR;
+        }
+
+        listSize = getStackListNbElement(_pvCtx, 3);
+
+        if (listSize == 3)
+        {
+            tlist = createAssignedList(_pvCtx, 3, 3);
+        }
+        else if (listSize == 4)
+        {
+            tlist = createAssignedList(_pvCtx, 3, 4);
+        }
+        else
+        {
+            Scierror(999, _("Wrong size for input argument: %d or %d expected.\n"), 4, 5);
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (tlist == NULL)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        status = set3ddata(_pvCtx, iObjUID, tlist);
+        destroyAssignedList(tlist);
+        return status;
+
+    }
+    else if (type == __GO_MATPLOT__)
+    {
+        int datatype = 0;
+        int * piDataType = &datatype;
+        int imagetype = 0;
+        int * piImageType = &imagetype;
+        int dataorder = 0;
+        int * piDataOrder = &dataorder;
+        int plottype = -1;
+        int gridSize[4];
+        int numX = 0;
+        int *piNumX = &numX;
+        int numY = 0;
+        int *piNumY = &numY;
+
+        bool bRGB = false;
+
+        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_NUM_X__, jni_int, (void **)&piNumX);
+        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_NUM_Y__, jni_int, (void **)&piNumY);
+        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_TYPE__, jni_int, (void **)&piDataType);
+        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__, jni_int, (void **)&piImageType);
+        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_ORDER__, jni_int, (void **)&piDataOrder);
+
+        gridSize[1] = 1;
+        gridSize[3] = 1;
+
+        types::InternalType* pIT = (types::InternalType*)_pvData;
+        if (pIT->isGenericType() == false)
+        {
+            Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+            return 1;
+        }
+
+        types::GenericType* pGT = pIT->getAs<types::GenericType>();
+        int iDims = pGT->getDims();
+        int* piDimsArray = pGT->getDimsArray();
+
+        int iRows = piDimsArray[0];
+        int iCols = piDimsArray[1];
+
+        void* pvData = NULL;
+        if (iDims != 2 && (iDims != 3 || (piDimsArray[2] != 1 && piDimsArray[2] != 3 && piDimsArray[2] != 4)))
+        {
+            Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+            return 1;
+        }
+
+        switch (pGT->getType())
+        {
+            case types::InternalType::ScilabInt8:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_Char)
+                {
+                    plottype = buildMatplotType(MATPLOT_Char, (DataOrder)dataorder, (ImageType)imagetype);
+                    bRGB = true;
+                }
+                else if (piDimsArray[2] != 1 && (DataType)datatype != MATPLOT_HM1_Char)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM1_Char, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 3 && (DataType)datatype != MATPLOT_HM3_Char)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM3_Char, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 4 && (DataType)datatype != MATPLOT_HM4_Char)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM4_Char, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+
+                pvData = (void*)pGT->getAs<types::Int8>()->get();
+                break;
+            }
+            case types::InternalType::ScilabUInt8:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_UChar)
+                {
+                    plottype = buildMatplotType(MATPLOT_UChar, (DataOrder)dataorder, (ImageType)imagetype);
+                    bRGB = true;
+                }
+                else if ((DataType)datatype != MATPLOT_HM1_Char)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM1_UChar, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 3 && (DataType)datatype != MATPLOT_HM3_UChar)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM3_UChar, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 4 && (DataType)datatype != MATPLOT_HM4_UChar)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM4_UChar, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+
+                pvData = (void*)pGT->getAs<types::UInt8>()->get();
+                break;
+            }
+            case types::InternalType::ScilabInt16:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_Short)
+                {
+                    plottype = buildMatplotType(MATPLOT_Short, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+                    return 1;
+                }
+                break;
+            }
+            case types::InternalType::ScilabUInt16:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_UShort)
+                {
+                    plottype = buildMatplotType(MATPLOT_UShort, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+                    return 1;
+                }
+                break;
+            }
+            case types::InternalType::ScilabInt32:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_Int)
+                {
+                    plottype = buildMatplotType(MATPLOT_Int, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+                    return 1;
+                }
+                break;
+            }
+            case types::InternalType::ScilabUInt32:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_UInt)
+                {
+                    plottype = buildMatplotType(MATPLOT_UInt, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+                    return 1;
+                }
+                break;
+            }
+            case types::InternalType::ScilabDouble:
+            {
+                if (iDims == 2 && (DataType)datatype != MATPLOT_Double)
+                {
+                    plottype = buildMatplotType(MATPLOT_Double, (DataOrder)dataorder, (ImageType)imagetype);
+                    iRows = nbRow;
+                    iCols = nbCol;
+                    pvData = _pvData;
+                    break;
+                }
+                else if ((DataType)datatype != MATPLOT_HM1_Double)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM1_Double, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 3 && (DataType)datatype != MATPLOT_HM3_Double)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM3_Double, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+                else if (piDimsArray[2] != 4 && (DataType)datatype != MATPLOT_HM4_Double)
+                {
+                    plottype = buildMatplotType(MATPLOT_HM4_Double, (DataOrder)dataorder, (ImageType)imagetype);
+                }
+
+                pvData = (void*)pGT->getAs<types::Double>()->get();
+                break;
+            }
+            default:
+            {
+                Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
+                return 1;
+            }
+        }
+
+        if (bRGB)
+        {
+            if ((ImageType)imagetype == MATPLOT_RGB)
+            {
+                const int mb3 = iRows / 3;
+                if (mb3 * 3 == iRows)
+                {
+                    iRows = mb3;
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong size for input argument #%d: The number of rows must be a multiple of 3.\n"), "data", 1);
+                    return 1;
+                }
+            }
+            else if ((ImageType)imagetype == MATPLOT_RGBA)
+            {
+                const int mb4 = iRows / 4;
+                if (mb4 * 4 == iRows)
+                {
+                    iRows = mb4;
+                }
+                else
+                {
+                    Scierror(202, _("%s: Wrong size for input argument #%d: The number of rows must be a multiple of 4.\n"), "data", 1);
+                    return 1;
+                }
+            }
+        }
+
+        if (numX != iCols + 1 || numY != iRows + 1)
+        {
+            gridSize[0] = iCols + 1;
+            gridSize[2] = iRows + 1;
+            setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4);
+        }
+
+        if (plottype != -1)
+        {
+            setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_INFOS__, &plottype, jni_int, 1);
+        }
 
+        setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, pvData, jni_double_vector, iRows * iCols);
+    }
+    else  /* F.Leray 02.05.05 : "data" case for others (using sciGetPoint routine inside GetProperty.c) */
+    {
+        if (valueType != sci_matrix)
+        {
+            Scierror(999, _("Incompatible type for property ''%s''.\n"), "data");
+            return SET_PROPERTY_ERROR;
+        }
+
+        return sciSetPoint(iObjUID, (double*)_pvData, &nbRow, &nbCol);
+    }
+    return SET_PROPERTY_ERROR;
+}
+/*------------------------------------------------------------------------*/
 
 /*--------------------------------------------------------------------------*/
 /* F.Leray 29.04.05 */
@@ -54,14 +380,14 @@ int setchampdata(void* _pvCtx, int iObjUID, AssignedList * tlist)
     int numberArrows = 0;
     int dimensions[2];
 
-    double* vx  = NULL;
-    double* vy  = NULL;
+    double* vx = NULL;
+    double* vy = NULL;
     double* vfx = NULL;
     double* vfy = NULL;
 
     /* get parameters */
-    vx  = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[0], &nbCol[0]);
-    vy  = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[1], &nbCol[1]);
+    vx = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[0], &nbCol[0]);
+    vy = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[1], &nbCol[1]);
     vfx = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[2], &nbCol[2]);
     vfy = getCurrentDoubleMatrixFromList(_pvCtx, tlist, &nbRow[3], &nbCol[3]);
 
@@ -93,8 +419,8 @@ int setchampdata(void* _pvCtx, int iObjUID, AssignedList * tlist)
 
     setGraphicObjectProperty(iObjUID, __GO_BASE_X__, vx, jni_double_vector, dimensions[0]);
     setGraphicObjectProperty(iObjUID, __GO_BASE_Y__, vy, jni_double_vector, dimensions[1]);
-    setGraphicObjectProperty(iObjUID, __GO_DIRECTION_X__, vfx, jni_double_vector, dimensions[0]*dimensions[1]);
-    setGraphicObjectProperty(iObjUID, __GO_DIRECTION_Y__, vfy, jni_double_vector, dimensions[0]*dimensions[1]);
+    setGraphicObjectProperty(iObjUID, __GO_DIRECTION_X__, vfx, jni_double_vector, dimensions[0] * dimensions[1]);
+    setGraphicObjectProperty(iObjUID, __GO_DIRECTION_Y__, vfy, jni_double_vector, dimensions[0] * dimensions[1]);
 
     return SET_PROPERTY_SUCCEED;
 }
@@ -141,9 +467,9 @@ int setgrayplotdata(void* _pvCtx, int iObjUID, AssignedList * tlist)
     }
 
     /*
-     * Update the x and y vectors dimensions
-     * These vectors are column ones
-     */
+    * Update the x and y vectors dimensions
+    * These vectors are column ones
+    */
     gridSize[0] = nbRow[0];
     gridSize[1] = 1;
     gridSize[2] = nbRow[1];
@@ -160,7 +486,7 @@ int setgrayplotdata(void* _pvCtx, int iObjUID, AssignedList * tlist)
 
     setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_X__, pvecx, jni_double_vector, nbRow[0]);
     setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_Y__, pvecy, jni_double_vector, nbRow[1]);
-    setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_Z__, pvecz, jni_double_vector, nbRow[2]*nbCol[2]);
+    setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_Z__, pvecz, jni_double_vector, nbRow[2] * nbCol[2]);
 
     return SET_PROPERTY_SUCCEED;
 }
@@ -398,9 +724,9 @@ int set3ddata(void* _pvCtx, int iObjUID, AssignedList * tlist)
     setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_Y__, pvecy, jni_double_vector, m2 * n2);
 
     /*
-     * Plot 3d case not treated for now
-     * To be implemented
-     */
+    * Plot 3d case not treated for now
+    * To be implemented
+    */
     if (isFac3d == 1)
     {
         if (getAssignedListNbElement(tlist) == 4) /* F.Leray There is a color matrix */
@@ -430,417 +756,3 @@ int set3ddata(void* _pvCtx, int iObjUID, AssignedList * tlist)
 
     return SET_PROPERTY_SUCCEED;
 }
-/*--------------------------------------------------------------------------*/
-int set_data_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
-{
-    int type = -1;
-    int *piType = &type;
-
-    getGraphicObjectProperty(iObjUID, __GO_TYPE__, jni_int, (void **)&piType);
-
-    if (type == __GO_CHAMP__)
-    {
-        AssignedList* tlist = NULL;
-        int status = -1;
-
-        if (!(valueType  == sci_tlist))
-        {
-            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
-            return SET_PROPERTY_ERROR;
-        }
-
-        /* we should have 4 properties in the tlist */
-        tlist = createAssignedList(_pvCtx, 3, 4);
-        if (tlist == NULL)
-        {
-            return SET_PROPERTY_ERROR;
-        }
-
-        status = setchampdata(_pvCtx, iObjUID, tlist);
-        destroyAssignedList(tlist);
-        return status;
-    }
-    else if (type == __GO_GRAYPLOT__)
-    {
-        AssignedList * tlist = NULL;
-        int status = -1;
-
-        if (!(valueType  == sci_tlist))
-        {
-            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
-            return SET_PROPERTY_ERROR;
-        }
-
-        /* we should have 3 properties in the tlist */
-        tlist = createAssignedList(_pvCtx, 3, 3);
-        if (tlist == NULL)
-        {
-            return SET_PROPERTY_ERROR;
-        }
-
-        status = setgrayplotdata(_pvCtx, iObjUID, tlist);
-        destroyAssignedList(tlist);
-        return status;
-    }
-    else if (type == __GO_FAC3D__ || type == __GO_PLOT3D__)
-    {
-        AssignedList * tlist = NULL;
-        int status = -1;
-        int listSize = 0;
-
-        if (!(valueType  == sci_tlist))
-        {
-            Scierror(999, _("Wrong type for input argument: A tlist expected.\n"));
-            return SET_PROPERTY_ERROR;
-        }
-
-        listSize = getStackListNbElement(_pvCtx, 3);
-
-        if (listSize == 3)
-        {
-            tlist = createAssignedList(_pvCtx, 3, 3);
-        }
-        else if (listSize == 4)
-        {
-            tlist = createAssignedList(_pvCtx, 3, 4);
-        }
-        else
-        {
-            Scierror(999, _("Wrong size for input argument: %d or %d expected.\n"), 4, 5);
-            return SET_PROPERTY_ERROR;
-        }
-
-        if (tlist == NULL)
-        {
-            return SET_PROPERTY_ERROR;
-        }
-
-        status = set3ddata(_pvCtx, iObjUID, tlist);
-        destroyAssignedList(tlist);
-        return status;
-
-    }
-    else if (type == __GO_MATPLOT__)
-    {
-        int datatype = 0;
-        int * piDataType = &datatype;
-        int imagetype = 0;
-        int * piImageType = &imagetype;
-        int dataorder = 0;
-        int * piDataOrder = &dataorder;
-        int plottype = -1;
-        int gridSize[4];
-        int numX = 0;
-        int *piNumX = &numX;
-        int numY = 0;
-        int *piNumY = &numY;
-        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_NUM_X__, jni_int, (void **)&piNumX);
-        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_NUM_Y__, jni_int, (void **)&piNumY);
-        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_TYPE__, jni_int, (void **)&piDataType);
-        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__, jni_int, (void **)&piImageType);
-        getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_ORDER__, jni_int, (void **)&piDataOrder);
-
-        gridSize[1] = 1;
-        gridSize[3] = 1;
-
-        if (valueType == sci_mlist)
-        {
-            if (isHypermatType(_pvCtx, _pvData))
-            {
-                int htype = 0;
-                int ndims = 0;
-                int * dims = NULL;
-                int precision;
-                SciErr sciErr;
-                void * l1 = NULL;
-
-                sciErr = getHypermatType(_pvCtx, _pvData, &htype);
-                if (sciErr.iErr)
-                {
-                    Scierror(202, _("%s: Cannot get the hypermatrix data type for argument #%d.\n"), "data", 1);
-                    return 1;
-                }
-
-                if (htype == sci_ints)
-                {
-                    sciErr = getHypermatOfIntegerPrecision(_pvCtx, _pvData, &precision);
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the hypermatrix data type for argument #%d.\n"), "data", 1);
-                        return 1;
-                    }
-
-                    if (precision != SCI_UINT8 && precision != SCI_INT8)
-                    {
-                        Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                        return 1;
-                    }
-
-                    if (precision == SCI_UINT8)
-                    {
-                        sciErr = getHypermatOfUnsignedInteger8(_pvCtx, _pvData, &dims, &ndims, (unsigned char **)&l1);
-                    }
-                    else
-                    {
-                        sciErr = getHypermatOfInteger8(_pvCtx, _pvData, &dims, &ndims, (char **)&l1);
-                    }
-
-                    if (sciErr.iErr || ndims != 3 || (dims[1] != 1 && dims[2] != 3 && dims[2] != 4))
-                    {
-                        Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                        return 1;
-                    }
-
-                    if (dims[2] == 1)
-                    {
-                        if (precision == SCI_INT8 && (DataType)datatype != MATPLOT_HM1_Char)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM1_Char, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                        else if (precision == SCI_UINT8 && (DataType)datatype != MATPLOT_HM1_UChar)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM1_UChar, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                    }
-                    else if (dims[2] == 3)
-                    {
-                        if (precision == SCI_INT8 && (DataType)datatype != MATPLOT_HM3_Char)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM3_Char, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                        else if (precision == SCI_UINT8 && (DataType)datatype != MATPLOT_HM3_UChar)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM3_UChar, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                    }
-                    else if (dims[2] == 4)
-                    {
-                        if (precision == SCI_INT8 && (DataType)datatype != MATPLOT_HM4_Char)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM4_Char, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                        else if (precision == SCI_UINT8 && (DataType)datatype != MATPLOT_HM4_UChar)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM4_UChar, (DataOrder)dataorder, (ImageType)imagetype);
-                        }
-                    }
-                }
-                else if (htype == sci_matrix)
-                {
-                    sciErr = getHypermatOfDouble(_pvCtx, _pvData, &dims, &ndims, (double **)&l1);
-
-                    if (sciErr.iErr || ndims != 3 || (dims[2] != 1 && dims[2] != 3 && dims[2] != 4))
-                    {
-                        Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                        return 1;
-                    }
-
-                    if (dims[2] == 1 && (DataType)datatype != MATPLOT_HM1_Double)
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM1_Double, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    else if (dims[2] == 3 && (DataType)datatype != MATPLOT_HM3_Double)
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM3_Double, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    else if (dims[2] == 4 && (DataType)datatype != MATPLOT_HM4_Double)
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM4_Double, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                }
-                else
-                {
-                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                    return 1;
-                }
-
-                if (numX != dims[1] + 1 || numY != dims[0] + 1)
-                {
-                    gridSize[0] = dims[1] + 1;
-                    gridSize[2] = dims[0] + 1;
-                    setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4);
-                }
-
-                if (plottype != -1)
-                {
-                    setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_INFOS__, &plottype, jni_int, 1);
-                }
-                setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, l1, jni_double_vector, dims[0] * dims[1]);
-            }
-        }
-        else if (valueType == sci_ints)
-        {
-            int m = 0;
-            int n = 0;
-            void * l = NULL;
-            SciErr sciErr;
-            int precision;
-
-            sciErr = getMatrixOfIntegerPrecision(_pvCtx, _pvData, &precision);
-            if (sciErr.iErr)
-            {
-                Scierror(999, _("%s: Cannot get the integer type for argument #%d.\n"), "data", 1);
-                printError(&sciErr, 0);
-                return 1;
-            }
-
-            switch (precision)
-            {
-                case SCI_INT8 :
-                    sciErr = getMatrixOfInteger8(_pvCtx, _pvData, &m, &n, (char **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_Char)
-                    {
-                        plottype = buildMatplotType(MATPLOT_Char, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                case SCI_UINT8 :
-                    sciErr = getMatrixOfUnsignedInteger8(_pvCtx, _pvData, &m, &n, (unsigned char **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_UChar)
-                    {
-                        plottype = buildMatplotType(MATPLOT_UChar, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                case SCI_INT16 :
-                    sciErr = getMatrixOfInteger16(_pvCtx, _pvData, &m, &n, (short **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_Short)
-                    {
-                        plottype = buildMatplotType(MATPLOT_Short, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                case SCI_UINT16 :
-                    sciErr = getMatrixOfUnsignedInteger16(_pvCtx, _pvData, &m, &n, (unsigned short **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_UShort)
-                    {
-                        plottype = buildMatplotType(MATPLOT_UShort, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                case SCI_INT32 :
-                    sciErr = getMatrixOfInteger32(_pvCtx, _pvData, &m, &n, (int **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_Int)
-                    {
-                        plottype = buildMatplotType(MATPLOT_Int, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                case SCI_UINT32 :
-                    sciErr = getMatrixOfUnsignedInteger32(_pvCtx, _pvData, &m, &n, (unsigned int **)(&l));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), "data", 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    if ((DataType)datatype != MATPLOT_UInt)
-                    {
-                        plottype = buildMatplotType(MATPLOT_UInt, (DataOrder)dataorder, (ImageType)imagetype);
-                    }
-                    break;
-                default :
-                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                    return 1;
-            }
-
-            if (precision == SCI_INT8 || precision == SCI_UINT8)
-            {
-                if ((ImageType)imagetype == MATPLOT_RGB)
-                {
-                    const int mb3 = m / 3;
-                    if (mb3 * 3 == m)
-                    {
-                        m = mb3;
-                    }
-                    else
-                    {
-                        Scierror(202, _("%s: Wrong size for input argument #%d: The number of rows must be a multiple of 3.\n"), "data", 1);
-                        return 1;
-                    }
-                }
-                else if ((ImageType)imagetype == MATPLOT_RGBA)
-                {
-                    const int mb4 = m / 4;
-                    if (mb4 * 4 == m)
-                    {
-                        m = mb4;
-                    }
-                    else
-                    {
-                        Scierror(202, _("%s: Wrong size for input argument #%d: The number of rows must be a multiple of 4.\n"), "data", 1);
-                        return 1;
-                    }
-                }
-            }
-
-            if (numX != n + 1 || numY != m + 1)
-            {
-                gridSize[0] = n + 1;
-                gridSize[2] = m + 1;
-                setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4);
-            }
-
-            if (plottype != -1)
-            {
-                setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_INFOS__, &plottype, jni_int, 1);
-            }
-
-            setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, l, jni_double_vector, m * n);
-        }
-        else if (valueType == sci_matrix)
-        {
-            if (numX != nbCol + 1 || numY != nbRow + 1)
-            {
-                gridSize[0] = nbCol + 1;
-                gridSize[2] = nbRow + 1;
-                setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4);
-            }
-
-            if ((DataType)datatype != MATPLOT_Double)
-            {
-                plottype = buildMatplotType(MATPLOT_Double, (DataOrder)dataorder, (ImageType)imagetype);
-                setGraphicObjectPropertyAndNoWarn(iObjUID, __GO_DATA_MODEL_MATPLOT_DATA_INFOS__, &plottype, jni_int, 1);
-            }
-
-            setGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, _pvData, jni_double_vector, nbRow * nbCol);
-        }
-    }
-    else  /* F.Leray 02.05.05 : "data" case for others (using sciGetPoint routine inside GetProperty.c) */
-    {
-        if (valueType != sci_matrix)
-        {
-            Scierror(999, _("Incompatible type for property ''%s''.\n"), "data");
-            return SET_PROPERTY_ERROR;
-        }
-
-        return sciSetPoint(iObjUID, (double*)_pvData, &nbRow, &nbCol);
-    }
-    return SET_PROPERTY_ERROR;
-}
-/*------------------------------------------------------------------------*/
index a67ec22..c872bed 100644 (file)
@@ -22,6 +22,7 @@ extern "C"
 #include "callFunctionFromGateway.h"
 #include "api_scilab.h"
 #include "sci_malloc.h"
+#include "h5_fileManagement.h"
 }
 /*--------------------------------------------------------------------------*/
 int Initialize(void)
@@ -37,6 +38,8 @@ int Finalize(void)
     org_modules_hdf5::H5Type::cleanMap();
     //org_modules_hdf5::H5VariableScope::clearScope();
     org_modules_hdf5::H5Object::clearRoot();
+    /* cleanup HDF5 */
+    HDF5cleanup();
     return 0;
 }
 /*--------------------------------------------------------------------------*/
index 85a6f09..b3640ed 100644 (file)
@@ -189,9 +189,30 @@ public:
             }
             else
             {
-                int * list = getHypermatrix(pvApiCtx, lhsPosition, parentList, listPosition, flip);
-                alloc(pvApiCtx, lhsPosition, (int)_totalSize, 1, list, 3, &newData);
-                H5DataConverter::C2FHypermatrix((int)_ndims, _dims, _totalSize, static_cast<T *>(getData()), newData, flip);
+                int* pNewDataVar = NULL;
+                int i = 0;
+                int indims = (int)_ndims;
+                int* piDimsArray = new int[indims];
+
+                alloc(pvApiCtx, lhsPosition, (int)_totalSize, 1, parentList, listPosition, &newData);
+                if (parentList)
+                {
+                    getListItemAddress(pvApiCtx, parentList, listPosition, &pNewDataVar);
+                }
+                else
+                {
+                    getVarAddressFromPosition(pvApiCtx, lhsPosition, &pNewDataVar);
+                }
+
+                for (i = 0; i < indims; i++)
+                {
+                    piDimsArray[i] = (int)_dims[i];
+                }
+
+                reshapeArray(pvApiCtx, pNewDataVar, piDimsArray, indims);
+                delete[] piDimsArray;
+
+                H5DataConverter::C2FHypermatrix(indims, _dims, _totalSize, static_cast<T *>(getData()), newData, flip);
             }
         }
     }
index d34ba21..9424348 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
+ * Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  *
  */
 
+#include "internal.hxx"
+#include "types.hxx"
+#include "internal.hxx"
+#include "double.hxx"
+#include "int.hxx"
+#include "string.hxx"
+#include "bool.hxx"
+
 #include "HDF5Scilab.hxx"
 
 namespace org_modules_hdf5
@@ -926,234 +935,148 @@ void HDF5Scilab::getScilabData(hid_t * type, unsigned int * ndims, hsize_t ** di
     *mustDelete = false;
     *mustDeleteContent = false;
 
-    err = getVarType(pvApiCtx, addr, &_type);
-    if (err.iErr)
+    types::InternalType* pIT = (types::InternalType*)addr;
+    if (pIT->isGenericType() == false)
+    {
+        throw H5Exception(__LINE__, __FILE__, _("%s: Datatype not handled for now."));
+    }
+
+    types::GenericType* pGT = pIT->getAs<types::GenericType>();
+    int iSize = pGT->getSize();
+
+    // get dimentions
+    *ndims = pGT->getDims();
+    int* _dims = pGT->getDimsArray();
+    *dims = new hsize_t[*ndims];
+
+    if (flip)
+    {
+        for (int i = 0; i < *ndims; i++)
+        {
+            (*dims)[i] = _dims[*ndims - 1 - i];
+        }
+    }
+    else
     {
-        throw H5Exception(__LINE__, __FILE__, _("Can not get the type of input argument #%d."), rhsPosition);
+        for (int i = 0; i < *ndims; i++)
+        {
+            (*dims)[i] = _dims[i];
+        }
     }
 
-    switch (_type)
+    // get data
+    switch (pGT->getType())
     {
-        case sci_matrix :
+        case types::InternalType::ScilabDouble:
         {
-            if (isVarComplex(pvApiCtx, addr))
+            types::Double* pDbl = pGT->getAs<types::Double>();
+            double* pdblReal = pDbl->get();
+
+            if (pDbl->isComplex())
             {
-                doublecomplex * mat = 0;
-                double * re = 0;
-                double * im = 0;
                 hid_t complex_id = H5Tcreate(H5T_COMPOUND, sizeof(doublecomplex));
                 H5Tinsert(complex_id, "real", offsetof(doublecomplex, r), H5T_NATIVE_DOUBLE);
                 H5Tinsert(complex_id, "imag", offsetof(doublecomplex, i), H5T_NATIVE_DOUBLE);
 
-                err = getComplexMatrixOfDouble(pvApiCtx, addr, &row, &col, &re, &im);
-                if (err.iErr)
-                {
-                    H5Tclose(complex_id);
-                    throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                }
+                double* pdblImg = pDbl->getImg();
+                doublecomplex* mat = new doublecomplex[iSize];
 
-                mat = new doublecomplex[row * col];
-                for (int i = 0; i < row * col; i++)
+                for (int i = 0; i < iSize; i++)
                 {
-                    mat[i].r = re[i];
-                    mat[i].i = im[i];
+                    mat[i].r = pdblReal[i];
+                    mat[i].i = pdblImg[i];
                 }
 
                 *type = complex_id;
-                *ndims = 2;
-                *dims = new hsize_t[*ndims];
-                (*dims)[0] = flip ? col : row;
-                (*dims)[1] = flip ? row : col;
                 *data = mat;
                 *mustDelete = true;
             }
             else
             {
-                double * mat = 0;
-                err = getMatrixOfDouble(pvApiCtx, addr, &row, &col, &mat);
-                if (err.iErr)
-                {
-                    throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                }
-                *type = H5Type::getBaseType(mat);
-                *ndims = 2;
-                *dims = new hsize_t[*ndims];
-                (*dims)[0] = flip ? col : row;
-                (*dims)[1] = flip ? row : col;
-                *data = mat;
+                *type = H5Type::getBaseType(pdblReal);
+                *data = pdblReal;
             }
+
             break;
         }
-        case sci_ints :
+        case types::InternalType::ScilabInt8:
         {
-            int prec = 0;
-            void * ints = 0;
-
-            err = getMatrixOfIntegerPrecision(pvApiCtx, addr, &prec);
-            if (err.iErr)
-            {
-                throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-            }
-
-            switch (prec)
-            {
-                case SCI_INT8 :
-                    err = getMatrixOfInteger8(pvApiCtx, addr, &row, &col, (char **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((char *)ints);
-                    break;
-                case SCI_UINT8 :
-                    err = getMatrixOfUnsignedInteger8(pvApiCtx, addr, &row, &col, (unsigned char **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((unsigned char *)ints);
-                    break;
-                case SCI_INT16 :
-                    err = getMatrixOfInteger16(pvApiCtx, addr, &row, &col, (short **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((short *)ints);
-                    break;
-                case SCI_UINT16 :
-                    err = getMatrixOfUnsignedInteger16(pvApiCtx, addr, &row, &col, (unsigned short **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((unsigned short *)ints);
-                    break;
-                case SCI_INT32 :
-                    err = getMatrixOfInteger32(pvApiCtx, addr, &row, &col, (int**)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((int *)ints);
-                    break;
-                case SCI_UINT32 :
-                    err = getMatrixOfUnsignedInteger32(pvApiCtx, addr, &row, &col, (unsigned int **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((unsigned int *)ints);
-                    break;
-
-#ifdef __SCILAB_INT64__
-                case SCI_INT64 :
-                    err = getMatrixOfInteger64(pvApiCtx, addr, &row, &col, (long long **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((long long *)ints);
-                    break;
-                case SCI_UINT64 :
-                    err = getMatrixOfUnsignedInteger64(pvApiCtx, addr, &row, &col, (unsigned long long **)(&ints));
-                    if (err.iErr)
-                    {
-                        throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                    }
-                    *type = H5Type::getBaseType((unsigned long long *)ints);
-                    break;
-#endif
-            }
-
-            *ndims = 2;
-            *dims = new hsize_t[*ndims];
-            (*dims)[0] = flip ? col : row;
-            (*dims)[1] = flip ? row : col;
-            *data = ints;
+            types::Int8* pIn = pGT->getAs<types::Int8>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
             break;
         }
-        case sci_strings :
+        case types::InternalType::ScilabUInt8:
         {
-            char ** matS = 0;
-            if (getAllocatedMatrixOfString(pvApiCtx, addr, &row, &col, &matS))
-            {
-                throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-            }
-            *type = H5Type::getBaseType((char **)matS);
-            *ndims = 2;
-            *dims = new hsize_t[*ndims];
-            (*dims)[0] = flip ? col : row;
-            (*dims)[1] = flip ? row : col;
-            *data = matS;
-            *mustDelete = true;
-            *mustDeleteContent = true;
+            types::UInt8* pIn = pGT->getAs<types::UInt8>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
             break;
         }
-        case sci_boolean :
+        case types::InternalType::ScilabInt16:
         {
-            int * matB;
-
-            err = getMatrixOfBoolean(pvApiCtx, addr, &row, &col, &matB);
-            if (err.iErr)
-            {
-                throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-            }
-            *type = H5Type::getBaseType((int *)matB);
-            *ndims = 2;
-            *dims = new hsize_t[*ndims];
-            (*dims)[0] = flip ? col : row;
-            (*dims)[1] = flip ? row : col;
-            *data = matB;
+            types::Int16* pIn = pGT->getAs<types::Int16>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
             break;
         }
-        case sci_mlist :
+        case types::InternalType::ScilabUInt16:
         {
-            if (isHypermatType(pvApiCtx, addr))
-            {
-                int * entries = 0;
-                int * _dims = 0;
-                int _ndims;
-
-                err = getHypermatEntries(pvApiCtx, addr, &entries);
-                if (err.iErr)
-                {
-                    throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                }
-
-                getScilabData(type, ndims, dims, data, mustDelete, mustDeleteContent, flip, entries, rhsPosition, pvApiCtx);
-                if (*dims)
-                {
-                    delete[] *dims;
-                }
-
-                err = getHypermatDimensions(pvApiCtx, addr, &_dims, &_ndims);
-                if (err.iErr)
-                {
-                    throw H5Exception(__LINE__, __FILE__, _("%s: Can not read input argument #%d."), rhsPosition);
-                }
+            types::UInt16* pIn = pGT->getAs<types::UInt16>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
+            break;
+        }
+        case types::InternalType::ScilabInt32:
+        {
+            types::Int32* pIn = pGT->getAs<types::Int32>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
+            break;
+        }
+        case types::InternalType::ScilabUInt32:
+        {
+            types::UInt32* pIn = pGT->getAs<types::UInt32>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
+            break;
+        }
+        case types::InternalType::ScilabInt64:
+        {
+            types::Int64* pIn = pGT->getAs<types::Int64>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
+            break;
+        }
+        case types::InternalType::ScilabUInt64:
+        {
+            types::UInt64* pIn = pGT->getAs<types::UInt64>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
+            break;
+        }
+        case types::InternalType::ScilabString:
+        {
+            types::String* pIn = pGT->getAs<types::String>();
+            wchar_t** pwcsIn = pIn->get();
+            char** pstrIn = new char*[iSize];
 
-                *dims = new hsize_t[_ndims];
-                if (flip)
-                {
-                    for (int i = 0; i < _ndims; i++)
-                    {
-                        (*dims)[i] = _dims[_ndims - 1 - i];
-                    }
-                }
-                else
-                {
-                    for (int i = 0; i < _ndims; i++)
-                    {
-                        (*dims)[i] = _dims[i];
-                    }
-                }
-                *ndims = _ndims;
-            }
-            else
+            for (int i = 0; i < iSize; i++)
             {
-                throw H5Exception(__LINE__, __FILE__, _("%s: Datatype not handled for now."));
+                pstrIn[i] = wide_string_to_UTF8(pwcsIn[i]);
             }
+
+            *type = H5Type::getBaseType(pstrIn);
+            *data = pstrIn;
+            *mustDelete = true;
+            *mustDeleteContent = true;
+            break;
+        }
+        case types::InternalType::ScilabBool:
+        {
+            types::Bool* pIn = pGT->getAs<types::Bool>();
+            *type = H5Type::getBaseType(pIn->get());
+            *data = pIn->get();
             break;
         }
         default :
diff --git a/scilab/modules/randlib/sci_gateway/c/sci_grand.c b/scilab/modules/randlib/sci_gateway/c/sci_grand.c
deleted file mode 100644 (file)
index 075e5e9..0000000
+++ /dev/null
@@ -1,1557 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2013 - Scilab Enterprises - Paul Bignier: added support for complexes, polynomials,
-*                                                         integers, booleans, strings and sparses.
-* Copyright (C) ENPC
-*
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* you should have received as part of this distribution.  The terms
-* are also available at
-* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
-*
-*/
-
-/*------------------------------------------------------------------------
-*    Interface for grand
-*    jpc@cermics.enpc.fr
-*    stuff to deal with several generators added
-*         by Bruno Pincon (12/11/2001)
-*
---------------------------------------------------------------------------*/
-#include <string.h>
-#include <math.h>
-#include "localization.h"
-#include "api_scilab.h"
-#include "MALLOC.h"
-
-/** external functions to be called through this interface **/
-
-#include "grand.h"
-#include "clcg4.h"
-#include "others_generators.h"
-#include "sciprint.h"
-#include "Scierror.h"
-#include "gw_randlib.h"
-
-enum {MT, KISS, CLCG4, CLCG2, URAND, FSULTRA};
-
-/* the current generator : */
-static int current_gen = MT;
-
-/* for clcg4 : the current virtual gen (current_clcg4 in [0, Maxgen]) */
-static int current_clcg4 = 0;
-
-/* clcg4 must be called with the virtual generator number */
-static unsigned long int clcg4_with_gen(void)
-{
-    return ( clcg4(current_clcg4) );
-}
-
-#define NbGenInScilab 6
-
-/*  pointers onto the generators func */
-unsigned long int (*gen[NbGenInScilab])(void) = { randmt, kiss,  clcg4_with_gen, clcg2 , urandc , fsultra};
-
-/*  names at the scilab level */
-static char *names_gen[NbGenInScilab] = { "mt",  "kiss", "clcg4", "clcg2", "urand", "fsultra" };
-
-/* all the generators provided integers in [0, RngMaxInt] :        */
-static
-unsigned long RngMaxInt[NbGenInScilab] = { 4294967295ul,  /* mt    */
-        4294967295ul,  /* kiss  */
-        2147483646ul,  /* clcg4 */
-        2147483561ul,  /* clcg2 */
-        2147483647ul,  /* urand */
-        4294967295ul
-                                         }; /* fsultra*/
-/* the factors (1/(RngMaxInt+1)) to get reals in [0,1) :           */
-static
-double factor[NbGenInScilab] = { 2.3283064365386963e-10,  /* mt    */
-                                 2.3283064365386963e-10,  /* kiss  */
-                                 4.6566128752457969e-10,  /* clcg4 */
-                                 4.6566130595601735e-10,  /* clcg2 */
-                                 4.6566128730773926e-10,  /* urand */
-                                 2.3283064365386963e-10
-                               }; /* fsultra*/
-
-
-static double* createOutputVar(void* _pvCtx, int _iVar, int _iRows, int _iCols, int* _piDims, int _iDims);
-
-double C2F(ranf)(void)
-{
-    /* random deviate from U[0,1) */
-    return ( (double) gen[current_gen]() * factor[current_gen] );
-}
-
-double ignlgi(void)
-{
-    /* random deviate from Ui[0,RngMaxInt] (direct output of the current gen) */
-    return ( (double) gen[current_gen]() );
-}
-
-double C2F(ignuin)(double *a, double *b)
-{
-    /*  random deviate from Ui[a,b]
-    *  it is assumed that : (i)  a and b are integers (stored in double)
-    *                       (ii) b-a+1 <= RngMaxInt[current_gen]
-    *  (these verif are done at the calling level)
-    *
-    *  We use the classic method with a minor difference : to choose
-    *  uniformly an int in [a,b] (ie d=b-a+1 numbers) with a generator
-    *  which provides uniformly integers in [0,RngMaxInt] (ie m=RngMaxInt+1
-    *  numbers) we do the Euclidian division :
-    *                                           m = q d + r,   r in [0,d-1]
-    *
-    *  and accept only numbers l in [0, qd-1], then the output is k = a + (l mod d)
-    *  (ie numbers falling in [qd , RngMaxInt] are rejected).
-    *  The problem is that RngMaxInt is 2^32-1 for mt and kiss so that RngMaxInt+1 = 0
-    *  with the 32 bits unsigned int arithmetic. So in place of rejected r
-    *  numbers we reject r+1 by using RngMaxInt in place of m. The constraint is
-    *  then that (b-a+1) <= RngMaxInt and if we doesn't want to deal we each generator
-    *  we take (b-a+1) <= Min RngMaxInt =  2147483561 (clcg2)
-    */
-    unsigned long k, d = (unsigned long)((*b - *a) + 1), qd;
-
-    if ( d == 1)
-    {
-        return (*a);
-    }
-
-    qd = RngMaxInt[current_gen] - RngMaxInt[current_gen] % d;
-    do
-    {
-        k = (unsigned long)ignlgi();
-    }
-    while ( k >= qd );
-    return ( *a + (double)(k % d) );
-}
-
-/**************************************************
-*  hand written interface for the randlib
-***********************************************************************/
-
-int sci_Rand(char *fname, unsigned long fname_len)
-{
-    int minrhs = 1, maxrhs = 10, minlhs = 1, maxlhs = 2;
-    int ResL, ResC, suite, m2, n2, l2, m1, n1, l1, ls, ms, ns, la, lr, lb, lc;
-    int l3, l4;
-    int i;
-    int iHyperMat = 0;
-    int iDims = 0;
-    int* piDims = NULL;
-    double* pdblData = NULL;
-
-    Nbvars = 0;
-    CheckRhs(minrhs, maxrhs);
-    CheckLhs(minlhs, maxlhs);
-    if (GetType(1) != sci_matrix && GetType(1) != 17)
-    {
-        int un = 1, deux = 2, dim_state_mt = 625, dim_state_fsultra = 40, dim_state_4 = 4;
-        GetRhsVar(1, STRING_DATATYPE, &ms, &ns, &ls);
-        if ( strcmp(cstk(ls), "getsd") == 0)
-        {
-            if ( Rhs != 1 )
-            {
-                Scierror(999, _("%s: Wrong number of input argument: %d expected with option '%s'.\n"), fname, 1, "getsd");
-                return 0;
-            }
-            if ( Lhs != 1 )
-            {
-                Scierror(999, _("%s: Wrong number of output argument: %d expected the option '%s'.\n"), fname, 1, "getsd");
-                return 0;
-            }
-
-            switch (current_gen)
-            {
-                case (MT) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &dim_state_mt, &un, &lr);
-                    get_state_mt(stk(lr));
-                    break;
-                case (KISS) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &dim_state_4, &un, &lr);
-                    get_state_kiss(stk(lr));
-                    break;
-                case (CLCG4) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &dim_state_4, &un, &lr);
-                    get_state_clcg4(current_clcg4, stk(lr));
-                    break;
-                case (CLCG2) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &deux, &un, &lr);
-                    get_state_clcg2(stk(lr));
-                    break;
-                case (URAND) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &lr);
-                    get_state_urand(stk(lr));
-                    break;
-                case (FSULTRA) :
-                    CreateVar(Rhs + 2, MATRIX_OF_DOUBLE_DATATYPE, &dim_state_fsultra, &un, &lr);
-                    get_state_fsultra(stk(lr));
-                    break;
-            };
-            LhsVar(1) = Rhs + 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if ( strcmp(cstk(ls), "setall") == 0 )
-        {
-            if ( current_gen != CLCG4 )
-            {
-                sciprint(_("The %s option affects only the clcg4 generator\n"), "setall");
-            }
-            if ( Rhs != 5 )
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 5, "setall");
-                return 0;
-            }
-            GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-            if ( m1 * n1 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                return 0;
-            }
-            GetRhsVar(3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l2);
-            if ( m1 * n1 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 3);
-                return 0;
-            }
-            GetRhsVar(4, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l3);
-            if ( m1 * n1 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 4);
-                return 0;
-            }
-            GetRhsVar(5, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l4);
-            if ( m1 * n1 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 5);
-                return 0;
-            }
-
-            if (! set_initial_seed_clcg4(*stk(l1), *stk(l2), *stk(l3), *stk(l4)) )
-            {
-                /* => seeds were not good  (info is displayed by the function) */
-                SciError(999);
-                return 0;
-            }
-            LhsVar(1) = 1;
-            PutLhsVar();
-            return(0);
-        }
-        else if ( strcmp(cstk(ls), "setsd") == 0 )
-        {
-            switch (current_gen)
-            {
-                case (MT) :
-                    if ( Rhs != 2 )
-                    {
-                        Scierror(999, _("%s: Wrong number of input arguments: %d expected for '%s' with the %s generator.\n"), fname, 2, "setsd", "mt");
-                        return 0;
-                    }
-                    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                    if ( m1 * n1 == 1)        /* simple init of mt     */
-                    {
-                        if (! set_state_mt_simple(*stk(l1)) )
-                        {
-                            SciError(999);
-                            return(0);
-                        };
-                    }
-                    else if ( m1 * n1 == 625 ) /* init of all the state */
-                    {
-                        if (! set_state_mt(stk(l1)))
-                        {
-                            SciError(999);
-                            return(0);
-                        };
-                    }
-                    else
-                    {
-                        Scierror(999, _("%s: Wrong values for input argument: Vector of %d or %d values for %s expected.\n"), fname, 1, 625, "mt");
-                        return 0;
-                    };
-                    break;
-
-                case (FSULTRA) :
-                    if ( Rhs == 2 ) /* init via a "complete" state */
-                    {
-                        GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                        if ( m1 != 40  ||  n1 != 1)
-                        {
-                            Scierror(999, _("%s: Wrong size for input argument #%d: %dx%d expected.\n"), fname, 2, 40, 1);
-                            return 0;
-                        };
-                        if (! set_state_fsultra(stk(l1)) )
-                        {
-                            SciError(999);
-                            return(0);
-                        }
-                        ;
-                    }
-                    else if ( Rhs == 3 ) /* init with 2 integers (like before) */
-                    {
-                        GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                        if ( m1 * n1 != 1)
-                        {
-                            Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                            return 0;
-                        };
-                        GetRhsVar(3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l2);
-                        if ( m1 * n1 != 1)
-                        {
-                            Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 3);
-                            return 0;
-                        };
-                        if (! set_state_fsultra_simple(*stk(l1), *stk(l2)) )
-                        {
-                            SciError(999);
-                            return(0);
-                        };
-                    }
-                    else
-                    {
-                        Scierror(999, _("%s: Wrong number of input arguments: %d or %d expected for '%s' option with the %s generator.\n"), fname, 2, 3, "setsd", "fsultra");
-                        return 0;
-                    }
-                    break;
-
-                case (KISS) :
-                case (CLCG4) :
-                    if ( Rhs != 5 )
-                    {
-                        Scierror(999, _("%s: Wrong number of input arguments: expected %d for '%s' option with the %s or %s generator.\n"), fname, 5, "setsd", "kiss", "clcg4");
-                        return 0;
-                    }
-                    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                        return 0;
-                    }
-                    GetRhsVar(3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l2);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 3);
-                        return 0;
-                    }
-                    GetRhsVar(4, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l3);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 4);
-                        return 0;
-                    }
-                    GetRhsVar(5, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l4);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 5);
-                        return 0;
-                    }
-                    if (current_gen == KISS)
-                    {
-                        if (! set_state_kiss(*stk(l1), *stk(l2), *stk(l3), *stk(l4)))
-                        {
-                            SciError(999);
-                            return 0;
-                        };
-                    }
-                    else
-                    {
-                        if (! set_seed_clcg4(current_clcg4, *stk(l1), *stk(l2), *stk(l3), *stk(l4)))
-                        {
-                            SciError(999);
-                            return 0;
-                        };
-                    }
-                    break;
-
-                case (CLCG2) :
-                    if ( Rhs != 3 )
-                    {
-                        Scierror(999, _("%s: Wrong number of input arguments: %d expected for '%s' option with the %s generator.\n"), fname, 3, "setsd", "clcg2");
-                        return 0;
-                    }
-                    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                        return 0;
-                    };
-                    GetRhsVar(3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l2);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 3);
-                        return 0;
-                    };
-                    if (! set_state_clcg2(*stk(l1), *stk(l2)))
-                    {
-                        SciError(999);
-                        return 0;
-                    };
-                    break;
-
-                case (URAND) :
-                    if ( Rhs != 2 )
-                    {
-                        Scierror(999, _("%s: Wrong number of input arguments: %d expected for '%s' option with the %s generator.\n"), fname, 2, "setsd", "urand");
-                        return 0;
-                    }
-                    GetRhsVar(2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
-                    if ( m1 * n1 != 1)
-                    {
-                        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                        return 0;
-                    };
-                    if (! set_state_urand(*stk(l1)))
-                    {
-                        SciError(999);
-                        return 0;
-                    };
-                    break;
-            };
-            LhsVar(1) = 0;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("phr2sd", cstk(ls)) == 0)
-        {
-            if ( Rhs != 2 )
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 2, "phr2sd");
-                return 0;
-            }
-            if ( Lhs > 1 )
-            {
-                Scierror(999, _("%s: Wrong number of output argument: %d expected with option '%s'.\n"), fname, 1, "phr2sd");
-
-                return 0;
-            }
-            GetRhsVar(2, STRING_DATATYPE, &m1, &n1, &l1);
-            CreateVar(3, MATRIX_OF_INTEGER_DATATYPE, &un, &deux, &l2);
-
-            C2F(phrtsd)(cstk(l1), &m1, istk(l2), istk(l2 + 1), m1);
-            LhsVar(1) = 3;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("initgn", cstk(ls)) == 0)
-        {
-            SeedType Where;
-            if ( current_gen != CLCG4 )
-            {
-                sciprint(_("%s: The %s option affects only the %s generator\n"), fname, "initgn", "clcg4");
-            }
-            if ( Rhs != 2)
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 2, "initgn");
-                return 0;
-            }
-            GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
-            if ( *istk(l1) != 0 && *istk(l1) != -1 && *istk(l1) != 1)
-            {
-                Scierror(999, _("%s: Wrong value for input argument #%d: %d, %d or %d expected.\n"), fname, 2, -1, 0, 1);
-                return 0;
-            }
-            Where = (SeedType) (*istk(l1) + 1);
-            init_generator_clcg4(current_clcg4, Where);
-            LhsVar(1) = 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("setcgn", cstk(ls)) == 0)
-        {
-            if ( current_gen != CLCG4 )
-            {
-                sciprint(_("The %s option affects only the %s generator\n"), "setcgn", "clcg4");
-            }
-            if ( Rhs != 2)
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 2, "setcgn");
-                return 0;
-            }
-            GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
-            if ( *istk(l1) < 0 || *istk(l1) > Maxgen )
-            {
-                Scierror(999, _("%s: Wrong value for input argument #%d: Must be between %d and %d.\n"), fname, 2, 0, Maxgen);
-                return 0;
-            }
-            current_clcg4 = *istk(l1);
-            LhsVar(1) = 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("advnst", cstk(ls)) == 0)
-        {
-            int k;
-            if ( current_gen != CLCG4 )
-            {
-                sciprint(_("The %s option affects only the %s generator\n"), "advnst", "clcg4");
-            }
-            if ( Rhs != 2)
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 2, "advnst");
-                return 0;
-            }
-            GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
-            k = *istk(l1);
-            if ( k < 1 )
-            {
-                Scierror(999, _("%s: Wrong value for input argument #%d: Must be > %d.\n"), fname, 2, 0);
-                return 0;
-            }
-            advance_state_clcg4(current_clcg4, k);
-            LhsVar(1) = 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("getcgn", cstk(ls)) == 0)
-        {
-            if ( Rhs != 1)
-            {
-                Scierror(999, _("%s: Wrong number of input argument: %d expected with option '%s'.\n"), fname, 1, "getcgn");
-                return 0;
-            }
-            if ( current_gen != CLCG4 )
-            {
-                sciprint(_("This information concerns only the clcg4 generator\n"));
-            }
-            CreateVar(2, MATRIX_OF_INTEGER_DATATYPE, &un, &un, &l1);
-            *istk(l1) = current_clcg4;
-            LhsVar(1) = 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("setgen", cstk(ls)) == 0)
-        {
-            int msb, nsb, lsb;
-            if ( Rhs != 2)
-            {
-                Scierror(999, _("%s: Wrong number of input arguments: %d expected with option '%s'.\n"), fname, 2, "setgen");
-                return 0;
-            }
-            GetRhsVar(2, STRING_DATATYPE, &msb, &nsb, &lsb);
-            if (strcmp("mt", cstk(lsb)) == 0)
-            {
-                current_gen = MT;
-            }
-            else if (strcmp("kiss", cstk(lsb)) == 0)
-            {
-                current_gen = KISS;
-            }
-            else if (strcmp("clcg4", cstk(lsb)) == 0)
-            {
-                current_gen = CLCG4;
-            }
-            else if (strcmp("clcg2", cstk(lsb)) == 0)
-            {
-                current_gen = CLCG2;
-            }
-            else if (strcmp("urand", cstk(lsb)) == 0)
-            {
-                current_gen = URAND;
-            }
-            else if (strcmp("fsultra", cstk(lsb)) == 0)
-            {
-                current_gen = FSULTRA;
-            }
-            else
-            {
-                Scierror(999, _("%s: Wrong value for input argument #%d: '%s', '%s', '%s', '%s', '%s' or '%s' expected.\n"), fname, 2, "mt", "kiss", "clcg4", "clcg2", "urand", "fsultra");
-                return 0;
-            }
-            LhsVar(1) = 2;
-            PutLhsVar();
-            return 0;
-        }
-        else if (strcmp("getgen", cstk(ls)) == 0)
-        {
-            int l_un = 1;
-            if ( Rhs != 1)
-            {
-                Scierror(999, _("%s: Wrong number of input argument: %d expected with option '%s'.\n"), fname, 1, "getgen");
-                return 0;
-            }
-            CreateVarFromPtr( Rhs + 2, MATRIX_OF_STRING_DATATYPE, &l_un, &l_un, &names_gen[current_gen]);
-            LhsVar(1) = Rhs + 2;
-            PutLhsVar();
-            return 0;
-        }
-        else
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: '%s' is unknown.\n"), fname, 1, cstk(ls));
-
-            return 0;
-        }
-    }
-    minrhs = 2;
-    CheckRhs(minrhs, maxrhs);
-    if ( GetType(2) == sci_matrix ) /** m,n,'string' */
-    {
-        //find all sci_matrix before sci_string.
-        SciErr sciErr;
-        int iSize = 1;
-
-        for (iDims = 2 ; iDims < Rhs ; iDims++)
-        {
-            int* piAddr = NULL;
-            sciErr = getVarAddressFromPosition(pvApiCtx, iDims + 1, &piAddr);
-            if (isDoubleType(pvApiCtx, piAddr))
-            {
-                //set hypermatrix flag
-                iHyperMat = 1;
-                continue;
-            }
-
-            if (isStringType(pvApiCtx, piAddr))
-            {
-                break;
-            }
-
-            Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, iDims);
-            return 0;
-        }
-
-        suite = iDims + 1;
-        if (iHyperMat)
-        {
-            piDims = (int*)MALLOC(sizeof(int) * iDims);
-            for (i = 0 ; i < iDims ; i++)
-            {
-                double dblVal = 0;
-                int* piAddr = NULL;
-                sciErr = getVarAddressFromPosition(pvApiCtx, i + 1 , &piAddr);
-
-                if (getScalarDouble(pvApiCtx, piAddr, &dblVal))
-                {
-                    Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, i + 1);
-                    return 0;
-                }
-
-                iSize *= (int)dblVal;
-                piDims[i] = (int)dblVal;
-            }
-
-            ResL = 1;
-            ResC = iSize;
-
-            //reset iHypermat flag to make difference between input hypermatrix cases
-            iHyperMat = 0;
-        }
-        else
-        {
-            GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
-            if ( m1 * n1 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 1);
-                return 0;
-            }
-            ResL = *istk(l1);
-            GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &m2, &n2, &l2);
-            if ( m2 * n2 != 1)
-            {
-                Scierror(999, _("%s: Wrong type for input argument #%d: Scalar expected.\n"), fname, 2);
-                return 0;
-            }
-            ResC = *istk(l2);
-        }
-
-        if ( GetType(suite) != sci_strings )
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, suite);
-            return 0;
-        }
-
-        GetRhsVar(suite, STRING_DATATYPE, &ms, &ns, &ls);
-        suite++;
-        if (ResL < 0 && (ResL != -1 || ResC != -1)) //ResL=-1 & ResC=-1 => eye
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: Positive scalar expected.\n"), fname, 1);
-            return 0;
-        }
-
-        if (ResC < 0 && (ResL != -1 || ResC != -1)) //ResL=-1 & ResC=-1 => eye
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: Positive scalar expected.\n"), fname, 2);
-            return 0;
-        }
-    }
-    else
-    {
-        int* piAddr = NULL;
-        getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-        if (isHypermatType(pvApiCtx, piAddr))
-        {
-            //get dimension information from input hypermatrix
-            getHypermatDimensions(pvApiCtx, piAddr, &piDims, &iDims);
-            iHyperMat = 1;
-
-            ResL = 1;
-            ResC = 1;
-            for (i = 0 ; i < iDims ; i++)
-            {
-                ResC *= piDims[i];
-            }
-        }
-        else
-        {
-            GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &ResL, &ResC, &l1);
-        }
-
-        GetRhsVar(2, STRING_DATATYPE, &ms, &ns, &ls);
-        suite = 3;
-
-    }
-    if ( strcmp(cstk(ls), "bet") == 0)
-    {
-        double minlog = 1.e-37;
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing A and B for beta law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "A");
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "B");
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( *stk(la) < minlog || *stk(lb) < minlog)
-        {
-            Scierror(999, _("Rand(...,'bet',..): A or B < %f\n"), minlog);
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(genbet)(stk(la), stk(lb));
-        }
-
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "f") == 0)
-    {
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Dfn and Dfd for F law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "Dfn");
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "Dfd");
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( *stk(la) <= 0.0 || *stk(lb) <= 0.0)
-        {
-            Scierror(999, _("Degrees of freedom nonpositive\n"));
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(genf)(stk(la), stk(lb));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "mul") == 0)
-    {
-        int l_i, nn, ncat;
-        double ptot;
-        if ( suite != 3 || ResL * ResC != 1)
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: Must be the number of random deviate.\n"), fname, 1);
-            return 0;
-        }
-        nn = *istk(l1);
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing N and P for MULtinomial law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "N");
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &lb);
-        if ( n2 != 1 )
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Column vector expected.\n"), fname);
-            return 0;
-        }
-        ncat = m2 + 1;
-        CreateVar(suite + 2, MATRIX_OF_INTEGER_DATATYPE, &ncat, &nn, &lr);
-        if ( *istk(la) < 0 )
-        {
-            Scierror(999, _("N < 0\n"));
-            return 0;
-        }
-        if ( ncat <= 1)
-        {
-            Scierror(999, _("Ncat <= 1\n"));
-            return 0;
-        }
-        ptot = 0.0;
-        for ( l_i = 0 ; l_i < ncat - 1 ; l_i++ )
-        {
-            if ( *stk(lb + l_i) < 0.0 )
-            {
-                Scierror(999, _("P(%d) < 0\n"), l_i + 1);
-                return 0;
-            }
-            if ( *stk(lb + l_i) > 1.0 )
-            {
-                Scierror(999, _("P(%d) > 1\n"), l_i + 1);
-                return 0;
-            }
-            ptot += *stk(lb + l_i);
-        }
-        if ( ptot > 1.0)
-        {
-            Scierror(999, _("Sum of P(i) > 1\n"));
-            return 0;
-        }
-        for ( l_i = 0 ; l_i < nn ; l_i++)
-        {
-            C2F(genmul)(istk(la), stk(lb), &ncat, istk(lr + ncat * l_i));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "gam") == 0)
-    {
-        if ( Rhs != suite + 1)
-
-            /*  ETRE PLUS CONSISTANT ICI : choisir entre shape , rate ou
-            bien A et R (idem pour le man)
-            */
-        {
-            Scierror(999, _("Missing shape and rate for Gamma law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "shape");
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "rate");
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( (*stk(la)) <= 0.0 ||  (*stk(lb)) <= 0.0 )
-        {
-            Scierror(999, _("grand(..'gam',A,R) : A <= 0.0 or R <= 0.0\n"));
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            /** WARNING : order is changed in parameters for
-            compatibility between Rand(...'gam',..) and cdfgam
-            **/
-            pdblData[i] = C2F(gengam)(stk(lb), stk(la));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "nor") == 0)
-    {
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Av and Sd for Normal law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "Av");
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong size for input argument: Scalar expected for %s.\n"), fname, "Sd");
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( *stk(lb) < 0 )
-        {
-            Scierror(999, _("SD < 0.0\n"));
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(gennor)(stk(la), stk(lb));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "unf") == 0)
-    {
-        double low = 0, high = 0;
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Low and High for Uniform Real law\n"));
-            return 0;
-        }
-
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        low = *stk(la);
-        high =  *stk(lb);
-        if ( low > high )
-        {
-            Scierror(999, _("%s: Wrong type for input argument. Low < High expected.\n"), fname);
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = low + (high - low) * C2F(ranf)();
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "uin") == 0)
-    {
-        double a = 0, b = 0;
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Low and High for Uniform int law\n"));
-            return 0;
-        }
-
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        a = *stk(la);
-        b = *stk(lb);
-
-        if ( a > b )
-        {
-            Scierror(999, _("%s: Wrong type for input argument. Low < High expected.\n"), fname);
-            return 0;
-        }
-
-        if ( a != floor(a) || b != floor(b) || (b - a + 1) > 2147483561 )
-        {
-            Scierror(999, _("a and b must integers with (b-a+1) <= 2147483561"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(ignuin)(stk(la), stk(lb));
-        }
-
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "lgi") == 0)
-    {
-        if ( Rhs != suite - 1 )
-        {
-            Scierror(999, _("%s: Wrong number of input argument: %d expected with option '%s'.\n"), fname, suite - 1, "lgi");
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = ignlgi();
-        }
-        LhsVar(1) = suite;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "prm") == 0)
-    {
-        int nn, Cmplx, *header;
-        if ( suite != 3 || ResL * ResC != 1)
-        {
-            Scierror(999, _("%s: Wrong value for input argument: Number of random simulation expected.\n"), fname);
-            return 0;
-        }
-        nn = *istk(l1);
-        if ( Rhs != suite)
-        {
-            Scierror(999, _("Missing vect for random permutation\n"));
-            return 0;
-        }
-        switch (GetType(suite))
-        {
-            case 1:
-                header = (int *)GetData(suite);
-                Cmplx = header[3];
-                if (Cmplx == 0)
-                {
-                    GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-                    if ( n1 != 1)
-                    {
-                        OverLoad(suite);
-                        return 0;
-                    }
-                    break;
-                }
-                else
-                {
-                    OverLoad(suite); // Complex, call %s_grand
-                    return 0;
-                    break;
-                }
-            case 2:  // Polynomial, call %p_grand
-            case 4:  // Boolean,    call %b_grand
-            case 5:  // Sparse,     call %sp_grand
-            case 8:  // Integer,    call %i_grand
-            case 10: // String,     call %c_grand
-            case 17: // String,     call %c_grand
-                OverLoad(suite);
-                return 0;
-                break;
-            default:
-                Scierror(999, _("%s: Wrong type for input argument: Matrix (full or sparse) or Hypermatrix of Reals, Complexes, Integers, Booleans, Strings or Polynomials expected.\n"), fname);
-                return 0;
-        }
-        CreateVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &nn, &lr);
-        for ( i = 0 ; i < nn ; i++)
-        {
-            int j ;
-            for (j = 0; j < m1 ; j++ )
-            {
-                *stk(lr + (m1)*i + j) = *stk(la + j);
-            }
-            C2F(genprm)(stk(lr + (m1)*i), &m1);
-        }
-        LhsVar(1) = suite + 1;
-        PutLhsVar();
-        return 0;
-    }
-    else if ( strcmp(cstk(ls), "nbn") == 0)
-    {
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing N and P for Negative Binomial law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( *stk(lb) < 0.0 || *stk(lb) > 1.0 )
-        {
-            Scierror(999, _("P is not in [0,1]\n"));
-            return 0;
-        }
-        if ( *istk(la) < 0 )
-        {
-            Scierror(999, _("N < 0\n"));
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = (double) C2F(ignnbn)(istk(la), stk(lb));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "bin") == 0)
-    {
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing N and P for Binomial law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        if ( *stk(lb) < 0.0 || *stk(lb) > 1.0 )
-        {
-            Scierror(999, _("P is not in [0,1]\n"));
-            return 0;
-        }
-        if ( *istk(la) < 0 )
-        {
-            Scierror(999, _("N < 0\n"));
-            return 0;
-        }
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = (double) C2F(ignbin)(istk(la), stk(lb));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-
-    else if ( strcmp(cstk(ls), "mn") == 0)
-    {
-        int nn, un = 1, work, mp, parm, ierr;
-        if ( suite != 3 || ResL * ResC != 1)
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: Must be the number of random simulation.\n"), fname, 1);
-            return 0;
-        }
-        nn = *istk(l1);
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Mean and Cov for Multivariate Normal law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Column vector expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m2, &n2, &lb);
-        if ( m2 != n2 )
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Square matrix expected.\n"), fname);
-            return 0;
-        }
-        if ( m2 != m1 )
-        {
-            Scierror(999, _("%s: Wrong type for input arguments: Mean and Cov have incompatible dimensions\n"), fname);
-            return 0;
-        }
-
-        CreateVar(suite + 2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &nn, &lr);
-        CreateVar(suite + 3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &un, &work);
-        mp = m1 * (m1 + 3) / 2 + 1;
-        CreateVar(suite + 4, MATRIX_OF_DOUBLE_DATATYPE, &mp, &un, &parm);
-        if ( m1 <= 0 )
-        {
-            Scierror(999, _("%s: Wrong size for input arguments: Mean and Cov are of null size.\n"), fname);
-            return 0;
-        }
-        C2F(setgmn)(stk(la), stk(lb), &m2, &m1, stk(parm), &ierr);
-        if ( ierr == 1)
-        {
-            SciError(999);
-            return 0;
-        }
-        for ( i = 0 ; i < nn ; i++)
-        {
-            C2F(genmn)(stk(parm), stk(lr + (m1)*i), stk(work));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "markov") == 0)
-    {
-        int nn, n1p1, lr1, j, icur, mm, jj;
-        if ( suite != 3 || ResL * ResC != 1)
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: Must be the number of random simulation.\n"), fname, 1);
-            return 0;
-        }
-        nn = *istk(l1);
-        if ( Rhs != suite + 1 )
-        {
-            Scierror(999, _("%s: Missing P matrix and X0 for Markov chain\n"), "fname");
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        GetRhsVar(suite + 1, MATRIX_OF_INTEGER_DATATYPE, &m2, &n2, &lb);
-        if ( m1 != n1 && m1 != 1 )
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: Square matrix or row vector expected.\n"), fname, 2);
-            return 0;
-        }
-
-        if ( m2 * n2 == 0 )
-        {
-            Scierror(999, _("X0 is empty\n"));
-            return 0;
-        }
-
-        for ( i = 0 ; i < m2 * n2 ; i++)
-            if ( *istk(lb + i) - 1 < 0 || *istk(lb + i) - 1 >= n1 )
-            {
-                Scierror(999, _("%s: X0(%d) must be in the range [1,%d[\n"), fname, i + 1, n1 + 1);
-                return 0;
-            }
-        mm = m2 * n2;
-        CreateVar(suite + 2, MATRIX_OF_INTEGER_DATATYPE, &mm, &nn, &lr);
-
-        n1p1 = n1 + 1;
-        CreateVar(suite + 3, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1p1, &lr1);
-        for ( i = 0 ; i < m1 ; i++ )
-        {
-            double ptot = 0.0;
-            for ( j = 0 ; j < n1 ; j++ )
-            {
-                if ( *stk(la + i + m1 * j) < 0 )
-                {
-                    Scierror(999, _("P(%d,%d) < 0\n"), i + 1, j + 1);
-                    return 0;
-                }
-                if ( *stk(la + i + m1 * j) > 1 )
-                {
-                    Scierror(999, _("P(%d,%d) > 1\n"), i + 1, j + 1);
-                    return 0;
-                }
-                ptot += *stk(la + i + m1 * j) ;
-            }
-            if ( fabs(ptot - 1.0) > 1e-8 )
-            {
-                Scierror(999, _("Sum of P(%d,1:%d)=%f ~= 1\n"), i + 1, n1, ptot);
-                return 0;
-            }
-        }
-        /** Computing the cumulative sum of the P matrix **/
-        for ( i = 0 ; i < m1 ; i++)
-        {
-            double cumsum = 0.0;
-            *stk(lr1 + i) = cumsum;
-            for ( j = 1; j < n1p1 ; j++ )
-            {
-                cumsum += *stk(la + i + m1 * (j - 1));
-                *stk(lr1 + i + m1 * j) = cumsum;
-            }
-        }
-        for ( jj = 0 ; jj < mm ; jj++)
-        {
-            icur = *istk(lb + jj) - 1;
-            for ( i = 0 ; i < nn ; i++)
-            {
-                int niv = 0;
-                double rr = C2F(ranf)();
-                if ( m1 == 1 )
-                {
-                    icur = 0;
-                }
-                while ( rr >= *stk(lr1 + icur + m1 * niv) && niv < n1p1 )
-                {
-                    niv++;
-                }
-                /** projection to avoid boundaries **/
-                niv = Max(Min(niv, n1), 1);
-                *istk(lr + jj + mm * i) = niv ;
-                icur = niv - 1;
-            }
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-        return 0;
-    }
-    else if ( strcmp(cstk(ls), "def") == 0)
-    {
-        if ( Rhs != suite - 1 )
-        {
-            Scierror(999, _("%s: Wrong number of input argument.\n"), fname);
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(ranf)();
-        }
-        LhsVar(1) = suite;
-        PutLhsVar();
-    }
-
-    else if ( strcmp(cstk(ls), "nch") == 0)
-    {
-        if ( Rhs != suite + 1)
-        {
-            Scierror(999, _("Missing Df and Xnonc for non-central chi-square law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        if ( *stk(la) < 1.0 || *stk(lb) < 0.0 )
-        {
-            Scierror(999, _("DF < 1 or XNONC < 0\n"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 2, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(gennch)(stk(la), stk(lb));
-        }
-        LhsVar(1) = suite + 2;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "nf") == 0)
-    {
-        if ( Rhs != suite + 2)
-        {
-            Scierror(999, _("Missing Dfn, Dfd and Xnonc for non-central F law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lb);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        GetRhsVar(suite + 2, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &lc);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        if ( *stk(la) < 1.0 || *stk(lb) < 0.0 || *stk(lc) < 0.0 )
-        {
-            Scierror(999, _("DF < 1.0 or DF <= 0.0 or Xnonc < 0.0\n"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 3, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(gennf)(stk(la), stk(lb), stk(lc));
-        }
-        LhsVar(1) = suite + 3;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "chi") == 0)
-    {
-        if ( Rhs != suite )
-        {
-            Scierror(999, _("Missing Df for chi-square law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        if  ( *stk(la) <= 0.0)
-        {
-            Scierror(999, _("Rand: DF <= 0\n"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 1, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(genchi)(stk(la));
-        }
-        LhsVar(1) = suite + 1;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "poi") == 0)
-    {
-        if ( Rhs != suite )
-        {
-            Scierror(999, _("Missing Av for Poisson law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        if ( *stk(la) < 0.0 )
-        {
-            Scierror(999, _("Av < 0\n"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 1, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = (double) C2F(ignpoi)(stk(la));
-        }
-        LhsVar(1) = suite + 1;
-        PutLhsVar();
-    }
-    else if ( strcmp(cstk(ls), "geom") == 0)
-    {
-        double p;
-        if ( Rhs != suite )
-        {
-            Scierror(999, _("Missing p for Geometric law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-        p = *stk(la);
-        if ( p < 1.3e-307 || p > 1 )
-        {
-            Scierror(999, _("%s: Wrong value for input argument: Must be between '%s' and %d.\n"), fname, "pmin", 1);
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 1, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = igngeom(p);
-        }
-        LhsVar(1) = suite + 1;
-        PutLhsVar();
-    }
-
-    else if ( strcmp(cstk(ls), "exp") == 0)
-    {
-        if ( Rhs != suite )
-        {
-            Scierror(999, _("Missing Av for exponential law\n"));
-            return 0;
-        }
-        GetRhsVar(suite, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &la);
-        if ( m1 * n1 != 1)
-        {
-            Scierror(999, _("%s: Wrong type for input argument: Scalar expected.\n"), fname);
-            return 0;
-        }
-
-        if ( *stk(la) < 0.0 )
-        {
-            Scierror(999, _("Av < 0.0\n"));
-            return 0;
-        }
-
-        pdblData = createOutputVar(pvApiCtx, suite + 1, ResL, ResC, piDims, iDims);
-
-        for ( i = 0 ; i < ResL * ResC ; i++)
-        {
-            pdblData[i] = C2F(genexp)(stk(la));
-        }
-        LhsVar(1) = suite + 1;
-        PutLhsVar();
-    }
-    else
-    {
-        Scierror(999, _("%s: Wrong value for input argument %s.\n"), fname, cstk(ls));
-        return 0;
-    }
-
-    if (piDims && iHyperMat == 0)
-    {
-        FREE(piDims);
-    }
-
-    return 0;
-}
-
-
-static double* createOutputVar(void* _pvCtx, int _iVar, int _iRows, int _iCols, int* _piDims, int _iDims)
-{
-    double* pdblData = NULL;
-    if (_piDims)
-    {
-        int* piAddr = NULL;
-        int* piAddrEntries = NULL;
-        int iRows = 0, iCols = 0;
-        allocHypermatOfDouble(pvApiCtx, _iVar, _piDims, _iDims, &pdblData);
-    }
-    else
-    {
-        int lr = 0;
-        CreateVar(_iVar, MATRIX_OF_DOUBLE_DATATYPE, &_iRows, &_iCols, &lr);
-        pdblData = stk(lr);
-    }
-
-    return pdblData;
-}