* Bug #16051 fixed: now undefined list elements are of Void type 60/20960/11
St├ęphane MOTTELET [Thu, 25 Apr 2019 12:06:10 +0000 (14:06 +0200)]
http://bugzilla.scilab.org/show_bug.cgi?id=16051

Change-Id: I19016c7544f4b3bd0c748a27b736fb86eda0a419

21 files changed:
scilab/CHANGES.md
scilab/modules/api_scilab/src/cpp/api_stack_list.cpp
scilab/modules/api_scilab/src/cpp/template/api_list.hpp
scilab/modules/ast/Makefile.am
scilab/modules/ast/Makefile.in
scilab/modules/ast/ast.vcxproj
scilab/modules/ast/ast.vcxproj.filters
scilab/modules/ast/includes/types/alltypes.hxx
scilab/modules/ast/includes/types/internal.hxx
scilab/modules/ast/includes/types/listundefined.hxx [deleted file]
scilab/modules/ast/includes/types/void.hxx
scilab/modules/ast/src/cpp/ast/visitor_common.cpp
scilab/modules/ast/src/cpp/types/internal.cpp
scilab/modules/ast/src/cpp/types/list.cpp
scilab/modules/ast/src/cpp/types/listundefined.cpp [deleted file]
scilab/modules/ast/src/cpp/types/macro.cpp
scilab/modules/ast/src/cpp/types/tlist.cpp
scilab/modules/ast/tests/nonreg_tests/bug_16051.tst [new file with mode: 0644]
scilab/modules/core/sci_gateway/cpp/sci_insert.cpp
scilab/modules/data_structures/sci_gateway/cpp/sci_getfield.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_load_v3.cpp

