From f0d304e399c1b4a4b53ced3bae8b785a30122f33 Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Fri, 16 Apr 2021 23:38:22 +0200 Subject: [PATCH] * Bug 16284 fixed: typename() updated for Scilab 6 (11 'm', 'mc'=>'function') http://bugzilla.scilab.org/16284 Change-Id: Ie1b66431b1487ccaaaa9cb066abc73b14426e40a --- scilab/CHANGES.md | 1 + .../modules/core/sci_gateway/cpp/sci_typename.cpp | 22 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 29267ec..87dfbf4 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -380,6 +380,7 @@ Bug Fixes * [#16193](https://bugzilla.scilab.org/16193): `covStart()` clear previous coverage information. `profileEnable()` could be use to append a macro later on. * [#16196](https://bugzilla.scilab.org/16196): `covStart()` help page was incomplete about the API usage. * [#16274](https://bugzilla.scilab.org/16274): assert_checkequal() did not considered equal matching Nan or void elements in (nested) containers. +* [#16284](https://bugzilla.scilab.org/16284): `typename()` still considered removed uncompiled macros (11, "m"), and "mc" overloading code instead of "function". * [#16288](https://bugzilla.scilab.org/16288): An error message from `wavread` was wrong. * [#16297](https://bugzilla.scilab.org/16297): After function test(), e={}, endfunction; macr2tree(test) crashes Scilab. * [#16305](https://bugzilla.scilab.org/16305): `unwrap()` failed unfolding curves with straight segments. diff --git a/scilab/modules/core/sci_gateway/cpp/sci_typename.cpp b/scilab/modules/core/sci_gateway/cpp/sci_typename.cpp index 5071985..cc12ecb 100644 --- a/scilab/modules/core/sci_gateway/cpp/sci_typename.cpp +++ b/scilab/modules/core/sci_gateway/cpp/sci_typename.cpp @@ -25,15 +25,15 @@ extern "C" #include "elem_common.h" } /*--------------------------------------------------------------------------*/ -#define NB_OF_TYPE 18 +#define NB_OF_TYPE 17 /*--------------------------------------------------------------------------*/ types::Function::ReturnValue sci_typename(types::typed_list &in, int _iRetCount, types::typed_list &out) { int iOne = 1; const wchar_t* pstShortTypeName[NB_OF_TYPE] = {L"s", L"p", L"b", L"sp", L"spb", L"msp", L"i", L"h", L"c", - L"m", L"mc", L"f", L"l", L"tl", L"ml", L"ptr", L"ip", L"fptr" + L"function", L"f", L"l", L"tl", L"ml", L"ptr", L"ip", L"fptr" }; - double pstShortTypeNum[NB_OF_TYPE] = {1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 128, 129, 130}; + double pstShortTypeNum[NB_OF_TYPE] = {1, 2, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 128, 129, 130}; /* Check the number of input argument */ if (in.size() != 0) @@ -49,15 +49,15 @@ types::Function::ReturnValue sci_typename(types::typed_list &in, int _iRetCount, return types::Function::Error; } - if (in.size() == 0) - { - // get type number - types::Double* pDblOut = new types::Double(NB_OF_TYPE, 1); - double* pdblOut = pDblOut->get(); - int iSize = NB_OF_TYPE; - C2F(dcopy)(&iSize, pstShortTypeNum, &iOne, pdblOut, &iOne); - out.push_back(pDblOut); + // get type number + types::Double* pDblOut = new types::Double(NB_OF_TYPE, 1); + double* pdblOut = pDblOut->get(); + int iSize = NB_OF_TYPE; + C2F(dcopy)(&iSize, pstShortTypeNum, &iOne, pdblOut, &iOne); + out.push_back(pDblOut); + if (_iRetCount > 1) + { // get type name types::String* pStrOut = new types::String(NB_OF_TYPE, 1); for (int i = 0; i < NB_OF_TYPE; i++) -- 1.7.9.5