eye double +/-, or
antoine ELIAS [Thu, 27 Aug 2009 15:48:00 +0000 (17:48 +0200)]
56 files changed:
scilab/Scilab.sln
scilab/etc/yasp_modules.xml
scilab/modules/abstractSyntaxTree/includes/execvisitor.hxx
scilab/modules/abstractSyntaxTree/src/cpp/exec/exec_MatrixExp.cpp
scilab/modules/api_scilab/includes/api_poly.h
scilab/modules/api_scilab/includes/api_string.h
scilab/modules/api_scilab/src/cpp/api_boolean.cpp
scilab/modules/api_scilab/src/cpp/api_common.cpp
scilab/modules/api_scilab/src/cpp/api_internal_poly.h
scilab/modules/api_scilab/src/cpp/api_poly.cpp
scilab/modules/api_scilab/src/cpp/api_string.cpp
scilab/modules/boolean/includes/boolean_gw.hxx [new file with mode: 0644]
scilab/modules/boolean/includes/dynlib_boolean_gw.h [new file with mode: 0644]
scilab/modules/boolean/includes/gw_boolean.h
scilab/modules/boolean/sci_gateway/c/gw_boolean.c
scilab/modules/boolean/sci_gateway/c/sci_or.c
scilab/modules/boolean/src/cpp/boolean_gw.cpp [new file with mode: 0644]
scilab/modules/boolean/src/cpp/boolean_gw.vcproj [new file with mode: 0644]
scilab/modules/core/sci_gateway/c/sci_typename.c
scilab/modules/elementary_functions/sci_gateway/c/sci_abs.c
scilab/modules/elementary_functions/sci_gateway/c/sci_atan.c
scilab/modules/elementary_functions/sci_gateway/c/sci_ceil.c
scilab/modules/elementary_functions/sci_gateway/c/sci_conj.c
scilab/modules/elementary_functions/sci_gateway/c/sci_eye.c
scilab/modules/elementary_functions/sci_gateway/c/sci_floor.c
scilab/modules/elementary_functions/sci_gateway/c/sci_gsort.c
scilab/modules/elementary_functions/sci_gateway/c/sci_imag.c
scilab/modules/elementary_functions/sci_gateway/c/sci_int.c
scilab/modules/elementary_functions/sci_gateway/c/sci_matrix.c
scilab/modules/elementary_functions/sci_gateway/c/sci_real.c
scilab/modules/elementary_functions/sci_gateway/c/sci_round.c
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/io/sci_gateway/c/sci_getenv.c
scilab/modules/operations/includes/matrix_addition.h
scilab/modules/operations/includes/matrix_substraction.h
scilab/modules/operations/src/c/matrix_addition.c
scilab/modules/operations/src/c/matrix_substraction.c
scilab/modules/operations/src/cpp/types_addition.cpp
scilab/modules/operations/src/cpp/types_substraction.cpp
scilab/modules/types/includes/bool.hxx
scilab/modules/types/includes/double.hxx
scilab/modules/types/includes/float.hxx
scilab/modules/types/includes/function.hxx
scilab/modules/types/includes/implicitlist.hxx
scilab/modules/types/includes/int.hxx
scilab/modules/types/includes/internal.hxx
scilab/modules/types/includes/macro.hxx
scilab/modules/types/includes/matrixpoly.hxx
scilab/modules/types/includes/poly.hxx
scilab/modules/types/includes/string.hxx
scilab/modules/types/includes/types.hxx
scilab/modules/types/includes/uint.hxx
scilab/modules/types/src/cpp/double.cpp
scilab/modules/types/src/cpp/string.cpp
scilab/modules/types/src/cpp/types.cpp

index edf4d24..ae19be3 100644 (file)
@@ -1088,6 +1088,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "elem_func_gw", "modules\ele
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "functions_manager", "modules\functions_manager\functions_manager.vcproj", "{8EAC9381-C059-43EA-B5D7-FD5D6997B0BD}"
        ProjectSection(ProjectDependencies) = postProject
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6} = {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}
                {9881F0CE-A1AC-4744-B709-7C1453A77B95} = {9881F0CE-A1AC-4744-B709-7C1453A77B95}
                {7CA60AEF-9AFA-4D06-AF28-613C0AA27640} = {7CA60AEF-9AFA-4D06-AF28-613C0AA27640}
        EndProjectSection
@@ -1132,6 +1133,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_yasp", "modules\core\c
                {7CA60AEF-9AFA-4D06-AF28-613C0AA27640} = {7CA60AEF-9AFA-4D06-AF28-613C0AA27640}
        EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boolean_gw", "modules\boolean\src\cpp\boolean_gw.vcproj", "{09E6CF32-EF2F-4C63-A2B8-B04964768BD6}"
+       ProjectSection(ProjectDependencies) = postProject
+               {2C60033B-0DBD-4CA4-80D3-176C9BE9CE2F} = {2C60033B-0DBD-4CA4-80D3-176C9BE9CE2F}
+               {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0} = {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0}
+               {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF} = {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}
+               {8AB8ECEC-8C22-475E-80D0-E14696F5A19B} = {8AB8ECEC-8C22-475E-80D0-E14696F5A19B}
+       EndProjectSection
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -2292,6 +2301,14 @@ Global
                {14373D41-991A-412E-8EA7-A832D98047B8}.Release|Win32.Build.0 = Release|Win32
                {14373D41-991A-412E-8EA7-A832D98047B8}.Release|x64.ActiveCfg = Release|x64
                {14373D41-991A-412E-8EA7-A832D98047B8}.Release|x64.Build.0 = Release|x64
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Debug|Win32.ActiveCfg = Debug|Win32
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Debug|Win32.Build.0 = Debug|Win32
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Debug|x64.ActiveCfg = Debug|x64
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Debug|x64.Build.0 = Debug|x64
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Release|Win32.ActiveCfg = Release|Win32
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Release|Win32.Build.0 = Release|Win32
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Release|x64.ActiveCfg = Release|x64
+               {09E6CF32-EF2F-4C63-A2B8-B04964768BD6}.Release|x64.Build.0 = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 281b728..9ffd74f 100644 (file)
@@ -12,7 +12,8 @@
  -->
 <!-- =================== -->
 <modules>
-<module name="core" activate="yes"/>
-<module name="double" activate="no"/>
-<module name="elementary_functions" activate="yes"/>
+    <module name="core" activate="yes"/>
+    <module name="double" activate="no"/>
+    <module name="elementary_functions" activate="yes"/>
+    <module name="boolean" activate="yes"/>
 </modules>
index 55e402f..b0837e8 100644 (file)
@@ -55,50 +55,7 @@ namespace ast
                        {
                                if(_result[i] != NULL && _result[i]->isDeletable() == true)
                                {
-                                       if(_result[i]->getType() == InternalType::RealBool)
-                                       {
-                                               delete _result[i]->getAsBool();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealDouble)
-                                       {
-                                               delete _result[i]->getAsDouble();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealFloat)
-                                       {
-                                               delete _result[i]->getAsFloat();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealFunction)
-                                       {
-                                               delete _result[i]->getAsFunction();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealImplicitList)
-                                       {
-                                               delete _result[i]->getAsImplicitList();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealInt)
-                                       {
-                                               delete _result[i]->getAsInt();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealMacro)
-                                       {
-                                               delete _result[i]->getAsMacro();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealPoly)
-                                       {
-                                               delete _result[i]->getAsPoly();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealString)
-                                       {
-                                               delete _result[i]->getAsString();
-                                       }
-                                       else if(_result[i]->getType() == InternalType::RealUInt)
-                                       {
-                                               delete _result[i]->getAsUInt();
-                                       }
-                                       else
-                                       {
-                                               delete _result[i];
-                                       }
+                                       delete _result[i];
                                }
                        }
                }
index f2a0539..bb5d7b3 100644 (file)
@@ -57,7 +57,6 @@ namespace ast
                                                        {
                                                                Double *pTemp = new Double(1, execMe->result_get()->getAsImplicitList()->size_get(), false);
                                                                execMe->result_get()->getAsImplicitList()->extract_matrix(pTemp->real_get());
-                                                               delete execMe->result_get();
                                                                execMe->result_set(pTemp);
                                                                iCurCol += ((GenericType*)execMe->result_get())->cols_get();
                                                        }