index ab5f2cd..2372012 100644 (file)
@@ -191,8 +191,7 @@ Bug Fixes
 * [#14863](http://bugzilla.scilab.org/show_bug.cgi?id=14863): In Xcos, the default ending time was unhandily high (100000), reduced it to 30.
 * [#14982](http://bugzilla.scilab.org/show_bug.cgi?id=14982): `msprintf` segmentation fault was caught due to wrong size
 * [#14985](http://bugzilla.scilab.org/show_bug.cgi?id=14985): scilab crashed if a .bin file was not found.
-* [#15087](http://bugzilla.scilab.org/show_bug.cgi?id=15087): Deleting rows or columns from a matrix is slow (regression
-)
+* [#15087](http://bugzilla.scilab.org/show_bug.cgi?id=15087): Deleting rows or columns from a matrix is slow (regression)
 * [#15248](http://bugzilla.scilab.org/show_bug.cgi?id=15248): `lsq()`was leaking memory.
 * [#15269](http://bugzilla.scilab.org/show_bug.cgi?id=15269): `xgetech` was poor and stiff compared to any combination of `gca()` properties `.axes_bounds`, `.data_bounds`, `.log_flags`, and `.margins`. It is removed.
 * [#15271](http://bugzilla.scilab.org/show_bug.cgi?id=15271): `bitget` needed to be upgraded.
@@ -224,6 +223,7 @@ Bug Fixes
 * [#16015](http://bugzilla.scilab.org/show_bug.cgi?id=116015): `intg(a,b,f)` called f(x) with x outside [a,b].
 * [#16021](http://bugzilla.scilab.org/show_bug.cgi?id=16021): `tand([-90 90])` answered [Nan Nan] instead of [-Inf, Inf]. `cotd([-90 90])` answered [Nan Nan] instead of [0 0]. `1 ./cosd([-90 90])` answered [Inf -Inf] instead of [Inf Inf].
 * [#16026](http://bugzilla.scilab.org/show_bug.cgi?id=16026): For `atanh()`, neither the documentation pages nor the `m2sci` converter were up to date.
+* [#16051](http://bugzilla.scilab.org/show_bug.cgi?id=16051): undefined list elements could be of 2 distinct typeof "void" or "listundefined" according to the way they are created.
 * [#16067](http://bugzilla.scilab.org/show_bug.cgi?id=16067): The display of matrices of signed integers was misaligned (regression of 6.0.0 vs 5.5.2)
 * [#16071](http://bugzilla.scilab.org/show_bug.cgi?id=16071): `prettyprint(complex(1,%nan))` omitted the "+" in `1 + Nani`. It printed positive exponents with a useless "+". For any input nul polynomial, the string result never included the name of the variable. Default input arguments could not be skipped. ExportFormat was uselessly case-sensitive. For tex|latex: for text input, $ \ % & { } ~ and ^ special characters were not protected ; spaces were not protected, all words were concatenated ; for polynomials and rationals, the result string could be extremely long and not easily wrappable. For MathML: "<" was not protected ; <mi></mi> were missing for text input ; <mtable>, </mtable>, <mtr>, </mtr>, <mtd>, <mfenced> and </mfenced> tags were not wrapped and could not be indented. Delimiters: "" was not documented as possible value ; ")" was wrongly documented. Dynamical linear systems were not documented as possible input.
 * [#16072](http://bugzilla.scilab.org/show_bug.cgi?id=16072): `prettyprint()` did not actually support input encoded integers.
index 65c1356..b1c78f2 100644 (file)
@@ -20,7 +20,7 @@
 #include <map>
 #include <string>
 #include "list.hxx"
-#include "listundefined.hxx"
+#include "void.hxx"
 #include "tlist.hxx"
 #include "mlist.hxx"
 #include "struct.hxx"
@@ -146,7 +146,7 @@ SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _p
     types::List* pL = (types::List*)_piAddress;
     //get offset of item array
     types::InternalType* pIT = pL->get(_iItemNum - 1);
-    if (pIT->isListUndefined())
+    if (pIT->isVoid())
     {
         *_piItemAddress = NULL;
     }
@@ -271,7 +271,7 @@ static SciErr createCommonNamedList(void* _pvCtx, const char* _pstName, int _iLi
     *_piAddress = (int*)pL;
     // create a list with the user number of items
     // it helps to check a wrong item, for example in createCommonListInList
-    pL->set(_iNbItem - 1, new types::ListUndefined());
+    pL->set(_iNbItem - 1, new types::Void());
 
     wchar_t* pwstName = to_wide_string(_pstName);
     symbol::Context* ctx = symbol::Context::getInstance();
@@ -336,7 +336,7 @@ static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNb
 
     // create a list with the user number of items
     // it helps to check a wrong item, for example in createCommonListInList
-    pL->set(_iNbItem - 1, new types::ListUndefined());
+    pL->set(_iNbItem - 1, new types::Void());
 
     int rhs = _iVar - *getNbInputArgument(_pvCtx);
     out[rhs - 1] = pL;
@@ -544,7 +544,7 @@ static SciErr createCommonListInList(void* _pvCtx, const char* _pstName, int* _p
         return sciErr;
     }
     // create a list in the list with a user number of items
-    pChild->set(_iNbItem - 1, new types::ListUndefined());
+    pChild->set(_iNbItem - 1, new types::Void());
 
     types::List* pParent = (types::List*)_piParent;
     pParent->set(_iItemPos - 1, pChild);
@@ -593,7 +593,7 @@ SciErr createUndefinedInNamedList(void* _pvCtx, const char* _pstName, int* _piPa
         return sciErr;
     }
 
-    pL->set(_iItemPos - 1, new types::ListUndefined());
+    pL->set(_iItemPos - 1, new types::Void());
     return sciErr;
 }
 
index c8934e0..0d5fe3c 100644 (file)
@@ -38,7 +38,7 @@ int API_PROTO(isUndefined)(scilabEnv env, scilabVar var, int index)
     }
 #endif
     types::InternalType* item = l->get(index);
-    if (item->isListUndefined())
+    if (item->isVoid())
     {
         return 1;
     }
index 59ee4ba..0e2739e 100644 (file)
@@ -96,7 +96,6 @@ src/cpp/types/list.cpp \
 src/cpp/types/listdelete.cpp \
 src/cpp/types/listinsert.cpp \
 src/cpp/types/listoperation.cpp \
-src/cpp/types/listundefined.cpp \
 src/cpp/types/macro.cpp \
 src/cpp/types/macrofile.cpp \
 src/cpp/types/mlist.cpp \
@@ -480,7 +479,6 @@ includes/types/listdelete.hxx \
 includes/types/list.hxx \
 includes/types/listinsert.hxx \
 includes/types/listoperation.hxx \
-includes/types/listundefined.hxx \
 includes/types/macrofile.hxx \
 includes/types/macro.hxx \
 includes/types/matrixiterator.hxx \
index d5b2a4f..86ec193 100644 (file)
@@ -245,8 +245,7 @@ am__libsciast_la_SOURCES_DIST = src/c/operations/doublecomplex.c \
        src/cpp/types/implicitlist.cpp src/cpp/types/int.cpp \
        src/cpp/types/library.cpp src/cpp/types/list.cpp \
        src/cpp/types/listdelete.cpp src/cpp/types/listinsert.cpp \
-       src/cpp/types/listoperation.cpp \
-       src/cpp/types/listundefined.cpp src/cpp/types/macro.cpp \
+       src/cpp/types/listoperation.cpp src/cpp/types/macro.cpp \
        src/cpp/types/macrofile.cpp src/cpp/types/mlist.cpp \
        src/cpp/types/overload.cpp src/cpp/types/polynom.cpp \
        src/cpp/types/singlepoly.cpp src/cpp/types/singlestruct.cpp \
@@ -461,7 +460,6 @@ am_libsciast_la_OBJECTS =  \
        src/cpp/types/libsciast_la-listdelete.lo \
        src/cpp/types/libsciast_la-listinsert.lo \
        src/cpp/types/libsciast_la-listoperation.lo \
-       src/cpp/types/libsciast_la-listundefined.lo \
        src/cpp/types/libsciast_la-macro.lo \
        src/cpp/types/libsciast_la-macrofile.lo \
        src/cpp/types/libsciast_la-mlist.lo \
@@ -859,7 +857,6 @@ am__depfiles_remade =  \
        src/cpp/types/$(DEPDIR)/libsciast_la-listdelete.Plo \
        src/cpp/types/$(DEPDIR)/libsciast_la-listinsert.Plo \
        src/cpp/types/$(DEPDIR)/libsciast_la-listoperation.Plo \
-       src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Plo \
        src/cpp/types/$(DEPDIR)/libsciast_la-macro.Plo \
        src/cpp/types/$(DEPDIR)/libsciast_la-macrofile.Plo \
        src/cpp/types/$(DEPDIR)/libsciast_la-mlist.Plo \
@@ -1301,8 +1298,7 @@ libsciast_la_SOURCES = src/c/operations/doublecomplex.c \
        src/cpp/types/implicitlist.cpp src/cpp/types/int.cpp \
        src/cpp/types/library.cpp src/cpp/types/list.cpp \
        src/cpp/types/listdelete.cpp src/cpp/types/listinsert.cpp \
-       src/cpp/types/listoperation.cpp \
-       src/cpp/types/listundefined.cpp src/cpp/types/macro.cpp \
+       src/cpp/types/listoperation.cpp src/cpp/types/macro.cpp \
        src/cpp/types/macrofile.cpp src/cpp/types/mlist.cpp \
        src/cpp/types/overload.cpp src/cpp/types/polynom.cpp \
        src/cpp/types/singlepoly.cpp src/cpp/types/singlestruct.cpp \
@@ -1652,7 +1648,6 @@ includes/types/listdelete.hxx \
 includes/types/list.hxx \
 includes/types/listinsert.hxx \
 includes/types/listoperation.hxx \
-includes/types/listundefined.hxx \
 includes/types/macrofile.hxx \
 includes/types/macro.hxx \
 includes/types/matrixiterator.hxx \
@@ -2098,9 +2093,6 @@ src/cpp/types/libsciast_la-listinsert.lo:  \
 src/cpp/types/libsciast_la-listoperation.lo:  \
        src/cpp/types/$(am__dirstamp) \
        src/cpp/types/$(DEPDIR)/$(am__dirstamp)
-src/cpp/types/libsciast_la-listundefined.lo:  \
-       src/cpp/types/$(am__dirstamp) \
-       src/cpp/types/$(DEPDIR)/$(am__dirstamp)
 src/cpp/types/libsciast_la-macro.lo: src/cpp/types/$(am__dirstamp) \
        src/cpp/types/$(DEPDIR)/$(am__dirstamp)
 src/cpp/types/libsciast_la-macrofile.lo:  \
@@ -2814,7 +2806,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-listdelete.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-listinsert.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-listoperation.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-macro.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-macrofile.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-mlist.Plo@am__quote@ # am--include-marker
@@ -3440,13 +3431,6 @@ src/cpp/types/libsciast_la-listoperation.lo: src/cpp/types/listoperation.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) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/types/libsciast_la-listoperation.lo `test -f 'src/cpp/types/listoperation.cpp' || echo '$(srcdir)/'`src/cpp/types/listoperation.cpp
 
-src/cpp/types/libsciast_la-listundefined.lo: src/cpp/types/listundefined.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/types/libsciast_la-listundefined.lo -MD -MP -MF src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Tpo -c -o src/cpp/types/libsciast_la-listundefined.lo `test -f 'src/cpp/types/listundefined.cpp' || echo '$(srcdir)/'`src/cpp/types/listundefined.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Tpo src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/types/listundefined.cpp' object='src/cpp/types/libsciast_la-listundefined.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) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/types/libsciast_la-listundefined.lo `test -f 'src/cpp/types/listundefined.cpp' || echo '$(srcdir)/'`src/cpp/types/listundefined.cpp
-
 src/cpp/types/libsciast_la-macro.lo: src/cpp/types/macro.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/types/libsciast_la-macro.lo -MD -MP -MF src/cpp/types/$(DEPDIR)/libsciast_la-macro.Tpo -c -o src/cpp/types/libsciast_la-macro.lo `test -f 'src/cpp/types/macro.cpp' || echo '$(srcdir)/'`src/cpp/types/macro.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/types/$(DEPDIR)/libsciast_la-macro.Tpo src/cpp/types/$(DEPDIR)/libsciast_la-macro.Plo
@@ -5035,7 +5019,6 @@ distclean: distclean-am
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listdelete.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listinsert.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listoperation.Plo
-       -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-macro.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-macrofile.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-mlist.Plo
@@ -5322,7 +5305,6 @@ maintainer-clean: maintainer-clean-am
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listdelete.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listinsert.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listoperation.Plo
-       -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-listundefined.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-macro.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-macrofile.Plo
        -rm -f src/cpp/types/$(DEPDIR)/libsciast_la-mlist.Plo
index e3e62cd..798cc34 100644 (file)
@@ -490,7 +490,6 @@ lib /DEF:"$(ProjectDir)functions_manager_import.def" /SUBSYSTEM:WINDOWS /MACHINE
     <ClInclude Include="includes\types\listdelete.hxx" />\r
     <ClInclude Include="includes\types\listinsert.hxx" />\r
     <ClInclude Include="includes\types\listoperation.hxx" />\r
-    <ClInclude Include="includes\types\listundefined.hxx" />\r
     <ClInclude Include="includes\types\macro.hxx" />\r
     <ClInclude Include="includes\types\macrofile.hxx" />\r
     <ClInclude Include="includes\types\matrixiterator.hxx" />\r
@@ -727,7 +726,6 @@ lib /DEF:"$(ProjectDir)functions_manager_import.def" /SUBSYSTEM:WINDOWS /MACHINE
     <ClCompile Include="src\cpp\types\listdelete.cpp" />\r
     <ClCompile Include="src\cpp\types\listinsert.cpp" />\r
     <ClCompile Include="src\cpp\types\listoperation.cpp" />\r
-    <ClCompile Include="src\cpp\types\listundefined.cpp" />\r
     <ClCompile Include="src\cpp\types\macro.cpp" />\r
     <ClCompile Include="src\cpp\types\macrofile.cpp" />\r
     <ClCompile Include="src\cpp\types\mlist.cpp" />\r
@@ -770,4 +768,4 @@ lib /DEF:"$(ProjectDir)functions_manager_import.def" /SUBSYSTEM:WINDOWS /MACHINE
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>
index 8234f7e..9369db1 100644 (file)
     <ClInclude Include="includes\types\listoperation.hxx">
       <Filter>Header Files\types</Filter>
     </ClInclude>
-    <ClInclude Include="includes\types\listundefined.hxx">
-      <Filter>Header Files\types</Filter>
-    </ClInclude>
     <ClInclude Include="includes\types\macro.hxx">
       <Filter>Header Files\types</Filter>
     </ClInclude>
     <ClCompile Include="src\cpp\types\listoperation.cpp">
       <Filter>Source Files\types</Filter>
     </ClCompile>
-    <ClCompile Include="src\cpp\types\listundefined.cpp">
-      <Filter>Source Files\types</Filter>
-    </ClCompile>
     <ClCompile Include="src\cpp\types\macro.cpp">
       <Filter>Source Files\types</Filter>
     </ClCompile>
       <Filter>Source Files\ast</Filter>
     </ClCompile>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
index 93de298..a734463 100644 (file)
@@ -40,7 +40,6 @@
 #include "listoperation.hxx"
 #include "listdelete.hxx"
 #include "listinsert.hxx"
-#include "listundefined.hxx"
 #include "tlist.hxx"
 #include "mlist.hxx"
 #include "file.hxx"
index d254805..0e141f6 100644 (file)
@@ -403,10 +403,10 @@ public :
     virtual bool isListOperation(void);
     virtual bool isListDelete(void);
     virtual bool isListInsert(void);
-    virtual bool isListUndefined(void);
     virtual bool isPointer(void);
     virtual bool isLibrary(void);
     virtual bool isUserType(void);
+    virtual bool isVoid(void);
 
     void clearPrintState();
 
diff --git a/scilab/modules/ast/includes/types/listundefined.hxx b/scilab/modules/ast/includes/types/listundefined.hxx
deleted file mode 100644 (file)
index 9845263..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- *  Copyright (C) 2009-2010 - DIGITEO - Antoine ELIAS
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- */
-
-#ifndef __LISTUNDEFINED_HXX__
-#define __LISTUNDEFINED_HXX__
-
-#include "types.hxx"
-#include "listoperation.hxx"
-
-namespace types
-{
-class EXTERN_AST ListUndefined : public ListOperation
-{
-public :
-    ListUndefined(): ListOperation() {};
-    virtual                 ~ListUndefined();
-
-    // FIXME : Should not return NULL;
-    ListUndefined*          clone();
-
-    ScilabType                getType(void);
-    bool                    isListUndefined()
-    {
-        return true;
-    }
-
-    void                    whoAmI();
-
-    bool                    toString(std::wostringstream& ostr);
-
-    /* return type as string ( double, int, cell, list, ... )*/
-    virtual std::wstring    getTypeStr() const
-    {
-        return L"listundefined";
-    }
-    /* return type as short string ( s, i, ce, l, ... )*/
-    virtual std::wstring    getShortTypeStr() const
-    {
-        return L"";
-    }
-};
-}
-
-
-#endif /* !__LISTUNDEFINED_HXX__ */
index a7b616d..eb60cdb 100644 (file)
@@ -37,7 +37,7 @@ public :
         return IdVoid;
     }
 
-    bool                    isVoid()
+    bool                    isVoid() override
     {
         return true;
     }
index b873906..3e3ead4 100644 (file)
@@ -1063,7 +1063,7 @@ types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*
                         int iNewSize = pEH->getSizeFromArgs();
                         if (pTL->getSize() < iNewSize)
                         {
-                            pTL = pTL->set(iNewSize - 1, new types::ListUndefined());
+                            pTL = pTL->set(iNewSize - 1, new types::Void());
                             pEH->setCurrent(pTL);
                         }
 
@@ -1219,7 +1219,7 @@ types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*
                             int iNewSize = pEH->getSizeFromArgs();
                             if (pL->getSize() < iNewSize)
                             {
-                                pL = pL->set(iNewSize - 1, new types::ListUndefined());
+                                pL = pL->set(iNewSize - 1, new types::Void());
                                 pEH->setCurrent(pL);
                             }
 
index 0f1e34b..f01b788 100644 (file)
@@ -305,22 +305,22 @@ bool InternalType::isListInsert(void)
     return false;
 }
 
-bool InternalType::isListUndefined(void)
+bool InternalType::isPointer(void)
 {
     return false;
 }
 
-bool InternalType::isPointer(void)
+bool InternalType::isLibrary(void)
 {
     return false;
 }
 
-bool InternalType::isLibrary(void)
+bool InternalType::isUserType(void)
 {
     return false;
 }
 
-bool InternalType::isUserType(void)
+bool InternalType::isVoid(void)
 {
     return false;
 }
index 5f8e325..51a7c04 100644 (file)
@@ -16,7 +16,7 @@
 #include <sstream>
 #include "double.hxx"
 #include "list.hxx"
-#include "listundefined.hxx"
+#include "void.hxx"
 #include "listinsert.hxx"
 #include "types_tools.hxx"
 #include "localization.hxx"
@@ -301,8 +301,8 @@ List* List::insert(typed_list* _pArgs, InternalType* _pSource)
             //try to insert after the last index, increase list size and assign value
             while ((int)m_plData->size() < idx)
             {
-                //incease list size and fill with "Undefined"
-                m_plData->push_back(new ListUndefined());
+                //incease list size and fill with Void type object
+                m_plData->push_back(new types::Void());
             }
             (*m_plData)[idx - 1] = pInsert;
         }
@@ -321,8 +321,8 @@ List* List::insert(typed_list* _pArgs, InternalType* _pSource)
     {
         while ((int)m_plData->size() < idx)
         {
-            //incease list size and fill with "Undefined"
-            InternalType* pLU = new ListUndefined();
+            //incease list size and fill with Void type object
+            InternalType* pLU = new types::Void();
             pLU->IncreaseRef();
             m_plData->push_back(pLU);
         }
@@ -368,8 +368,8 @@ List* List::set(const int _iIndex, InternalType* _pIT)
 
     while ((int)m_plData->size() < _iIndex)
     {
-        //incease list size and fill with "Undefined"
-        m_plData->push_back(new ListUndefined());
+        //incease list size and fill with Void type object
+        m_plData->push_back(new types::Void());
         m_plData->back()->IncreaseRef();
         m_iSize = getSize();
     }
diff --git a/scilab/modules/ast/src/cpp/types/listundefined.cpp b/scilab/modules/ast/src/cpp/types/listundefined.cpp
deleted file mode 100644 (file)
index 2d457c3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-*  Copyright (C) 2009-2009 - DIGITEO - Antoine ELIAS
-*
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
-*
-*/
-
-#include <sstream>
-#include <cstdio>
-
-#include "listundefined.hxx"
-#include "localization.h"
-#include "scilabWrite.hxx"
-
-namespace types
-{
-ListUndefined::~ListUndefined()
-{
-}
-
-void ListUndefined::whoAmI()
-{
-    std::cout << "types::ListUndefined";
-}
-
-ListUndefined* ListUndefined::clone(void)
-{
-    return new ListUndefined();
-}
-
-InternalType::ScilabType ListUndefined::getType(void)
-{
-    return ScilabListUndefinedOperation;
-}
-
-bool ListUndefined::toString(std::wostringstream& ostr)
-{
-    ostr << L"    Undefined" << std::endl;
-    return true;
-}
-}
index c78c572..f7e473f 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "macro.hxx"
 #include "list.hxx"
+#include "void.hxx"
 #include "listinsert.hxx"
 #include "string.hxx"
 #include "context.hxx"
@@ -405,7 +406,7 @@ Callable::ReturnValue Macro::call(typed_list &in, optional_list &opt, int _iRetC
         for (int i = 0 ; i < size ; ++i)
         {
             InternalType* pIT = pVarOut->get(i);
-            if (pIT->isListUndefined())
+            if (pIT->isVoid())
             {
                 for (int j = 0; j < i; ++j)
                 {
index 8390293..aa6ffc7 100644 (file)
@@ -19,7 +19,6 @@
 #include "string.hxx"
 #include "list.hxx"
 #include "tlist.hxx"
-#include "listundefined.hxx"
 #include "callable.hxx"
 #include "polynom.hxx"
 #include "overload.hxx"
diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_16051.tst b/scilab/modules/ast/tests/nonreg_tests/bug_16051.tst
new file mode 100644 (file)
index 0000000..eb04149
--- /dev/null
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2019 - St├ęphane MOTTELET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 16051 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/16051
+//
+// <-- Short Description -->
+// undefined list elements can be of 2 distinct typeof "void" or "listundefined" according to the way they are created
+
+L = list(,);
+L(4) = 1;
+assert_checkequal(type(L(1)), 0)
+assert_checkequal(type(L(3)), 0)
+assert_checkequal(typeof(L(1)), "void")
+assert_checkequal(typeof(L(3)), "void")
index eab3f38..a66a9d3 100644 (file)
 #include "core_gw.hxx"
 #include "function.hxx"
 #include "listinsert.hxx"
-#include "listundefined.hxx"
+#include "void.hxx"
 
 types::Function::ReturnValue sci_insert(types::typed_list &in, int _piRetCount, types::typed_list &out)
 {
     if (in.size() == 0)
     {
-        out.push_back(new types::ListInsert(new types::ListUndefined()));
+        out.push_back(new types::ListInsert(new types::Void()));
     }
     else
     {
index 2196996..7a03719 100644 (file)
@@ -125,7 +125,7 @@ types::Function::ReturnValue sci_getfield(types::typed_list &in, int _iRetCount,
     int iIndex = 0;
     for (int i = 0; i < iListSize; i++)
     {
-        if (pList->get(i)->isListUndefined())
+        if (pList->get(i)->isVoid())
         {
             switch (pIndex->getType())
             {
index 0f7583b..333855c 100644 (file)
@@ -31,7 +31,6 @@
 #include "graphichandle.hxx"
 #include "macro.hxx"
 #include "void.hxx"
-#include "listundefined.hxx"
 #include "context.hxx"
 #include "handle_properties.hxx"
 #include "deserializervisitor.hxx"
@@ -283,7 +282,7 @@ types::InternalType* import_data(hid_t dataset)
     if (type == g_SCILAB_CLASS_UNDEFINED)
     {
         closeDataSet(dataset);
-        return new types::ListUndefined();
+        return new types::Void();
     }
 
     if (type == g_SCILAB_CLASS_USERTYPE)