matplot for hypermat 49/15149/12
Anais AUBERT [Wed, 3 Sep 2014 10:14:22 +0000 (12:14 +0200)]
a=rand(3,3,3);
Matplot(a, strf="081")
Matplot(a, strf="083")// set y axes to the right side
Matplot(a, "081")
Matplot(a, "083")
Matplot(a)

Change-Id: I43c47e57dfb6cdd2b4e08844aab98614f09b17d3

scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/includes/graphics_gw.hxx
scilab/modules/graphics/includes/gw_graphics.h
scilab/modules/graphics/sci_gateway/c/sci_matplot.c [deleted file]
scilab/modules/graphics/sci_gateway/cpp/graphics_gw.vcxproj
scilab/modules/graphics/sci_gateway/cpp/graphics_gw.vcxproj.filters
scilab/modules/graphics/sci_gateway/cpp/sci_matplot.cpp [new file with mode: 0644]

index 1d8b939..909683d 100644 (file)
@@ -425,7 +425,6 @@ GATEWAY_C_SOURCES = \
     sci_gateway/c/sci_xname.c \
     sci_gateway/c/sci_xpoly.c \
     sci_gateway/c/sci_xchange.c \
-    sci_gateway/c/sci_matplot.c \
     sci_gateway/c/sci_drawaxis.c \
     sci_gateway/c/sci_demo.c \
     sci_gateway/c/sci_plot2d1.c \
@@ -469,6 +468,7 @@ GATEWAY_CXX_SOURCES = \
     sci_gateway/cpp/sci_get.cpp \
     sci_gateway/cpp/sci_xget.cpp \
     sci_gateway/cpp/sci_xset.cpp \
+    sci_gateway/cpp/sci_matplot.cpp \
     sci_gateway/cpp/sci_winsid.cpp
 
 
index 7658675..140a07e 100644 (file)
@@ -581,7 +581,6 @@ am__objects_3 = sci_gateway/c/libscigraphics_la-sci_swap_handles.lo \
        sci_gateway/c/libscigraphics_la-sci_xname.lo \
        sci_gateway/c/libscigraphics_la-sci_xpoly.lo \
        sci_gateway/c/libscigraphics_la-sci_xchange.lo \
-       sci_gateway/c/libscigraphics_la-sci_matplot.lo \
        sci_gateway/c/libscigraphics_la-sci_drawaxis.lo \
        sci_gateway/c/libscigraphics_la-sci_demo.lo \
        sci_gateway/c/libscigraphics_la-sci_plot2d1.lo \
@@ -623,6 +622,7 @@ am__objects_4 = sci_gateway/cpp/libscigraphics_la-graphics_gw.lo \
        sci_gateway/cpp/libscigraphics_la-sci_get.lo \
        sci_gateway/cpp/libscigraphics_la-sci_xget.lo \
        sci_gateway/cpp/libscigraphics_la-sci_xset.lo \
+       sci_gateway/cpp/libscigraphics_la-sci_matplot.lo \
        sci_gateway/cpp/libscigraphics_la-sci_winsid.lo
 am_libscigraphics_la_OBJECTS = $(am__objects_3) $(am__objects_4)
 libscigraphics_la_OBJECTS = $(am_libscigraphics_la_OBJECTS)
@@ -1412,7 +1412,6 @@ GATEWAY_C_SOURCES = \
     sci_gateway/c/sci_xname.c \
     sci_gateway/c/sci_xpoly.c \
     sci_gateway/c/sci_xchange.c \
-    sci_gateway/c/sci_matplot.c \
     sci_gateway/c/sci_drawaxis.c \
     sci_gateway/c/sci_demo.c \
     sci_gateway/c/sci_plot2d1.c \
@@ -1456,6 +1455,7 @@ GATEWAY_CXX_SOURCES = \
     sci_gateway/cpp/sci_get.cpp \
     sci_gateway/cpp/sci_xget.cpp \
     sci_gateway/cpp/sci_xset.cpp \
+    sci_gateway/cpp/sci_matplot.cpp \
     sci_gateway/cpp/sci_winsid.cpp
 
 libscigraphics_la_CPPFLAGS = \