@@ -395,6 +394,8 @@ InternalType* AddElementToVariable(InternalType* _poDest, InternalType* _poSourc
                        break;
                case GenericType::RealString :
                        poResult->getAsString()->string_set(iCurRow, iCurCol, _poSource->getAsString()->string_get(0,0));
+                       *_piRows = _poSource->getAsString()->rows_get();
+                       *_piCols = _poSource->getAsString()->cols_get();
                        break;
                case GenericType::RealImplicitList :
                        {
index de12511..74a834a 100644 (file)
@@ -64,7 +64,7 @@ API_SCILAB_IMPEXP int getComplexMatrixOfPoly(int* _piAddress, int* _piRows, int*
  * @param[in] _pdblReal pointer on data
  * @return if the operation successed (0) or not ( !0 )
  */
-API_SCILAB_IMPEXP int createMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal);
+API_SCILAB_IMPEXP int createMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, int* _piKey);
 
 /**
  * Get complex polynomial named variable data
@@ -77,7 +77,7 @@ API_SCILAB_IMPEXP int createMatrixOfPoly(int _iVar, char* _pstVarName, int _iRow
  * @param[in] _pdblImg pointer on imaginary data
  * @return if the operation successed (0) or not ( !0 )
  */
-API_SCILAB_IMPEXP int createComplexMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
+API_SCILAB_IMPEXP int createComplexMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piKey);
 
 /**
  * Create polynomial named variable
index 8484104..5e9220e 100644 (file)
@@ -55,7 +55,7 @@ API_SCILAB_IMPEXP int getMatrixOfWideString(int* _piAddress, int* _piRows, int*
  * @param[out] _piAddress return pointer on new variable
  * @return if the operation successed (0) or not ( !0 )
  */
-API_SCILAB_IMPEXP int createMatrixOfString(int _iVar, int _iRows, int _iCols, char** _pstStrings);
+API_SCILAB_IMPEXP int createMatrixOfString(int _iVar, int _iRows, int _iCols, char** _pstStrings, int* _piKey);
 
 /**
 * Create wide strings variable data
@@ -66,7 +66,7 @@ API_SCILAB_IMPEXP int createMatrixOfString(int _iVar, int _iRows, int _iCols, ch
 * @param[out] _piAddress return pointer on new variable
 * @return if the operation successed (0) or not ( !0 )
 */
-API_SCILAB_IMPEXP int createMatrixOfWideString(int _iVar, int _iRows, int _iCols, wchar_t** _pwstStrings);
+API_SCILAB_IMPEXP int createMatrixOfWideString(int _iVar, int _iRows, int _iCols, wchar_t** _pwstStrings, int* _piKey);
 
 /**
  * Create strings variable data
index 234e14b..0701c82 100644 (file)
@@ -38,9 +38,18 @@ int getMatrixOfBoolean(int* _piAddress, int* _piRows, int* _piCols, int** _piBoo
        
        getVarDimension(_piAddress, _piRows, _piCols);
 
-       if(_piBool)
+       Bool* pb = ((InternalType*)_piAddress)->getAsBool();
+       if(_piBool != NULL)
        {
-               *_piBool = _piAddress + 3;
+               int* piBool = new int[*_piRows * *_piCols];
+               for(int i = 0 ; i < *_piRows ; i++)
+               {
+                       for(int j = 0 ; j < *_piCols ; j++)
+                       {
+                               piBool[i + j * *_piRows] = pb->bool_get(i,j) == true ? 1 : 0;
+                       }
+               }
+                       *_piBool = piBool;
        }
        return 0;
 }
index 0cc0a4b..f818f32 100644 (file)
@@ -335,7 +335,7 @@ int getProcessMode(int* _piAddCheck, int* _piAddRef, int *_piMode)
                        return 1;
                }
 
-               pstMode[1] = (char*)malloc(sizeof(char) * (iLen + 1)); //+1 for null termination
+               pstMode[0] = (char*)malloc(sizeof(char) * (iLen + 1)); //+1 for null termination
                iRet = getMatrixOfString(_piAddCheck, &iRows2, &iCols2, &iLen, pstMode);
                if(iRet)
                {
index 44bd563..f5e66b9 100644 (file)
@@ -14,7 +14,7 @@
 
 //internal poly functions
 int getCommonMatrixOfPoly(int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
-int createCommonMatrixOfPoly(int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
+int createCommonMatrixOfPoly(int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piKey);
 int fillCommonMatrixOfPoly(int* _piAddress, char* _pstVarName, int _iComplex, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piTotalLen);
 int createCommonNamedMatrixOfPoly(char* _pstName, char* _pstVarName, int _iComplex, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
 int readCommonNamedMatrixOfPoly(char* _pstName, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg);
index 5284f05..ad5177a 100644 (file)
@@ -17,7 +17,6 @@
 #include "api_internal_common.h"
 #include "api_internal_poly.h"
 #include "api_poly.h"
-#include "alltypes.hxx"
 
 #include "MALLOC.h"
 #include "CallScilab.h"
@@ -26,11 +25,12 @@ extern "C" {
 #include "code2str.h"
 };
 
+#include "alltypes.hxx"
+
 using namespace types;
 
 int getPolyVariableName(int* _piAddress, char* _pstVarName, int* _piVarNameLen)
 {
-//const SimpleVar *pVar                                = dynamic_cast<const SimpleVar*>(&e.left_exp_get());
        MatrixPoly* pPoly = dynamic_cast<MatrixPoly*>((InternalType*)_piAddress);
        if(pPoly == NULL)
        {
@@ -59,34 +59,26 @@ int getComplexMatrixOfPoly(int* _piAddress, int* _piRows, int* _piCols, int* _pi
 
 int getCommonMatrixOfPoly(int* _piAddress, int _iComplex, int* _piRows, int* _piCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
 {
-       MatrixPoly* pPoly = (MatrixPoly*)_piAddress;
-
-
-/*     int i                                                   = 0;
-       int iSize                                       = 0;
-       int *piOffset                   = NULL;
-       double *pdblReal        = NULL;
-       double *pdblImg         = NULL;
-
-       if(     _piAddress == NULL || 
-                       getVarType(_piAddress) != sci_poly || 
-                       isVarComplex(_piAddress) != _iComplex)
+       bool bRet = true;
+       MatrixPoly* pPoly = dynamic_cast<MatrixPoly*>((InternalType*)_piAddress);
+       if(pPoly == NULL || pPoly->isComplex() != (_iComplex == 1? true : false))
        {
                return 1;
        }
 
-       getVarDimension(_piAddress, _piRows, _piCols);
-       iSize   = *_piRows * *_piCols;
+       *_piRows = pPoly->rows_get();
+       *_piCols = pPoly->cols_get();
 
        if(_piNbCoef == NULL)
        {
                return 0;
        }
 
-       piOffset = _piAddress + 8; //4 for header and 4 for variable name
-       for(i = 0 ; i < iSize ; i++)
+       //get polys rank
+       bRet = pPoly->rank_get(_piNbCoef);
+       if(!bRet)
        {
-               _piNbCoef[i]    = piOffset[i + 1] - piOffset[i];
+               return 1;
        }
 
        if(_pdblReal == NULL)
@@ -94,36 +86,80 @@ int getCommonMatrixOfPoly(int* _piAddress, int _iComplex, int* _piRows, int* _pi
                return 0;
        }
 
-       pdblReal = (double*)(piOffset + iSize + 1 + ((iSize + 1) % 2 == 0 ? 0 : 1 ));
-       for(i = 0 ; i < iSize ; i++)
+       if(pPoly->isComplex() && _pdblImg == NULL)
        {
-               memcpy(_pdblReal[i], pdblReal + piOffset[i] - 1, sizeof(double) * _piNbCoef[i]);
+               return 0;
        }
 
-       if(_iComplex == 1)
+       for(int i = 0 ; i < pPoly->size_get() ; i++)
        {
-               pdblImg = pdblReal + piOffset[iSize] - 1;
-               for(i = 0 ; i < iSize ; i++)
+               memcpy(_pdblReal[i], pPoly->poly_get(i)->coef_real_get(), _piNbCoef[i] * sizeof(double));
+       }
+
+       if(pPoly->isComplex() && _pdblImg != NULL)
+       {
+               for(int i = 0 ; i < pPoly->size_get() ; i++)
                {
-                       memcpy(_pdblImg[i], pdblImg + piOffset[i] - 1, sizeof(double) * _piNbCoef[i]);
+                       memcpy(_pdblImg[i], pPoly->poly_get(i)->coef_img_get(), _piNbCoef[i] * sizeof(double));
                }
        }
-*/
        return 0;
 }
 
-int createMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal)
+int createMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, int* _piKey)
 {
-       return createCommonMatrixOfPoly(_iVar, 0, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, NULL);
+       return createCommonMatrixOfPoly(_iVar, 0, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, NULL, _piKey);
 }
 
-int createComplexMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
+int createComplexMatrixOfPoly(int _iVar, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piKey)
 {
-       return createCommonMatrixOfPoly(_iVar, 1, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg);
+       return createCommonMatrixOfPoly(_iVar, 1, _pstVarName, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg, _piKey);
 }
 
