remove using namespace ast/types/std and use :: instead of.
Change-Id: Id5033cd35c3e82176e5f4d43268370f75659a3d1
#include "localization.h"
}
-using namespace std;
-
/********************************/
/* boolean matrix functions */
/********************************/
#include "localization.h"
}
-using namespace std;
-using namespace types;
-
SciErr getBooleanSparseMatrix(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos)
{
SciErr sciErr = sciErrInit();
return sciErr;
}
- SparseBool* pSpBool = ((InternalType*)_piAddress)->getAs<SparseBool>();
+ types::SparseBool* pSpBool = ((types::InternalType*)_piAddress)->getAs<types::SparseBool>();
*_piNbItem = (int)pSpBool->nbTrue();
if (_piNbItemRow == NULL)
return sciErr;
}
- SparseBool* pSparse = (SparseBool*)_piAddress;
+ types::SparseBool* pSparse = (types::SparseBool*)_piAddress;
for (int i = 0; i < _iRows; i++)
{
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
- types::SparseBool* pSparse = new SparseBool(_iRows, _iCols);
+ types::SparseBool* pSparse = new types::SparseBool(_iRows, _iCols);
if (pSparse == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_BOOLEAN_SPARSE, _("%s: Unable to create variable in Scilab memory"), "createBooleanSparseMatrix");
return sciErr;
}
- types::SparseBool* pSparse = new SparseBool(_iRows, _iCols);
+ types::SparseBool* pSparse = new types::SparseBool(_iRows, _iCols);
if (pSparse == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_NAMED_BOOLEAN_SPARSE, _("%s: Unable to create %s named \"%s\""), "createNamedBooleanSparseMatrix", _("boolean sparse matrix"), _pstName);
#include "gatewaystruct.hxx"
#include "double.hxx"
#include "polynom.hxx"
-#include "gatewaystruct.hxx"
#include "overload.hxx"
#include "context.hxx"
#include "symbol.hxx"
//StrCtx *pvApiCtx = NULL;
}
-using namespace types;
/*--------------------------------------------------------------------------*/
static SciErr getinternalVarAddress(void* _pvCtx, int _iVar, int** _piAddress);
/* Replaces Rhs */
int* getNbInputArgument(void* _pvCtx)
{
- GatewayStruct *pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct *pStr = (types::GatewayStruct*)_pvCtx;
if (pStr == NULL)
{
/* Replaces Lhs */
int* getNbOutputArgument(void* _pvCtx)
{
- GatewayStruct *pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct *pStr = (types::GatewayStruct*)_pvCtx;
if (pStr == NULL)
{
return &api_fake_int;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
//do nothing but don't crash
if (_iVal > *pStr->m_piRetCount || (_iVal - 1) < 0)
{
SciErr sciErr = sciErrInit();
- GatewayStruct *pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct *pStr = (types::GatewayStruct*)_pvCtx;
int iRhs = *getNbInputArgument(_pvCtx);
if (_iMin <= nbInputArgument(_pvCtx) && _iMax >= nbInputArgument(_pvCtx))
{
SciErr sciErr = sciErrInit();
- InternalType* pIT = ((InternalType*)_piAddress);
+ types::InternalType* pIT = (types::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);
+ pIT->getAs<types::GenericType>()->reshape(_iDimsArray, _iDims);
return sciErr;
}
return 1;
}
- Scierror(77, _("%s: Wrong number of input argument(s): at least %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMin);
+ Scierror(77, _("%s: Wrong number of input argument(s): at least %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMin);
return 0;
}
return 1;
}
- Scierror(77, _("%s: Wrong number of input argument(s): at most %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMax);
+ Scierror(77, _("%s: Wrong number of input argument(s): at most %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMax);
return 0;
}
if (_iMax == _iMin)
{
- Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMax);
+ Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMax);
}
else
{
- Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMin, _iMax);
+ Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMin, _iMax);
}
return 0;
return 1;
}
- Scierror(78, _("%s: Wrong number of output argument(s): at least %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMin);
+ Scierror(78, _("%s: Wrong number of output argument(s): at least %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMin);
return 0;
}
return 1;
}
- Scierror(78, _("%s: Wrong number of output argument(s): at most %d expected.\n"), ((GatewayStruct*)_pvCtx)->m_pstName, _iMax);
+ Scierror(78, _("%s: Wrong number of output argument(s): at most %d expected.\n"), ((types::GatewayStruct*)_pvCtx)->m_pstName, _iMax);
return 0;
}
/*--------------------------------------------------------------------------*/
int callScilabFunction(void* _pvCtx, char const* _pstName, int _iStart, int _iLhs, int _iRhs)
{
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- Function::ReturnValue callResult;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::Function::ReturnValue callResult;
wchar_t* pwstName = to_wide_string(_pstName);
std::wstring wsFunName(pwstName);
- typed_list in;
- typed_list out;
+ types::typed_list in;
+ types::typed_list out;
for (int i = 0 ; i < _iRhs ; i++)
in[i]->DecreaseRef();
}
- if (callResult == Function::OK)
+ if (callResult == types::Function::OK)
{
int iCallerRhs = (int)pStr->m_pIn->size();
pStr->m_pIn->resize(iCallerRhs + _iRhs + _iLhs, NULL);
int callOverloadFunction(void* _pvCtx, int _iVar, char* _pstName, unsigned int _iNameLen)
{
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- Function::ReturnValue callResult;
- typed_list tlReturnedValues;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::Function::ReturnValue callResult;
+ types::typed_list tlReturnedValues;
wchar_t* pwstName = NULL;
if (_pstName == NULL || strlen(_pstName) == 0)
(*pStr->m_pIn)[i]->DecreaseRef();
}
- if (callResult == Function::OK)
+ if (callResult == types::Function::OK)
{
int i = 0;
- typed_list::iterator it;
+ types::typed_list::iterator it;
for (it = tlReturnedValues.begin() ; it != tlReturnedValues.end() ; ++it, ++i)
{
(pStr->m_pOut)[i] = *it;
if (_piAddress != NULL && isVarMatrixType(_pvCtx, _piAddress))
{
- *_piRows = ((InternalType*)_piAddress)->getAs<GenericType>()->getRows();
- *_piCols = ((InternalType*)_piAddress)->getAs<GenericType>()->getCols();
+ *_piRows = ((types::InternalType*)_piAddress)->getAs<types::GenericType>()->getRows();
+ *_piCols = ((types::InternalType*)_piAddress)->getAs<types::GenericType>()->getCols();
}
else
{
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- typed_list in = *pStr->m_pIn;
- optional_list opt = *pStr->m_pOpt;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::typed_list in = *pStr->m_pIn;
+ types::optional_list opt = *pStr->m_pOpt;
int* piRetCount = pStr->m_piRetCount;
int iInputSize = static_cast<int>(in.size()) + static_cast<int>(opt.size());
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- typed_list in = *pStr->m_pIn;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::typed_list in = *pStr->m_pIn;
if (in[_iVar - 1]->isCallable())
{
wchar_t* pwstName = to_wide_string(_pstName);
symbol::Context* pCtx = symbol::Context::getInstance();
- InternalType* pVar = pCtx->get(symbol::Symbol(pwstName));
+ types::InternalType* pVar = pCtx->get(symbol::Symbol(pwstName));
FREE(pwstName);
if (pVar == NULL)
return sciErr;
}
- switch (((InternalType*)_piAddress)->getType())
+ switch (((types::InternalType*)_piAddress)->getType())
{
- case GenericType::ScilabDouble :
+ case types::InternalType::ScilabDouble :
*_piType = sci_matrix;
break;
- case GenericType::ScilabPolynom :
+ case types::InternalType::ScilabPolynom :
*_piType = sci_poly;
break;
- case GenericType::ScilabBool :
+ case types::InternalType::ScilabBool :
*_piType = sci_boolean;
break;
- case GenericType::ScilabSparse :
+ case types::InternalType::ScilabSparse :
*_piType = sci_sparse;
break;
- case GenericType::ScilabSparseBool :
+ case types::InternalType::ScilabSparseBool :
*_piType = sci_boolean_sparse;
break;
- //case GenericType::RealMatlabSparse :
+ //case types::InternalType::RealMatlabSparse :
// *_piType = sci_matlab_sparse;
// break;
- case GenericType::ScilabInt8 :
- case GenericType::ScilabUInt8 :
- case GenericType::ScilabInt16 :
- case GenericType::ScilabUInt16 :
- case GenericType::ScilabInt32 :
- case GenericType::ScilabUInt32 :
- case GenericType::ScilabInt64 :
- case GenericType::ScilabUInt64 :
+ case types::InternalType::ScilabInt8 :
+ case types::InternalType::ScilabUInt8 :
+ case types::InternalType::ScilabInt16 :
+ case types::InternalType::ScilabUInt16 :
+ case types::InternalType::ScilabInt32 :
+ case types::InternalType::ScilabUInt32 :
+ case types::InternalType::ScilabInt64 :
+ case types::InternalType::ScilabUInt64 :
*_piType = sci_ints;
break;
- case GenericType::ScilabHandle :
+ case types::InternalType::ScilabHandle :
*_piType = sci_handles;
break;
- case GenericType::ScilabString :
+ case types::InternalType::ScilabString :
*_piType = sci_strings;
break;
- case GenericType::ScilabMacroFile :
+ case types::InternalType::ScilabMacroFile :
*_piType = sci_u_function;
break;
- case GenericType::ScilabMacro :
+ case types::InternalType::ScilabMacro :
*_piType = sci_c_function;
break;
- case GenericType::ScilabList :
+ case types::InternalType::ScilabList :
*_piType = sci_list;
break;
- case GenericType::ScilabCell :
+ case types::InternalType::ScilabCell :
*_piType = sci_mlist;
break;
- case GenericType::ScilabTList :
+ case types::InternalType::ScilabTList :
*_piType = sci_tlist;
break;
- case GenericType::ScilabMList :
+ case types::InternalType::ScilabMList :
*_piType = sci_mlist;
break;
- case GenericType::ScilabStruct :
+ case types::InternalType::ScilabStruct :
// Scilab < 6 compatibility... Struct have type 17;
*_piType = sci_mlist;
break;
- case GenericType::ScilabUserType :
+ case types::InternalType::ScilabUserType :
*_piType = sci_pointer;
break;
- case GenericType::ScilabColon :
- case GenericType::ScilabImplicitList :
+ case types::InternalType::ScilabColon :
+ case types::InternalType::ScilabImplicitList :
*_piType = sci_implicit_poly;
break;
- case GenericType::ScilabFunction:
+ case types::InternalType::ScilabFunction:
*_piType = sci_intrinsic_function;
break;
- case GenericType::ScilabLibrary:
+ case types::InternalType::ScilabLibrary:
*_piType = sci_lib;
break;
default:
return 0;
}
- InternalType* pIT = (InternalType*)_piAddress;
- GenericType* pGT = dynamic_cast<GenericType*>(pIT);
+ types::InternalType* pIT = (types::InternalType*)_piAddress;
+ types::GenericType* pGT = dynamic_cast<types::GenericType*>(pIT);
if (pGT == NULL)
{
addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "isVarComplex");
int getRhsFromAddress(void *_pvCtx, int *_piAddress)
{
int i = 0;
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- typed_list in = *pStr->m_pIn;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::typed_list in = *pStr->m_pIn;
for (i = 0 ; i < in.size() ; i++)
{
/*--------------------------------------------------------------------------*/
int isStruct(void *_pvCtx, int *_piAddress)
{
- if (((InternalType*)_piAddress)->getType() == GenericType::ScilabStruct)
+ if (((types::InternalType*)_piAddress)->getType() == types::InternalType::ScilabStruct)
{
return 1;
}
/*--------------------------------------------------------------------------*/
int isCell(void *_pvCtx, int *_piAddress)
{
- if (((InternalType*)_piAddress)->getType() == GenericType::ScilabCell)
+ if (((types::InternalType*)_piAddress)->getType() == types::InternalType::ScilabCell)
{
return 1;
}
}
_psciErr->iMsgCount = 0;
-}
\ No newline at end of file
+}
extern int C2F(icopy)(int *, int *, int *, int *, int *);
}
-using namespace types;
-
/*******************************/
/* double matrix functions */
/*******************************/
return sciErr;
}
- Double* pDbl = (Double*)_piAddress;
+ types::Double* pDbl = (types::Double*)_piAddress;
pDbl->convertToZComplex();
*_pdblZ = (doublecomplex*)(pDbl->get());
return sciErr;
//Warning we overwrite double by int !!!!
C2F(entier)(&iSize, pdblReal, *_piReal);
- Double* pD = (Double*)_piAddress;
+ types::Double* pD = (types::Double*)_piAddress;
pD->setViewAsInteger();
return sciErr;
return sciErr;
}
- Double* pD = (Double*)_piAddress;
+ types::Double* pD = (types::Double*)_piAddress;
//convert values and view of data to int and int*
pD->convertToInteger();
if (_pdblReal != NULL)
{
- *_pdblReal = ((InternalType*)_piAddress)->getAs<Double>()->getReal();
+ *_pdblReal = ((types::InternalType*)_piAddress)->getAs<types::Double>()->getReal();
}
if (_iComplex && _pdblImg != NULL)
{
- *_pdblImg = ((InternalType*)_piAddress)->getAs<Double>()->getImg();
+ *_pdblImg = ((types::InternalType*)_piAddress)->getAs<types::Double>()->getImg();
}
return sciErr;
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
- Double* pDbl = NULL;
+ types::Double* pDbl = NULL;
try
{
if (_cType == 'z')
{
- pDbl = new Double(_iRows, _iCols, _iComplex == 1, true);
+ pDbl = new types::Double(_iRows, _iCols, _iComplex == 1, true);
}
else
{
- pDbl = new Double(_iRows, _iCols, _iComplex == 1);
+ pDbl = new types::Double(_iRows, _iCols, _iComplex == 1);
if (_cType == 'i')
{
pDbl->setViewAsInteger();
return sciErr;
}
- Double* pDbl = new Double(_iRows, _iCols, true);
+ types::Double* pDbl = new types::Double(_iRows, _iCols, true);
double* pdblReal = pDbl->get();
double* pdblImg = pDbl->getImg();
int iOne = 1;
int iSize = _iRows * _iCols;
- Double* pDbl = new Double(_iRows, _iCols, _iComplex == 1);
+ types::Double* pDbl = new types::Double(_iRows, _iCols, _iComplex == 1);
double* pdblReal = pDbl->get();
C2F(dcopy)(&iSize, const_cast<double*>(_pdblReal), &iOne, pdblReal, &iOne);
#include "call_scilab.h"
}
-using namespace std;
-using namespace types;
-
-
SciErr getMatrixOfHandle(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, long long** _pllHandle)
{
SciErr sciErr = sciErrInit();
if (_pllHandle)
{
- *_pllHandle = ((InternalType*)_piAddress)->getAs<types::GraphicHandle>()->get();
+ *_pllHandle = ((types::InternalType*)_piAddress)->getAs<types::GraphicHandle>()->get();
}
return sciErr;
}
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- typed_list in = *pStr->m_pIn;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::typed_list in = *pStr->m_pIn;
+ types::InternalType** out = pStr->m_pOut;
- GraphicHandle *pHandle = new GraphicHandle(_iRows, _iCols);
+ types::GraphicHandle *pHandle = new types::GraphicHandle(_iRows, _iCols);
if (pHandle == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), "allocMatrixOfHandle");
#include "api_internal_common.h"
}
-using namespace types;
static int getCommonScalarInteger(void* _pvCtx, int* _piAddress, int _iPrec, void** _pvData);
static int getCommonNamedScalarInteger(void* _pvCtx, const char* _pstName, int _iPrec, void** _pvData);
return sciErr;
}
- if (!((InternalType*)_piAddress)->isInt())
+ if (!((types::InternalType*)_piAddress)->isInt())
{
addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getMatrixOfIntegerPrecision", _("int matrix"));
return sciErr;
}
- switch (((InternalType*)_piAddress)->getType())
+ switch (((types::InternalType*)_piAddress)->getType())
{
- case GenericType::ScilabInt8 :
+ case types::InternalType::ScilabInt8 :
*_piPrecision = SCI_INT8;
break;
- case GenericType::ScilabUInt8 :
+ case types::InternalType::ScilabUInt8 :
*_piPrecision = SCI_UINT8;
break;
- case GenericType::ScilabInt16 :
+ case types::InternalType::ScilabInt16 :
*_piPrecision = SCI_INT16;
break;
- case GenericType::ScilabUInt16 :
+ case types::InternalType::ScilabUInt16 :
*_piPrecision = SCI_UINT16;
break;
- case GenericType::ScilabInt32 :
+ case types::InternalType::ScilabInt32 :
*_piPrecision = SCI_INT32;
break;
- case GenericType::ScilabUInt32 :
+ case types::InternalType::ScilabUInt32 :
*_piPrecision = SCI_UINT32;
break;
- case GenericType::ScilabInt64 :
+ case types::InternalType::ScilabInt64 :
*_piPrecision = SCI_INT64;
break;
- case GenericType::ScilabUInt64 :
+ case types::InternalType::ScilabUInt64 :
*_piPrecision = SCI_UINT64;
break;
default:
return sciErr;
}
- switch (((InternalType*)_piAddress)->getType())
+ switch (((types::InternalType*)_piAddress)->getType())
{
- case GenericType::ScilabInt8 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::Int8>()->get();
+ case types::InternalType::ScilabInt8 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::Int8>()->get();
break;
- case GenericType::ScilabUInt8 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::UInt8>()->get();
+ case types::InternalType::ScilabUInt8 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::UInt8>()->get();
break;
- case GenericType::ScilabInt16 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::Int16>()->get();
+ case types::InternalType::ScilabInt16 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::Int16>()->get();
break;
- case GenericType::ScilabUInt16 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::UInt16>()->get();
+ case types::InternalType::ScilabUInt16 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::UInt16>()->get();
break;
- case GenericType::ScilabInt32 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::Int32>()->get();
+ case types::InternalType::ScilabInt32 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::Int32>()->get();
break;
- case GenericType::ScilabUInt32 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::UInt32>()->get();
+ case types::InternalType::ScilabUInt32 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::UInt32>()->get();
break;
- case GenericType::ScilabInt64 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::Int64>()->get();
+ case types::InternalType::ScilabInt64 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::Int64>()->get();
break;
- case GenericType::ScilabUInt64 :
- *_piData = (void*)((InternalType*)_piAddress)->getAs<types::UInt64>()->get();
+ case types::InternalType::ScilabUInt64 :
+ *_piData = (void*)((types::InternalType*)_piAddress)->getAs<types::UInt64>()->get();
break;
default:
return sciErr;
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
- InternalType *pIT;
+ types::InternalType *pIT = nullptr;
switch (_iPrecision)
{
case SCI_INT8 :
- pIT = new Int8(_iRows, _iCols, (char**)_pvData);
+ pIT = new types::Int8(_iRows, _iCols, (char**)_pvData);
break;
case SCI_UINT8 :
- pIT = new UInt8(_iRows, _iCols, (unsigned char**)_pvData);
+ pIT = new types::UInt8(_iRows, _iCols, (unsigned char**)_pvData);
break;
case SCI_INT16 :
- pIT = new Int16(_iRows, _iCols, (short**)_pvData);
+ pIT = new types::Int16(_iRows, _iCols, (short**)_pvData);
break;
case SCI_UINT16 :
- pIT = new UInt16(_iRows, _iCols, (unsigned short**)_pvData);
+ pIT = new types::UInt16(_iRows, _iCols, (unsigned short**)_pvData);
break;
case SCI_INT32 :
- pIT = new Int32(_iRows, _iCols, (int**)_pvData);
+ pIT = new types::Int32(_iRows, _iCols, (int**)_pvData);
break;
case SCI_UINT32 :
- pIT = new UInt32(_iRows, _iCols, (unsigned int**)_pvData);
+ pIT = new types::UInt32(_iRows, _iCols, (unsigned int**)_pvData);
break;
case SCI_INT64 :
- pIT = new Int64(_iRows, _iCols, (long long**)_pvData);
+ pIT = new types::Int64(_iRows, _iCols, (long long**)_pvData);
break;
case SCI_UINT64 :
- pIT = new UInt64(_iRows, _iCols, (unsigned long long**)_pvData);
+ pIT = new types::UInt64(_iRows, _iCols, (unsigned long long**)_pvData);
break;
}
return sciErr;
}
- InternalType *pIT;
+ types::InternalType *pIT = nullptr;
switch (_iPrecision)
{
case SCI_INT8 :
- Int8 *pInt8;
- pInt8 = new Int8(_iRows, _iCols);
+ {
+ types::Int8 *pInt8 = new types::Int8(_iRows, _iCols);
pInt8->set((char*)_pvData);
pIT = pInt8;
break;
- case SCI_UINT8 :
- UInt8 *pUInt8;
- pUInt8 = new UInt8(_iRows, _iCols);
+ }
+ case SCI_UINT8:
+ {
+ types::UInt8 *pUInt8 = new types::UInt8(_iRows, _iCols);
pUInt8->set((unsigned char*)_pvData);
pIT = pUInt8;
break;
+ }
case SCI_INT16 :
- Int16 *pInt16;
- pInt16 = new Int16(_iRows, _iCols);
+ {
+ types::Int16 *pInt16 = new types::Int16(_iRows, _iCols);
pInt16->set((short*)_pvData);
pIT = pInt16;
break;
- case SCI_UINT16 :
- UInt16 *pUInt16;
- pUInt16 = new UInt16(_iRows, _iCols);
+ }
+ case SCI_UINT16:
+ {
+ types::UInt16 *pUInt16 = new types::UInt16(_iRows, _iCols);
pUInt16->set((unsigned short*)_pvData);
pIT = pUInt16;
break;
- case SCI_INT32 :
- Int32 *pInt32;
- pInt32 = new Int32(_iRows, _iCols);
+ }
+ case SCI_INT32:
+ {
+ types::Int32 *pInt32 = new types::Int32(_iRows, _iCols);
pInt32->set((int*)_pvData);
pIT = pInt32;
break;
- case SCI_UINT32 :
- UInt32 *pUInt32;
- pUInt32 = new UInt32(_iRows, _iCols);
+ }
+ case SCI_UINT32:
+ {
+ types::UInt32 *pUInt32 = new types::UInt32(_iRows, _iCols);
pUInt32->set((unsigned int*)_pvData);
pIT = pUInt32;
break;
- case SCI_INT64 :
- Int64 *pInt64;
- pInt64 = new Int64(_iRows, _iCols);
+ }
+ case SCI_INT64:
+ {
+ types::Int64 *pInt64 = new types::Int64(_iRows, _iCols);
pInt64->set((long long*)_pvData);
pIT = pInt64;
break;
- case SCI_UINT64 :
- UInt64 *pUInt64;
- pUInt64 = new UInt64(_iRows, _iCols);
+ }
+ case SCI_UINT64:
+ {
+ types::UInt64 *pUInt64 = new types::UInt64(_iRows, _iCols);
pUInt64->set((unsigned long long*)_pvData);
pIT = pUInt64;
break;
}
+}
if (pIT == NULL)
{
return sciErr;
}
- InternalType* pIT = (InternalType*)piAddr;
+ types::InternalType* pIT = (types::InternalType*)piAddr;
//check variable type
if (pIT->isInt() == false)
switch (pIT->getType())
{
- case InternalType::ScilabInt8 :
+ case types::InternalType::ScilabInt8 :
*_piPrecision = sci_int8;
break;
- case InternalType::ScilabUInt8 :
+ case types::InternalType::ScilabUInt8 :
*_piPrecision = sci_uint8;
break;
- case InternalType::ScilabInt16 :
+ case types::InternalType::ScilabInt16 :
*_piPrecision = sci_int16;
break;
- case InternalType::ScilabUInt16 :
+ case types::InternalType::ScilabUInt16 :
*_piPrecision = sci_uint16;
break;
- case InternalType::ScilabInt32 :
+ case types::InternalType::ScilabInt32 :
*_piPrecision = sci_int32;
break;
- case InternalType::ScilabUInt32 :
+ case types::InternalType::ScilabUInt32 :
*_piPrecision = sci_uint32;
break;
- case InternalType::ScilabInt64 :
+ case types::InternalType::ScilabInt64 :
*_piPrecision = sci_int64;
break;
- case InternalType::ScilabUInt64 :
+ case types::InternalType::ScilabUInt64 :
*_piPrecision = sci_uint64;
break;
default :
#include "localization.h"
}
-using namespace types;
-
//internal functions
static SciErr checkListItemPosition(void* _pvCtx, int* _piParent, int _iItemPos, int _apiError, const char* _functionName);
static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNbItem, int** _piAddress);
return sciErr;
}
- List* pL = (List*)_piAddress;
+ types::List* pL = (types::List*)_piAddress;
switch (iType)
{
case sci_list :
return sciErr;
}
- List* pL = (List*)_piAddress;
+ types::List* pL = (types::List*)_piAddress;
//get offset of item array
- InternalType* pIT = pL->get(_iItemNum - 1);
+ types::InternalType* pIT = pL->get(_iItemNum - 1);
if (pIT->isListUndefined())
{
*_piItemAddress = NULL;
return sciErr;
}
- List* pL = NULL;
+ types::List* pL = NULL;
try
{
if (_iListType == sci_list)
{
- pL = new List();
+ pL = new types::List();
}
else if (_iListType == sci_mlist)
{
- pL = new MList();
+ pL = new types::MList();
}
else if (_iListType == sci_tlist)
{
- pL = new TList();
+ pL = new types::TList();
}
else
{
*_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 ListUndefined());
+ pL->set(_iNbItem - 1, new types::ListUndefined());
wchar_t* pwstName = to_wide_string(_pstName);
symbol::Context* ctx = symbol::Context::getInstance();
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
- List* pL = NULL;
+ types::List* pL = NULL;
try
{
if (_iListType == sci_list)
{
- pL = new List();
+ pL = new types::List();
}
else if (_iListType == sci_mlist)
{
- pL = new MList();
+ pL = new types::MList();
}
else if (_iListType == sci_tlist)
{
- pL = new TList();
+ pL = new types::TList();
}
else
{
// 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 ListUndefined());
+ pL->set(_iNbItem - 1, new types::ListUndefined());
int rhs = _iVar - *getNbInputArgument(_pvCtx);
out[rhs - 1] = pL;
return sciErr;
}
- List* pChild = NULL;
+ types::List* pChild = NULL;
try
{
if (_iListType == sci_list)
{
- pChild = new List();
+ pChild = new types::List();
}
else if (_iListType == sci_mlist)
{
- pChild = new MList();
+ pChild = new types::MList();
}
else if (_iListType == sci_tlist)
{
- pChild = new TList();
+ pChild = new types::TList();
}
else
{
return sciErr;
}
// create a list in the list with a user number of items
- pChild->set(_iNbItem - 1, new ListUndefined());
+ pChild->set(_iNbItem - 1, new types::ListUndefined());
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
pParent->set(_iItemPos - 1, pChild);
*_piAddress = (int*)pChild;
return sciErr;
return sciErr;
}
- List* pL = (List*)_piParent;
+ types::List* pL = (types::List*)_piParent;
if (pL == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "createVoidInNamedList");
return sciErr;
}
- pL->set(_iItemPos - 1, new Void());
+ pL->set(_iItemPos - 1, new types::Void());
return sciErr;
}
return sciErr;
}
- List* pL = (List*)_piParent;
+ types::List* pL = (types::List*)_piParent;
if (pL == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "createUndefinedInNamedList");
return sciErr;
}
- pL->set(_iItemPos - 1, new ListUndefined());
+ pL->set(_iItemPos - 1, new types::ListUndefined());
return sciErr;
}
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
if (_iRows == 0 || _iCols == 0)
{
- Double *pDbl = Double::Empty();
+ types::Double *pDbl = types::Double::Empty();
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
return sciErr;
}
- Double* pDbl = NULL;
+ types::Double* pDbl = NULL;
try
{
- pDbl = new Double(_iRows, _iCols, _iComplex == 1);
+ pDbl = new types::Double(_iRows, _iCols, _iComplex == 1);
}
catch (const ast::InternalError& ie)
{
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
if (_iRows == 0 || _iCols == 0)
{
- Double *pDbl = Double::Empty();
+ types::Double *pDbl = types::Double::Empty();
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
return sciErr;
}
- String* pS = NULL;
+ types::String* pS = NULL;
try
{
- pS = new String(_iRows, _iCols);
+ pS = new types::String(_iRows, _iCols);
}
catch (const ast::InternalError& ie)
{
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
if (_iRows == 0 || _iCols == 0)
{
- Double *pDbl = Double::Empty();
+ types::Double *pDbl = types::Double::Empty();
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
return sciErr;
}
- Bool* pBool = NULL;
+ types::Bool* pBool = NULL;
try
{
- pBool = new Bool(_iRows, _iCols);
+ pBool = new types::Bool(_iRows, _iCols);
}
catch (const ast::InternalError& ie)
{
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
//return empty matrix
if (_iRows == 0 || _iCols == 0)
{
- Double *pDbl = Double::Empty();
+ types::Double *pDbl = types::Double::Empty();
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
wchar_t* pstTemp = to_wide_string(_pstVarName);
std::wstring wstTemp(pstTemp);
- Polynom* pP = new Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
+ types::Polynom* pP = new types::Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
FREE(pstTemp);
if (pP == NULL)
{
for (int i = 0; i < pP->getSize(); i++)
{
- Double* pD = new Double(_piNbCoef[i], 1, _iComplex == 1);
+ types::Double* pD = new types::Double(_piNbCoef[i], 1, _iComplex == 1);
pD->set(_pdblReal[i]);
if (_iComplex)
{
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
if (_iRows == 0 || _iCols == 0)
{
- Double *pDbl = Double::Empty();
+ types::Double *pDbl = types::Double::Empty();
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
return sciErr;
}
- InternalType* pIT = NULL;
+ types::InternalType* pIT = NULL;
try
{
switch (_iPrecision)
{
case SCI_INT8 :
{
- Int8* pi = new Int8(_iRows, _iCols);
+ types::Int8* pi = new types::Int8(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_UINT8 :
{
- UInt8* pi = new UInt8(_iRows, _iCols);
+ types::UInt8* pi = new types::UInt8(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_INT16 :
{
- Int16* pi = new Int16(_iRows, _iCols);
+ types::Int16* pi = new types::Int16(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_UINT16 :
{
- UInt16* pi = new UInt16(_iRows, _iCols);
+ types::UInt16* pi = new types::UInt16(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_INT32 :
{
- Int32* pi = new Int32(_iRows, _iCols);
+ types::Int32* pi = new types::Int32(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_UINT32 :
{
- UInt32* pi = new UInt32(_iRows, _iCols);
+ types::UInt32* pi = new types::UInt32(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_INT64 :
{
- Int64* pi = new Int64(_iRows, _iCols);
+ types::Int64* pi = new types::Int64(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
break;
case SCI_UINT64 :
{
- UInt64* pi = new UInt64(_iRows, _iCols);
+ types::UInt64* pi = new types::UInt64(_iRows, _iCols);
*_pvData = pi->get();
pIT = pi;
}
{
SciErr sciErr = sciErrInit();
- Sparse* pSparse = (Sparse*)_piParent;
+ types::Sparse* pSparse = (types::Sparse*)_piParent;
if (_iComplex)
{
return sciErr;
}
- Sparse* pSparse = NULL;
+ types::Sparse* pSparse = NULL;
try
{
- pSparse = new Sparse(_iRows, _iCols, _iComplex == 1);
+ pSparse = new types::Sparse(_iRows, _iCols, _iComplex == 1);
}
catch (const ast::InternalError& ie)
{
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
pParent->set(_iItemPos - 1, pSparse);
return sciErr;
static SciErr fillBooleanSparseMatrixInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, int _iNbItem, const int* _piNbItemRow, const int* _piColPos)
{
SciErr sciErr = sciErrInit();
- SparseBool* pSparse = (SparseBool*)_piParent;
+ types::SparseBool* pSparse = (types::SparseBool*)_piParent;
for (int i = 0; i < _iRows; i++)
{
return sciErr;
}
- SparseBool* pSparse = NULL;
+ types::SparseBool* pSparse = NULL;
try
{
- pSparse = new SparseBool(_iRows, _iCols);
+ pSparse = new types::SparseBool(_iRows, _iCols);
}
catch (const ast::InternalError& ie)
{
return sciErr;
}
- List* piParent = (List*)_piParent;
+ types::List* piParent = (types::List*)_piParent;
piParent->set(_iItemPos - 1, pSparse);
return sciErr;
return sciErr;
}
- Pointer* pP = NULL;
+ types::Pointer* pP = NULL;
try
{
- pP = new Pointer(_pvPtr);
+ pP = new types::Pointer(_pvPtr);
if (pP == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "createPointerInList");
return sciErr;
}
- List* pParent = (List*)_piParent;
+ types::List* pParent = (types::List*)_piParent;
pParent->set(_iItemPos - 1, pP);
return sciErr;
}
-using namespace types;
-
static int findOptional(void* _pvCtx, char *fname, rhs_opts opts[]);
static void printOptionalNames(void* _pvCtx, rhs_opts opts[]);
/**************************/
int getOptionals(void* _pvCtx, char* pstFuncName, rhs_opts opts[])
{
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
types::optional_list opt = *pStr->m_pOpt;
int i = 0;
}
opts[index].iPos = i + 1;
- GenericType* pGT = (GenericType*)opt[i].second;
+ types::GenericType* pGT = (types::GenericType*)opt[i].second;
getVarType(_pvCtx, (int*)pGT, &typeOfOpt);
opts[index].iType = typeOfOpt;
if (typeOfOpt == sci_implicit_poly)
{
- InternalType* pIT = NULL;
- ImplicitList* pIL = pGT->getAs<ImplicitList>();
+ types::InternalType* pIT = NULL;
+ types::ImplicitList* pIL = pGT->getAs<types::ImplicitList>();
pIT = pIL->extractFullMatrix();
- Double* impResult = (Double*)pIT;
+ types::Double* impResult = (types::Double*)pIT;
opts[index].iRows = impResult->getRows();
opts[index].iCols = impResult->getCols();
opts[index].piAddr = (int*)impResult;
int FirstOpt(void* _pvCtx)
{
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
return (int)pStr->m_pIn->size() + 1;
}
int NumOpt(void* _pvCtx)
{
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
return (int)pStr->m_pOpt->size();
}
#include "localization.h"
}
-using namespace types;
-
SciErr getPointer(void* _pvCtx, int* _piAddress, void** _pvPtr)
{
SciErr sciErr = sciErrInit();
return sciErr;
}
- *_pvPtr = ((InternalType*)_piAddress)->getAs<Pointer>()->get();
+ *_pvPtr = ((types::InternalType*)_piAddress)->getAs<types::Pointer>()->get();
return sciErr;
}
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
- Pointer* pP = NULL;
+ types::Pointer* pP = NULL;
try
{
- pP = new Pointer(_pvPtr);
+ pP = new types::Pointer(_pvPtr);
if (pP == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "createPointer");
wchar_t* pwstName = to_wide_string(_pstName);
- Pointer* pP = new Pointer(_pvPtr);
+ types::Pointer* pP = new types::Pointer(_pvPtr);
symbol::Context* ctx = symbol::Context::getInstance();
symbol::Symbol sym = symbol::Symbol(pwstName);
FREE(pwstName);
#include "sci_malloc.h"
#include "charEncoding.h"
}
-using namespace types;
static int getCommonAllocatedSinglePoly(void* _pvCtx, int* _piAddress, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
static int getCommonAllocatedNamedSinglePoly(void* _pvCtx, const char* _pstName, int _iComplex, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
return sciErr;
}
- if (!((InternalType*)_piAddress)->isPoly())
+ if (!((types::InternalType*)_piAddress)->isPoly())
{
addErrorMessage(&sciErr, API_ERROR_INVALID_TYPE, _("%s: Invalid argument type, %s expected"), "getPolyVariableName", _("polynomial matrix"));
return sciErr;
if (*_piVarNameLen == 0)
{
- *_piVarNameLen = (int)((InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().size();
+ *_piVarNameLen = (int)((types::InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().size();
//No error
}
return sciErr;
}
- char* pstTemp = wide_string_to_UTF8(((InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().c_str());
+ char* pstTemp = wide_string_to_UTF8(((types::InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().c_str());
strcpy(_pstVarName, pstTemp);
FREE(pstTemp);
*_piVarNameLen = static_cast<int>(strlen(_pstVarName));
return sciErr;
}
- Polynom *pMP = ((InternalType*)_piAddress)->getAs<types::Polynom>();
+ types::Polynom *pMP = ((types::InternalType*)_piAddress)->getAs<types::Polynom>();
pMP->getSizes(_piNbCoef);
if (_pdblReal == NULL)
return sciErr;
}
- SinglePoly** pSP = pMP->get();
+ types::SinglePoly** pSP = pMP->get();
if (_iComplex == 1)
{
for (int i = 0 ; i < iSize ; i++)
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
int rhs = _iVar - *getNbInputArgument(_pvCtx);
//return empty matrix
if (_iRows == 0 && _iCols == 0)
{
- Double *pDbl = new Double(_iRows, _iCols);
+ types::Double *pDbl = new types::Double(_iRows, _iCols);
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
wchar_t* pstTemp = to_wide_string(_pstVarName);
std::wstring wstTemp(pstTemp);
- Polynom* pP = new Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
+ types::Polynom* pP = new types::Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
FREE(pstTemp);
if (pP == NULL)
{
for (int i = 0 ; i < pP->getSize() ; i++)
{
- Double* pD = new Double(_piNbCoef[i], 1, _iComplex == 1);
+ types::Double* pD = new types::Double(_piNbCoef[i], 1, _iComplex == 1);
pD->set(_pdblReal[i]);
if (_iComplex)
{
wchar_t* pstTemp = to_wide_string(_pstVarName);
std::wstring wstTemp(pstTemp);
- Polynom* pP = new Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
+ types::Polynom* pP = new types::Polynom(wstTemp, _iRows, _iCols, _piNbCoef);
FREE(pstTemp);
if (pP == NULL)
{
for (int i = 0 ; i < pP->getSize() ; i++)
{
- Double* pD = new Double(_piNbCoef[i], 1, _iComplex == 1);
+ types::Double* pD = new types::Double(_piNbCoef[i], 1, _iComplex == 1);
pD->set(_pdblReal[i]);
if (_iComplex)
{
#include "call_scilab.h"
}
-using namespace types;
-
static int getCommonAllocatedSparseMatrix(void* _pvCtx, int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg);
static int getCommonNamedAllocatedSparseMatrix(void* _pvCtx, const char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbItem, int** _piNbItemRow, int** _piColPos, double** _pdblReal, double** _pdblImg);
return sciErr;
}
- Sparse* pS = ((InternalType*)_piAddress)->getAs<Sparse>();
+ types::Sparse* pS = ((types::InternalType*)_piAddress)->getAs<types::Sparse>();
*_piNbItem = (int)pS->nonZeros();
//convert to ij, val, dims format to call sparse constructor
//dims
- Double* dims = new Double(1, 2, false);
+ types::Double* dims = new types::Double(1, 2, false);
dims->get()[0] = (double)_iRows;
dims->get()[1] = (double)_iCols;
//ij
- Double* ij = new Double(_iNbItem, 2);
+ types::Double* ij = new types::Double(_iNbItem, 2);
double* pI = ij->get();
double* pJ = ij->get() + _iNbItem;
}
}
- Double* val = new Double(_iNbItem, 1, _iComplex == 1);
+ types::Double* val = new types::Double(_iNbItem, 1, _iComplex == 1);
double* pR = val->get();
if (_iComplex)
{
}
}
- Sparse* pSparse = new Sparse(*val, *ij, *dims);
+ types::Sparse* pSparse = new types::Sparse(*val, *ij, *dims);
delete dims;
delete val;
delete ij;
return sciErr;
}
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
int iTotalSize = 0;
types::Sparse* pSparse = NULL;
#include "os_string.h"
}
-using namespace types;
/*--------------------------------------------------------------------------*/
/*******************************/
return sciErr;
}
- String *pS = ((InternalType*)_piAddress)->getAs<types::String>();
+ types::String *pS = ((types::InternalType*)_piAddress)->getAs<types::String>();
//non cummulative length
int iSize = pS->getSize();
SciErr sciErr = sciErrInit();
int rhs = _iVar - *getNbInputArgument(_pvCtx);
- GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
- InternalType** out = pStr->m_pOut;
+ types::GatewayStruct* pStr = (types::GatewayStruct*)_pvCtx;
+ types::InternalType** out = pStr->m_pOut;
//return empty matrix
if (_iRows == 0 && _iCols == 0)
{
- Double *pDbl = new Double(_iRows, _iCols);
+ types::Double *pDbl = new types::Double(_iRows, _iCols);
if (pDbl == NULL)
{
addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
return sciErr;
}
- String* pS = new String(_iRows, _iCols);
+ types::String* pS = new types::String(_iRows, _iCols);
if (pS == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), "createMatrixOfString");
return sciErr;
}
- String* pS = new String(_iRows, _iCols);
+ types::String* pS = new types::String(_iRows, _iCols);
if (pS == NULL)
{
addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedMatrixOfString", _pstName);
return sciErr;
}
- String *pS = ((InternalType*)_piAddress)->getAs<types::String>();
+ types::String *pS = ((types::InternalType*)_piAddress)->getAs<types::String>();
int iSize = pS->getSize();
if (_pwstStrings == NULL || *_pwstStrings == NULL)
return sciErr;
}
- String* pS = new String(_iRows, _iCols);
+ types::String* pS = new types::String(_iRows, _iCols);
if (pS == NULL)
{
addErrorMessage(&sciErr, API_ERROR_INVALID_NAME, _("%s: Invalid variable name: %s."), "createNamedMatrixOfWideString", _pstName);
{
SciErr sciErr = sciErrInit();
- GatewayStruct* pGstr = (GatewayStruct*)_pvCtx;
- typed_list in = *pGstr->m_pIn;
- InternalType** out = pGstr->m_pOut;
- String *pStr = NULL;
+ types::GatewayStruct* pGstr = (types::GatewayStruct*)_pvCtx;
+ types::typed_list in = *pGstr->m_pIn;
+ types::InternalType** out = pGstr->m_pOut;
+ types::String *pStr = NULL;
char* pstStrings = new char[_iLen];
return sciErr.iErr;
}
- pStr = new String(pstStrings);
+ pStr = new types::String(pstStrings);
if (pStr == NULL)
{
public:
- typedef unordered_map<std::wstring, std::shared_ptr<CallAnalyzer>> MapSymCall;
+ typedef std::unordered_map<std::wstring, std::shared_ptr<CallAnalyzer>> MapSymCall;
typedef std::vector<Call *> Calls;
private:
/** \} */
template<typename T>
- inline void printInternalType(wostringstream & stream, types::InternalType * pIT)
+ inline void printInternalType(std::wostringstream & stream, types::InternalType * pIT)
{
T * pT = static_cast<T *>(pIT);
if (pT)
void DEBUG_START_NODE(const ast::Ast & e);
void DEBUG_END_NODE(void);
- void DEBUG(wstring str);
- void DEBUG(wstring str, const Exp & e);
+ void DEBUG(const std::wstring& str);
+ void DEBUG(const std::wstring& str, const Exp & e);
};
}
#endif // !AST_DEBUGVISITOR_HXX
bool isAlreadyIn(std::list<std::wstring>& lst);
bool isAlreadyUsed();
- void addIn(std::wstring st)
+ void addIn(const std::wstring& st)
{
m_in.push_back(st);
}
- void addOut(std::wstring st)
+ void addOut(const std::wstring& st)
{
m_out.push_back(st);
}
#include "sci_malloc.h"
}
-using namespace types;
-
namespace ast
{
class EXTERN_AST RunVisitor : public ConstVisitor
{
if (!isSingleResult() && _resultVect.size() > 1)
{
- for (vector<types::InternalType*>::iterator rv = _resultVect.begin() + 1, end = _resultVect.end(); rv != end; ++rv)
+ for (std::vector<types::InternalType*>::iterator rv = _resultVect.begin() + 1, end = _resultVect.end(); rv != end; ++rv)
{
if (*rv != nullptr)
{
}
else
{
- for (vector<types::InternalType*>::iterator rv = _resultVect.begin(); rv != _resultVect.end(); rv++)
+ for (std::vector<types::InternalType*>::iterator rv = _resultVect.begin(); rv != _resultVect.end(); rv++)
{
if (*rv != nullptr)
{
return _resultVect[_iPos];
}
- vector<types::InternalType*>* getResultList()
+ std::vector<types::InternalType*>* getResultList()
{
// TODO: this function is not used but it could lead to a memleak
// (in the first case the vector is allocated and so must be freed)
if (getResultSize() == 1)
{
- vector<types::InternalType*>* pList = new vector<types::InternalType*>;
+ std::vector<types::InternalType*>* pList = new std::vector<types::InternalType*>;
pList->push_back(_result);
return pList;
}
| Attributes. |
`-------------*/
protected:
- vector<types::InternalType*> _resultVect;
+ std::vector<types::InternalType*> _resultVect;
types::InternalType* _result;
bool m_bSingleResult;
int _excepted_result;
{
if (e.getConstant() == nullptr)
{
- Double *pdbl = new Double(e.getValue());
+ types::Double *pdbl = new types::Double(e.getValue());
(const_cast<DoubleExp *>(&e))->setConstant(pdbl);
}
{
if (e.getConstant() == nullptr)
{
- Bool *pB = new Bool(e.getValue());
+ types::Bool *pB = new types::Bool(e.getValue());
(const_cast<BoolExp *>(&e))->setConstant(pB);
}
{
symbol::Context* ctx = symbol::Context::getInstance();
symbol::Variable* var = ((SimpleVar&)e).getStack();
- InternalType *pI = ctx->get(var);
+ types::InternalType *pI = ctx->get(var);
setResult(pI);
if (pI != nullptr)
{
void visitprivate(const ColonVar &/*e*/)
{
- Colon *pC = new Colon();
+ types::Colon *pC = new types::Colon();
setResult(pC);
}
void visitprivate(const DollarVar &/*e*/)
{
- setResult(Polynom::Dollar());
+ setResult(types::Polynom::Dollar());
}
void visitprivate(const TryCatchExp &e)
int iNbExpSize = this->getExpectedSize();
this->setExpectedSize(1);
- typed_list lstIT;
+ types::typed_list lstIT;
for (it = e.getExps().begin() ; it != e.getExps().end() ; it++)
{
(*it)->accept(*this);
}
types::InternalType* callOverloadOpExp(OpExp::Oper _oper, types::InternalType* _paramL, types::InternalType* _paramR);
- types::InternalType* callOverloadMatrixExp(std::wstring strType, types::InternalType* _paramL, types::InternalType* _paramR);
+ types::InternalType* callOverloadMatrixExp(const std::wstring& strType, types::InternalType* _paramL, types::InternalType* _paramR);
};
}
class InternalError : public ScilabException
{
public :
- InternalError(std::wstring _wstErrorMesssage) : ScilabException(_wstErrorMesssage)
+ InternalError(const std::wstring& _wstErrorMesssage) : ScilabException(_wstErrorMesssage)
{
m_type = TYPE_ERROR;
setLastError(999, _wstErrorMesssage.c_str(), 0, NULL);
setLastError(999, m_wstErrorMessage.c_str(), 0, NULL);
}
- InternalError(std::wstring _wstErrorMesssage, int _iErrorNumber, const Location& _ErrorLocation) : ScilabException(_wstErrorMesssage, _iErrorNumber, _ErrorLocation)
+ InternalError(const std::wstring& _wstErrorMesssage, int _iErrorNumber, const Location& _ErrorLocation) : ScilabException(_wstErrorMesssage, _iErrorNumber, _ErrorLocation)
{
m_type = TYPE_ERROR;
setLastError(_iErrorNumber, _wstErrorMesssage.c_str(), _ErrorLocation.first_line, NULL);
types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*>& fields, types::InternalType* pIT);
types::InternalType* callOverload(const ast::Exp& e,
- std::wstring _strType,
+ const std::wstring& _strType,
types::typed_list* _pArgs,
types::InternalType* _source,
types::InternalType* _dest);
-types::InternalType* callOverload(std::wstring strType, types::InternalType* _paramL, types::InternalType* _paramR);
+types::InternalType* callOverload(const std::wstring& strType, types::InternalType* _paramL, types::InternalType* _paramR);
types::InternalType* insertionCall(const ast::Exp& e, types::typed_list* _pArgs, types::InternalType* _pVar, types::InternalType* _pInsert);
#include "constexp.hxx"
-using namespace types;
-
namespace ast
{
/** \brief Abstract an Boolean Expression node.
#include "arraylistvar.hxx"
#include "seqexp.hxx"
-using namespace std;
-
namespace ast
{
/*
class StringExp : public ConstExp
{
public:
- StringExp (const Location& location, const std::wstring & value)
+ StringExp (const Location& location, const std::wstring& value)
: ConstExp (location),
_value (value)
{
public:
/** \brief Return the name of the type name (read only). */
- const std::wstring & getValue() const
+ const std::wstring& getValue() const
{
return _value;
}
#include "matrix_finite.h"
}
-// FIXME : Remove using namespace.
-using namespace types;
-
-bool isDoubleFinite(Double *_pDouble);
+bool isDoubleFinite(types::Double *_pDouble);
#endif /* __TYPES_FINITE__ */
#include "polynom.hxx"
#include "sparse.hxx"
-// FIXME : remove using namespace.
-using namespace types;
-
//power operations
-int PowerDoubleByDouble(Double* _pDouble1, Double* _pDouble2, Double** _pDoubleOut);
-int PowerPolyByDouble(Polynom* _pPoly, Double* _pDouble, InternalType** _pOut);
+int PowerDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut);
+int PowerPolyByDouble(types::Polynom* _pPoly, types::Double* _pDouble, types::InternalType** _pOut);
//dot power operations
-int DotPowerDoubleByDouble(Double* _pDouble1, Double* _pDouble2, Double** _pDoubleOut);
-int DotPowerPolyByDouble(Polynom* _pPoly, Double* _pDouble, InternalType** _pOut);
-int DotPowerSpaseByDouble(Sparse* _pSp, Double* _pDouble, InternalType** _pOut);
+int DotPowerDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut);
+int DotPowerPolyByDouble(types::Polynom* _pPoly, types::Double* _pDouble, types::InternalType** _pOut);
+int DotPowerSpaseByDouble(types::Sparse* _pSp, types::Double* _pDouble, types::InternalType** _pOut);
extern "C"
{
{
return const_cast<wchar_t *>(_error_message.c_str());
}
- void setErrorMessage(std::wstring& errorMessage)
+ void setErrorMessage(const std::wstring& errorMessage)
{
_error_message = errorMessage;
}
** Error Message management
*/
static std::wstring& getErrorMessage(void);
- static void appendErrorMessage(std::wstring ostr);
+ static void appendErrorMessage(const std::wstring& ostr);
static void resetErrorMessage(void)
{
_error_message.clear();
*/
static char* getCodeLine(int line, char **codeLine);
- static void PrintError(std::wstring msg);
+ static void PrintError(const std::wstring& msg);
private :
static std::wstring _file_name;
types::InternalType* getFunction(const Symbol& key);
/*return function list in the module _stModuleName*/
- int getFunctionList(std::list<Symbol>& lst, std::wstring _stModuleName);
+ int getFunctionList(std::list<Symbol>& lst, const std::wstring& _stModuleName);
int getConsoleVarsName(std::list<std::wstring>& lst);
int getVarsName(std::list<std::wstring>& lst);
private :
static std::map<std::wstring, DynLibHandle> m_DynModules;
public :
- static void addDynModule(std::wstring _name, DynLibHandle _lib);
- static void removeDynModule(std::wstring _name);
- static DynLibHandle getDynModule(std::wstring _name);
+ static void addDynModule(const std::wstring& _name, DynLibHandle _lib);
+ static void removeDynModule(const std::wstring& _name);
+ static DynLibHandle getDynModule(const std::wstring& _name);
static int getDynModuleCount();
static DynLibHandle* getAllDynModule();
static void cleanDynModule();
return getNbOutputArgument();
}
- void setName(std::wstring _wstName)
+ void setName(const std::wstring& _wstName)
{
m_wstName = _wstName;
}
{
return m_wstName;
}
- void setModule(std::wstring _wstModule)
+ void setModule(const std::wstring& _wstModule)
{
m_wstModule = _wstModule;
}
File();
~File();
- void setFileMode(std::wstring _pstMode);
+ void setFileMode(const std::wstring& _pstMode);
std::wstring& getFileMode();
void setFileModeAsInt(int _iMode);
int getFileModeAsInt();
int getFileType();
std::wstring getFileTypeAsString();
- void setFilename(std::wstring _stFilename);
+ void setFilename(const std::wstring& _stFilename);
std::wstring& getFilename();
int getCountLines();
EntryPointCPPOpt = 3,
};
- typedef int (*LOAD_DEPS)(std::wstring);
+ typedef int(*LOAD_DEPS)(const std::wstring&);
typedef int (*INIT_MODULE)(void);
typedef ReturnValue (*GW_FUNC)(typed_list &in, int _iRetCount, typed_list &out);
typedef ReturnValue (*GW_FUNC_OPT)(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out);
Function() : Callable() {};
- Function(std::wstring _wstName, GW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
+ Function(const std::wstring& _wstName, GW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
~Function();
//FIXME : Should not return NULL
InternalType* clone();
- static Function* createFunction(std::wstring _wstName, GW_FUNC _pFunc, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, GW_FUNC_OPT _pFunc, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, OLDGW_FUNC _pFunc, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, MEXGW_FUNC _pFunc, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, GW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, GW_FUNC_OPT _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, OLDGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
- static Function* createFunction(std::wstring _wstName, MEXGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, GW_FUNC _pFunc, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, GW_FUNC_OPT _pFunc, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, OLDGW_FUNC _pFunc, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, MEXGW_FUNC _pFunc, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, GW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, GW_FUNC_OPT _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, OLDGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
+ static Function* createFunction(const std::wstring& _wstName, MEXGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
/*dynamic gateways*/
- static Function* createFunction(std::wstring _wstFunctionName, std::wstring _wstEntryPointName, std::wstring _wstLibName, FunctionType _iType, LOAD_DEPS _pLoadDeps, std::wstring _wstModule, bool _bCloseLibAfterCall = false);
- static Function* createFunction(std::wstring _wstFunctionName, std::wstring _wstEntryPointName, std::wstring _wstLibName, FunctionType _iType, std::wstring _wstLoadDepsName, std::wstring _wstModule, bool _bCloseLibAfterCall = false);
+ static Function* createFunction(const std::wstring& _wstFunctionName, const std::wstring& _wstEntryPointName, const std::wstring& _wstLibName, FunctionType _iType, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule, bool _bCloseLibAfterCall = false);
+ static Function* createFunction(const std::wstring& _wstFunctionName, const std::wstring& _wstEntryPointName, const std::wstring& _wstLibName, FunctionType _iType, const std::wstring& _wstLoadDepsName, const std::wstring& _wstModule, bool _bCloseLibAfterCall = false);
inline ScilabType getType(void)
{
private :
OptFunction(OptFunction* _Function);
public :
- OptFunction(std::wstring _wstName, GW_FUNC_OPT _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
+ OptFunction(const std::wstring& _wstName, GW_FUNC_OPT _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
Callable::ReturnValue call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc);
InternalType* clone();
private :
WrapFunction(WrapFunction* _pWrapFunction);
public :
- WrapFunction(std::wstring _wstName, OLDGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
+ WrapFunction(const std::wstring& _wstName, OLDGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
Callable::ReturnValue call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc);
InternalType* clone();
private :
WrapMexFunction(WrapMexFunction* _pWrapFunction);
public :
- WrapMexFunction(std::wstring _wstName, MEXGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, std::wstring _wstModule);
+ WrapMexFunction(const std::wstring& _wstName, MEXGW_FUNC _pFunc, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule);
Callable::ReturnValue call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc);
InternalType* clone();
private :
DynamicFunction(DynamicFunction* _pDynamicFunction);
public :
- DynamicFunction(std::wstring _wstName, std::wstring _wstEntryPointName, std::wstring _wstLibName, FunctionType _iType, LOAD_DEPS _pLoadDeps, std::wstring _wstModule, bool _bCloseLibAfterCall = false);
+ DynamicFunction(const std::wstring& _wstName, const std::wstring& _wstEntryPointName, const std::wstring& _wstLibName, FunctionType _iType, LOAD_DEPS _pLoadDeps, const std::wstring& _wstModule, bool _bCloseLibAfterCall = false);
virtual ~DynamicFunction();
- DynamicFunction(std::wstring _wstName, std::wstring _wstEntryPointName, std::wstring _wstLibName, FunctionType _iType, std::wstring _wstLoadDepsName, std::wstring _wstModule, bool _bCloseLibAfterCall = false);
+ DynamicFunction(const std::wstring& _wstName, const std::wstring& _wstEntryPointName, const std::wstring& _wstLibName, FunctionType _iType, const std::wstring& _wstLoadDepsName, const std::wstring& _wstModule, bool _bCloseLibAfterCall = false);
Callable::ReturnValue call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc);
private :
Callable::ReturnValue Init();
return true;
}
- bool extract(const std::wstring & name, InternalType *& out);
+ bool extract(const std::wstring& name, InternalType *& out);
void add(const std::wstring& _wstName, MacroFile* _macro);
MacroFile* get(const std::wstring& _wstName);
{
public :
MacroFile(): Callable() {};
- MacroFile(std::wstring _stName, std::wstring _stPath, std::wstring _stModule);
+ MacroFile(const std::wstring& _stName, const std::wstring& _stPath, const std::wstring& _stModule);
virtual ~MacroFile();
//FIXME : Should not return NULL
** depending on input parameters
** and maybe on number of result expected <further implementation>
*/
- static std::wstring buildOverloadName(std::wstring _stFunctionName, types::typed_list &in, int _iRetCount, bool _isOperator = false, bool _truncated = false);
+ static std::wstring buildOverloadName(const std::wstring& _stFunctionName, types::typed_list &in, int _iRetCount, bool _isOperator = false, bool _truncated = false);
/**
*/
- static types::Function::ReturnValue generateNameAndCall(std::wstring _stFunctionName, types::typed_list &in, int _iRetCount,
+ static types::Function::ReturnValue generateNameAndCall(const std::wstring& _stFunctionName, types::typed_list &in, int _iRetCount,
types::typed_list &out, ast::ConstVisitor *_execMe = nullptr, bool _isOperator = false);
/**
*/
- static types::Function::ReturnValue call(std::wstring _stFunctionName, types::typed_list &in, int _iRetCount,
+ static types::Function::ReturnValue call(const std::wstring& _stFunctionName, types::typed_list &in, int _iRetCount,
types::typed_list &out, ast::ConstVisitor *_execMe = nullptr, bool _isOperator = false);
static std::wstring getNameFromOper(const int);
void whoAmI(void);
std::wstring& getVariableName();
- void setVariableName(std::wstring);
+ void setVariableName(const std::wstring&);
bool getSizes(int *_piSizes);
bool getRank(int *_piRank);
int getMaxRank(void);
bool evaluate(double _dblInR, double _dblInI, double *_pdblOutR, double *_pdblOutI);
void updateRank(void);
- void toStringReal(std::wstring _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
- void toStringImg(std::wstring _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
+ void toStringReal(const std::wstring& _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
+ void toStringImg(const std::wstring& _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
bool toString(std::wostringstream& ostr);
}
private :
- void toStringInternal(double *_pdblVal, std::wstring _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
+ void toStringInternal(double *_pdblVal, const std::wstring& _szVar, std::list<std::wstring>* _pListExp , std::list<std::wstring>* _pListCoef);
};
bool addFieldFront(const std::wstring& _sKey);
bool removeField(const std::wstring& _sKey);
bool toString(std::wostringstream& ostr);
- List* extractFieldWithoutClone(std::wstring _wstField);
+ List* extractFieldWithoutClone(const std::wstring& _wstField);
std::vector<InternalType*> extractFields(std::vector<std::wstring> _wstFields);
std::vector<InternalType*> extractFields(typed_list* _pArgs);
- inline InternalType * extractField(const std::wstring & wstField);
+ inline InternalType * extractField(const std::wstring& wstField);
bool resize(int* _piDims, int _iDims);
bool resize(int _iNewRows, int _iNewCols);
void setCloneInCopyValue(bool _val);
using ArrayOf<SingleStruct *>::extract;
- bool extract(const std::wstring & name, InternalType *& out);
+ bool extract(const std::wstring& name, InternalType *& out);
virtual bool invoke(typed_list & in, optional_list & opt, int _iRetCount, typed_list & out, ast::ConstVisitor & execFunc, const ast::Exp & e);
bool set(const int _iIndex, InternalType* _pIT);
using List::extract; // to avoid this extract to hide extract in list
- bool extract(const std::wstring & name, InternalType *& out);
+ bool extract(const std::wstring& name, InternalType *& out);
virtual bool invoke(typed_list & in, optional_list & opt, int _iRetCount, typed_list & out, ast::ConstVisitor & execFunc, const ast::Exp & e);
return NULL;
}
- virtual bool extract(const std::wstring & /*name*/, InternalType *& /*out*/)
+ virtual bool extract(const std::wstring& /*name*/, InternalType *& /*out*/)
{
return false;
}
// this method is called to perform an extraction by field. ie : a = myUserType.myfield
// name is the field name
// out contain extraction of field
- virtual bool extract(const std::wstring & /*name*/, InternalType *& /*out*/)
+ virtual bool extract(const std::wstring& /*name*/, InternalType *& /*out*/)
{
return false;
}
--level;
}
-void DebugVisitor::DEBUG(wstring str)
+void DebugVisitor::DEBUG(const std::wstring& str)
{
for (int i = 0 ; i < level; ++i)
{
{
*ostr << L" ";
}
- *ostr << str << endl;
+ *ostr << str << std::endl;
}
-void DebugVisitor::DEBUG(wstring str, const Exp &e)
+void DebugVisitor::DEBUG(const std::wstring& str, const Exp &e)
{
for (int i = 0 ; i < level; ++i)
{
void DebugVisitor::visit (const StringExp &e)
{
DEBUG_START_NODE(e);
- wostringstream stream;
+ std::wostringstream stream;
if (e.getConstant())
{
printInternalType<types::String>(stream, e.getConstant());
void DebugVisitor::visit (const DoubleExp &e)
{
DEBUG_START_NODE(e);
- wostringstream stream;
+ std::wostringstream stream;
types::InternalType * pIT = e.getConstant();
if (pIT)
{
void DebugVisitor::visit (const BoolExp &e)
{
DEBUG_START_NODE(e);
- wostringstream stream;
+ std::wostringstream stream;
if (e.getConstant())
{
printInternalType<types::Bool>(stream, e.getConstant());
#include "macrovarvisitor.hxx"
#include "context.hxx"
-using namespace std;
-using namespace ast;
-using namespace symbol;
namespace ast
{
void MacrovarVisitor::add()
{
- InternalType* pVar = Context::getInstance()->get(Symbol(m_current));
+ types::InternalType* pVar = symbol::Context::getInstance()->get(symbol::Symbol(m_current));
if (pVar)
{
if (pVar->isCallable())
{
// x = ?
/*getting what to assign*/
- InternalType *pIT = e.getRightVal();
+ types::InternalType *pIT = e.getRightVal();
if (pIT == NULL)
{
setExpectedSize(1);
if (pIT->isImplicitList())
{
- if (pIT->getAs<ImplicitList>()->isComputable())
+ if (pIT->getAs<types::ImplicitList>()->isComputable())
{
- InternalType *pTemp = pIT->getAs<ImplicitList>()->extractFullMatrix();
+ types::InternalType *pTemp = pIT->getAs<types::ImplicitList>()->extractFullMatrix();
delete pIT;
pIT = pTemp;
}
if (e.getLeftExp().isCellCallExp())
{
CellCallExp *pCell = static_cast<CellCallExp*>(&e.getLeftExp());
- InternalType *pOut = NULL;
+ types::InternalType *pOut = NULL;
/*getting what to assign*/
- InternalType* pITR = e.getRightVal();
+ types::InternalType* pITR = e.getRightVal();
if (pITR == NULL)
{
e.getRightExp().accept(*this);
{
CallExp *pCall = static_cast<CallExp*>(&e.getLeftExp());
//x(?) = ?
- InternalType *pOut = NULL;
+ types::InternalType *pOut = NULL;
/*getting what to assign*/
- InternalType* pITR = e.getRightVal();
+ types::InternalType* pITR = e.getRightVal();
if (pITR == NULL)
{
e.getRightExp().accept(*this);
if (pCall->getName().isSimpleVar())
{
ast::SimpleVar* var = pCall->getName().getAs<ast::SimpleVar>();
- InternalType* pIT = ctx->getCurrentLevel(var->getStack());
+ types::InternalType* pIT = ctx->getCurrentLevel(var->getStack());
if (pIT && pIT->isArrayOf())
{
if (ctx->isprotected(var->getStack()))
// called in insertionCall when pITR is an ImplicitList
pITR->IncreaseRef();
- typed_list* currentArgs = GetArgumentList(pCall->getArgs());
+ types::typed_list* currentArgs = GetArgumentList(pCall->getArgs());
try
{
if (e.getLeftExp().isFieldExp())
{
FieldExp *pField = static_cast<FieldExp*>(&e.getLeftExp());
- InternalType *pIT = e.getRightVal();
+ types::InternalType *pIT = e.getRightVal();
if (pIT == NULL)
{
//a.b = x
if (pIT->isImplicitList())
{
- if (pIT->getAs<ImplicitList>()->isComputable())
+ if (pIT->getAs<types::ImplicitList>()->isComputable())
{
- InternalType *pTemp = pIT->getAs<ImplicitList>()->extractFullMatrix();
+ types::InternalType *pTemp = pIT->getAs<types::ImplicitList>()->extractFullMatrix();
delete pIT;
setResult(NULL);
pIT = pTemp;
if (e.isVerbose() && ConfigVariable::isPromptShow())
{
- const wstring *pstName = getStructNameFromExp(pField);
+ const std::wstring *pstName = getStructNameFromExp(pField);
types::InternalType* pPrint = ctx->get(symbol::Symbol(*pstName));
std::wostringstream ostr;
SimpleVar* pVar = pL->getAs<SimpleVar>();
Exp* pR = &pAssign->getRightExp();
pR->accept(*this);
- InternalType* pITR = getResult();
+ types::InternalType* pITR = getResult();
// IncreaseRef to protect opt argument of scope_end delete
// It will be deleted by clear_opt
pITR->IncreaseRef();
if (pIT->hasInvokeOption())
{
- opt.push_back(std::pair<std::wstring, InternalType*>(pVar->getSymbol().getName(), pITR));
+ opt.push_back(std::pair<std::wstring, types::InternalType*>(pVar->getSymbol().getName(), pITR));
//in case of macro/macrofile, we have to shift input param
//so add NULL item in in list to keep initial order
if (pIT->isMacro() || pIT->isMacroFile())
//extract implicit list for call()
if (pIT->isCallable() || pIT->isUserType())
{
- InternalType * pITArg = getResult();
+ types::InternalType * pITArg = getResult();
if (pITArg->isImplicitList())
{
types::ImplicitList* pIL = pITArg->getAs<types::ImplicitList>();
{
for (int i = 0 ; i < getResultSize() ; i++)
{
- InternalType * pITArg = getResult(i);
+ types::InternalType * pITArg = getResult(i);
pITArg->IncreaseRef();
in.push_back(pITArg);
}
char szError[bsiz];
if(pIT->isCallable())
{
- char* strFName = wide_string_to_UTF8(pIT->getAs<Callable>()->getName().c_str());
+ char* strFName = wide_string_to_UTF8(pIT->getAs<types::Callable>()->getName().c_str());
os_sprintf(szError, _("%s: Wrong number of output argument(s): %d expected.\n"), strFName, out.size());
FREE(strFName);
}
if (pList->getSize() == 1)
{
- InternalType* ret = pList->get(0);
+ types::InternalType* ret = pList->get(0);
setResult(ret);
ret->IncreaseRef();
{
exps_t::const_iterator row;
exps_t::const_iterator col;
- InternalType *poResult = NULL;
- list<InternalType*> rowList;
+ types::InternalType *poResult = NULL;
+ std::list<types::InternalType*> rowList;
exps_t lines = e.getLines();
if (lines.size() == 0)
{
- setResult(Double::Empty());
+ setResult(types::Double::Empty());
return;
}
//manage evstr('//xxx') for example
if (getResult() == NULL)
{
- setResult(Double::Empty());
+ setResult(types::Double::Empty());
}
return;
}
//do all [x,x]
for (row = lines.begin() ; row != lines.end() ; row++)
{
- InternalType* poRow = NULL;
+ types::InternalType* poRow = NULL;
exps_t cols = (*row)->getAs<MatrixLineExp>()->getColumns();
for (col = cols.begin() ; col != cols.end() ; col++)
{
throw error;
}
- InternalType *pIT = getResult();
+ types::InternalType *pIT = getResult();
if (pIT == NULL)
{
continue;
if (pIT->isImplicitList())
{
- ImplicitList *pIL = pIT->getAs<ImplicitList>();
+ types::ImplicitList *pIL = pIT->getAs<types::ImplicitList>();
if (pIL->isComputable())
{
- InternalType* pIT2 = pIL->extractFullMatrix();
+ types::InternalType* pIT2 = pIL->extractFullMatrix();
pIT->killMe();
pIT = pIT2;
}
throw ast::InternalError(os.str(), 999, (*col)->getLocation());
}
- GenericType* pGT = pIT->getAs<GenericType>();
- if (pGT->isDouble() && pGT->getAs<Double>()->isEmpty())
+ types::GenericType* pGT = pIT->getAs<types::GenericType>();
+ if (pGT->isDouble() && pGT->getAs<types::Double>()->isEmpty())
{
pGT->killMe();
continue;
continue;
}
- GenericType* pGTResult = poRow->getAs<GenericType>();
+ types::GenericType* pGTResult = poRow->getAs<types::GenericType>();
//check dimension
if (pGT->getDims() != 2 || pGT->getRows() != pGTResult->getRows())
int* piRank = new int[_iRows * _iCols];
memset(piRank, 0x00, _iRows * _iCols * sizeof(int));
poRow = new types::Polynom(pGT->getAs<types::Polynom>()->getVariableName(), _iRows, _iCols, piRank);
- Polynom* pP = poRow->getAs<types::Polynom>();
- SinglePoly** pSS = pP->get();
+ types::Polynom* pP = poRow->getAs<types::Polynom>();
+ types::SinglePoly** pSS = pP->get();
types::Double* pDb = pGTResult->getAs<types::Double>();
double* pdblR = pDb->get();
if (pDb->isComplex())
delete[] piRank;
}
- InternalType *pNewSize = AddElementToVariable(NULL, poRow, pGTResult->getRows(), pGTResult->getCols() + pGT->getCols());
- InternalType* p = AddElementToVariable(pNewSize, pGT, 0, pGTResult->getCols());
+ types::InternalType *pNewSize = AddElementToVariable(NULL, poRow, pGTResult->getRows(), pGTResult->getCols() + pGT->getCols());
+ types::InternalType* p = AddElementToVariable(pNewSize, pGT, 0, pGTResult->getCols());
if (p != pNewSize)
{
pNewSize->killMe();
continue;
}
- GenericType* pGT = poRow->getAs<GenericType>();
+ types::GenericType* pGT = poRow->getAs<types::GenericType>();
//check dimension
- GenericType* pGTResult = poResult->getAs<GenericType>();
+ types::GenericType* pGTResult = poResult->getAs<types::GenericType>();
if (pGT->isList() || pGTResult->isList() ||
pGT->isStruct() || pGTResult->isStruct())
{
poResult = new types::Sparse(*pGTResult->getAs<types::Double>());
pGTResult->killMe();
- pGTResult = poResult->getAs<GenericType>();
+ pGTResult = poResult->getAs<types::GenericType>();
}
else if (pGT->isSparseBool() && pGTResult->isBool()) // [Bool SparseBool] => [SparseBool SparseBool]
{
poResult = new types::SparseBool(*pGTResult->getAs<types::Bool>());
pGTResult->killMe();
- pGTResult = poResult->getAs<GenericType>();
+ pGTResult = poResult->getAs<types::GenericType>();
}
- InternalType* pNewSize = AddElementToVariable(NULL, poResult, pGTResult->getRows() + pGT->getRows(), pGT->getCols());
- InternalType* p = AddElementToVariable(pNewSize, pGT, pGTResult->getRows(), 0);
+ types::InternalType* pNewSize = AddElementToVariable(NULL, poResult, pGTResult->getRows() + pGT->getRows(), pGT->getCols());
+ types::InternalType* p = AddElementToVariable(pNewSize, pGT, pGTResult->getRows(), 0);
if (p != pNewSize)
{
pNewSize->killMe();
}
else
{
- setResult(Double::Empty());
+ setResult(types::Double::Empty());
}
}
catch (const InternalError& error)
}
template<class T>
-types::InternalType* RunVisitorT<T>::callOverloadMatrixExp(std::wstring strType, types::InternalType* _paramL, types::InternalType* _paramR)
+types::InternalType* RunVisitorT<T>::callOverloadMatrixExp(const std::wstring& strType, types::InternalType* _paramL, types::InternalType* _paramR)
{
types::typed_list in;
types::typed_list out;
- Callable::ReturnValue Ret;
+ types::Callable::ReturnValue Ret;
_paramL->IncreaseRef();
_paramR->IncreaseRef();
}
else
{
- Ret = Overload::call(L"%" + _paramL->getAs<List>()->getShortTypeStr() + L"_" + strType + L"_" + _paramR->getAs<List>()->getShortTypeStr(), in, 1, out, this, true);
+ Ret = Overload::call(L"%" + _paramL->getAs<types::List>()->getShortTypeStr() + L"_" + strType + L"_" + _paramR->getAs<types::List>()->getShortTypeStr(), in, 1, out, this, true);
}
}
catch (const InternalError& error)
throw error;
}
- if (Ret != Callable::OK)
+ if (Ret != types::Callable::OK)
{
cleanInOut(in, out);
throw InternalError(ConfigVariable::getLastErrorMessage());
template<class T>
void RunVisitorT<T>::visitprivate(const OpExp &e)
{
- InternalType * pITL = NULL, * pITR = NULL, * pResult = NULL;
+ types::InternalType * pITL = NULL, *pITR = NULL, *pResult = NULL;
try
{
/*getting what to assign*/
}
pITR = getResult();
- if (pITL->getType() == GenericType::ScilabImplicitList)
+ if (pITL->getType() == types::InternalType::ScilabImplicitList)
{
- ImplicitList* pIL = pITL->getAs<ImplicitList>();
+ types::ImplicitList* pIL = pITL->getAs<types::ImplicitList>();
if (pIL->isComputable())
{
pITL = pIL->extractFullMatrix();
}
}
- if (pITR->getType() == GenericType::ScilabImplicitList)
+ if (pITR->getType() == types::InternalType::ScilabImplicitList)
{
- ImplicitList* pIR = pITR->getAs<ImplicitList>();
+ types::ImplicitList* pIR = pITR->getAs<types::ImplicitList>();
if (pIR->isComputable())
{
pITR = pIR->extractFullMatrix();
{
try
{
- InternalType *pITR = NULL; //assign only in non shortcut operations.
+ types::InternalType *pITR = NULL; //assign only in non shortcut operations.
/*getting what to assign*/
e.getLeft().accept(*this);
- InternalType *pITL = getResult();
+ types::InternalType *pITL = getResult();
if (isSingleResult() == false)
{
std::wostringstream os;
setResult(NULL);
- if (pITL->getType() == GenericType::ScilabImplicitList)
+ if (pITL->getType() == types::InternalType::ScilabImplicitList)
{
- ImplicitList* pIL = pITL->getAs<ImplicitList>();
+ types::ImplicitList* pIL = pITL->getAs<types::ImplicitList>();
if (pIL->isComputable())
{
pITL = pIL->extractFullMatrix();
}
}
- InternalType *pResult = NULL;
+ types::InternalType *pResult = NULL;
switch (e.getOper())
{
throw ast::InternalError(os.str(), 999, e.getRight().getLocation());
}
- if (pITR->getType() == GenericType::ScilabImplicitList)
+ if (pITR->getType() == types::InternalType::ScilabImplicitList)
{
- ImplicitList* pIR = pITR->getAs<ImplicitList>();
+ types::ImplicitList* pIR = pITR->getAs<types::ImplicitList>();
if (pIR->isComputable())
{
pITR = pIR->extractFullMatrix();
throw ast::InternalError(os.str(), 999, e.getRight().getLocation());
}
- if (pITR->getType() == GenericType::ScilabImplicitList)
+ if (pITR->getType() == types::InternalType::ScilabImplicitList)
{
- ImplicitList* pIR = pITR->getAs<ImplicitList>();
+ types::ImplicitList* pIR = pITR->getAs<types::ImplicitList>();
if (pIR->isComputable())
{
pITR = pIR->extractFullMatrix();
for (j = 0, col = cols.begin() ; col != cols.end() ; ++col, ++j)
{
(*col)->accept(*this);
- InternalType *pIT = getResult();
+ types::InternalType *pIT = getResult();
if (pIT->isImplicitList())
{
- InternalType * _pIT = pIT->getAs<ImplicitList>()->extractFullMatrix();
+ types::InternalType * _pIT = pIT->getAs<types::ImplicitList>()->extractFullMatrix();
pC->set(i, j, _pIT);
_pIT->killMe();
}
SimpleVar * psvRightMember = static_cast<SimpleVar *>(const_cast<Exp *>(e.getTail()));
std::wstring wstField = psvRightMember->getSymbol().getName();
- InternalType * pValue = getResult();
- InternalType * pReturn = NULL;
+ types::InternalType * pValue = getResult();
+ types::InternalType * pReturn = NULL;
bool ok = false;
try
{
if (pValue->isGenericType() || pValue->isUserType())
{
- ok = pValue->getAs<GenericType>()->extract(wstField, pReturn);
+ ok = pValue->getAs<types::GenericType>()->extract(wstField, pReturn);
}
}
catch (std::wstring & err)
types::typed_list in;
types::typed_list out;
- String* pS = new String(wstField.c_str());
+ types::String* pS = new types::String(wstField.c_str());
//TODO: in the case where overload is a macro there is no need to incref in
// because args will be put in context, removed and killed if required.
in.push_back(pS);
in.push_back(pValue);
- Callable::ReturnValue Ret = Callable::Error;
+ types::Callable::ReturnValue Ret = types::Callable::Error;
std::wstring stType = pValue->getShortTypeStr();
try
}
}
- if (Ret != Callable::OK)
+ if (Ret != types::Callable::OK)
{
cleanInOut(in, out);
setResult(NULL);
//condition
e.getTest().accept(*this);
- InternalType* pIT = getResult();
+ types::InternalType* pIT = getResult();
while (pIT->isTrue())
{
symbol::Context* ctx = symbol::Context::getInstance();
//vardec visit increase its result reference
e.getVardec().accept(*this);
- InternalType* pIT = getResult();
+ types::InternalType* pIT = getResult();
if (pIT->isImplicitList())
{
//get IL
- ImplicitList* pVar = pIT->getAs<ImplicitList>();
+ types::ImplicitList* pVar = pIT->getAs<types::ImplicitList>();
//get IL initial Type
- InternalType * pIL = pVar->getInitalType();
+ types::InternalType * pIL = pVar->getInitalType();
//std::cout << "for IL: " << pIL << std::endl;
//std::cout << " for IV: " << pIT << std::endl;
//get index stack
}
else if (pIT->isList())
{
- List* pL = pIT->getAs<List>();
+ types::List* pL = pIT->getAs<types::List>();
const int size = pL->getSize();
symbol::Variable* var = e.getVardec().getAs<VarDec>()->getStack();
for (int i = 0; i < size; ++i)
{
- InternalType* pNew = pL->get(i);
+ types::InternalType* pNew = pL->get(i);
if (ctx->isprotected(var))
{
else if (pIT->isGenericType())
{
//Matrix i = [1,3,2,6] or other type
- GenericType* pVar = pIT->getAs<GenericType>();
+ types::GenericType* pVar = pIT->getAs<types::GenericType>();
if (pVar->getDims() > 2)
{
pIT->DecreaseRef();
symbol::Variable* var = e.getVardec().getAs<VarDec>()->getStack();
for (int i = 0; i < pVar->getCols(); i++)
{
- GenericType* pNew = pVar->getColumnValues(i);
+ types::GenericType* pNew = pVar->getColumnValues(i);
if (pNew == NULL)
{
pIT->DecreaseRef();
void RunVisitorT<T>::visitprivate(const StringSelectExp &e)
{
e.getSelect()->accept(*this);
- InternalType* pIT = getResult();
+ types::InternalType* pIT = getResult();
setResult(nullptr);
bool found = false;
if (pIT && pIT->isString())
{
- String * pStr = static_cast<String *>(pIT);
+ types::String * pStr = static_cast<types::String *>(pIT);
if (pStr->getSize() == 1)
{
if (wchar_t * s = pStr->get(0))
e.getSelect()->accept(*this);
bool bCase = false;
- InternalType* pIT = getResult();
+ types::InternalType* pIT = getResult();
setResult(NULL);
if (pIT)
{
{
CaseExp* pCase = exp->getAs<CaseExp>();
pCase->getTest()->accept(*this);
- InternalType *pITCase = getResult();
+ types::InternalType *pITCase = getResult();
setResult(NULL);
if (pITCase)
{
setExpectedSize(-1);
exp->accept(*this);
setExpectedSize(iExpectedSize);
- InternalType * pIT = getResult();
+ types::InternalType * pIT = getResult();
// In case of exec file, set the file name in the Macro to store where it is defined.
int iFileID = ConfigVariable::getExecutedFileID();
if (iFileID && exp->isFunctionDec())
{
- InternalType* pITMacro = symbol::Context::getInstance()->get(exp->getAs<FunctionDec>()->getSymbol());
+ types::InternalType* pITMacro = symbol::Context::getInstance()->get(exp->getAs<FunctionDec>()->getSymbol());
if (pITMacro)
{
types::Macro* pMacro = pITMacro->getAs<types::Macro>();
bool bImplicitCall = false;
if (pIT->isCallable()) //to manage call without ()
{
- Callable *pCall = pIT->getAs<Callable>();
- typed_list out;
- typed_list in;
- optional_list opt;
+ types::Callable *pCall = pIT->getAs<types::Callable>();
+ types::typed_list out;
+ types::typed_list in;
+ types::optional_list opt;
try
{
if (getResult() != NULL && (!exp->isSimpleVar() || bImplicitCall))
{
//symbol::Context::getInstance()->put(symbol::Symbol(L"ans"), *execMe.getResult());
- InternalType* pITAns = getResult();
+ types::InternalType* pITAns = getResult();
symbol::Context::getInstance()->put(m_pAns, pITAns);
if (exp->isVerbose() && ConfigVariable::isPromptShow())
{
*/
e.getExp().accept(*this);
- InternalType * pValue = getResult();
- InternalType * pReturn = NULL;
+ types::InternalType * pValue = getResult();
+ types::InternalType * pReturn = NULL;
if (pValue->neg(pReturn))
{
if (pValue != pReturn)
pValue->IncreaseRef();
in.push_back(pValue);
- Callable::ReturnValue Ret = Overload::call(L"%" + pValue->getShortTypeStr() + L"_5", in, 1, out, this);
+ types::Callable::ReturnValue Ret = Overload::call(L"%" + pValue->getShortTypeStr() + L"_5", in, 1, out, this);
- if (Ret != Callable::OK)
+ if (Ret != types::Callable::OK)
{
cleanInOut(in, out);
throw InternalError(ConfigVariable::getLastErrorMessage(), ConfigVariable::getLastErrorNumber(), e.getLocation());
throw InternalError(szError, 999, e.getLocation());
}
- InternalType * pValue = getResult();
- InternalType * pReturn = NULL;
+ types::InternalType * pValue = getResult();
+ types::InternalType * pReturn = NULL;
const bool bConjug = e.getConjugate() == TransposeExp::_Conjugate_;
if ((bConjug && pValue->adjoint(pReturn)) || (!bConjug && pValue->transpose(pReturn)))
pValue->IncreaseRef();
in.push_back(pValue);
- Callable::ReturnValue Ret;
+ types::Callable::ReturnValue Ret;
if (bConjug)
{
Ret = Overload::call(L"%" + getResult()->getShortTypeStr() + L"_t", in, 1, out, this);
Ret = Overload::call(L"%" + getResult()->getShortTypeStr() + L"_0", in, 1, out, this);
}
- if (Ret != Callable::OK)
+ if (Ret != types::Callable::OK)
{
cleanInOut(in, out);
throw InternalError(ConfigVariable::getLastErrorMessage(), ConfigVariable::getLastErrorNumber(), e.getLocation());
void RunVisitorT<T>::visitprivate(const ListExp &e)
{
e.getStart().accept(*this);
- GenericType* pITStart = static_cast<GenericType*>(getResult());
- if ((pITStart->getSize() != 1 || (pITStart->isDouble() && pITStart->getAs<Double>()->isComplex())) &&
+ types::GenericType* pITStart = static_cast<types::GenericType*>(getResult());
+ if ((pITStart->getSize() != 1 || (pITStart->isDouble() && pITStart->getAs<types::Double>()->isComplex())) &&
pITStart->isList() == false) // list case => call overload
{
pITStart->killMe();
os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 1);
throw InternalError(szError, 999, e.getLocation());
}
- InternalType * piStart = pITStart;
+ types::InternalType * piStart = pITStart;
e.getStep().accept(*this);
- GenericType* pITStep = static_cast<GenericType*>(getResult());
- if ((pITStep->getSize() != 1 || (pITStep->isDouble() && pITStep->getAs<Double>()->isComplex())) &&
+ types::GenericType* pITStep = static_cast<types::GenericType*>(getResult());
+ if ((pITStep->getSize() != 1 || (pITStep->isDouble() && pITStep->getAs<types::Double>()->isComplex())) &&
pITStep->isList() == false) // list case => call overload
{
pITStart->killMe();
os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 2);
throw InternalError(szError, 999, e.getLocation());
}
- InternalType* piStep = pITStep;
+ types::InternalType* piStep = pITStep;
e.getEnd().accept(*this);
- GenericType* pITEnd = static_cast<GenericType*>(getResult());
- if ((pITEnd->getSize() != 1 || (pITEnd->isDouble() && pITEnd->getAs<Double>()->isComplex())) &&
+ types::GenericType* pITEnd = static_cast<types::GenericType*>(getResult());
+ if ((pITEnd->getSize() != 1 || (pITEnd->isDouble() && pITEnd->getAs<types::Double>()->isComplex())) &&
pITEnd->isList() == false) // list case => call overload
{
pITStart->killMe();
os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 3);
throw InternalError(szError, 999, e.getLocation());
}
- InternalType* piEnd = pITEnd;
+ types::InternalType* piEnd = pITEnd;
////check if implicitlist is 1:$ to replace by ':'
//if (piStart->isDouble() && piStep->isDouble() && piEnd->isPoly())
(piEnd->isPoly() || piEnd->isDouble()))
{
// No need to kill piStart, ... because Implicit list ctor will incref them
- setResult(new ImplicitList(piStart, piStep, piEnd));
+ setResult(new types::ImplicitList(piStart, piStep, piEnd));
return;
}
piStep->isDouble()))
{
// No need to kill piStart, ... because Implicit list ctor will incref them
- setResult(new ImplicitList(piStart, piStep, piEnd));
+ setResult(new types::ImplicitList(piStart, piStep, piEnd));
return;
}
}
// Call Overload
- Callable::ReturnValue Ret;
+ types::Callable::ReturnValue Ret;
types::typed_list in;
types::typed_list out;
throw error;
}
- if (Ret != Callable::OK)
+ if (Ret != types::Callable::OK)
{
cleanInOut(in, out);
throw InternalError(ConfigVariable::getLastErrorMessage(), ConfigVariable::getLastErrorNumber(), e.getLocation());
template <class T>
void RunVisitorT<T>::visitprivate(const DAXPYExp &e)
{
- InternalType* pIT = NULL;
- Double* ad = NULL;
+ types::InternalType* pIT = NULL;
+ types::Double* ad = NULL;
int ar = 0;
int ac = 0;
- Double* xd = NULL;
+ types::Double* xd = NULL;
int xr = 0;
int xc = 0;
- Double* yd = NULL;
+ types::Double* yd = NULL;
int yr = 0;
int yc = 0;
pIT = getResult();
if (pIT->isDouble())
{
- yd = pIT->getAs<Double>();
+ yd = pIT->getAs<types::Double>();
if (yd->getDims() == 2 && yd->isComplex() == false)
{
yr = yd->getRows();
if (pIT->isDouble())
{
- xd = pIT->getAs<Double>();
+ xd = pIT->getAs<types::Double>();
if (xd->isScalar() && xd->isComplex() == false)
{
// x become a
{
if (ad)
{
- xd = pIT->getAs<Double>();
+ xd = pIT->getAs<types::Double>();
//X is scalar it become A
//now use A as X
if (xd->getDims() == 2 && xd->isComplex() == false)
else
{
//a is a and it must be scalar
- ad = pIT->getAs<Double>();
+ ad = pIT->getAs<types::Double>();
if (/*ad->isScalar() && */ad->isComplex() == false)
{
ar = ad->getRows(); //1;
if (lines.size() == 0)
{
- l = createConst(Double::Empty());
+ l = createConst(types::Double::Empty());
return;
}
void TreeVisitor::visit(const FunctionDec &e)
{
wchar_t* pwstState;
- wostringstream wostr;
+ std::wostringstream wostr;
PrintVisitor pv(wostr, false, false);
types::TList* function = new types::TList();
FREE(pwstFun);
// Now print function body
- wostringstream wostrBody;
+ std::wostringstream wostrBody;
PrintVisitor pvBody(wostrBody, false, true);
std::vector<wchar_t*> allTokens;
e.getBody().getOriginal()->accept(pvBody);
/*
* Generate destination variable from _poSource type and size parameters
*/
-InternalType* allocDest(InternalType* _poSource, int _iRows, int _iCols)
+types::InternalType* allocDest(types::InternalType* _poSource, int _iRows, int _iCols)
{
- InternalType* poResult = NULL;
+ types::InternalType* poResult = NULL;
switch (_poSource->getType())
{
- case GenericType::ScilabDouble :
- poResult = new Double(_iRows, _iCols, false);
+ case types::InternalType::ScilabDouble :
+ poResult = new types::Double(_iRows, _iCols, false);
break;
- case GenericType::ScilabBool :
- poResult = new Bool(_iRows, _iCols);
+ case types::InternalType::ScilabBool :
+ poResult = new types::Bool(_iRows, _iCols);
break;
- case GenericType::ScilabInt8 :
- poResult = new Int8(_iRows, _iCols);
+ case types::InternalType::ScilabInt8 :
+ poResult = new types::Int8(_iRows, _iCols);
break;
- case GenericType::ScilabUInt8 :
- poResult = new UInt8(_iRows, _iCols);
+ case types::InternalType::ScilabUInt8 :
+ poResult = new types::UInt8(_iRows, _iCols);
break;
- case GenericType::ScilabInt16 :
- poResult = new Int16(_iRows, _iCols);
+ case types::InternalType::ScilabInt16 :
+ poResult = new types::Int16(_iRows, _iCols);
break;
- case GenericType::ScilabUInt16 :
- poResult = new UInt16(_iRows, _iCols);
+ case types::InternalType::ScilabUInt16 :
+ poResult = new types::UInt16(_iRows, _iCols);
break;
- case GenericType::ScilabInt32 :
- poResult = new Int32(_iRows, _iCols);
+ case types::InternalType::ScilabInt32 :
+ poResult = new types::Int32(_iRows, _iCols);
break;
- case GenericType::ScilabUInt32 :
- poResult = new UInt32(_iRows, _iCols);
+ case types::InternalType::ScilabUInt32 :
+ poResult = new types::UInt32(_iRows, _iCols);
break;
- case GenericType::ScilabInt64 :
- poResult = new Int64(_iRows, _iCols);
+ case types::InternalType::ScilabInt64 :
+ poResult = new types::Int64(_iRows, _iCols);
break;
- case GenericType::ScilabUInt64 :
- poResult = new UInt64(_iRows, _iCols);
+ case types::InternalType::ScilabUInt64 :
+ poResult = new types::UInt64(_iRows, _iCols);
break;
- case GenericType::ScilabString :
- poResult = new String(_iRows, _iCols);
+ case types::InternalType::ScilabString :
+ poResult = new types::String(_iRows, _iCols);
break;
- case GenericType::ScilabPolynom :
+ case types::InternalType::ScilabPolynom :
{
int* piRank = new int[_iRows * _iCols];
memset(piRank, 0x00, _iRows * _iCols * sizeof(int));
- poResult = new Polynom(_poSource->getAs<Polynom>()->getVariableName(), _iRows, _iCols, piRank);
+ poResult = new types::Polynom(_poSource->getAs<types::Polynom>()->getVariableName(), _iRows, _iCols, piRank);
delete[] piRank;
break;
}
- case InternalType::ScilabImplicitList :
- poResult = new ImplicitList();
+ case types::InternalType::ScilabImplicitList:
+ poResult = new types::ImplicitList();
break;
default :
// FIXME : What should we do here ??
return poResult;
}
-InternalType* AddElementToVariableFromCol(InternalType* _poDest, InternalType* _poSource, int _iRows, int _iCols, int *_piCols)
+types::InternalType* AddElementToVariableFromCol(types::InternalType* _poDest, types::InternalType* _poSource, int _iRows, int _iCols, int *_piCols)
{
- InternalType *poResult = NULL;
- InternalType::ScilabType TypeSource = _poSource->getType();
- InternalType::ScilabType TypeDest = InternalType::ScilabInternal;
+ types::InternalType *poResult = NULL;
+ types::InternalType::ScilabType TypeSource = _poSource->getType();
+ types::InternalType::ScilabType TypeDest = types::InternalType::ScilabInternal;
if (_poDest == NULL)
{
{
switch (TypeDest)
{
- case GenericType::ScilabDouble :
- if (poResult->getAs<Double>()->isComplex() == false && _poSource->getAs<Double>()->isComplex() == true)
+ case types::InternalType::ScilabDouble :
+ if (poResult->getAs<types::Double>()->isComplex() == false && _poSource->getAs<types::Double>()->isComplex() == true)
{
- poResult->getAs<Double>()->setComplex(true);
+ poResult->getAs<types::Double>()->setComplex(true);
}
- poResult->getAs<Double>()->fillFromCol(*_piCols, _poSource->getAs<Double>());
- *_piCols += _poSource->getAs<Double>()->getCols();
+ poResult->getAs<types::Double>()->fillFromCol(*_piCols, _poSource->getAs<types::Double>());
+ *_piCols += _poSource->getAs<types::Double>()->getCols();
break;
default:
return NULL;
}
-InternalType* AddElementToVariableFromRow(InternalType* _poDest, InternalType* _poSource, int _iRows, int _iCols, int *_piRows)
+types::InternalType* AddElementToVariableFromRow(types::InternalType* _poDest, types::InternalType* _poSource, int _iRows, int _iCols, int *_piRows)
{
- InternalType *poResult = NULL;
- InternalType::ScilabType TypeSource = _poSource->getType();
- InternalType::ScilabType TypeDest = InternalType::ScilabInternal;
+ types::InternalType *poResult = NULL;
+ types::InternalType::ScilabType TypeSource = _poSource->getType();
+ types::InternalType::ScilabType TypeDest = types::InternalType::ScilabInternal;
if (_poDest == NULL)
{
{
switch (TypeDest)
{
- case GenericType::ScilabDouble :
- if (poResult->getAs<Double>()->isComplex() == false && _poSource->getAs<Double>()->isComplex() == true)
+ case types::InternalType::ScilabDouble :
+ if (poResult->getAs<types::Double>()->isComplex() == false && _poSource->getAs<types::Double>()->isComplex() == true)
{
- poResult->getAs<Double>()->setComplex(true);
+ poResult->getAs<types::Double>()->setComplex(true);
}
- poResult->getAs<Double>()->fillFromRow(*_piRows, _poSource->getAs<Double>());
- *_piRows += _poSource->getAs<Double>()->getRows();
+ poResult->getAs<types::Double>()->fillFromRow(*_piRows, _poSource->getAs<types::Double>());
+ *_piRows += _poSource->getAs<types::Double>()->getRows();
break;
default:
_iRows : Position if _poDest allready initialized else size of the matrix
_iCols : Position if _poDest allready initialized else size of the matrix
*/
-InternalType* AddElementToVariable(InternalType* _poDest, InternalType* _poSource, int _iRows, int _iCols)
+types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::InternalType* _poSource, int _iRows, int _iCols)
{
- InternalType *poResult = NULL;
+ types::InternalType *poResult = NULL;
bool isNew = true;
- InternalType::ScilabType TypeSource = _poSource->getType();
- InternalType::ScilabType TypeDest = InternalType::ScilabInternal;
+ types::InternalType::ScilabType TypeSource = _poSource->getType();
+ types::InternalType::ScilabType TypeDest = types::InternalType::ScilabInternal;
int iCurRow = _iRows;
int iCurCol = _iCols;
{
switch (TypeSource)
{
- case GenericType::ScilabDouble :
- poResult = new Double(_iRows, _iCols);
+ case types::InternalType::ScilabDouble :
+ poResult = new types::Double(_iRows, _iCols);
break;
- case GenericType::ScilabBool :
- poResult = new Bool(_iRows, _iCols);
+ case types::InternalType::ScilabBool :
+ poResult = new types::Bool(_iRows, _iCols);
break;
- case GenericType::ScilabInt8 :
- poResult = new Int8(_iRows, _iCols);
+ case types::InternalType::ScilabInt8 :
+ poResult = new types::Int8(_iRows, _iCols);
break;
- case GenericType::ScilabUInt8 :
- poResult = new UInt8(_iRows, _iCols);
+ case types::InternalType::ScilabUInt8 :
+ poResult = new types::UInt8(_iRows, _iCols);
break;
- case GenericType::ScilabInt16 :
- poResult = new Int16(_iRows, _iCols);
+ case types::InternalType::ScilabInt16 :
+ poResult = new types::Int16(_iRows, _iCols);
break;
- case GenericType::ScilabUInt16 :
- poResult = new UInt16(_iRows, _iCols);
+ case types::InternalType::ScilabUInt16 :
+ poResult = new types::UInt16(_iRows, _iCols);
break;
- case GenericType::ScilabInt32 :
- poResult = new Int32(_iRows, _iCols);
+ case types::InternalType::ScilabInt32 :
+ poResult = new types::Int32(_iRows, _iCols);
break;
- case GenericType::ScilabUInt32 :
- poResult = new UInt32(_iRows, _iCols);
+ case types::InternalType::ScilabUInt32 :
+ poResult = new types::UInt32(_iRows, _iCols);
break;
- case GenericType::ScilabInt64 :
- poResult = new Int64(_iRows, _iCols);
+ case types::InternalType::ScilabInt64 :
+ poResult = new types::Int64(_iRows, _iCols);
break;
- case GenericType::ScilabUInt64 :
- poResult = new UInt64(_iRows, _iCols);
+ case types::InternalType::ScilabUInt64 :
+ poResult = new types::UInt64(_iRows, _iCols);
break;
- case GenericType::ScilabString :
- poResult = new String(_iRows, _iCols);
+ case types::InternalType::ScilabString :
+ poResult = new types::String(_iRows, _iCols);
break;
- case GenericType::ScilabSparse :
- poResult = new Sparse(_iRows, _iCols);
+ case types::InternalType::ScilabSparse :
+ poResult = new types::Sparse(_iRows, _iCols);
break;
- case GenericType::ScilabSparseBool :
- poResult = new SparseBool(_iRows, _iCols);
+ case types::InternalType::ScilabSparseBool :
+ poResult = new types::SparseBool(_iRows, _iCols);
break;
- case GenericType::ScilabPolynom :
+ case types::InternalType::ScilabPolynom :
{
int* piRank = new int[_iRows * _iCols];
memset(piRank, 0x00, _iRows * _iCols * sizeof(int));
- poResult = new Polynom(_poSource->getAs<Polynom>()->getVariableName(), _iRows, _iCols, piRank);
+ poResult = new types::Polynom(_poSource->getAs<types::Polynom>()->getVariableName(), _iRows, _iCols, piRank);
delete[] piRank;
break;
}
- case InternalType::ScilabImplicitList :
- poResult = new ImplicitList();
+ case types::InternalType::ScilabImplicitList :
+ poResult = new types::ImplicitList();
break;
- case GenericType::ScilabHandle :
- poResult = new GraphicHandle(_iRows, _iCols);
+ case types::InternalType::ScilabHandle :
+ poResult = new types::GraphicHandle(_iRows, _iCols);
break;
default :
// FIXME What should we do here ...
//check if source type is compatible with dest type
switch (TypeDest)
{
- case GenericType::ScilabDouble :
- if (TypeSource == GenericType::ScilabPolynom)
+ case types::InternalType::ScilabDouble :
+ if (TypeSource == types::InternalType::ScilabPolynom)
{
- Double *poDest = _poDest->getAs<Double>();
- Polynom* pPSource = _poSource->getAs<Polynom>();
+ types::Double *poDest = _poDest->getAs<types::Double>();
+ types::Polynom* pPSource = _poSource->getAs<types::Polynom>();
//Convert Dest to ScilabPolynom
int iSize = poDest->getSize();
{
poResult->killMe();
}
- poResult = new Polynom(pPSource->getVariableName(), poDest->getRows(), poDest->getCols(), piRank);
+ poResult = new types::Polynom(pPSource->getVariableName(), poDest->getRows(), poDest->getCols(), piRank);
delete[] piRank;
- Polynom* pPResult = poResult->getAs<Polynom>();
+ types::Polynom* pPResult = poResult->getAs<types::Polynom>();
pPResult->setComplex(poDest->isComplex());
double *pR = poDest->getReal();
- SinglePoly** pSP = pPResult->get();
+ types::SinglePoly** pSP = pPResult->get();
if (poDest->isComplex())
{
return poResult;
}
break;
- case GenericType::ScilabPolynom :
- if (TypeSource == GenericType::ScilabDouble)
+ case types::InternalType::ScilabPolynom :
+ if (TypeSource == types::InternalType::ScilabDouble)
{
//Add Source like coef of the new element
- Double* pD = _poSource->getAs<Double>();
- Polynom* pPolyOut = poResult->getAs<Polynom>();
+ types::Double* pD = _poSource->getAs<types::Double>();
+ types::Polynom* pPolyOut = poResult->getAs<types::Polynom>();
if (pD->isComplex())
{
{
for (int j = 0 ; j < pD->getCols() ; j++)
{
- SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
+ types::SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
pSPOut->setRank(0);
double pDblR = pD->get(i, j);
{
for (int j = 0 ; j < pD->getCols() ; j++)
{
- SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
+ types::SinglePoly* pSPOut = pPolyOut->get(iCurRow + i, iCurCol + j);
pSPOut->setRank(0);
double pDbl = pD->get(i, j);
return poResult;
}
break;
- case GenericType::ScilabSparse :
- if (TypeSource == GenericType::ScilabDouble)
+ case types::InternalType::ScilabSparse :
+ if (TypeSource == types::InternalType::ScilabDouble)
{
- Double* poSource = _poSource->getAs<Double>();
- Sparse* spResult = poResult->getAs<Sparse>();
+ types::Double* poSource = _poSource->getAs<types::Double>();
+ types::Sparse* spResult = poResult->getAs<types::Sparse>();
// Set complex the result if one of inputs is complex
if (poSource->isComplex())
return poResult;
}
break;
- case GenericType::ScilabSparseBool :
- if (TypeSource == GenericType::ScilabBool)
+ case types::InternalType::ScilabSparseBool :
+ if (TypeSource == types::InternalType::ScilabBool)
{
- Bool* poSource = _poSource->getAs<Bool>();
- SparseBool* spResult = poResult->getAs<SparseBool>();
+ types::Bool* poSource = _poSource->getAs<types::Bool>();
+ types::SparseBool* spResult = poResult->getAs<types::SparseBool>();
// Add poSource at the end of spResult
for (int i = 0; i < poSource->getRows(); i++)
//Just add the new value in the current item
switch (TypeDest)
{
- case GenericType::ScilabDouble :
- poResult->getAs<Double>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabDouble :
+ poResult->getAs<types::Double>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabPolynom :
- poResult->getAs<Polynom>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabPolynom :
+ poResult->getAs<types::Polynom>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabBool:
- poResult->getAs<Bool>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabBool:
+ poResult->getAs<types::Bool>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabInt8 :
- poResult->getAs<Int8>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabInt8 :
+ poResult->getAs<types::Int8>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabUInt8 :
- poResult->getAs<UInt8>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabUInt8 :
+ poResult->getAs<types::UInt8>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabInt16 :
- poResult->getAs<Int16>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabInt16 :
+ poResult->getAs<types::Int16>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabUInt16 :
- poResult->getAs<UInt16>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabUInt16 :
+ poResult->getAs<types::UInt16>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabInt32 :
- poResult->getAs<Int32>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabInt32 :
+ poResult->getAs<types::Int32>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabUInt32 :
- poResult->getAs<UInt32>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabUInt32 :
+ poResult->getAs<types::UInt32>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabInt64 :
- poResult->getAs<Int64>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabInt64 :
+ poResult->getAs<types::Int64>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabUInt64 :
- poResult->getAs<UInt64>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabUInt64 :
+ poResult->getAs<types::UInt64>()->append(iCurRow, iCurCol, _poSource);
break;
- case GenericType::ScilabSparse :
- poResult->getAs<Sparse>()->append(iCurRow, iCurCol, _poSource->getAs<Sparse>());
+ case types::InternalType::ScilabSparse :
+ poResult->getAs<types::Sparse>()->append(iCurRow, iCurCol, _poSource->getAs<types::Sparse>());
break;
- case GenericType::ScilabSparseBool :
- poResult->getAs<SparseBool>()->append(iCurRow, iCurCol, _poSource->getAs<SparseBool>());
+ case types::InternalType::ScilabSparseBool :
+ poResult->getAs<types::SparseBool>()->append(iCurRow, iCurCol, _poSource->getAs<types::SparseBool>());
break;
- case GenericType::ScilabString :
+ case types::InternalType::ScilabString :
{
- poResult->getAs<String>()->append(iCurRow, iCurCol, _poSource);
+ poResult->getAs<types::String>()->append(iCurRow, iCurCol, _poSource);
}
break;
- case GenericType::ScilabImplicitList :
+ case types::InternalType::ScilabImplicitList :
{
- ImplicitList* pIL = _poSource->getAs<ImplicitList>();
- ImplicitList* pOL = poResult->getAs<ImplicitList>();
+ types::ImplicitList* pIL = _poSource->getAs<types::ImplicitList>();
+ types::ImplicitList* pOL = poResult->getAs<types::ImplicitList>();
pOL->setStart(pIL->getStart());
pOL->setStep(pIL->getStep());
pOL->setEnd(pIL->getEnd());
break;
}
- case GenericType::ScilabHandle :
- poResult->getAs<GraphicHandle>()->append(iCurRow, iCurCol, _poSource);
+ case types::InternalType::ScilabHandle :
+ poResult->getAs<types::GraphicHandle>()->append(iCurRow, iCurCol, _poSource);
break;
default:
// call overload
//i1, ..., in : indexes
//dest : variable where insert data || NULL
//source : data to insert || extract indexes from source
-InternalType* callOverload(const ast::Exp& e, std::wstring _strType, typed_list* _pArgs, InternalType* _source, InternalType* _dest)
+types::InternalType* callOverload(const ast::Exp& e, const std::wstring& _strType, types::typed_list* _pArgs, types::InternalType* _source, types::InternalType* _dest)
{
- Function::ReturnValue ret = Function::Error;
- InternalType* pITOut = NULL;
- typed_list in;
- typed_list out;
+ types::Function::ReturnValue ret = types::Function::Error;
+ types::InternalType* pITOut = NULL;
+ types::typed_list in;
+ types::typed_list out;
std::wstring function_name;
function_name = L"%" + _source->getShortTypeStr() + L"_" + _strType;
function_name += L"_" + _dest->getShortTypeStr();
}
- InternalType* pFunc = symbol::Context::getInstance()->get(symbol::Symbol(function_name));
+ types::InternalType* pFunc = symbol::Context::getInstance()->get(symbol::Symbol(function_name));
// if %type_6 doesn't exist, call %l_6
if (_dest == NULL && pFunc == NULL)
{
_dest->DecreaseRef();
}
- if (ret == Function::Error)
+ if (ret == types::Function::Error)
{
//manage error
std::wostringstream os;
}
else if (out.size() > 1)
{
- List* pListOut = new List();
+ types::List* pListOut = new types::List();
for (int i = 0; i < (int)out.size(); i++)
{
pListOut->append(out[i]);
else if (pCall)
{
bool bArgList = false;
- List* pList = NULL;
+ types::List* pList = NULL;
int iListIncr = 0;
int iListSize = 0;
ast::ExecVisitor execMe;
ast::exps_t args = pCall->getArgs();
- typed_list* pCurrentArgs = execMe.GetArgumentList(args);
+ types::typed_list* pCurrentArgs = execMe.GetArgumentList(args);
if (getFieldsFromExp(&pCall->getName(), fields) == false)
{
(*pCurrentArgs)[0]->isMList() == false)
{
bArgList = true;
- pList = (*pCurrentArgs)[0]->getAs<List>();
+ pList = (*pCurrentArgs)[0]->getAs<types::List>();
//pList->IncreaseRef();
pCurrentArgs->clear();
pCurrentArgs->push_back(pList->get(iListIncr));
if (pCurrentArgs &&
pCurrentArgs->size() == 1 &&
(*pCurrentArgs)[0]->isString() &&
- (*pCurrentArgs)[0]->getAs<String>()->getSize() == 1)
+ (*pCurrentArgs)[0]->getAs<types::String>()->getSize() == 1)
{
// a("b") => a.b or a(x)("b") => a(x).b
ExpHistory * pEHParent = fields.back();
- ast::SimpleVar* pFieldVar = new ast::SimpleVar(pCall->getLocation(), symbol::Symbol((*pCurrentArgs)[0]->getAs<String>()->get(0)));
+ ast::SimpleVar* pFieldVar = new ast::SimpleVar(pCall->getLocation(), symbol::Symbol((*pCurrentArgs)[0]->getAs<types::String>()->get(0)));
ExpHistory * pEH = new ExpHistory(pEHParent, pFieldVar);
pEH->setLevel(pEHParent->getLevel() + 1);
pEH->setExpOwner(true);
if (iListIncr < iListSize)
{
// create new args for next loop.
- pCurrentArgs = new typed_list();
+ pCurrentArgs = new types::typed_list();
pCurrentArgs->push_back(pList->get(iListIncr)->clone());
}
}
}
}
-InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*>& fields, InternalType* _pAssignValue)
+types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*>& fields, types::InternalType* _pAssignValue)
{
std::list<ExpHistory*> evalFields;
std::list<ExpHistory*> workFields;
bool bPutInCtx = false;
- InternalType* pITMain = NULL;
+ types::InternalType* pITMain = NULL;
try
{
if (pFirstField->isCellExp())
{
// a{x}, where "a" doesn't exists
- pITMain = new Cell(1, 1);
+ pITMain = new types::Cell(1, 1);
pITMain->IncreaseRef();
bPutInCtx = true;
}
// is a field exp
//"a" does not exist or it is another type, create it with size 1,1 and return it
//create new structure variable
- pITMain = new Struct(1, 1);
+ pITMain = new types::Struct(1, 1);
pITMain->IncreaseRef();
bPutInCtx = true;
}
evalFields.push_back(pEH);
workFields.pop_front();
- InternalType* pITCurrent = pEH->getCurrent();
+ types::InternalType* pITCurrent = pEH->getCurrent();
if (pEH->isCellExp() && pITCurrent->isCell() == false)
{
if (pITCurrent->isStruct())
{
- Struct* pStruct = pITCurrent->getAs<Struct>();
+ types::Struct* pStruct = pITCurrent->getAs<types::Struct>();
std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
if (pEH->needResize())
if (pEH->getArgs())
{
- InternalType* pIT = pStruct->extractWithoutClone(pEH->getArgs());
+ types::InternalType* pIT = pStruct->extractWithoutClone(pEH->getArgs());
workFields.push_front(new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pIT));
}
else
if (iterFieldsNext == fields.end() && (*iterFields)->getArgs() == NULL)
{
// create pArg with "x" and set it as argument of "a"
- typed_list* args = new typed_list();
- args->push_back(new String(pwcsFieldname.c_str()));
+ types::typed_list* args = new types::typed_list();
+ args->push_back(new types::String(pwcsFieldname.c_str()));
pEH->setArgs(args);
// a.x where x is the last field
}
// extract field x and append it to elements for next recursion.
- List* pLOut = pStruct->extractFieldWithoutClone(pwcsFieldname);
+ types::List* pLOut = pStruct->extractFieldWithoutClone(pwcsFieldname);
// pStruct must be scalar because we cant insert most of one element in the same insertion
- InternalType* pIT = pLOut->get(0);
+ types::InternalType* pIT = pLOut->get(0);
if (pIT->getRef() > 2) //One for my own ref + 1 for "extractFieldWithoutClone" artificial ref
{
// clone element before modify it.
}
else if (pITCurrent->isTList() || pITCurrent->isMList())
{
- TList* pTL = pITCurrent->getAs<TList>();
- typed_list* pArgs = pEH->getArgs();
+ types::TList* pTL = pITCurrent->getAs<types::TList>();
+ types::typed_list* pArgs = pEH->getArgs();
if (pArgs)
{
if (pArgs->size() > 1 || pITCurrent->isMList())
{
// call overload
- InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pArgs, pTL, NULL);
+ types::InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pArgs, pTL, NULL);
if ((*iterFields)->getExp() == NULL)
{
// a(x)(y)
int iNewSize = pEH->getSizeFromArgs();
if (pTL->getSize() < iNewSize)
{
- pTL->set(iNewSize - 1, new ListUndefined());
+ pTL->set(iNewSize - 1, new types::ListUndefined());
}
// update pArgs variables with new argument computed in getSizeFromArgs
pArgs = pEH->getArgs();
- InternalType* pIT = pTL->extract(pArgs);
- List* pList = pIT->getAs<List>();
+ types::InternalType* pIT = pTL->extract(pArgs);
+ types::List* pList = pIT->getAs<types::List>();
if (pList->getSize() > 1)
{
throw ast::InternalError(os.str(), 999, _pExp->getLocation());
}
- double* pdblArgs = (*pArgs)[0]->getAs<Double>()->get();
+ double* pdblArgs = (*pArgs)[0]->getAs<types::Double>()->get();
if ((*iterFields)->getExp() == NULL)
{
// a(x)(y)
else
{
// get string "x" of a.x
- InternalType* pExtract = NULL;
+ types::InternalType* pExtract = NULL;
std::wstring pwcsFieldname = L"";
bool bReinsert = false;
ExpHistory* pEHChield = NULL;
if (iterFieldsNext == fields.end() && (*iterFields)->getArgs() == NULL)
{
// create pArg with "x" and set it as argument of "a"
- typed_list* args = new typed_list();
- args->push_back(new String(pwcsFieldname.c_str()));
+ types::typed_list* args = new types::typed_list();
+ args->push_back(new types::String(pwcsFieldname.c_str()));
pEH->setArgs(args);
// a.x where x is the last field
{
// M=mlist(['MType','x','y'], ...
// M.rows1 = "somthing"
- pArgs = new typed_list();
- pArgs->push_back(new String(pwcsFieldname.c_str()));
+ pArgs = new types::typed_list();
+ pArgs->push_back(new types::String(pwcsFieldname.c_str()));
// call overload
pExtract = callOverload(*pEH->getExp(), L"6", pArgs, pTL, NULL);
}
else if (pITCurrent->isList())
{
- List* pL = pITCurrent->getAs<List>();
+ types::List* pL = pITCurrent->getAs<types::List>();
if (pEH->getParent() && pEH->getParent()->getLevel() == pEH->getLevel())
{
std::wostringstream os;
if (pEH->getArgs()->size() > 1)
{
// call overload
- InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pEH->getArgs(), pL, NULL);
+ types::InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pEH->getArgs(), pL, NULL);
if ((*iterFields)->getExp() == NULL)
{
int iNewSize = pEH->getSizeFromArgs();
if (pL->getSize() < iNewSize)
{
- pL->set(iNewSize - 1, new ListUndefined());
+ pL->set(iNewSize - 1, new types::ListUndefined());
}
- Double* pDblArgs = (*pEH->getArgs())[0]->getAs<Double>();
+ types::Double* pDblArgs = (*pEH->getArgs())[0]->getAs<types::Double>();
double* pdblArgs = pDblArgs->get();
if ((*iterFields)->getExp() == NULL)
std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
// create pArg with "x"
- typed_list* args = new typed_list();
- args->push_back(new String(pwcsFieldname.c_str()));
+ types::typed_list* args = new types::typed_list();
+ args->push_back(new types::String(pwcsFieldname.c_str()));
pEH->setArgs(args);
// check if the field x is the last field
else
{
// call overload
- InternalType* pExtract = callOverload(*pEH->getExp(), L"6", args, pL, NULL);
+ types::InternalType* pExtract = callOverload(*pEH->getExp(), L"6", args, pL, NULL);
// append extraction of a.x for next level.
workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
}
else if (pITCurrent->isHandle())
{
- typed_list* pArgs = pEH->getArgs();
- GraphicHandle* pGH = pITCurrent->getAs<GraphicHandle>();
+ types::typed_list* pArgs = pEH->getArgs();
+ types::GraphicHandle* pGH = pITCurrent->getAs<types::GraphicHandle>();
if (pArgs)
{
- InternalType* pExtract = NULL;
+ types::InternalType* pExtract = NULL;
if (pArgs->size() == 1 && (*pArgs)[0]->isImplicitList() == false)
{
std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
// create arg with next field
- typed_list* args = new typed_list();
- args->push_back(new String(pwcsFieldname.c_str()));
+ types::typed_list* args = new types::typed_list();
+ args->push_back(new types::String(pwcsFieldname.c_str()));
pEH->setArgs(args);
// check if the field x is the last field
else
{
// call overload
- InternalType* pExtract = callOverload(*pEH->getExp(), L"e", args, pITCurrent, NULL);
+ types::InternalType* pExtract = callOverload(*pEH->getExp(), L"e", args, pITCurrent, NULL);
// append extraction of a.x for next level.
workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
}
else if (pITCurrent->isCell())
{
- Cell* pCell = pITCurrent->getAs<Cell>();
+ types::Cell* pCell = pITCurrent->getAs<types::Cell>();
if (pEH->getArgs() && (*pEH->getArgs())[0]->isString() == false)
{
if (pEH->isCellExp())
// extract each elements of a(x)
for (int iCell = 0; iCell < pCell->getSize(); iCell++)
{
- InternalType* pIT = pCell->get(iCell);
+ types::InternalType* pIT = pCell->get(iCell);
if ((*iterFields)->getExp() == NULL)
{
// a{x}(y)
pCell->resize(pEH->getArgsDimsArray(), pEH->getArgsDims());
}
- InternalType* pIT = pCell->extract(pEH->getArgs());
+ types::InternalType* pIT = pCell->extract(pEH->getArgs());
workFields.push_front(new ExpHistory(pEH, pEH->getExp(), pEH->getArgs(), pEH->getLevel(), pEH->isCellExp(), pIT));
workFields.front()->setReinsertion();
}
pCell->resize(pEH->getArgsDimsArray(), pEH->getArgsDims());
}
- InternalType* pIT = pCell->extract(pEH->getArgs());
+ types::InternalType* pIT = pCell->extract(pEH->getArgs());
workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pIT));
workFields.front()->setReinsertion();
}
if (pEH->getArgs())
{
// a(x)
- InternalType* pExtract = pITCurrent->getAs<UserType>()->extract(pEH->getArgs());
+ types::InternalType* pExtract = pITCurrent->getAs<types::UserType>()->extract(pEH->getArgs());
if (pExtract == NULL)
{
// call overload
std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
// create arg with next field
- typed_list* args = new typed_list();
- args->push_back(new String(pwcsFieldname.c_str()));
+ types::typed_list* args = new types::typed_list();
+ args->push_back(new types::String(pwcsFieldname.c_str()));
pEH->setArgs(args);
// check if the field x is the last field
}
else
{
- InternalType* pExtract = pITCurrent->getAs<UserType>()->extract(args);
+ types::InternalType* pExtract = pITCurrent->getAs<types::UserType>()->extract(args);
if (pExtract == NULL)
{
// call overload
}
else
{
- InternalType* pIT = new Struct(1, 1);
+ types::InternalType* pIT = new types::Struct(1, 1);
pEH->setCurrent(pIT);
pEH->setReinsertion();
evalFields.push_back(pEH);
workFields.pop_front();
- typed_list* pArgs = pEH->getArgs();
+ types::typed_list* pArgs = pEH->getArgs();
// should never occured
if (pArgs == NULL || pArgs->size() == 0)
if (pEH->isCellExp())
{
- Cell* pCell = pEH->getCurrent()->getAs<Cell>();
+ types::Cell* pCell = pEH->getCurrent()->getAs<types::Cell>();
// insert "something" in b{x}
if ((*pArgs)[0]->isString())
{
else
{
// insert "something" in b(x,y)
- InternalType* pIT = insertionCall(*_pExp, pArgs, pEH->getCurrent(), _pAssignValue);
+ types::InternalType* pIT = insertionCall(*_pExp, pArgs, pEH->getCurrent(), _pAssignValue);
if (pIT == NULL)
{
std::wostringstream os;
break;
}
- typed_list* pParentArgs = pEHParent->getArgs();
+ types::typed_list* pParentArgs = pEHParent->getArgs();
if (pParentArgs == NULL || pEH->getWhereReinsert() != -1)
{
- InternalType* pParent = pEHParent->getCurrent();
+ types::InternalType* pParent = pEHParent->getCurrent();
if (pParent->isStruct())
{
- Struct* pStruct = pParent->getAs<Struct>();
+ types::Struct* pStruct = pParent->getAs<types::Struct>();
pStruct->get(pEH->getWhereReinsert())->set(pEH->getExpAsString(), pEH->getCurrent());
evalFields.pop_back();
delete pEH;
}
else if (pParent->isTList() || pParent->isMList())
{
- TList* pTL = pParent->getAs<TList>();
+ types::TList* pTL = pParent->getAs<types::TList>();
if (pParentArgs)
{
// In case where pTL is in several scilab variable,
// we have to clone it for keep the other variables unchanged.
if (pTL->getRef() > 1)
{
- pTL = pTL->clone()->getAs<TList>();
+ pTL = pTL->clone()->getAs<types::TList>();
}
pTL->set(pEH->getWhereReinsert(), pEH->getCurrent());
// we have to clone it for keep the other variables unchanged.
if (pTL->getRef() > 1)
{
- pTL = pTL->clone()->getAs<TList>();
+ pTL = pTL->clone()->getAs<types::TList>();
}
pTL->set(pEH->getExpAsString(), pEH->getCurrent());
continue;
}
- pParentArgs = new typed_list();
- pParentArgs->push_back(new String(pEH->getExpAsString().c_str()));
+ pParentArgs = new types::typed_list();
+ pParentArgs->push_back(new types::String(pEH->getExpAsString().c_str()));
}
}
else if (pParent->isCell())
{
- Cell* pCell = pParent->getAs<Cell>();
+ types::Cell* pCell = pParent->getAs<types::Cell>();
if (pEHParent->isCellExp() && pEH->getWhereReinsert() != -1)
{
// a{x}.b => reinsert b in a{x}
}
}
- InternalType* pIT = insertionCall(*_pExp, pParentArgs, pEHParent->getCurrent(), pEH->getCurrent());
+ types::InternalType* pIT = insertionCall(*_pExp, pParentArgs, pEHParent->getCurrent(), pEH->getCurrent());
if (pIT == NULL)
{
std::wostringstream os;
}
}
-InternalType* insertionCall(const ast::Exp& e, typed_list* _pArgs, InternalType* _pVar, InternalType* _pInsert)
+types::InternalType* insertionCall(const ast::Exp& e, types::typed_list* _pArgs, types::InternalType* _pVar, types::InternalType* _pInsert)
{
- InternalType* pOut = NULL;
- InternalType *pIL = NULL;
+ types::InternalType* pOut = NULL;
+ types::InternalType *pIL = NULL;
//fisrt extract implicit list
if (_pInsert->isColon())
{
//double* pdbl = NULL;
//_pInsert = new Double(-1, -1, &pdbl);
//pdbl[0] = 1;
- pIL = Double::Identity(-1, -1);
+ pIL = types::Double::Identity(-1, -1);
_pInsert->killMe();
_pInsert = pIL;
}
else if (_pInsert->isImplicitList())
{
- pIL = _pInsert->getAs<ImplicitList>()->extractFullMatrix();
+ pIL = _pInsert->getAs<types::ImplicitList>()->extractFullMatrix();
if (pIL && pIL->isDeletable())
{
_pInsert->killMe();
else if (_pInsert->isContainer() && _pInsert->isRef())
{
//std::cout << "assign container type during insertion" << std::endl;
- //InternalType* pIL = _pInsert->clone();
+ //types::InternalType* pIL = _pInsert->clone();
//_pInsert = pIL;
}
- if (_pInsert->isDouble() && _pInsert->getAs<Double>()->isEmpty() && _pVar == NULL)
+ if (_pInsert->isDouble() && _pInsert->getAs<types::Double>()->isEmpty() && _pVar == NULL)
{
// l(x) = [] when l is not defined => create l = []
- pOut = Double::Empty();
+ pOut = types::Double::Empty();
}
- else if (_pInsert->isDouble() && _pInsert->getAs<Double>()->isEmpty() && _pVar->isStruct() == false && _pVar->isList() == false)
+ else if (_pInsert->isDouble() && _pInsert->getAs<types::Double>()->isEmpty() && _pVar->isStruct() == false && _pVar->isList() == false)
{
//insert [] so deletion except for Struct and List which can insert []
- InternalType::ScilabType varType = _pVar->getType();
+ types::InternalType::ScilabType varType = _pVar->getType();
switch (varType)
{
- case InternalType::ScilabDouble :
+ case types::InternalType::ScilabDouble :
{
- pOut = _pVar->getAs<Double>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Double>()->remove(_pArgs);
break;
}
- case InternalType::ScilabString :
+ case types::InternalType::ScilabString :
{
- pOut = _pVar->getAs<String>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::String>()->remove(_pArgs);
break;
}
- case InternalType::ScilabCell :
+ case types::InternalType::ScilabCell :
{
- pOut = _pVar->getAs<Cell>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Cell>()->remove(_pArgs);
break;
}
- case InternalType::ScilabBool :
+ case types::InternalType::ScilabBool :
{
- pOut = _pVar->getAs<Bool>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Bool>()->remove(_pArgs);
break;
}
- case InternalType::ScilabPolynom :
+ case types::InternalType::ScilabPolynom :
{
- pOut = _pVar->getAs<Polynom>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Polynom>()->remove(_pArgs);
break;
}
- case InternalType::ScilabInt8 :
+ case types::InternalType::ScilabInt8 :
{
- pOut = _pVar->getAs<Int8>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Int8>()->remove(_pArgs);
break;
}
- case InternalType::ScilabUInt8 :
+ case types::InternalType::ScilabUInt8 :
{
- pOut = _pVar->getAs<UInt8>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::UInt8>()->remove(_pArgs);
break;
}
- case InternalType::ScilabInt16 :
+ case types::InternalType::ScilabInt16 :
{
- pOut = _pVar->getAs<Int16>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Int16>()->remove(_pArgs);
break;
}
- case InternalType::ScilabUInt16 :
+ case types::InternalType::ScilabUInt16 :
{
- pOut = _pVar->getAs<UInt16>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::UInt16>()->remove(_pArgs);
break;
}
- case InternalType::ScilabInt32 :
+ case types::InternalType::ScilabInt32 :
{
- pOut = _pVar->getAs<Int32>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Int32>()->remove(_pArgs);
break;
}
- case InternalType::ScilabUInt32 :
+ case types::InternalType::ScilabUInt32 :
{
- pOut = _pVar->getAs<UInt32>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::UInt32>()->remove(_pArgs);
break;
}
- case InternalType::ScilabInt64 :
+ case types::InternalType::ScilabInt64 :
{
- pOut = _pVar->getAs<Int64>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Int64>()->remove(_pArgs);
break;
}
- case InternalType::ScilabUInt64 :
+ case types::InternalType::ScilabUInt64 :
{
- pOut = _pVar->getAs<UInt64>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::UInt64>()->remove(_pArgs);
break;
}
- case InternalType::ScilabSparse :
+ case types::InternalType::ScilabSparse :
{
- pOut = _pVar->getAs<Sparse>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::Sparse>()->remove(_pArgs);
break;
}
- case InternalType::ScilabSparseBool :
+ case types::InternalType::ScilabSparseBool :
{
- pOut = _pVar->getAs<SparseBool>()->remove(_pArgs);
+ pOut = _pVar->getAs<types::SparseBool>()->remove(_pArgs);
break;
}
- case InternalType::ScilabStruct :
+ case types::InternalType::ScilabStruct :
{
- pOut = _pVar->getAs<Struct>()->insert(_pArgs, _pInsert);
+ pOut = _pVar->getAs<types::Struct>()->insert(_pArgs, _pInsert);
break;
}
- case InternalType::ScilabHandle :
+ case types::InternalType::ScilabHandle :
{
- GraphicHandle* pH = _pVar->getAs<GraphicHandle>();
+ types::GraphicHandle* pH = _pVar->getAs<types::GraphicHandle>();
if ((*_pArgs)[0]->isString())
{
- String *pS = (*_pArgs)[0]->getAs<String>();
+ types::String *pS = (*_pArgs)[0]->getAs<types::String>();
- typed_list in;
- typed_list out;
- optional_list opt;
+ types::typed_list in;
+ types::typed_list out;
+ types::optional_list opt;
ast::ExecVisitor exec;
in.push_back(pH);
in.push_back(pS);
in.push_back(_pInsert);
- Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
- Callable::ReturnValue ret = pCall->call(in, opt, 1, out, &exec);
- if (ret == Callable::OK)
+ types::Function* pCall = (types::Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
+ types::Callable::ReturnValue ret = pCall->call(in, opt, 1, out, &exec);
+ if (ret == types::Callable::OK)
{
pOut = _pVar;
}
}
}
}
- else if (_pVar == NULL || (_pVar->isDouble() && _pVar->getAs<Double>()->getSize() == 0))
+ else if (_pVar == NULL || (_pVar->isDouble() && _pVar->getAs<types::Double>()->getSize() == 0))
{
//insert in a new variable or []
//call static insert function
//if _pVar == NULL and pArg is single string, it's a struct creation
if ((*_pArgs)[0]->isString())
{
- String *pS = (*_pArgs)[0]->getAs<String>();
- Struct* pStr = new Struct(1, 1);
+ types::String *pS = (*_pArgs)[0]->getAs<types::String>();
+ types::Struct* pStr = new types::Struct(1, 1);
if (_pArgs->size() != 1 || pS->isScalar() == false)
{
{
switch (_pInsert->getType())
{
- case InternalType::ScilabDouble :
- pOut = Double::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabDouble :
+ pOut = types::Double::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabString :
- pOut = String::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabString :
+ pOut = types::String::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabCell :
- pOut = Cell::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabCell :
+ pOut = types::Cell::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabBool :
- pOut = Bool::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabBool :
+ pOut = types::Bool::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabPolynom :
- pOut = Polynom::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabPolynom :
+ pOut = types::Polynom::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabInt8 :
- pOut = Int8::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabInt8 :
+ pOut = types::Int8::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabUInt8 :
- pOut = UInt8::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabUInt8 :
+ pOut = types::UInt8::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabInt16 :
- pOut = Int16::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabInt16 :
+ pOut = types::Int16::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabUInt16 :
- pOut = UInt16::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabUInt16 :
+ pOut = types::UInt16::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabInt32 :
- pOut = Int32::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabInt32 :
+ pOut = types::Int32::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabUInt32 :
- pOut = UInt32::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabUInt32 :
+ pOut = types::UInt32::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabInt64 :
- pOut = Int64::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabInt64 :
+ pOut = types::Int64::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabUInt64 :
- pOut = UInt64::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabUInt64 :
+ pOut = types::UInt64::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabSparse :
- pOut = Sparse::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabSparse :
+ pOut = types::Sparse::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabSparseBool :
- pOut = SparseBool::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabSparseBool :
+ pOut = types::SparseBool::insertNew(_pArgs, _pInsert);
break;
- case InternalType::ScilabHandle:
- pOut = GraphicHandle::insertNew(_pArgs, _pInsert);
+ case types::InternalType::ScilabHandle:
+ pOut = types::GraphicHandle::insertNew(_pArgs, _pInsert);
break;
default :
{
// overload
- Double* pEmpty = Double::Empty();
+ types::Double* pEmpty = types::Double::Empty();
pOut = callOverload(e, L"i", _pArgs, _pInsert, pEmpty);
pEmpty->killMe();
break;
else
{
//call type insert function
- InternalType* pRet = NULL;
+ types::InternalType* pRet = NULL;
// case m=x; m()=x;
if (_pArgs == NULL || _pArgs->size() == 0)
//check types compatibilties
if (_pVar->isDouble() && _pInsert->isDouble())
{
- pRet = _pVar->getAs<Double>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Double>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isDouble() && _pInsert->isSparse())
{
- Sparse* pSp = _pInsert->getAs<Sparse>();
- Double* pD = new Double(pSp->getRows(), pSp->getCols(), pSp->isComplex());
+ types::Sparse* pSp = _pInsert->getAs<types::Sparse>();
+ types::Double* pD = new types::Double(pSp->getRows(), pSp->getCols(), pSp->isComplex());
pSp->fill(*pD);
- pRet = _pVar->getAs<Double>()->insert(_pArgs, pD);
+ pRet = _pVar->getAs<types::Double>()->insert(_pArgs, pD);
delete pD;
}
else if (_pVar->isString() && _pInsert->isString())
{
- pRet = _pVar->getAs<String>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::String>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isCell() && _pInsert->isCell())
{
- pRet = _pVar->getAs<Cell>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Cell>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isBool() && _pInsert->isBool())
{
- pRet = _pVar->getAs<Bool>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Bool>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isSparse() && _pInsert->isSparse())
{
- pRet = _pVar->getAs<Sparse>()->insert(_pArgs, _pInsert->getAs<Sparse>());
+ pRet = _pVar->getAs<types::Sparse>()->insert(_pArgs, _pInsert->getAs<types::Sparse>());
}
else if (_pVar->isSparse() && _pInsert->isDouble())
{
- pRet = _pVar->getAs<Sparse>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Sparse>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isSparseBool() && _pInsert->isSparseBool())
{
- pRet = _pVar->getAs<SparseBool>()->insert(_pArgs, _pInsert->getAs<SparseBool>());
+ pRet = _pVar->getAs<types::SparseBool>()->insert(_pArgs, _pInsert->getAs<types::SparseBool>());
}
else if (_pVar->isSparseBool() && _pInsert->isBool())
{
- pRet = _pVar->getAs<SparseBool>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::SparseBool>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isDouble() && _pInsert->isPoly())
{
- Double* pDest = _pVar->getAs<Double>();
- Polynom* pIns = _pInsert->getAs<Polynom>();
+ types::Double* pDest = _pVar->getAs<types::Double>();
+ types::Polynom* pIns = _pInsert->getAs<types::Polynom>();
int iSize = pDest->getSize();
int* piRanks = new int[iSize];
memset(piRanks, 0x00, iSize * sizeof(int));
- Polynom* pP = new Polynom(pIns->getVariableName(), pDest->getDims(), pDest->getDimsArray(), piRanks);
+ types::Polynom* pP = new types::Polynom(pIns->getVariableName(), pDest->getDims(), pDest->getDimsArray(), piRanks);
delete[] piRanks;
pP->setComplex(pDest->isComplex());
}
else if (_pVar->isPoly() && _pInsert->isDouble())
{
- Polynom* pDest = _pVar->getAs<Polynom>();
- Double* pIns = _pInsert->getAs<Double>();
+ types::Polynom* pDest = _pVar->getAs<types::Polynom>();
+ types::Double* pIns = _pInsert->getAs<types::Double>();
bool isComplexIns = pIns->isComplex();
int iSize = pIns->getSize();
int* piRanks = new int[iSize];
memset(piRanks, 0x00, iSize * sizeof(int));
//create a new polynom with Double to insert it into dest polynom
- Polynom* pP = new Polynom(pDest->getVariableName(), pIns->getDims(), pIns->getDimsArray(), piRanks);
+ types::Polynom* pP = new types::Polynom(pDest->getVariableName(), pIns->getDims(), pIns->getDimsArray(), piRanks);
delete[] piRanks;
if (isComplexIns)
{
double* pR = pIns->get();
double* pI = pIns->getImg();
- SinglePoly** pSP = pP->get();
+ types::SinglePoly** pSP = pP->get();
for (int idx = 0 ; idx < pP->getSize() ; idx++)
{
double dblR = pR[idx];
else
{
double* pdblR = pIns->get();
- SinglePoly** pSP = pP->get();
+ types::SinglePoly** pSP = pP->get();
for (int idx = 0 ; idx < pP->getSize() ; idx++)
{
double dblR = pdblR[idx];
}
else if (_pVar->isPoly() && _pInsert->isPoly())
{
- pRet = _pVar->getAs<Polynom>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Polynom>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isInt8() && _pInsert->isInt8())
{
- pRet = _pVar->getAs<Int8>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Int8>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isUInt8() && _pInsert->isUInt8())
{
- pRet = _pVar->getAs<UInt8>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::UInt8>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isInt16() && _pInsert->isInt16())
{
- pRet = _pVar->getAs<Int16>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Int16>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isUInt16() && _pInsert->isUInt16())
{
- pRet = _pVar->getAs<UInt16>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::UInt16>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isInt32() && _pInsert->isInt32())
{
- pRet = _pVar->getAs<Int32>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Int32>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isUInt32() && _pInsert->isUInt32())
{
- pRet = _pVar->getAs<UInt32>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::UInt32>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isInt64() && _pInsert->isInt64())
{
- pRet = _pVar->getAs<Int64>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::Int64>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isUInt64() && _pInsert->isUInt64())
{
- pRet = _pVar->getAs<UInt64>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::UInt64>()->insert(_pArgs, _pInsert);
}
else if (_pVar->isStruct())
{
- Struct* pStruct = _pVar->getAs<Struct>();
+ types::Struct* pStruct = _pVar->getAs<types::Struct>();
// insert something in a field of a struct
if (_pArgs->size() == 1 && (*_pArgs)[0]->isString())
{
//s("x") = y
- String *pS = (*_pArgs)[0]->getAs<String>();
+ types::String *pS = (*_pArgs)[0]->getAs<types::String>();
if (pS->isScalar() == false)
{
if (pIL)
{
if (_pInsert->isStruct())
{
- String* pStrFieldsName = pStruct->getFieldNames();
- Struct* pStructInsert = _pInsert->clone()->getAs<Struct>();
- String* pStrInsertFieldsName = pStructInsert->getFieldNames();
- Struct* pStructRet = NULL;
+ types::String* pStrFieldsName = pStruct->getFieldNames();
+ types::Struct* pStructInsert = _pInsert->clone()->getAs<types::Struct>();
+ types::String* pStrInsertFieldsName = pStructInsert->getFieldNames();
+ types::Struct* pStructRet = NULL;
// if not an empty struct
if (pStrFieldsName)
else
{
std::wstring pwcsField = pStrFieldsName->get(i - 1);
- List* pLExtract = pStructInsert->extractFieldWithoutClone(pwcsField);
+ types::List* pLExtract = pStructInsert->extractFieldWithoutClone(pwcsField);
for (int i = 0; i < pLExtract->getSize(); i++)
{
// insert elements in following pArgs
pRet = pStruct->insert(_pArgs, pStructInsert);
- pStructRet = pRet->getAs<Struct>();
+ pStructRet = pRet->getAs<types::Struct>();
pStructInsert->killMe();
}
else if (_pVar->isTList() || _pVar->isMList())
{
- TList* pTL = _pVar->getAs<TList>();
+ types::TList* pTL = _pVar->getAs<types::TList>();
if (_pArgs->size() == 1)
{
if ((*_pArgs)[0]->isString())
{
//s("x") = y
- String *pS = (*_pArgs)[0]->getAs<String>();
+ types::String *pS = (*_pArgs)[0]->getAs<types::String>();
if (pS->isScalar() == false)
{
if (pIL)
// we have to clone it for keep the other variables unchanged.
if (pTL->getRef() > 1)
{
- pTL = pTL->clone()->getAs<TList>();
+ pTL = pTL->clone()->getAs<types::TList>();
}
pRet = pTL->insert(_pArgs, _pInsert);
// in the first element, the TList have to be a List.
if (pTL->get(0)->isString() == false)
{
- List* pL = new List();
+ types::List* pL = new types::List();
for (int i = 0; i < pTL->getSize(); i++)
{
pL->append(pTL->get(i));
}
else if (_pVar->isList())
{
- List* pL = NULL;
+ types::List* pL = NULL;
// In case where pL is in several scilab variable,
// we have to clone it for keep the other variables unchanged.
if (_pVar->getRef() > 1)
{
- pL = _pVar->clone()->getAs<List>();
+ pL = _pVar->clone()->getAs<types::List>();
pRet = pL->insert(_pArgs, _pInsert);
if (pRet == NULL)
{
}
else
{
- pL = _pVar->getAs<List>();
+ pL = _pVar->getAs<types::List>();
pRet = pL->insert(_pArgs, _pInsert);
if (pRet == NULL)
{
if (_pArgs->size() == 1 && (*_pArgs)[0]->isString())
{
//s(["x"])
- GraphicHandle* pH = _pVar->getAs<GraphicHandle>();
- String *pS = (*_pArgs)[0]->getAs<String>();
- typed_list in;
- typed_list out;
- optional_list opt;
+ types::GraphicHandle* pH = _pVar->getAs<types::GraphicHandle>();
+ types::String *pS = (*_pArgs)[0]->getAs<types::String>();
+ types::typed_list in;
+ types::typed_list out;
+ types::optional_list opt;
ast::ExecVisitor exec;
in.push_back(pH);
in.push_back(pS);
in.push_back(_pInsert);
- Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
+ types::Function* pCall = (types::Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
if (pCall)
{
- Callable::ReturnValue ret = pCall->call(in, opt, 1, out, &exec);
- if (ret == Callable::OK)
+ types::Callable::ReturnValue ret = pCall->call(in, opt, 1, out, &exec);
+ if (ret == types::Callable::OK)
{
pRet = _pVar;
}
}
else
{
- pRet = _pVar->getAs<GraphicHandle>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::GraphicHandle>()->insert(_pArgs, _pInsert);
}
}
else if (_pVar->isUserType())
types::ImplicitList* pIL = (*_pArgs)[i]->getAs<types::ImplicitList>();
if (pIL->isComputable())
{
- InternalType* pIT = pIL->extractFullMatrix();
+ types::InternalType* pIT = pIL->extractFullMatrix();
(*_pArgs)[i]->killMe();
(*_pArgs)[i] = pIT;
}
}
}
- pRet = _pVar->getAs<UserType>()->insert(_pArgs, _pInsert);
+ pRet = _pVar->getAs<types::UserType>()->insert(_pArgs, _pInsert);
if (pRet == NULL)
{
pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
onPrompt = symbol::Context::getInstance()->getOrCreate(symbol::Symbol(L"%onprompt"));
}
- InternalType* pOnPrompt = NULL;
+ types::InternalType* pOnPrompt = NULL;
pOnPrompt = onPrompt->get();
if (pOnPrompt != NULL && pOnPrompt->isCallable())
{
}
using namespace types;
-
-
//define arrays on operation functions
static add_function pAddfunction[types::InternalType::IdLast][types::InternalType::IdLast] = {NULL};
#include "types_finite.hxx"
-bool isDoubleFinite(Double *_pDouble)
+bool isDoubleFinite(types::Double *_pDouble)
{
int iSize = _pDouble->getSize();
if (matrix_finite( _pDouble->getReal(), iSize) == 1)
#include "charEncoding.h"
}
+using namespace types;
+
InternalType *GenericPower(InternalType *_pLeftOperand, InternalType *_pRightOperand)
{
InternalType *pResult = NULL;
return _error_message;
}
-void ParserSingleInstance::appendErrorMessage(std::wstring message)
+void ParserSingleInstance::appendErrorMessage(const std::wstring& message)
{
_error_message += message;
}
#include "charEncoding.h"
}
-void ParserSingleInstance::PrintError(std::wstring msg)
+void ParserSingleInstance::PrintError(const std::wstring& msg)
{
int i = 0;
return get(_key);
}
-int Context::getFunctionList(std::list<Symbol>& lst, std::wstring _stModuleName)
+int Context::getFunctionList(std::list<Symbol>& lst, const std::wstring& _stModuleName)
{
return variables.getFunctionList(lst, _stModuleName, m_iLevel);
}
//dynamic modules
std::map<std::wstring, DynLibHandle> ConfigVariable::m_DynModules;
-void ConfigVariable::addDynModule(std::wstring _name, DynLibHandle _lib)
+void ConfigVariable::addDynModule(const std::wstring& _name, DynLibHandle _lib)
{
m_DynModules[_name] = _lib;
}
-void ConfigVariable::removeDynModule(std::wstring _name)
+void ConfigVariable::removeDynModule(const std::wstring& _name)
{
m_DynModules.erase(_name);
}
-DynLibHandle ConfigVariable::getDynModule(std::wstring _name)
+DynLibHandle ConfigVariable::getDynModule(const std::wstring& _name)
{
std::map<std::wstring, DynLibHandle>::iterator it;
it = m_DynModules.find(_name);
#include "getshortpathname.h"
}
-using namespace std;
/*--------------------------------------------------------------------------*/
wchar_t* getSCIHOMEW(void)
{
/*--------------------------------------------------------------------------*/
char* getSCIHOME(void)
{
- wstring tmpSCIHOME = ConfigVariable::getSCIHOME();
+ std::wstring tmpSCIHOME = ConfigVariable::getSCIHOME();
if (tmpSCIHOME == L"")
{
tmpSCIHOME = L"empty_SCIHOME";
#include "getshortpathname.h"
}
-using namespace std;
char *getSCI(void)
{
return wide_string_to_UTF8(ConfigVariable::getSCIPath().c_str());
pwstWSCI = to_wide_string(_sci_path);
#endif
- wstring wst(pwstWSCI);
+ std::wstring wst(pwstWSCI);
ConfigVariable::setSCIPath(wst);
FREE(pwstWSCI);
if (ierr == 1)
{
- cerr << "SCI environment variable not defined." << endl;
+ std::cerr << "SCI environment variable not defined." << std::endl;
exit(1);
}
}
#include "getshortpathname.h"
}
-using namespace std;
/*--------------------------------------------------------------------------*/
{
if ( (!Set_Shell()) || (!IsTheGoodShell()))
{
- cout << "Please modify ""ComSpec"" environment variable." << endl << "cmd.exe on W2K and more." << endl;
+ std::cout << "Please modify ""ComSpec"" environment variable." << std::endl << "cmd.exe on W2K and more." << std::endl;
}
}
#include "addfunction.h"
}
-void addCFunction(wchar_t* _wstName, OLDGW_FUNC _pFunc, wchar_t* _wstModule)
+void addCFunction(const wchar_t* _wstName, OLDGW_FUNC _pFunc, const wchar_t* _wstModule)
{
symbol::Context::getInstance()->addFunction(types::Function::createFunction(_wstName, _pFunc, _wstModule));
}
-void addMexFunction(wchar_t* _wstName, MEXGW_FUNC _pFunc, wchar_t* _wstModule)
+void addMexFunction(const wchar_t* _wstName, MEXGW_FUNC _pFunc, const wchar_t* _wstModule)
{
symbol::Context::getInstance()->addFunction(types::Function::createFunction(_wstName, _pFunc, _wstModule));
}
#include "os_string.h"
}
-using namespace std;
-
namespace types
{
Double* Double::Empty()
return true;
}
-bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*/)
+bool Double::subMatrixToString(std::wostringstream& ostr, int* _piDims, int /*_iDims*/)
{
int iCurrentLine = 0;
int iLineLen = ConfigVariable::getConsoleWidth();
if (isIdentity())
{
- ostr << L"eye *" << endl << endl;
+ ostr << L"eye *" << std::endl << std::endl;
if (isComplex() == false)
{
DoubleFormat df;
getDoubleFormat((m_pRealData[0]), &df);
addDoubleValue(&ostr, (m_pRealData[0]), &df);
- ostr << endl;
+ ostr << std::endl;
}
else
{
getDoubleFormat(ZeroIsZero(m_pRealData[0]), &dfR);
getDoubleFormat(ZeroIsZero(m_pImgData[0]), &dfI);
addDoubleComplexValue(&ostr, ZeroIsZero(m_pRealData[0]), ZeroIsZero(m_pImgData[0]), dfR.iWidth + dfI.iWidth, &dfR, &dfI);
- ostr << endl;
+ ostr << std::endl;
}
- ostr << endl;
+ ostr << std::endl;
}
else if (isEmpty())
{
ostr << L" []";
- ostr << endl;
+ ostr << std::endl;
}
else if (isScalar())
{
getDoubleFormat((m_pRealData[iPos]), &df);
ostr << SPACE_BETWEEN_TWO_VALUES;
addDoubleValue(&ostr, (m_pRealData[iPos]), &df);
- ostr << endl;
+ ostr << std::endl;
}
else
{
getDoubleFormat(ZeroIsZero(m_pImgData[iPos]), &dfI);
ostr << SPACE_BETWEEN_TWO_VALUES;
addDoubleComplexValue(&ostr, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), dfR.iWidth + dfI.iWidth, &dfR, &dfI);
- ostr << endl;
+ ostr << std::endl;
}
}
else if (getCols() == 1)
getDoubleFormat(ZeroIsZero(m_pRealData[iPos]), &df);
ostr << SPACE_BETWEEN_TWO_VALUES;
addDoubleValue(&ostr, ZeroIsZero(m_pRealData[iPos]), &df);
- ostr << endl;
+ ostr << std::endl;
}
}
else
ostr << SPACE_BETWEEN_TWO_VALUES;
addDoubleComplexValue(&ostr, ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), dfR.iWidth + dfI.iWidth, &dfR, &dfI);
- ostr << endl;
+ ostr << std::endl;
}
}
}
else if (getRows() == 1)
{
//row vector
- wostringstream ostemp;
+ std::wostringstream ostemp;
int iLastVal = m_iCols1PrintState;
if (isComplex() == false)
if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
{
m_iCols1PrintState = iLastVal;
- ostr << endl << endl;
+ ostr << std::endl << std::endl;
return false;
}
addColumnString(ostr, iLastVal + 1, i);
- ostr << ostemp.str() << endl;
+ ostr << ostemp.str() << std::endl;
ostemp.str(L"");
iLastVal = i;
}
{
addColumnString(ostr, iLastVal + 1, getCols());
}
- ostemp << endl;
+ ostemp << std::endl;
ostr << ostemp.str();
}
else //complex case
}
addColumnString(ostr, iLastVal + 1, i);
- ostr << ostemp.str() << endl;
+ ostr << ostemp.str() << std::endl;
ostemp.str(L"");
iLastVal = i;
}
{
addColumnString(ostr, iLastVal + 1, getCols());
}
- ostemp << endl;
+ ostemp << std::endl;
ostr << ostemp.str();
}
}
else // matrix
{
- wostringstream ostemp;
+ std::wostringstream ostemp;
int iLen = 0;
int iLastCol = m_iCols1PrintState;
df.iWidth = piSize[iCols2];
addDoubleValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), &df);
}
- ostemp << endl;
+ ostemp << std::endl;
}
iLen = 0;
df.iWidth = piSize[iCols2];
addDoubleValue(&ostemp, ZeroIsZero(m_pRealData[iPos]), &df);
}
- ostemp << endl;
+ ostemp << std::endl;
}
if (m_iRows2PrintState == 0 && iLastCol != 0)