@@ -2916,9 +2916,6 @@ sci_gateway/c/libscigraphics_la-sci_xpoly.lo:  \
 sci_gateway/c/libscigraphics_la-sci_xchange.lo:  \
        sci_gateway/c/$(am__dirstamp) \
        sci_gateway/c/$(DEPDIR)/$(am__dirstamp)
-sci_gateway/c/libscigraphics_la-sci_matplot.lo:  \
-       sci_gateway/c/$(am__dirstamp) \
-       sci_gateway/c/$(DEPDIR)/$(am__dirstamp)
 sci_gateway/c/libscigraphics_la-sci_drawaxis.lo:  \
        sci_gateway/c/$(am__dirstamp) \
        sci_gateway/c/$(DEPDIR)/$(am__dirstamp)
@@ -3048,6 +3045,9 @@ sci_gateway/cpp/libscigraphics_la-sci_xget.lo:  \
 sci_gateway/cpp/libscigraphics_la-sci_xset.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
+sci_gateway/cpp/libscigraphics_la-sci_matplot.lo:  \
+       sci_gateway/cpp/$(am__dirstamp) \
+       sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
 sci_gateway/cpp/libscigraphics_la-sci_winsid.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
@@ -3092,7 +3092,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_grayplot.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_is_handle_valid.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_light.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_matplot.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_matplot1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_move.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_name2rgb.Plo@am__quote@
@@ -3135,6 +3134,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_zoom_rect.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-graphics_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_get.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_matplot.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_winsid.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_xget.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_xset.Plo@am__quote@
@@ -6280,13 +6280,6 @@ sci_gateway/c/libscigraphics_la-sci_xchange.lo: sci_gateway/c/sci_xchange.c
 @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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sci_gateway/c/libscigraphics_la-sci_xchange.lo `test -f 'sci_gateway/c/sci_xchange.c' || echo '$(srcdir)/'`sci_gateway/c/sci_xchange.c
 
-sci_gateway/c/libscigraphics_la-sci_matplot.lo: sci_gateway/c/sci_matplot.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sci_gateway/c/libscigraphics_la-sci_matplot.lo -MD -MP -MF sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_matplot.Tpo -c -o sci_gateway/c/libscigraphics_la-sci_matplot.lo `test -f 'sci_gateway/c/sci_matplot.c' || echo '$(srcdir)/'`sci_gateway/c/sci_matplot.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_matplot.Tpo sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_matplot.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='sci_gateway/c/sci_matplot.c' object='sci_gateway/c/libscigraphics_la-sci_matplot.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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sci_gateway/c/libscigraphics_la-sci_matplot.lo `test -f 'sci_gateway/c/sci_matplot.c' || echo '$(srcdir)/'`sci_gateway/c/sci_matplot.c
-
 sci_gateway/c/libscigraphics_la-sci_drawaxis.lo: sci_gateway/c/sci_drawaxis.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sci_gateway/c/libscigraphics_la-sci_drawaxis.lo -MD -MP -MF sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_drawaxis.Tpo -c -o sci_gateway/c/libscigraphics_la-sci_drawaxis.lo `test -f 'sci_gateway/c/sci_drawaxis.c' || echo '$(srcdir)/'`sci_gateway/c/sci_drawaxis.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_drawaxis.Tpo sci_gateway/c/$(DEPDIR)/libscigraphics_la-sci_drawaxis.Plo