-int createCommonMatrixOfPoly(int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
+int createCommonMatrixOfPoly(int _iVar, int _iComplex, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piKey)
 {
+       bool bRet = true;
+       GatewayStruct *pStr =  (GatewayStruct*)_piKey;
+
+       int iNewPos                     = _iVar - (int)pStr->m_pin->size() - 1;
+
+       MatrixPoly *pPoly = NULL;
+
+       if(iNewPos < 0 /*|| iNewPos > *pStr->m_piRetCount*/)
+       {
+               return 1;
+       }
+
+       pPoly = new MatrixPoly(_pstVarName, _iRows, _iCols, _piNbCoef);
+       pPoly->complex_set(_iComplex ? true : false);
+
+       for(int i = 0 ; i < pPoly->size_get() ; i++)
+       {
+               Poly *pP = pPoly->poly_get(i);
+               if(_iComplex)
+               {
+                       bRet = pP->coef_set(_pdblReal[i], _pdblImg[i]);
+               }
+               else
+               {
+                       bRet = pP->coef_set(_pdblReal[i], NULL);
+               }
+       
+               if(bRet == false)
+               {
+                       return 1;
+               }
+       }
+
+       for(int i = (int)pStr->m_pout->size() ; i <= iNewPos ; i++)
+       {
+               pStr->m_pout->push_back(NULL);
+       }
+
+       (*pStr->m_pout)[iNewPos] = pPoly;
+
+       return 0;
+       /*
        int *piAddr                             = NULL;
        int iSize                                       = _iRows * _iCols;
        int iNewPos                             = Top - Rhs + _iVar;
@@ -142,6 +178,7 @@ int createCommonMatrixOfPoly(int _iVar, int _iComplex, char* _pstVarName, int _i
        updateLstk(iNewPos, iAddr + 4 + 4 + iSize + 1, iTotalLen);
 
        return 0;
+*/
 }
 
 int fillCommonMatrixOfPoly(int* _piAddress, char* _pstVarName, int _iComplex, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg, int* _piTotalLen)
index 436f3ec..5c69ca0 100644 (file)
@@ -30,6 +30,10 @@ extern "C"
 #include "code2str.h"
 #include "freeArrayOfString.h"
 };
+
+#include "alltypes.hxx"
+
+using namespace types;
 /*--------------------------------------------------------------------------*/
 
 /*******************************/
@@ -38,28 +42,23 @@ extern "C"
 
 int getMatrixOfString(int* _piAddress, int* _piRows, int* _piCols, int* _piLength, char** _pstStrings)
 {
-       int i = 0;
-       int *piOffset = NULL;
-       int *piData             = NULL;
-
-       if(     _piAddress == NULL || getVarType(_piAddress) != sci_strings)
+       String *pS = dynamic_cast<String*>((InternalType*)_piAddress);
+       if(pS == NULL)
        {
                return 1;
        }
 
-       getVarDimension(_piAddress, _piRows, _piCols);
+       *_piRows = pS->rows_get();
+       *_piCols = pS->cols_get();
 
        if(_piLength == NULL)
        {
                return 0;
        }
 
-       piOffset = _piAddress + 4;
-
-       //non cummulative length
-       for(i = 0 ; i < *_piRows * *_piCols ; i++)
+       for(int i = 0 ; i < pS->size_get() ; i++)
        {
-               _piLength[i] = piOffset[i + 1] - piOffset[i];
+               _piLength[i] = (int)strlen(pS->string_get(i));
        }
 
        if(_pstStrings == NULL)
@@ -67,36 +66,42 @@ int getMatrixOfString(int* _piAddress, int* _piRows, int* _piCols, int* _piLengt
                return 0;
        }
 
-       piData = piOffset + *_piRows * *_piCols + 1;
-
-       for(i = 0 ; i < *_piRows * *_piCols ; i++)
+       for(int i = 0 ; i < pS->size_get() ; i++)
        {
-               if(_pstStrings[i] == NULL)
-               {
-                       return 1;
-               }
-               code2str(&_pstStrings[i], piData + iArraySum(_piLength, 0, i), _piLength[i]);
-               _pstStrings[i][_piLength[i]] = 0;
+               strcpy(_pstStrings[i], pS->string_get(i));
        }
+
        return 0;
 }
 /*--------------------------------------------------------------------------*/
-int createMatrixOfString(int _iVar, int _iRows, int _iCols, char** _pstStrings)
+int createMatrixOfString(int _iVar, int _iRows, int _iCols, char** _pstStrings, int* _piKey)
 {
-       int iNewPos                     = Top - Rhs + _iVar;
-       int iAddr                               = *Lstk(iNewPos);
-       int iTotalLen           = 0;
-       int *piAddr                     = NULL;
+       bool bRet = true;
+       GatewayStruct *pStr =  (GatewayStruct*)_piKey;
 
-       int iRet = getNewVarAddressFromPosition(iNewPos, &piAddr);
-       if(iRet != 0)
+       int iNewPos                     = _iVar - (int)pStr->m_pin->size() - 1;
+
+       String *pS = NULL;
+
+       if(iNewPos < 0 /*|| iNewPos > *pStr->m_piRetCount*/)
        {
                return 1;
        }
 
-       fillMatrixOfString(piAddr, _iRows, _iCols, _pstStrings, &iTotalLen);
-       updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 5 + _iRows * _iCols));
-       updateLstk(iNewPos, sadr(iadr(iAddr) + 5 + _iRows * _iCols + !((_iRows * _iCols) % 2)), (iTotalLen + 1) / (sizeof(double) / sizeof(int)));
+       pS = new String(_iRows, _iCols);
+       bRet = pS->string_set((const char**)_pstStrings);
+       if(bRet == false)
+       {
+               return 1;
+       }
+
+       for(int i = (int)pStr->m_pout->size() ; i <= iNewPos ; i++)
+       {
+               pStr->m_pout->push_back(NULL);
+       }
+
+       (*pStr->m_pout)[iNewPos] = pS;
+
        return 0;
 }
 /*--------------------------------------------------------------------------*/
@@ -264,7 +269,7 @@ int getMatrixOfWideString(int* _piAddress, int* _piRows, int* _piCols, int* _piw
        return ierr;
 }
 /*--------------------------------------------------------------------------*/
-int createMatrixOfWideString(int _iVar, int _iRows, int _iCols, wchar_t** _pstwStrings)
+int createMatrixOfWideString(int _iVar, int _iRows, int _iCols, wchar_t** _pstwStrings, int* _piKey)
 {
        char **pStrings = NULL;
        int i = 0;
@@ -281,7 +286,7 @@ int createMatrixOfWideString(int _iVar, int _iRows, int _iCols, wchar_t** _pstwS
                pStrings[i] = wide_string_to_UTF8(_pstwStrings[i]);
        }
 
-       ierr = createMatrixOfString(_iVar, _iRows, _iCols, pStrings);
+       ierr = createMatrixOfString(_iVar, _iRows, _iCols, pStrings, _piKey);
        freeArrayOfString(pStrings, _iRows * _iCols);
 
        return ierr;
diff --git a/scilab/modules/boolean/includes/boolean_gw.hxx b/scilab/modules/boolean/includes/boolean_gw.hxx
new file mode 100644 (file)
index 0000000..2c363c8
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
+*
+*  This file must be used under the terms of the CeCILL.
+*  This source file is licensed as described in the file COPYING, which
+*  you should have received as part of this distribution.  The terms
+*  are also available at
+*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+#ifndef __BOOLEAN_GW_HXX__
+#define __BOOLEAN_GW_HXX__
+
+#include "funcmanager.hxx"
+#include "context.hxx"
+
+#include "dynlib_boolean_gw.h"
+
+class BooleanModule
+{
+private :
+       BooleanModule(){};
+       ~BooleanModule(){};
+public :
+       BOOLEAN_GW_IMPEXP static bool Load();
+};
+
+#endif /* __BOOLEAN_GW_HXX__ */
diff --git a/scilab/modules/boolean/includes/dynlib_boolean_gw.h b/scilab/modules/boolean/includes/dynlib_boolean_gw.h
new file mode 100644 (file)
index 0000000..ff12fe8
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009 - Allan CORNET
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+/*--------------------------------------------------------------------------*/ 
+#ifndef __DYNLIB_BOOLEAN_GW_H__
+#define __DYNLIB_BOOLEAN_GW_H__
+
+#ifdef _MSC_VER
+       #ifdef BOOLEAN_GW_EXPORTS
+               #define BOOLEAN_GW_IMPEXP __declspec(dllexport)
+       #else
+               #define BOOLEAN_GW_IMPEXP __declspec(dllimport)
+       #endif
+#else
+       #define BOOLEAN_GW_IMPEXP
+#endif
+
+#endif /* __DYNLIB_BOOLEAN_GW_H__ */
+/*--------------------------------------------------------------------------*/ 
index b979466..e71a907 100644 (file)
 /*--------------------------------------------------------------------------*/
 int gw_boolean(void);
 /*--------------------------------------------------------------------------*/
-int C2F(intor)(char *fname,unsigned long fname_len);
 int C2F(intand)(char *fname,unsigned long fname_len);
 int C2F(sci_find)(char *fname,unsigned long fname_len);
 int C2F(sci_bool2s)(char *fname,unsigned long fname_len);
+
+//YaSp
+int sci_or(char *fname, int* _piKey);
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_BOOLEAN__ */
 /*--------------------------------------------------------------------------*/
index 043ba6f..0f7bb3a 100644 (file)
@@ -20,7 +20,7 @@ static gw_generic_table Tab[BOOLEAN_TAB_SIZE]=
 {
        {C2F(sci_find),"find"},
        {C2F(sci_bool2s),"bool2s"},
-       {C2F(intor),"or"},
+       {NULL, ""}, //or
        {C2F(intand),"and"}
 };
 /*--------------------------------------------------------------------------*/
index ad6da23..005b2de 100644 (file)
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) INRIA - Allan CORNET
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
 
 #include <string.h>
+#include <stdlib.h>
 #include "stack-c.h"
 #include "Scierror.h"
 #include "vect_or.h"
-/*--------------------------------------------------------------------------*/
-int C2F(intor)(char *fname,unsigned long l);
+#include "api_common.h"
+#include "api_boolean.h"
+#include "api_oldstack.h"
 /*--------------------------------------------------------------------------*/
 /* SCILAB function : or */
 /*--------------------------------------------------------------------------*/
-int C2F(intor)(char *fname,unsigned long l)
+int sci_or(char *fname, int* _piKey)
 {
- int m1,n1,l1,mm2,l2,lo,nopt=0,lw;
- int opt=0,errn=44;
- CheckRhs(1,2);
- CheckLhs(1,1);
- if (VarType(1)!=sci_boolean) {
-   lw = 1 + Top - Rhs;
-   C2F(overload)(&lw,"or",2L);
-   return 0;}
-
- if (Rhs==2) {
-   nopt=1;
-   if (VarType(2)==sci_strings) {
-     GetRhsVar(2,STRING_DATATYPE,&m1,&n1,&lo);
-     if (*cstk(lo)=='r')
-       opt=1;
-     else if (*cstk(lo)=='*')
-       opt=0;
-     else if (*cstk(lo)=='c')
-       opt=2;
-     else {
-       Err=2;
-          Error(errn);
-     }
-   }
-   else {
-     GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&lo);
-     opt=(int) *stk(lo);
-     if (opt>2||opt<1) {
-       Err=2;
-       Error(errn);
-     }
-   }
- }  /*(Rhs==2) */
-
- /*  checking variable a */
- GetRhsVar(1,MATRIX_OF_BOOLEAN_DATATYPE,&m1,&n1,&l1);
-
- if (Rhs==2 && m1*n1==0) {
-   LhsVar(1)= 1;
-   C2F(putlhsvar)();
-   return 0;
- }
-
- /* cross variable size checking */
- mm2=1;
- l2 = 0;
- if (opt==0) 
- {
-   CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&mm2,&mm2,&l2);
- }/* named: x */
- else if (opt==1) 
- {
-   CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&mm2,&n1,&l2);
- }/* named: x */
- else if (opt==2) 
- {
-   CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&m1,&mm2,&l2);
- }/* named: x */
- vect_or(istk(l1),m1,n1,istk(l2),opt);
- LhsVar(1)= 2+nopt;
- C2F(putlhsvar)();
- return 0;
+       int iRet                        = 0;
+       int iMode                       = 0;
+
+       int iRows                       = 0;
+       int iCols                       = 0;
+
+       int* piAddr1    = NULL;
+       int* piAddr2    = NULL;
+
+       int* piBool1            = NULL;
+       int* piBool3            = NULL;
+
+       CheckRhs(1,2);
+       CheckLhs(1,1);
+
+
+       iRet = getVarAddressFromPosition(1, &piAddr1, _piKey);
+       if(iRet)
+       {
+               return 1;
+       }
+
+       if(getVarType(piAddr1) != sci_boolean)
+       {
+               OverLoad(1);
+               return 0;
+       }
+
+       if(Rhs == 2)
+       {
+               iRet = getVarAddressFromPosition(2, &piAddr2, _piKey);
+               if(iRet)
+               {
+                       return 1;
+               }
+
+               iRet = getProcessMode(piAddr2, piAddr1, &iMode);
+               if(iRet)
+               {
+                       return 1;
+               }
+       }
+
+       iRet = getMatrixOfBoolean(piAddr1, &iRows, &iCols, &piBool1);
+       if(iRet)
+       {
+               return 1;
+       }
+
+       switch(iMode)
+       {
+       case BY_ALL : 
+               piBool3 = (int*)malloc(sizeof(int));
+               break;
+       case BY_ROWS : 
+               piBool3 = (int*)malloc(sizeof(int) * iCols);
+               break;
+       case BY_COLS : 
+               piBool3 = (int*)malloc(sizeof(int) * iRows);
+               break;
+       }
+
+       vect_or(piBool1, iRows, iCols, piBool3, iMode);
+
+       switch(iMode)
+       {
+       case BY_ALL : 
+               iRet = createMatrixOfBoolean(Rhs + 1, 1, 1, piBool3, _piKey);
+               break;
+       case BY_ROWS : 
+               iRet = createMatrixOfBoolean(Rhs + 1, 1, iCols, piBool3, _piKey);
+               break;
+       case BY_COLS : 
+               iRet = createMatrixOfBoolean(Rhs + 1, iRows, 1, piBool3, _piKey);
+               break;
+       }
+
+       if(iRet)
+       {
+               return 1;
+       }
+
+
+       LhsVar(1)= Rhs + 1;
+       PutLhsVar();
+       return 0;
+
+       /*
+       int m1,n1,l1,mm2,l2,lo,nopt=0,lw;
+       int opt=0,errn=44;
+       CheckRhs(1,2);
+       CheckLhs(1,1);
+       if (VarType(1)!=sci_boolean) {
+       lw = 1 + Top - Rhs;
+       C2F(overload)(&lw,"or",2L);
+       return 0;}
+
+       if (Rhs==2) {
+       nopt=1;
+       if (VarType(2)==sci_strings) {
+       GetRhsVar(2,STRING_DATATYPE,&m1,&n1,&lo);
+       if (*cstk(lo)=='r')
+       opt=1;
+       else if (*cstk(lo)=='*')
+       opt=0;
+       else if (*cstk(lo)=='c')
+       opt=2;
+       else {
+       Err=2;
+       Error(errn);
+       }
+
+       }
+       else {
+       GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&lo);
+       opt=(int) *stk(lo);
+       if (opt>2||opt<1) {
+       Err=2;
+       Error(errn);
+       }
+       }
+       }  //(Rhs==2)
+
+       // checking variable a
+       GetRhsVar(1,MATRIX_OF_BOOLEAN_DATATYPE,&m1,&n1,&l1);
+
+       if (Rhs==2 && m1*n1==0) {
+       LhsVar(1)= 1;
+       C2F(putlhsvar)();
+       return 0;
+       }
+
+       // cross variable size checking
+       mm2=1;
+       l2 = 0;
+       if (opt==0) 
+       {
+       CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&mm2,&mm2,&l2);
+       }// named: x
+       else if (opt==1) 
+       {
+       CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&mm2,&n1,&l2);
+       }// named: x
+       else if (opt==2) 
+       {
+       CreateVar(2+nopt,MATRIX_OF_BOOLEAN_DATATYPE,&m1,&mm2,&l2);
+       }// named: x
+       vect_or(istk(l1),m1,n1,istk(l2),opt);
+       LhsVar(1)= 2+nopt;
+       C2F(putlhsvar)();
+       return 0;
+       */
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/boolean/src/cpp/boolean_gw.cpp b/scilab/modules/boolean/src/cpp/boolean_gw.cpp
new file mode 100644 (file)
index 0000000..270df51
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
+*
+*  This file must be used under the terms of the CeCILL.
+*  This source file is licensed as described in the file COPYING, which
+*  you should have received as part of this distribution.  The terms
+*  are also available at
+*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+#include "boolean_gw.hxx"
+
+extern "C"
+{
+       #include "gw_boolean.h"
+}
+
+using namespace types;
+
+bool BooleanModule::Load()
+{
+       symbol::Context::getInstance()->AddFunction(Function::createFunction("or", &sci_or, "boolean"));
+       return true;
+}
+
diff --git a/scilab/modules/boolean/src/cpp/boolean_gw.vcproj b/scilab/modules/boolean/src/cpp/boolean_gw.vcproj
new file mode 100644 (file)
index 0000000..37d6ff2
--- /dev/null
@@ -0,0 +1,359 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="9,00"
+       Name="boolean_gw"
+       ProjectGUID="{09E6CF32-EF2F-4C63-A2B8-B04964768BD6}"
+       RootNamespace="boolean_gw"
+       Keyword="Win32Proj"
+       TargetFrameworkVersion="196613"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+               <Platform
+                       Name="x64"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="2"
+                       CharacterSet="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../elementary_functions/includes;../../../core/includes;../../../operations/includes;../../../api_scilab/includes"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BOOLEAN_GW_EXPORTS"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
+                               LinkIncremental="2"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="2"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../elementary_functions/includes;../../../core/includes;../../../operations/includes;../../../api_scilab/includes"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BOOLEAN_GW_EXPORTS"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
+                               LinkIncremental="1"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Debug|x64"
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+                       ConfigurationType="2"
+                       CharacterSet="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TargetEnvironment="3"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../elementary_functions/includes;../../../core/includes;../../../operations/includes;../../../api_scilab/includes"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BOOLEAN_GW_EXPORTS"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
+                               LinkIncremental="2"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               TargetMachine="17"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|x64"
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+                       ConfigurationType="2"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TargetEnvironment="3"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../elementary_functions/includes;../../../core/includes;../../../operations/includes;../../../api_scilab/includes"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BOOLEAN_GW_EXPORTS"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
+                               LinkIncremental="1"
+                               GenerateDebugInformation="true"
+                               SubSystem="2"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="17"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+                       >
+                       <File
+                               RelativePath=".\boolean_gw.cpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+                       >
+                       <File
+                               RelativePath="..\..\includes\boolean_gw.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\dynlib_boolean_gw.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index 6fa8038..862dc01 100644 (file)
@@ -152,7 +152,7 @@ int sci_typename_no_rhs(char *fname, int* _piKey)
                m_out2 = numberOfTypes;
                n_out2 = 1;
                