@@ -6619,6 +6612,13 @@ sci_gateway/cpp/libscigraphics_la-sci_xset.lo: sci_gateway/cpp/sci_xset.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) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscigraphics_la-sci_xset.lo `test -f 'sci_gateway/cpp/sci_xset.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xset.cpp
 
+sci_gateway/cpp/libscigraphics_la-sci_matplot.lo: sci_gateway/cpp/sci_matplot.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscigraphics_la-sci_matplot.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_matplot.Tpo -c -o sci_gateway/cpp/libscigraphics_la-sci_matplot.lo `test -f 'sci_gateway/cpp/sci_matplot.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_matplot.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_matplot.Tpo sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_matplot.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='sci_gateway/cpp/sci_matplot.cpp' object='sci_gateway/cpp/libscigraphics_la-sci_matplot.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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscigraphics_la-sci_matplot.lo `test -f 'sci_gateway/cpp/sci_matplot.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_matplot.cpp
+
 sci_gateway/cpp/libscigraphics_la-sci_winsid.lo: sci_gateway/cpp/sci_winsid.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscigraphics_la-sci_winsid.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_winsid.Tpo -c -o sci_gateway/cpp/libscigraphics_la-sci_winsid.lo `test -f 'sci_gateway/cpp/sci_winsid.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_winsid.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_winsid.Tpo sci_gateway/cpp/$(DEPDIR)/libscigraphics_la-sci_winsid.Plo
index 5f04f28..a25885a 100644 (file)
@@ -488,7 +488,6 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="sci_gateway\c\sci_grayplot.c" />
     <ClCompile Include="sci_gateway\c\sci_is_handle_valid.c" />
     <ClCompile Include="sci_gateway\c\sci_Legend.c" />
-    <ClCompile Include="sci_gateway\c\sci_matplot.c" />
     <ClCompile Include="sci_gateway\c\sci_matplot1.c" />
     <ClCompile Include="sci_gateway\c\sci_move.c" />
     <ClCompile Include="sci_gateway\c\sci_newaxes.c" />
index 91a3d45..d6b4be8 100644 (file)
     <ClCompile Include="sci_gateway\c\sci_Legend.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sci_gateway\c\sci_matplot.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sci_gateway\c\sci_matplot1.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <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 45fa370..c8e4a77 100644 (file)
@@ -39,4 +39,5 @@ CPP_GATEWAY_PROTOTYPE_EXPORT(sci_get, GRAPHICS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_xget, GRAPHICS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_xset, GRAPHICS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_winsid, GRAPHICS_GW_IMPEXP);
+CPP_OPT_GATEWAY_PROTOTYPE_EXPORT(sci_matplot, GRAPHICS_GW_IMPEXP);
 #endif /* !__GUI_GW_HXX__ */