-               createMatrixOfString(Rhs + 2, m_out2, n_out2, TypesNames);
+               createMatrixOfString(Rhs + 2, m_out2, n_out2, TypesNames, _piKey);
                if (TypesNames) freeArrayOfString(TypesNames,numberOfTypes);
                LhsVar(2) = Rhs + 2; 
        }
index a933872..2eb3aa8 100644 (file)
@@ -160,7 +160,7 @@ int abs_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
        }
        else
        {
@@ -186,15 +186,21 @@ int abs_poly(int* _piAddress, int* _piKey)
                        pdblRealRet[i]  = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
+               iRet = getMatrixOfPoly(_piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               if(iRet)
+               {
+                       return 1;
+               }
+
                for(i = 0 ; i < iRows * iCols ; i++)
                {
-                       for(j = 0 ; i < piCoeff[i] ; j++)
+                       for(j = 0 ; j < piCoeff[i] ; j++)
                        {
                                pdblRealRet[i][j] = dabss(pdblReal[i][j]);
                        }
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
        }
 
        if(iRet)
index 98bafd8..9b9e8eb 100644 (file)
@@ -44,7 +44,7 @@ int sci_atan(char *fname, int* _piKey)
        iRet = getVarAddressFromPosition(1, &piAddr1, _piKey);
        if(getVarType(piAddr1) != sci_matrix)
        {
-//             OverLoad(1);
+               OverLoad(1);
                return 0;
        }
 
index d20905b..c7446f4 100644 (file)
@@ -173,7 +173,7 @@ int ceil_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet, _piKey);
                if(iRet)
                {
                        return 1;
@@ -238,7 +238,7 @@ int ceil_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
                if(iRet)
                {
                        return 1;
index 527b00e..fb47d45 100644 (file)
@@ -163,7 +163,7 @@ int conj_poly(int* _piAddress, int* _piKey)
                        C2F(dscal)(&piCoeff[i], &dblCoef, pdblImgRet[i], &iOne);
                }
 
-               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet, _piKey);
                if(iRet)
                {
                        return 1;
@@ -196,7 +196,7 @@ int conj_poly(int* _piAddress, int* _piKey)
                        return 1;
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal, _piKey);
                if(iRet)
                {
                        return 1;
index 2675a30..fd5451a 100644 (file)
@@ -28,8 +28,6 @@ int sci_eye(char *fname, int* _piKey)
 
        double *pdblRealRet             = NULL;
 
-       //Rhs = Max(Rhs,0);
-
        CheckRhs(0,2);
        CheckLhs(1,1);
 
@@ -73,6 +71,18 @@ int sci_eye(char *fname, int* _piKey)
        }
        else if(Rhs == 2)
        {
+               iRet = getVarAddressFromPosition(1, &piAddr1, _piKey);
+               if(iRet)
+               {
+                       return 1;
+               }
+
+               iRet = getVarAddressFromPosition(2, &piAddr2, _piKey);
+               if(iRet)
+               {
+                       return 1;
+               }
+
                getDimFromVar(piAddr1, &iRows);
                getDimFromVar(piAddr2, &iCols);
        }
index 4789120..6aeea8b 100644 (file)
@@ -177,7 +177,7 @@ int floor_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet, _piKey);
                if(iRet)
                {
                        return 1;
@@ -221,7 +221,7 @@ int floor_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
                if(iRet)
                {
                        return 1;
index d346b47..5781e82 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Jean-Baptiste SILVY
- * Copyright (C) 2007 - INRIA - Allan CORNET
- * Copyright (C) 2007 - INRIA - Cong WU
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2007 - INRIA - Jean-Baptiste SILVY
+* Copyright (C) 2007 - INRIA - Allan CORNET
+* Copyright (C) 2007 - INRIA - Cong WU
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
 
 /*------------------------------------------------------------------------*/
 #include <string.h>
@@ -26,9 +26,9 @@
 #include "isanan.h"
 
 /* Next define intruction put here instead of stack-c.h waiting for
- more genral usage stack-c.h macros CreateVarFromPtr and CreateVar
- contains a "return 0" which make impossible to free indices in case
- of error
+more genral usage stack-c.h macros CreateVarFromPtr and CreateVar
+contains a "return 0" which make impossible to free indices in case
+of error
 */
 #define CreateVarFromPtrNoCheck(n,ct,mx,nx,lx) C2F(createvarfromptr)((c_local=n,&c_local),ct,mx,nx,(void *)lx,1L)
 #define CreateVarNoCheck(n,ct,mx,nx,lx) C2F(createvar)((c_local=n,&c_local),ct,mx,nx,(void *)lx, 1L)
@@ -60,20 +60,17 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
        CheckRhs(1,3);
        CheckLhs(1,2);
 
-
-
-
        if (Rhs >= 1)
-    {
+       {
                Type=VarType(1);
                switch (Type)
                {
-                       case sci_strings :
-                               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&S);
+               case sci_strings :
+                       GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&S);
                        break;
-                       case sci_matrix :
+               case sci_matrix :
                        {
-                               #define COMPLEX 1
+#define COMPLEX 1
                                int *header = NULL;
                                int Cmplx = 0; 
                                header = (int *) GetData(1);   
@@ -102,15 +99,15 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                }
                        }
                        break;
-                       case sci_ints:
-                               GetRhsVar(1,MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE,&m1,&n1,&Im);
+               case sci_ints:
+                       GetRhsVar(1,MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE,&m1,&n1,&Im);
                        break;
-                       default :
-                               Scierror(999,_("%s: Wrong type for input argument #%d: Real, complex, int matrix or matrix of strings expected.\n"),fname,2);
-                               return 0;
+               default :
+                       Scierror(999,_("%s: Wrong type for input argument #%d: Real, complex, int matrix or matrix of strings expected.\n"),fname,2);
+                       return 0;
                        break;
                }
-    }
+       }
 
        if (Rhs == 3)
        {
@@ -143,7 +140,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
        }
 
        if ( typex[0] == LIST_SORT) 
-    {
+       {
                if (typex[1] == ROW_SORT) 
                {
                        ind_m1 = m1;
@@ -163,21 +160,21 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                        Scierror(999,_("%s: Wrong value for input argument #%d.\n"),fname,2);
                        return 0;
                }
-    }
+       }
        else 
-    {
+       {
                ind_m1 = m1;
                ind_n1 = n1;
                ind_l1 = 0;
                if ( ind_m1*ind_n1 != 0 )indices = (int*)MALLOC(sizeof(int)*(ind_m1*ind_n1));  /* return a matrix*/
-    }
+       }
 
        if (Lhs == 2) iflag = 1; 
        else iflag = 0;
 
        switch (Type)
-    {
-               case sci_matrix:
+       {
+       case sci_matrix:
                {
                        if ( m1*n1 != 0 ) 
                        {
@@ -212,7 +209,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                }
                break;
 
-               case sci_ints:               
+       case sci_ints:               
                {
                        int lr;
                        lr=Im.it;
@@ -225,7 +222,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
 
                        switch(Im.it) /* Type defined in stack-c.h */
                        {
-                               case I_CHAR :
+                       case I_CHAR :
                                {
                                        char *matrix = Im.D;
                                        char *tmp_matrix = (char*) istk(lr);
@@ -234,7 +231,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                }
                                break;
 
-                               case I_INT32 :
+                       case I_INT32 :
                                {
                                        int *matrix = Im.D;
                                        int *tmp_matrix = istk(lr);
@@ -242,7 +239,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                        C2F(gsortint)(tmp_matrix,indices,&iflag,&m1,&n1,typex,iord);
                                }
                                break;
-                               case I_UCHAR :
+                       case I_UCHAR :
                                {
                                        unsigned char *matrix = Im.D;
                                        unsigned char *tmp_matrix = (unsigned char*) istk(lr);
@@ -250,7 +247,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                        C2F(gsortuchar)(tmp_matrix,indices,&iflag,&m1,&n1,typex,iord);
                                }
                                break;
-                               case I_INT16 :
+                       case I_INT16 :
                                {
                                        short *matrix = Im.D;
                                        short *tmp_matrix = (short*) istk(lr);
@@ -258,7 +255,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                        C2F(gsortshort)(tmp_matrix,indices,&iflag,&m1,&n1,typex,iord);
                                }
                                break;
-                               case I_UINT16 :
+                       case I_UINT16 :
                                {
                                        unsigned short *matrix = Im.D;
                                        unsigned short *tmp_matrix = (short*) istk(lr);
@@ -266,7 +263,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                        C2F(gsortushort)(tmp_matrix,indices,&iflag,&m1,&n1,typex,iord);
                                }
                                break;
-                               case I_UINT32 :
+                       case I_UINT32 :
                                {
                                        unsigned int *matrix = Im.D;
                                        unsigned int *tmp_matrix = (unsigned int *)istk(lr);
@@ -274,9 +271,9 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                                        C2F(gsortuint)(tmp_matrix,indices,&iflag,&m1,&n1,typex,iord);
                                }
                                break;
-                               default:
-                                       if (indices) {FREE(indices); indices = NULL;}
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: Unknown type.\n"),fname,1);
+                       default:
+                               if (indices) {FREE(indices); indices = NULL;}
+                               Scierror(999,_("%s: Wrong type for input argument #%d: Unknown type.\n"),fname,1);
                                return 0;
                        }
 
@@ -296,7 +293,7 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                }
                break;
 
-               case sci_strings:
+       case sci_strings:
                {
                        C2F(gsorts)(S,indices,&iflag,&m1,&n1,typex,iord);
                        if (!CreateVarFromPtrNoCheck(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m1, &n1, S)) 
@@ -321,10 +318,10 @@ int C2F(sci_gsort)(char *fname, unsigned long fname_len)
                }
                break;
 
-               default:
-                       if (indices) {FREE(indices); indices = NULL;}
-                       Scierror(999,_("%s: Wrong type for input argument #%d.\n"),fname,1);
-                       return 0;
+       default:
+               if (indices) {FREE(indices); indices = NULL;}
+               Scierror(999,_("%s: Wrong type for input argument #%d.\n"),fname,1);
+               return 0;
                break;
        }
        return 0;
index 266bd54..550afc8 100644 (file)
@@ -171,7 +171,7 @@ int img_poly(int* _piAddress, int* _piKey)
                                }
                        }
                }
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblImg);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblImg, _piKey);
                if(iRet)
                {
                        return 1;
@@ -193,7 +193,7 @@ int img_poly(int* _piAddress, int* _piKey)
                        pdblRealRet[i] = (double*)malloc(sizeof(double) * 1);
                        pdblRealRet[i] = 0;
                }
-               createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
                if(iRet)
                {
                        return 1;
index f9f085f..961d741 100644 (file)
@@ -175,7 +175,7 @@ int int_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet, _piKey);
                if(iRet)
                {
                        return 1;
@@ -219,7 +219,7 @@ int int_poly(int* _piAddress, int* _piKey)
                        }
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
                if(iRet)
                {
                        return 1;
index 59c4d83..25356d4 100644 (file)
@@ -553,7 +553,7 @@ int matrix_poly(int* _piAddress, int _iRowsRet, int _iColsRet, int* _piKey)
                        return 1;
                }
 
-               iRet                    = createComplexMatrixOfPoly(Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal, pdblImg);
+               iRet                    = createComplexMatrixOfPoly(Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal, pdblImg, _piKey);
        }
        else
        {
@@ -582,7 +582,7 @@ int matrix_poly(int* _piAddress, int _iRowsRet, int _iColsRet, int* _piKey)
                        return 1;
                }
 
-               iRet                    = createMatrixOfPoly(Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal);
+               iRet                    = createMatrixOfPoly(Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal, _piKey);
        }
 
        if(iRet)
@@ -645,7 +645,7 @@ int matrix_string(int* _piAddress, int _iRowsRet, int _iColsRet, int* _piKey)
                return 1;
        }
 
-       iRet = createMatrixOfString(Rhs + 1, _iRowsRet, _iColsRet, pstData);
+       iRet = createMatrixOfString(Rhs + 1, _iRowsRet, _iColsRet, pstData, _piKey);
        if(iRet)
        {
                return 1;
index 27fe9f0..04a886d 100644 (file)
@@ -126,7 +126,7 @@ int real_poly(int* _piAddress, int* _piKey)
                                }
                        }
                }
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal, _piKey);
                if(iRet)
                {
                        return 1;
@@ -160,7 +160,7 @@ int real_poly(int* _piAddress, int* _piKey)
                        return 1;
                }
 
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal, _piKey);
                if(iRet)
                {
                        return 1;
index e10bd0e..a9f57b9 100644 (file)
@@ -178,7 +178,7 @@ int round_poly(int* _piAddress, int* _piKey)
                        }
                }
                
-               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               iRet = createComplexMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet, _piKey);
                if(iRet)
                {
                        return 1;
@@ -222,7 +222,7 @@ int round_poly(int* _piAddress, int* _piKey)
                        }
                }
                
-               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               iRet = createMatrixOfPoly(Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, _piKey);
                if(iRet)
                {
                        return 1;
index 7fc0063..fd6afe8 100644 (file)
@@ -266,6 +266,7 @@ bool FuncManager::CreateModuleList(void)
 {
        bool bRet = true;
        m_ModuleMap.insert(pair<string, GW_MOD>("elementary_functions", &ElemFuncModule::Load));
+       m_ModuleMap.insert(pair<string, GW_MOD>("boolean", &BooleanModule::Load));
        return bRet;
 }
 
index c08e50e..dbca6fb 100644 (file)
@@ -131,7 +131,7 @@ int C2F(sci_getenv)(char *fname, int* _piKey)
 
                if (ierr == 0)
                {
-                       createMatrixOfString(Rhs + 1, m_out, n_out, &env_value);
+                       createMatrixOfString(Rhs + 1, m_out, n_out, &env_value, _piKey);
                        LhsVar(1) = Rhs + 1;
                        C2F(putlhsvar)();       
                }
@@ -139,7 +139,7 @@ int C2F(sci_getenv)(char *fname, int* _piKey)
                {
                        if (default_env_value)
                        {
-                               createMatrixOfString(Rhs + 1, m_out, n_out, &default_env_value);
+                               createMatrixOfString(Rhs + 1, m_out, n_out, &default_env_value, _piKey);
                                LhsVar(1) = Rhs + 1;
                                C2F(putlhsvar)();       
                        }
index b52a011..3af9568 100644 (file)
@@ -22,6 +22,10 @@ EXTERN_OP int iAddComplexScalarToComplexMatrix(double _dblReal1, double _dblImg1
 EXTERN_OP int iAddRealMatrixToRealMatrix(double* _pdblReal1, double* _pdblReal2, int _iRows, int _iCols, double* _pdblRealOut);
 EXTERN_OP int iAddRealMatrixToComplexMatrix(double* _pdblReal1, double* _pdblReal2, double* _pdblImg2, int _iRows, int _iCols, double* _pdblRealOut, double* _pdblImgOut);
 EXTERN_OP int iAddComplexMatrixToComplexMatrix(double* _pdblReal1, double* _pdblImg1, double* _pdblReal2, double* _pdblImg2, int _iRows, int _iCols, double* _pdblRealOut, double* _pdblImgOut);
+EXTERN_OP int iAddRealIdentityToRealMatrix(double _dblReal1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut);
+EXTERN_OP int iAddRealIdentityToComplexMatrix(double _dblReal1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
+EXTERN_OP int iAddComplexIdentityToRealMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
+EXTERN_OP int iAddComplexIdentityToComplexMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
 
 
 
index 125a400..b19252c 100644 (file)
 
 #include "operation.hxx"
 
+EXTERN_OP int iSubstractRealIdentityToRealMatrix(double _dblReal1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut);
+EXTERN_OP int iSubstractRealIdentityToComplexMatrix(double _dblReal1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
+EXTERN_OP int iSubstractComplexIdentityToRealMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
+EXTERN_OP int iSubstractComplexIdentityToComplexMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut);
+
 EXTERN_OP int iSubstractRealMatrixToRealScalar(double* _pdblReal1, int _iRows, int _iCols, double _dblReal2, double* _pdblRealOut);
 EXTERN_OP int iSubstractComplexMatrixToRealScalar(double* _pdblReal1, double* _pdblImg1, int _iRows, int _iCols, double _dblReal2, double* _pdblRealOut, double* _pdblImgOut);
 EXTERN_OP int iSubstractRealMatrixToComplexScalar(double* _pdblReal1, int _iRows, int _iCols, double _dblReal2, double _dblImg2, double* _pdblRealOut, double* _pdblImgOut);
index 1302eea..3ae4964 100644 (file)
 #include <stdio.h>
 #include "matrix_addition.h"
 #include "core_math.h"
+#include <string.h>
+
+int iAddRealIdentityToRealMatrix(double _dblReal1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut, _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   += _dblReal1;
+       }
+       return 0;
+}
+
+int iAddRealIdentityToComplexMatrix(double _dblReal1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut,    _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memcpy(_pdblImgOut,             _pdblImg2       , sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   += _dblReal1;
+       }
+       return 0;
+}
+
+int iAddComplexIdentityToRealMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut,    _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memset(_pdblImgOut,             0x00, sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   += _dblReal1;
+               _pdblImgOut[i * _iRows2 + i]    += _dblImg1;
+       }
+       return 0;
+}
+
+int iAddComplexIdentityToComplexMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut,    _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memcpy(_pdblImgOut,             _pdblImg2       , sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   += _dblReal1;
+               _pdblImgOut[i * _iRows2 + i]    += _dblImg1;
+       }
+       return 0;
+}
 
 int iAddRealScalarToRealMatrix(double _dblReal1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut)
 {
index 48cc211..92bfa09 100644 (file)
 *
 */
 
+#include "core_math.h"
 #include "matrix_substraction.h"
+#include "string.h"
+
+//Matrix - eye
+int iSubstractRealIdentityToRealMatrix(double _dblReal1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut, _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   -= _dblReal1;
+       }
+       return 0;
+}
+
+int iSubstractRealIdentityToComplexMatrix(double _dblReal1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut, _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memcpy(_pdblImgOut,             _pdblImg2       , sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   -= _dblReal1;
+       }
+       return 0;
+}
+
+int iSubstractComplexIdentityToRealMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut, _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memset(_pdblImgOut,             0x00, sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   -= _dblReal1;
+               _pdblImgOut[i * _iRows2 + i]    -= _dblImg1;
+       }
+       return 0;
+}
+
+int iSubstractComplexIdentityToComplexMatrix(double _dblReal1, double _dblImg1, double* _pdblReal2, double* _pdblImg2, int _iRows2, int _iCols2, double* _pdblRealOut, double* _pdblImgOut)
+{
+       int i = 0;
+       memcpy(_pdblRealOut,    _pdblReal2, sizeof(double) * _iRows2 * _iCols2);
+       memcpy(_pdblImgOut,             _pdblImg2       , sizeof(double) * _iRows2 * _iCols2);
+       for(i = 0 ; i < Min(_iRows2, _iCols2) ; i++)
+       {
+               _pdblRealOut[i * _iRows2 + i]   -= _dblReal1;
+               _pdblImgOut[i * _iRows2 + i]    -= _dblImg1;
+       }
+       return 0;
+}
 
 //Scalar - Matrix
 int iSubstractRealMatrixToRealScalar(double* _pdblReal1, int _iRows, int _iCols, double _dblReal2, double* _pdblRealOut)