index dda4ca1..e8a414f 100644 (file)
@@ -80,7 +80,7 @@ GRAPHICS_IMPEXP int sci_move(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_matlot1(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_matplot1(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_matlot(char *fname, void *pvApiCtx);
-GRAPHICS_IMPEXP int sci_matplot(char *fname, void *pvApiCtx);
+//GRAPHICS_IMPEXP int sci_matplot(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_Legend(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_is_handle_valid(char *fname, void *pvApiCtx);
 GRAPHICS_IMPEXP int sci_grayplot(char *fname, void *pvApiCtx);
diff --git a/scilab/modules/graphics/sci_gateway/c/sci_matplot.c b/scilab/modules/graphics/sci_gateway/c/sci_matplot.c
deleted file mode 100644 (file)
index 9c2081d..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Fabrice Leray
- * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
- *
- * 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
- *
- */
-
-/*------------------------------------------------------------------------*/
-/* file: sci_matplot.h                                                    */
-/* desc : interface for matplot routine                                   */
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include "gw_graphics.h"
-#include "GetCommandArg.h"
-#include "DefaultCommandArg.h"
-#include "BuildObjects.h"
-#include "sciCall.h"
-#include "api_scilab.h"
-#include "localization.h"
-#include "Scierror.h"
-#include "Matplot.h"
-/*--------------------------------------------------------------------------*/
-int sci_matplot(char *fname, void *pvApiCtx)
-{
-    SciErr sciErr;
-    int m1 = 0, n1 = 0;
-    int frame_def = 8;
-    int *frame = &frame_def;
-    int axes_def = 1;
-    int *axes = &axes_def;
-    static rhs_opts opts[] =
-    {
-        { -1, "axesflag", -1, 0, 0, NULL},
-        { -1, "frameflag", -1, 0, 0, NULL},
-        { -1, "nax", -1, 0, 0, NULL},
-        { -1, "rect", -1, 0, 0, NULL},
-        { -1, "strf", -1, 0, 0, NULL},
-        { -1, NULL, -1, 0, 0, NULL}
-    };
-
-    char   * strf    = NULL ;
-    char strfl[4];
-    double* rect    = NULL ;
-    int    * nax     = NULL ;
-    BOOL     flagNax = FALSE;
-
-    int* piAddr1 = NULL;
-    void * l1 = NULL;
-    int type = 0;
-    int precision = 0;
-    int plottype = -1;
-
-    if (nbInputArgument(pvApiCtx) <= 0)
-    {
-        sci_demo(fname, pvApiCtx);
-        return 0;
-    }
-    CheckInputArgument(pvApiCtx, 1, 5);
-
-    if (getOptionals(pvApiCtx, fname, opts) == 0)
-    {
-        ReturnArguments(pvApiCtx);
-        return 0;
-    }
-    if (FirstOpt(pvApiCtx) < 2)
-    {
-        Scierror(999, _("%s: Misplaced optional argument: #%d must be at position %d.\n"),
-                 fname, 1, 2);
-        return(0);
-    }
-
-    //get variable address
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
-    if (sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 1;
-    }
-
-    sciErr = getVarType(pvApiCtx, piAddr1, &type);
-    if (sciErr.iErr)
-    {
-        Scierror(999, _("%s: Cannot get the data type.\n"), fname, 1);
-        printError(&sciErr, 0);
-        return 1;
-    }
-
-    switch (type)
-    {
-        case sci_matrix :
-            sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, (double **)&l1);
-            if (sciErr.iErr)
-            {
-                Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1);
-                printError(&sciErr, 0);
-                return 1;
-            }
-
-            if (m1 * n1 == 0)
-            {
-                AssignOutputVariable(pvApiCtx, 1) = 0;
-                ReturnArguments(pvApiCtx);
-                return 0;
-            }
-
-            plottype = buildMatplotType(MATPLOT_Double, MATPLOT_FORTRAN, MATPLOT_INDEX);
-            break;
-        case sci_ints :
-            sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr1, &precision);
-            if (sciErr.iErr)
-            {
-                Scierror(999, _("%s: Cannot get the integer type for argument #%d.\n"), fname, 1);
-                printError(&sciErr, 0);
-                return 1;
-            }
-
-            switch (precision)
-            {
-                case SCI_INT8 :
-                    sciErr = getMatrixOfInteger8(pvApiCtx, piAddr1, &m1, &n1, (char **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_Char, MATPLOT_FORTRAN, MATPLOT_RGB_332);
-                    break;
-                case SCI_UINT8 :
-                    sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddr1, &m1, &n1, (unsigned char **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_UChar, MATPLOT_FORTRAN, MATPLOT_GRAY);
-                    break;
-                case SCI_INT16 :
-                    sciErr = getMatrixOfInteger16(pvApiCtx, piAddr1, &m1, &n1, (short **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_Short, MATPLOT_FORTRAN, MATPLOT_RGB_444);
-                    break;
-                case SCI_UINT16 :
-                    sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddr1, &m1, &n1, (unsigned short **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_UShort, MATPLOT_FORTRAN, MATPLOT_RGBA_4444);
-                    break;
-                case SCI_INT32 :
-                    sciErr = getMatrixOfInteger32(pvApiCtx, piAddr1, &m1, &n1, (int **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_Int, MATPLOT_FORTRAN, MATPLOT_RGB);
-                    break;
-                case SCI_UINT32 :
-                    sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddr1, &m1, &n1, (unsigned int **)(&l1));
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the data for argument #%d.\n"), fname, 1);
-                        printError(&sciErr, 0);
-                        return 1;
-                    }
-                    plottype = buildMatplotType(MATPLOT_UInt, MATPLOT_FORTRAN, MATPLOT_RGBA);
-                    break;
-                default :
-                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), fname, 1);
-                    return 1;
-            }
-            break;
-        case sci_mlist :
-            if (isHypermatType(pvApiCtx, piAddr1))
-            {
-                int htype = 0;
-                int ndims = 0;
-                int * dims = NULL;
-
-                sciErr = getHypermatType(pvApiCtx, piAddr1, &htype);
-                if (sciErr.iErr)
-                {
-                    Scierror(202, _("%s: Cannot get the hypermatrix data type for argument #%d.\n"), fname, 1);
-                    return 1;
-                }
-
-                if (htype == sci_ints)
-                {
-                    sciErr = getHypermatOfIntegerPrecision(pvApiCtx, piAddr1, &precision);
-                    if (sciErr.iErr)
-                    {
-                        Scierror(202, _("%s: Cannot get the hypermatrix data type for argument #%d.\n"), fname, 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"), fname, 1);
-                        return 1;
-                    }
-
-                    if (precision == SCI_UINT8)
-                    {
-                        sciErr = getHypermatOfUnsignedInteger8(pvApiCtx, piAddr1, &dims, &ndims, (unsigned char **)&l1);
-                    }
-                    else
-                    {
-                        sciErr = getHypermatOfInteger8(pvApiCtx, piAddr1, &dims, &ndims, (char **)&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"), fname, 1);
-                        return 1;
-                    }
-
-                    m1 = dims[0];
-                    n1 = dims[1];
-                    if (dims[2] == 1)
-                    {
-                        if (precision == SCI_INT8)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM1_Char, MATPLOT_FORTRAN, MATPLOT_GRAY);
-                        }
-                        else
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM1_UChar, MATPLOT_FORTRAN, MATPLOT_GRAY);
-                        }
-                    }
-                    else if (dims[2] == 3)
-                    {
-                        if (precision == SCI_INT8)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM3_Char, MATPLOT_FORTRAN, MATPLOT_RGB);
-                        }
-                        else
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM3_UChar, MATPLOT_FORTRAN, MATPLOT_RGB);
-                        }
-                    }
-                    else
-                    {
-                        if (precision == SCI_INT8)
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM4_Char, MATPLOT_FORTRAN, MATPLOT_RGBA);
-                        }
-                        else
-                        {
-                            plottype = buildMatplotType(MATPLOT_HM4_UChar, MATPLOT_FORTRAN, MATPLOT_RGBA);
-                        }
-                    }
-                }
-                else if (htype == sci_matrix)
-                {
-                    sciErr = getHypermatOfDouble(pvApiCtx, piAddr1, &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"), fname, 1);
-                        return 1;
-                    }
-
-                    m1 = dims[0];
-                    n1 = dims[1];
-                    if (dims[2] == 1)
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM1_Double, MATPLOT_FORTRAN, MATPLOT_GRAY);
-                    }
-                    else if (dims[2] == 3)
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM3_Double, MATPLOT_FORTRAN, MATPLOT_RGB);
-                    }
-                    else
-                    {
-                        plottype = buildMatplotType(MATPLOT_HM4_Double, MATPLOT_FORTRAN, MATPLOT_RGBA);
-                    }
-                }
-                else
-                {
-                    Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "data", 1);
-                    return 1;
-                }
-            }
-            break;
-        default :
-            Scierror(202, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), fname, 1);
-            return 1;
-    }
-
-    GetStrf(pvApiCtx, fname, 2, opts, &strf);
-    GetRect(pvApiCtx, fname, 3, opts, &rect);
-    GetNax(pvApiCtx, 4, opts, &nax, &flagNax);
-
-    getOrCreateDefaultSubwin();
-
-    if (isDefStrf(strf))
-    {
-        strcpy(strfl, DEFSTRFN);
-
-        strf = strfl;
-        if (!isDefRect(rect))
-        {
-            strfl[1] = '7';
-        }
-
-        GetOptionalIntArg(pvApiCtx, fname, 5, "frameflag", &frame, 1, opts);
-        if (frame != &frame_def)
-        {
-            strfl[1] = (char)(*frame + 48);
-        }
-        GetOptionalIntArg(pvApiCtx, fname, 5, "axesflag", &axes, 1, opts);
-        if (axes != &axes_def)
-        {
-            strfl[2] = (char)(*axes + 48);
-        }
-    }
-
-    ObjmatplotImage((unsigned char *)(l1), &m1, &n1, strf, rect, nax, flagNax, plottype);
-
-    /* NG end */
-    AssignOutputVariable(pvApiCtx, 1) = 0;
-    ReturnArguments(pvApiCtx);
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
index 4e02c44..1f9a632 100644 (file)
@@ -25,6 +25,7 @@
   <ItemGroup>
     <ClCompile Include="graphics_gw.cpp" />
     <ClCompile Include="sci_get.cpp" />
+    <ClCompile Include="sci_matplot.cpp" />
     <ClCompile Include="sci_winsid.cpp" />
     <ClCompile Include="sci_xget.cpp" />
     <ClCompile Include="sci_xset.cpp" />
index ab2782f..31dd257 100644 (file)
@@ -35,5 +35,8 @@
     <ClCompile Include="sci_xget.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="sci_matplot.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/scilab/modules/graphics/sci_gateway/cpp/sci_matplot.cpp b/scilab/modules/graphics/sci_gateway/cpp/sci_matplot.cpp
new file mode 100644 (file)
index 0000000..ef3d815
--- /dev/null
@@ -0,0 +1,379 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Fabrice Leray
+ * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
+ * Copyright (C) 2014 - Scilab Enterprises - Anais AUBERT
+ *
+ * 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
+ *
+ */
+
+/*------------------------------------------------------------------------*/
+/* file: sci_matplot.h                                                    */
+/* desc : interface for matplot routine                                   */
+/*------------------------------------------------------------------------*/
+
+#include "graphics_gw.hxx"
+#include "function.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "graphichandle.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
+
+extern "C"
+{
+#include <string.h>
+#include "gw_graphics.h"
+#include "GetCommandArg.h"
+#include "DefaultCommandArg.h"
+#include "BuildObjects.h"
+#include "sciCall.h"
+#include "api_scilab.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "Matplot.h"
+}
+
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_matplot(types::typed_list &in, types::optional_list &opt, int _iRetCount, types::typed_list &out)
+{
+    int m1 = 0;
+    int n1 = 0;
+    int *dims = NULL;
+    int frame_def = 8;
+    int *frame = &frame_def;
+    int axes_def = 1;
+    int *axes = &axes_def;
+    int *frameflag = NULL;
+    int *axesflag  = NULL;
+
+    char* strf      = NULL ;
+    char strfl[4];
+    double* rect    = NULL ;
+    int* nax        = NULL ;
+    BOOL flagNax    = FALSE;
+
+    void* l1 = NULL;
+    int plottype = -1;
+
+    bool bFREE = false;
+
+    if (in.size() < 1)
+    {
+        return Overload::call(L"%_Matplot", in, _iRetCount, out, new ast::ExecVisitor());
+
+    }
+    else if (in.size() > 5)
+    {
+        Scierror(999, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "Matplot", 1, 5);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isDouble())
+    {
+        types::Double *pIn = in[0]->getAs<types::Double>();
+        l1 = (void*) pIn->get();
+        if (pIn->getDims() > 2)
+        {
+
+            dims = pIn->getDimsArray();
+            if (pIn->getDims() > 3 || (dims[2] != 1 && dims[2] != 3 && dims[2] != 4))
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "Matplot", 1);
+                return types::Function::Error;
+            }
+
+            m1 = dims[0];
+            n1 = dims[1];
+            if (dims[2] == 1)
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_Double, MATPLOT_FORTRAN, MATPLOT_GRAY);
+            }
+            else if (dims[2] == 3)
+            {
+                plottype = buildMatplotType(MATPLOT_HM3_Double, MATPLOT_FORTRAN, MATPLOT_RGB);
+            }
+            else
+            {
+                plottype = buildMatplotType(MATPLOT_HM4_Double, MATPLOT_FORTRAN, MATPLOT_RGBA);
+            }
+        }
+        else
+        {
+            m1 = pIn->getRows();
+            n1 = pIn->getCols();
+            plottype = buildMatplotType(MATPLOT_Double, MATPLOT_FORTRAN, MATPLOT_INDEX);
+        }
+    }
+    else if (in[0]->isInt8())
+    {
+        types::Int8 *pIn = in[0]->getAs<types::Int8>();
+        l1 = (void*) pIn->get();
+        if (pIn->getDims() > 2)
+        {
+
+            dims = pIn->getDimsArray();
+            if (pIn->getDims() > 3 || (dims[2] != 1 && dims[2] != 3 && dims[2] != 4))
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "Matplot", 1);
+                return types::Function::Error;
+            }
+
+            m1 = dims[0];
+            n1 = dims[1];
+            if (dims[2] == 1)
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_Char, MATPLOT_FORTRAN, MATPLOT_GRAY);
+            }
+            else if (dims[2] == 3)
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_Char, MATPLOT_FORTRAN, MATPLOT_RGB);
+            }
+            else
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_Char, MATPLOT_FORTRAN, MATPLOT_RGBA);
+            }
+        }
+        else
+        {
+            m1 = pIn->getRows();
+            n1 = pIn->getCols();
+            plottype = buildMatplotType(MATPLOT_Char, MATPLOT_FORTRAN, MATPLOT_INDEX);
+        }
+    }
+    else if (in[0]->isUInt8())
+    {
+        types::UInt8 *pIn = in[0]->getAs<types::UInt8>();
+        l1 = (void*) pIn->get();
+        if (pIn->getDims() > 2)
+        {
+
+            dims = pIn->getDimsArray();
+            if (pIn->getDims() > 3 || (dims[2] != 1 && dims[2] != 3 && dims[2] != 4))
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A real or integer expected.\n"), "Matplot", 1);
+                return types::Function::Error;
+            }
+
+            m1 = dims[0];
+            n1 = dims[1];
+            if (dims[2] == 1)
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_UChar, MATPLOT_FORTRAN, MATPLOT_GRAY);
+            }
+            else if (dims[2] == 3)
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_UChar, MATPLOT_FORTRAN, MATPLOT_RGB);
+            }
+            else
+            {
+                plottype = buildMatplotType(MATPLOT_HM1_UChar, MATPLOT_FORTRAN, MATPLOT_RGBA);
+            }
+        }
+        else
+        {
+            m1 = pIn->getRows();
+            n1 = pIn->getCols();
+            plottype = buildMatplotType(MATPLOT_UChar, MATPLOT_FORTRAN, MATPLOT_INDEX);
+        }
+    }
+    else if (in[0]->isInt16())
+    {
+        types::Int16 *pIn = in[0]->getAs<types::Int16>();
+        l1 = (void*) pIn->get();
+        m1 = pIn->getRows();
+        n1 = pIn->getCols();
+        plottype = buildMatplotType(MATPLOT_Short, MATPLOT_FORTRAN, MATPLOT_INDEX);
+    }
+    else if (in[0]->isUInt16())
+    {
+        types::UInt16 *pIn = in[0]->getAs<types::UInt16>();
+        l1 = (void*) pIn->get();
+        m1 = pIn->getRows();
+        n1 = pIn->getCols();
+        plottype = buildMatplotType(MATPLOT_UShort, MATPLOT_FORTRAN, MATPLOT_INDEX);
+    }
+    else if ((in[0]->isInt32()) || (in[0]->isInt64()))
+    {
+        types::Int32 *pIn = in[0]->getAs<types::Int32>();
+        l1 = (void*) pIn->get();
+        m1 = pIn->getRows();
+        n1 = pIn->getCols();
+        plottype = buildMatplotType(MATPLOT_Int, MATPLOT_FORTRAN, MATPLOT_INDEX);
+    }
+    else if ((in[0]->isUInt32()) || (in[0]->isUInt64()))
+    {
+        types::UInt32 *pIn = in[0]->getAs<types::UInt32>();
+        l1 = (void*) pIn->get();
+        m1 = pIn->getRows();
+        n1 = pIn->getCols();
+        plottype = buildMatplotType(MATPLOT_UInt, MATPLOT_FORTRAN, MATPLOT_INDEX);
+    }
+
+    if (in.size() > 1)
+    {
+        if (in[1]->isString() == false)
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), "Matplot1", 2);
+            return types::Function::Error;
+
+        }
+        strf =  wide_string_to_UTF8(in[1]->getAs<types::String>()->get(0));
+        bFREE = true;
+        if (in.size() > 2)
+        {
+            if (in[2]->isDouble() == false)
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), "Matplot1", 3);
+                return types::Function::Error;
+
+            }
+
+            rect =  in[2]->getAs<types::Double>()->get();
+            if (in.size() > 3)
+            {
+                if (in[3]->isDouble() == false)
+                {
+                    Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), "Matplot1", 4);
+                    return types::Function::Error;
+
+                }
+
+                types::Double* pDbl = in[3]->getAs<types::Double>();
+                double* pdbl = pDbl->get();
+                int iSize = pDbl->getSize();
+                nax = new int[iSize];
+                for (int i = 0; i < iSize; i++)
+                {
+                    nax[i] = (int)pdbl[i];
+                }
+
+                flagNax = TRUE;
+            }
+        }
+    }
+
+    if (opt.size() > 4)
+    {
+        Scierror(999, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "Matplot", 1, 5);
+        return types::Function::Error;
+    }
+
+    // get optional argument if necessary
+    for (int i = 0; i < opt.size(); i++)
+    {
+        if (opt[i].first == L"strf")
+        {
+            if (opt[i].second->isString() == false)
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%ls: A string expected.\n"), "Matplot1", opt[i].first.c_str());
+                return types::Function::Error;
+            }
+
+            if (strf)
+            {
+                continue;
+            }
+
+            strf =  wide_string_to_UTF8(opt[i].second->getAs<types::String>()->get(0));
+            bFREE = true;
+        }
+        else
+        {
+            if (opt[i].second->isDouble() == false)
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%ls: A matrix expected.\n"), "Matplot1", opt[i].first.c_str());
+                return types::Function::Error;
+            }
+
+            types::Double* pDbl = opt[i].second->getAs<types::Double>();
+            double* pdbl = pDbl->get();
+            int iSize = pDbl->getSize();
+
+            if (opt[i].first == L"rect" && rect == NULL)
+            {
+                rect = pdbl;
+            }
+            else if (opt[i].first == L"nax" && nax == NULL)
+            {
+                nax = new int[iSize];
+                for (int i = 0; i < iSize; i++)
+                {
+                    nax[i] = (int)pdbl[i];
+                }
+                flagNax = TRUE;
+            }
+            else if (opt[i].first == L"frameflag" && frameflag == NULL)
+            {
+                frameflag = new int[iSize];
+                for (int i = 0; i < iSize; i++)
+                {
+                    frameflag[i] = (int)pdbl[i];
+                }
+            }
+            else if (opt[i].first == L"axesflag" && axesflag == NULL)
+            {
+                axesflag = new int[iSize];
+                for (int i = 0; i < iSize; i++)
+                {
+                    axesflag[i] = (int)pdbl[i];
+                }
+            }
+        }
+    }
+
+    getOrCreateDefaultSubwin();
+
+    if (strf == NULL)
+    {
+        reinitDefStrfN();
+
+        strcpy(strfl, DEFSTRFN);
+        strf = strfl;
+
+        if (!isDefRect(rect))
+        {
+            strfl[1] = '7';
+        }
+
+        if (frameflag != &frame_def)
+        {
+            strfl[1] = (char)(*frame + 48);
+        }
+
+        if (axesflag != &axes_def)
+        {
+            strfl[2] = (char)(*axes + 48);
+        }
+    }
+
+    ObjmatplotImage(l1, &m1, &n1, strf, rect, nax, flagNax, plottype);
+
+    if (bFREE)
+    {
+        FREE(strf);
+    }
+
+    if (nax)
+    {
+        delete[] nax;
+    }
+
+    if (frameflag)
+    {
+        delete[] frameflag;
+    }
+
+    if (axesflag)
+    {
+        delete[] axesflag;
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/