index fdd3d1f..766d3e9 100644 (file)
@@ -24,11 +24,113 @@ int AddDoubleToDouble(Double *_pDouble1, Double *_pDouble2, Double** _pDoubleOut
        bool bComplex2                  = _pDouble2->isComplex();
        bool bScalar1                           = _pDouble1->rows_get() == 1 && _pDouble1->cols_get() == 1;
        bool bScalar2                           = _pDouble2->rows_get() == 1 && _pDouble2->cols_get() == 1;
+       bool bIdentity1                 = _pDouble1->isIdentity();
+       bool bIdentity2                 = _pDouble2->isIdentity();
+       bool bEmpty1                            = _pDouble1->rows_get() == 0 && _pDouble1->cols_get() == 0;
+       bool bEmpty2                            = _pDouble2->rows_get() == 0 && _pDouble2->cols_get() == 0;
 
        double *pReal                   = NULL;
        double *pImg                    = NULL;
 
-       if(bScalar1)
+       if(bEmpty1)
+       {
+               if(bComplex2 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal);
+                       memcpy(pReal, _pDouble2->real_get(), sizeof(double) * _pDouble2->rows_get() * _pDouble2->cols_get());
+               }
+               else
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       memcpy(pReal, _pDouble2->real_get(), sizeof(double) * _pDouble2->rows_get() * _pDouble2->cols_get());
+                       memcpy(pImg, _pDouble2->img_get(), sizeof(double) * _pDouble2->rows_get() * _pDouble2->cols_get());
+               }
+       }
+       else if(bEmpty2)
+       {
+               if(bComplex1 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal);
+                       memcpy(pReal, _pDouble1->real_get(), sizeof(double) * _pDouble1->rows_get() * _pDouble1->cols_get());
+               }
+               else
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       memcpy(pReal, _pDouble1->real_get(), sizeof(double) * _pDouble1->rows_get() * _pDouble1->cols_get());
+                       memcpy(pImg, _pDouble1->img_get(), sizeof(double) * _pDouble1->rows_get() * _pDouble1->cols_get());
+               }
+       }
+       else if(bIdentity1)
+       {
+               if(bComplex1 == false && bComplex2 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal);
+                       iAddRealIdentityToRealMatrix(
+                                       _pDouble1->real_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get());
+               }
+               else if(bComplex1 == false && bComplex2 == true)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iAddRealIdentityToComplexMatrix(
+                                       _pDouble1->real_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->img_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iAddComplexIdentityToRealMatrix(
+                                       _pDouble1->real_get()[0], _pDouble1->img_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == true)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iAddComplexIdentityToComplexMatrix(
+                                       _pDouble1->real_get()[0], _pDouble1->img_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->img_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+       }
+       else if(bIdentity2)
+       {
+               if(bComplex1 == false && bComplex2 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal);
+                       iAddRealIdentityToRealMatrix(
+                                       _pDouble2->real_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get());
+               }
+               else if(bComplex1 == false && bComplex2 == true)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iAddComplexIdentityToRealMatrix(
+                                       _pDouble2->real_get()[0], _pDouble2->img_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == false)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iAddRealIdentityToComplexMatrix(
+                                       _pDouble2->real_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->img_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == true)
+               {
+                       (*_pDoubleOut)  = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iAddComplexIdentityToComplexMatrix(
+                                       _pDouble2->real_get()[0], _pDouble2->img_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->img_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+       }
+       else if(bScalar1)
        {//add pL with each element of pR
                if(bComplex1 == false && bComplex2 == false)
                {
index a23e419..c619f53 100644 (file)
@@ -24,11 +24,83 @@ int SubstractDoubleToDouble(Double* _pDouble1, Double* _pDouble2, Double** _pDou
        bool bComplex2          = _pDouble2->isComplex();
        bool bScalar1                   = _pDouble1->rows_get() == 1 && _pDouble1->cols_get() == 1;
        bool bScalar2                   = _pDouble2->rows_get() == 1 && _pDouble2->cols_get() == 1;
+       bool bIdentity1         = _pDouble1->isIdentity();
+       bool bIdentity2         = _pDouble2->isIdentity();
 
        double *pReal                   = NULL;
        double *pImg                    = NULL;
 
-       if(bScalar1)
+       if(bIdentity1)
+       {
+               if(bComplex1 == false && bComplex2 == false)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal);
+                       iSubstractRealIdentityToRealMatrix(
+                                       _pDouble1->real_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get());
+               }
+               else if(bComplex1 == false && bComplex2 == true)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iSubstractRealIdentityToComplexMatrix(
+                                       _pDouble1->real_get()[0], 
+                                       _pDouble2->real_get(), _pDouble2->img_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == false)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iSubstractComplexIdentityToRealMatrix(
+                                       _pDouble1->real_get()[0], _pDouble1->img_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == true)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble2->rows_get(), _pDouble2->cols_get(), &pReal, &pImg);
+                       iSubstractComplexIdentityToComplexMatrix(
+                                       _pDouble1->real_get()[0], _pDouble1->img_get()[0],
+                                       _pDouble2->real_get(), _pDouble2->img_get(), _pDouble2->rows_get(), _pDouble2->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+       }
+       else if(bIdentity2)
+       {
+               if(bComplex1 == false && bComplex2 == false)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal);
+                       iSubstractRealIdentityToRealMatrix(
+                                       _pDouble2->real_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get());
+               }
+               else if(bComplex1 == false && bComplex2 == true)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iSubstractComplexIdentityToRealMatrix(
+                                       _pDouble2->real_get()[0], _pDouble2->img_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == false)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iSubstractRealIdentityToComplexMatrix(
+                                       _pDouble2->real_get()[0], 
+                                       _pDouble1->real_get(), _pDouble1->img_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+               else if(bComplex1 == true && bComplex2 == true)
+               {
+                       (*_pDoubleOut) = new Double(_pDouble1->rows_get(), _pDouble1->cols_get(), &pReal, &pImg);
+                       iSubstractComplexIdentityToComplexMatrix(
+                                       _pDouble2->real_get()[0], _pDouble2->img_get()[0],
+                                       _pDouble1->real_get(), _pDouble1->img_get(), _pDouble1->rows_get(), _pDouble1->cols_get(),
+                                       (*_pDoubleOut)->real_get(), (*_pDoubleOut)->img_get());
+               }
+       }
+       else if(bScalar1)
        {//add pL with each element of pR
                if(bComplex1 == false && bComplex2 == false)
                {
index f173e06..3d51bdb 100644 (file)
@@ -26,7 +26,7 @@ namespace types
     Bool(int _iRows, int _iCols);
     Bool(int _iRows, int _iCols, bool **_pbData);
                void CreateBool(int _iRows, int _iCols, bool **_pbData);
-               ~Bool();
+               virtual ~Bool();
 
                /*data management*/
                bool*                                   bool_get() const;
index 411df1b..2503e6e 100644 (file)
@@ -22,7 +22,7 @@ namespace types
        class EXTERN_TYPES Double : public GenericType
        {
   public :
-               ~Double();
+               virtual ~Double();
 
                Double(double _dblReal);
                Double(double _dblReal, double _dblImg);
index 0257e68..c1393b8 100644 (file)
@@ -21,7 +21,7 @@ namespace types
        class EXTERN_TYPES Float : public GenericType
        {
   public :
-               ~Float();
+               virtual ~Float();
                Float(float _fReal);
     Float(int _iRows, int _iCols, bool _bComplex = false);
     Float(int _iRows, int _iCols, float **_pfReal);
index c0cb769..76a4078 100644 (file)
@@ -43,7 +43,7 @@ namespace types
 
     Function() {};
     Function(std::string _szName, GW_FUNC _pFunc, std::string _szModule);
-    ~Function();
+    virtual ~Function();
     //private:
  
     static Function *createFunction(std::string _szName, GW_FUNC _pFunc, std::string _szModule);
index 4fadc22..6e308e3 100644 (file)
@@ -44,7 +44,7 @@ namespace types
 
        public :
                ImplicitList();
-               ~ImplicitList();
+               virtual ~ImplicitList();
                ImplicitList(double _dblStart, double _dblStep, double _dblEnd);
                ImplicitList(double _dblStart, double _dblEnd);
                ImplicitList(InternalType* _poStart, InternalType* _poStep, InternalType* _poEnd);
index 954015e..a271354 100644 (file)
@@ -25,7 +25,7 @@ namespace types
     Int(int _iRows, int _iCols, int **_puiReal);
     Int(int _iRows, int _iCols, int **_puiReal, int **_puiImg);
                void CreateInt(int _iRows, int _iCols, int **_puiReal, int **_puiImg);
-               ~Int();
+               virtual ~Int();
 
                /*data management*/
                int*                                    real_get() const;
index 9518b47..38a573a 100644 (file)
@@ -51,6 +51,7 @@ namespace types
                        RealPoly
     };
 
+               virtual ~InternalType(){};
     virtual void whoAmI(void) { std::cout << "types::Inernal"; }
 
                virtual bool isAssignable(void) { return false; }
index 184b456..b0e559f 100644 (file)
@@ -37,7 +37,7 @@ namespace types
 
                Macro(){};
                Macro(std::string _stName, std::list<symbol::Symbol> &_inputArgs, std::list<symbol::Symbol> &_outputArgs, ast::SeqExp &_body);
-               ~Macro(){};
+               virtual ~Macro(){};
   
   public :
     std::list<symbol::Symbol>  *m_inputArgs;
index e9af16c..b2df597 100644 (file)
 
 #include "types.hxx"
 
+#ifdef isComplex
+#undef isComplex
+#endif
+
 namespace types
 {
        class EXTERN_TYPES MatrixPoly : public GenericType
@@ -22,7 +26,7 @@ namespace types
   public :
                MatrixPoly();
                MatrixPoly(string _szVarName, int _iRows, int _iCols, int *_piRank);
-               ~MatrixPoly();
+               virtual ~MatrixPoly();
 
                Poly*                                   poly_get(int _iRows, int _iCols);
                Poly*                                   poly_get(int _iIdx);
index 4745f03..32e2821 100644 (file)
@@ -28,7 +28,7 @@ namespace types
                Poly(double** _pdblCoefR, int _iRank);
                Poly(double** _pdblCoefR, double** _pdblcoefI, int _iRank);
                Poly(Double** _poCoefR, int _iRank);
-               ~Poly();
+               virtual ~Poly();
 
 
                /*Config management*/
index 4c62e52..132dc07 100644 (file)
@@ -25,13 +25,15 @@ namespace types
   public :
                                                        String(int _iRows, int _iCols);
                                                        String(const char *_pcData);
-                                                       ~String();
+                                                       virtual ~String();
 
     char**             string_get() const;
     char*                      string_get(int _iRows, int _iCols) const;
+               char*                   string_get(int _iPos) const;
 
     bool                       string_set(const char **_pcData);
     bool                       string_set(int _iRows, int _iCols, const char *_pcData);
+               bool                    string_set(int _iPos, const char *_pcData);
 
     void                       whoAmI();
 
@@ -47,7 +49,6 @@ namespace types
                void                    all_delete();
                void                    string_delete(int _iRows, int _iCols);
                void                    string_delete(int _iPos);
-               bool                    string_set(int _iPos, const char *_pcData);
 
                void                    CreateString(int _iRows, int _iCols);
   };
index 1f38a69..ddf44bb 100644 (file)
@@ -37,7 +37,7 @@ namespace types
 
   protected :
     GenericType() {}
-
+               virtual ~GenericType() {}
   public :
     void whoAmI(void) { std::cout << "types::GenericType"; }
 
@@ -75,6 +75,7 @@ namespace types
                std::string DimToString();
 
 
+    bool isIdentity(void);
     virtual bool isAssignable(void) { return true; }
 
                virtual RealType getType(void) { return RealGeneric; }
index 151bd6f..5a66bd6 100644 (file)
@@ -20,7 +20,7 @@ namespace types
        class EXTERN_TYPES UInt : public GenericType
        {
   public :
-               ~UInt();
+               virtual ~UInt();
                UInt(unsigned int _iReal);
     UInt(int _iRows, int _iCols, bool _bComplex = false);
     UInt(int _iRows, int _iCols, int unsigned **_puiReal);
index 695ddbc..61f5f4e 100644 (file)
@@ -415,7 +415,30 @@ namespace types
                //if(isComplex() == false)
                {
                        /*Comment tenir compte de la longueur des lignes dans le formatage de variable ? */
-                       if(cols_get() == 0 || rows_get() == 0)
+                       if(isIdentity())
+                       {
+                               ostr << "eye *" << endl << endl;
+                               if(isComplex() == false)
+                               {
+                                       int iWidth = 0, iPrec = 0;
+                                       bool bFP = false; // FloatingPoint
+                                       GetFormat((m_pdblReal[0]), _iPrecision, &iWidth, &iPrec, &bFP);
+                                       Add_Value(&ostr, (m_pdblReal[0]), iWidth, iPrec);
+                                       ostr << endl;
+                               }
+                               else
+                               {//complex value
+                                       int iWidthR = 0, iWidthI = 0;
+                                       int iPrecR = 0, iPrecI = 0;
+                                       bool bFPR = false, bFPI = false; // FloatingPoint
+                                       GetFormat(ZeroIsZero(m_pdblReal[0]),    _iPrecision, &iWidthR, &iPrecR, &bFPR);
+                                       GetFormat(ZeroIsZero(m_pdblImg[0]),             _iPrecision, &iWidthI, &iPrecI, &bFPI);
+                                       Add_Complex_Value(&ostr, ZeroIsZero(m_pdblReal[0]), ZeroIsZero(m_pdblImg[0]), iWidthR + iWidthI, iWidthR, iWidthI, Max(iPrecR, iPrecI));
+                                       ostr << endl;
+                               }
+                               ostr << endl;
+                       }
+                       else if(cols_get() == 0 || rows_get() == 0)
                        {
                                ostr << "   []";
                                ostr << endl;
index ff3ae15..0571ac7 100644 (file)
@@ -68,9 +68,18 @@ namespace types
 
        char* String::string_get(int _iRows, int _iCols) const
        {
-               if(m_pcData != NULL)
+               if(_iRows >= m_iRows || _iCols >= m_iCols)
+               {
+                       return NULL;
+               }
+               return string_get(_iCols * m_iRows + _iRows);
+       }
+
+       char* String::string_get(int _iPos) const
+       {
+               if(m_pcData != NULL && _iPos < m_iSize)
                {
-                       return m_pcData[_iCols * m_iRows + _iRows];
+                       return m_pcData[_iPos];
                }
                else
                {
index acd53f3..1c70e95 100644 (file)
@@ -38,4 +38,13 @@ namespace types
                return ostr.str();
        }
 
+       bool GenericType::isIdentity(void)
+       {
+               if(m_iRows == -1 && m_iCols == -1)
+               {
+                       return true;
+               }
+               return false;
+       }
+
 }