Add string function. 60/2560/4
Bruno JOFRET [Mon, 22 Nov 2010 15:15:52 +0000 (16:15 +0100)]
Change-Id: I7a702a71b915f7a093529ec01ca404b960c1d574

12 files changed:
scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/includes/gw_string.h
scilab/modules/string/includes/string_gw.hxx
scilab/modules/string/sci_gateway/c/gw_string.c
scilab/modules/string/sci_gateway/c/sci_string.c [deleted file]
scilab/modules/string/sci_gateway/cpp/sci_string.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/string_gw.cpp
scilab/modules/string/sci_gateway/cpp/string_gw.vcproj
scilab/modules/string/src/c/string.vcproj
scilab/modules/string/tests/unit_tests/string.tst
scilab/modules/types/src/cpp/tostring_common.cpp

index 8ff7736..36f161e 100644 (file)
@@ -35,7 +35,6 @@ GATEWAY_C_SOURCES = sci_gateway/c/gw_string.c \
 sci_gateway/c/sci_code2str.c \
 sci_gateway/c/sci_convstr.c \
 sci_gateway/c/sci_str2code.c \
-sci_gateway/c/sci_string.c \
 sci_gateway/c/sci_strsplit.c \
 sci_gateway/c/sci_tokens.c \
 sci_gateway/c/sci_strcmp.c \
@@ -63,7 +62,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_strindex.cpp \
        sci_gateway/cpp/sci_strsubst.cpp \
        sci_gateway/cpp/sci_ascii.cpp \
-       sci_gateway/cpp/sci_strcat.cpp
+       sci_gateway/cpp/sci_strcat.cpp \
+       sci_gateway/cpp/sci_string.cpp
 
 GATEWAY_FORTRAN_SOURCES =  sci_gateway/fortran/sci_string.f \
 sci_gateway/fortran/strops.f
index 22e296f..b89a608 100644 (file)
@@ -134,7 +134,7 @@ am__objects_2 = libscistring_la-code2str.lo libscistring_la-convstr.lo \
 am__objects_3 =
 am__objects_4 = libscistring_la-gw_string.lo \
        libscistring_la-sci_code2str.lo libscistring_la-sci_convstr.lo \
-       libscistring_la-sci_str2code.lo libscistring_la-sci_string.lo \
+       libscistring_la-sci_str2code.lo \
        libscistring_la-sci_strsplit.lo libscistring_la-sci_tokens.lo \
        libscistring_la-sci_strcmp.lo libscistring_la-sci_isletter.lo \
        libscistring_la-sci_isdigit.lo \
@@ -150,7 +150,7 @@ am__objects_6 = libscistring_la-sci_stripblanks.lo \
        libscistring_la-sci_regexp.lo libscistring_la-sci_part.lo \
        libscistring_la-sci_length.lo libscistring_la-sci_strindex.lo \
        libscistring_la-sci_strsubst.lo libscistring_la-sci_ascii.lo \
-       libscistring_la-sci_strcat.lo
+       libscistring_la-sci_strcat.lo libscistring_la-sci_string.lo
 am_libscistring_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
        $(am__objects_3) $(am__objects_4) $(am__objects_5) \
        $(am__objects_6)
@@ -474,7 +474,6 @@ GATEWAY_C_SOURCES = sci_gateway/c/gw_string.c \
 sci_gateway/c/sci_code2str.c \
 sci_gateway/c/sci_convstr.c \
 sci_gateway/c/sci_str2code.c \
-sci_gateway/c/sci_string.c \
 sci_gateway/c/sci_strsplit.c \
 sci_gateway/c/sci_tokens.c \
 sci_gateway/c/sci_strcmp.c \
@@ -502,7 +501,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_strindex.cpp \
        sci_gateway/cpp/sci_strsubst.cpp \
        sci_gateway/cpp/sci_ascii.cpp \
-       sci_gateway/cpp/sci_strcat.cpp
+       sci_gateway/cpp/sci_strcat.cpp \
+       sci_gateway/cpp/sci_string.cpp
 
 GATEWAY_FORTRAN_SOURCES = sci_gateway/fortran/sci_string.f \
 sci_gateway/fortran/strops.f
@@ -962,13 +962,6 @@ libscistring_la-sci_str2code.lo: sci_gateway/c/sci_str2code.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-sci_str2code.lo `test -f 'sci_gateway/c/sci_str2code.c' || echo '$(srcdir)/'`sci_gateway/c/sci_str2code.c
 
-libscistring_la-sci_string.lo: sci_gateway/c/sci_string.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-sci_string.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_string.Tpo -c -o libscistring_la-sci_string.lo `test -f 'sci_gateway/c/sci_string.c' || echo '$(srcdir)/'`sci_gateway/c/sci_string.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_string.Tpo $(DEPDIR)/libscistring_la-sci_string.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_string.c' object='libscistring_la-sci_string.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-sci_string.lo `test -f 'sci_gateway/c/sci_string.c' || echo '$(srcdir)/'`sci_gateway/c/sci_string.c
-
 libscistring_la-sci_strsplit.lo: sci_gateway/c/sci_strsplit.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-sci_strsplit.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strsplit.Tpo -c -o libscistring_la-sci_strsplit.lo `test -f 'sci_gateway/c/sci_strsplit.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strsplit.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strsplit.Tpo $(DEPDIR)/libscistring_la-sci_strsplit.Plo
@@ -1179,6 +1172,13 @@ libscistring_la-sci_strcat.lo: sci_gateway/cpp/sci_strcat.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscistring_la-sci_strcat.lo `test -f 'sci_gateway/cpp/sci_strcat.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strcat.cpp
 
+libscistring_la-sci_string.lo: sci_gateway/cpp/sci_string.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscistring_la-sci_string.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_string.Tpo -c -o libscistring_la-sci_string.lo `test -f 'sci_gateway/cpp/sci_string.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_string.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_string.Tpo $(DEPDIR)/libscistring_la-sci_string.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_string.cpp' object='libscistring_la-sci_string.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscistring_la-sci_string.lo `test -f 'sci_gateway/cpp/sci_string.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_string.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
index 30f9a6f..3f1755b 100644 (file)
@@ -2,25 +2,25 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA -
- * 
+ *
  * 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    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 #ifndef __GW_STRING__
 #define __GW_STRING__
 #include "api_scilab.h"
 #include "dynlib_string.h"
 
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 STRING_IMPEXP int gw_string(void);
-/*--------------------------------------------------------------------------*/ 
-//STRING_IMPEXP int sci_length(char *fname,unsigned long fname_len);
-STRING_IMPEXP int sci_string(char *fname,unsigned long fname_len);
+/*--------------------------------------------------------------------------*/
+//STRING_IMPEXP int sci_length(char *fname,unsigned long fname_len); -> C++
+//STRING_IMPEXP int sci_string(char *fname,unsigned long fname_len); -> C++
 STRING_IMPEXP int sci_convstr(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_str2code(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_code2str(char *fname,unsigned long fname_len);
@@ -43,6 +43,6 @@ STRING_IMPEXP int sci_strsplit(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isdigit(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isalphanum(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isascii(char *fname, int* _piKey);
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 #endif /*  __GW_STRING__ */
 /*--------------------------------------------------------------------------*/
index 1de2691..860b947 100644 (file)
@@ -36,6 +36,7 @@ CPP_GATEWAY_PROTOTYPE(sci_strindex);
 CPP_GATEWAY_PROTOTYPE(sci_strsubst);
 CPP_GATEWAY_PROTOTYPE(sci_ascii);
 CPP_GATEWAY_PROTOTYPE(sci_strcat);
+CPP_GATEWAY_PROTOTYPE(sci_string);
 
 
 #endif /* !__STRING_GW_HXX__ */
index 14516bf..1dd35ca 100644 (file)
@@ -1,11 +1,11 @@
 /*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - Allan CORNET , 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    
+* are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 */
@@ -21,7 +21,7 @@ static gw_generic_table Tab[] =
 {
        {NULL, ""}, //length
        {NULL, ""}, //part
-       {sci_string,"string"},
+       {NULL,""}, //string
        {sci_convstr,"convstr"},
        {NULL, ""}, //emptystr
        {sci_str2code,"str2code"},
@@ -52,7 +52,7 @@ static gw_generic_table Tab[] =
 };
 /*--------------------------------------------------------------------------*/
 int gw_string(void)
-{  
+{
        callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
        return 0;
 }
diff --git a/scilab/modules/string/sci_gateway/c/sci_string.c b/scilab/modules/string/sci_gateway/c/sci_string.c
deleted file mode 100644 (file)
index 5e7d738..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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 "gw_string.h"
-#include "stack-c.h"
-#include "localization.h"
-#include "Scierror.h"
-/*--------------------------------------------------------------------------*/
-extern int C2F(intstring) (void); /* fortran routine */
-/*--------------------------------------------------------------------------*/
-int sci_string(char *fname,unsigned long fname_len)
-{
-       CheckRhs(1,1);
-       CheckLhs(1,3);
-
-       switch(VarType(1))
-       {
-               case sci_matrix:
-               {
-                       if (Lhs == 1)
-                       {
-                               int relativePosition = Top - Rhs + 1;
-                               int address = *Lstk(relativePosition);
-                               int intAddress = iadr(address);
-                               int m = getNumberOfLines(intAddress);
-                               int n = getNumberOfColumns(intAddress);
-
-                               /* case string(A) returns '' */
-                               /* with A has special dimensions (-1,-1) */
-                               /* bug 3747 */
-                               if ( (m == -1) && (n == -1) ) 
-                               {
-                                       int m1 = 0, n1 = 0, l1 = 0;
-                                       CreateVar(Rhs+1,STRING_DATATYPE,  &m1, &n1, &l1);
-                                       LhsVar(1)=Rhs+1;
-                                       C2F(putlhsvar)();
-                               }
-                               else C2F(intstring)();
-                       }
-                       else SciError(39);
-               }
-               break;
-
-               case sci_poly: 
-               case sci_boolean:
-               case sci_sparse: 
-               case sci_boolean_sparse:
-               case sci_matlab_sparse: 
-               case sci_ints:
-               case sci_handles: 
-               case sci_strings:
-               case sci_list: 
-               case sci_tlist:
-               case sci_mlist: 
-               case sci_lufact_pointer:
-               {
-                       if (Lhs == 1)
-                       {
-                               C2F(intstring)();
-                       }
-                       else
-                       {
-                               SciError(39);
-                       }
-               }
-               break;
-
-               case sci_u_function: 
-               case sci_c_function:
-               {
-                       /* macros */
-                       if (Lhs == 3)
-                       {
-                               C2F(intstring)();
-                       }
-                       else SciError(41);
-               }
-               break;
-               case sci_lib:
-               {
-                       if (Lhs == 1)
-                       {
-                               C2F(intstring)();
-                       }
-                       else SciError(39);
-               }
-               break;
-
-               default:
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d.\n"),fname,1);
-               }
-               break;
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_string.cpp b/scilab/modules/string/sci_gateway/cpp/sci_string.cpp
new file mode 100644 (file)
index 0000000..3a7e920
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
+*
+*  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_gw.hxx"
+extern "C"
+{
+#include "os_wcsdup.h"
+#include "Scierror.h"
+#include "localization.h"
+}
+
+using namespace types;
+
+static void DoubleComplexMatrix2String(wostringstream *_postr,  double _dblR, double _dblI)
+{
+    /*
+    if R && !C -> R
+    if R && C -> R + Ci
+    if !R && !C -> 0
+    if(!R aa C -> Ci
+    */
+
+    if(_dblR == 0)
+    {//no real part
+        if(_dblI == 0)
+        {//no imaginary part
+
+            //0
+            *_postr << (_dblI < 0 ? L"-" : L"");
+            *_postr << left << 0;
+        }
+        else
+        {//imaginary part
+
+            //I
+            *_postr << (_dblI < 0 ? L"-" : L"");
+            *_postr << L"%i";
+            if(fabs(_dblI) != 1)
+            {//specail case if I == 1 write only %i and not %i*1
+                *_postr << L"*";
+                PrintDoubleVar(_postr, _dblI);
+            }
+        }
+    }
+    else
+    {//real part
+        if(_dblI == 0)
+        {//no imaginary part
+
+            //R
+            *_postr << (_dblR < 0 ? L"-" : L"");
+            PrintDoubleVar(_postr, _dblR);
+        }
+        else
+        {//imaginary part
+
+            //R
+            *_postr << (_dblR < 0 ? L"-" : L"");
+            PrintDoubleVar(_postr, _dblR);
+            //I
+            *_postr << (_dblI < 0 ? L"-%i" : L"+%i");
+            if(fabs(_dblI) != 1)
+            {//special case if I == 1 write only %i and not %i*1
+                *_postr << L"*";
+                PrintDoubleVar(_postr, _dblI);
+            }
+        }
+    }
+}
+
+Function::ReturnValue sci_string(typed_list &in, int _iRetCount, typed_list &out)
+{
+    if(in.size() != 1)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"string", 1);
+        return Function::Error;
+    }
+
+    switch(in[0]->getType())
+    {
+    case GenericType::RealDouble :
+        {
+            int iRows = in[0]->getAsDouble()->rows_get();
+            int iCols = in[0]->getAsDouble()->cols_get();
+
+            // Special case string([]) == []
+            if(iRows == 0 && iCols == 0)
+            {
+                out.push_back(new types::Double(0,0));
+                return Function::OK;
+            }
+
+            String *pstOutput = new String(iRows, iCols);
+            for (int i = 0; i < iRows ; ++i)
+            {
+                for (int j = 0 ; j < iCols; ++j)
+                {
+                    std::wostringstream ostr;
+                    double dblReal = in[0]->getAsDouble()->real_get(i, j);
+                    double dblImg  = 0.0;
+                    if (in[0]->getAsDouble()->isComplex() == true)
+                    {
+                        dblImg  = in[0]->getAsDouble()->img_get(i, j);
+                    }
+                    DoubleComplexMatrix2String(&ostr, dblReal, dblImg);
+                    pstOutput->string_set(i, j, ostr.str().c_str());
+                }
+            }
+            out.push_back(pstOutput);
+            break;
+        }
+    case GenericType::RealString :
+        {
+            out.push_back(in[0]);
+            break;
+        }
+    default :
+        {
+            out.push_back(new types::String((in[0]->toString(0,0)).c_str()));
+            break;
+        }
+    }
+
+
+    return Function::OK;
+}
index 461345a..3c0371b 100644 (file)
@@ -30,5 +30,6 @@ bool StringModule::Load()
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"strsplit", &sci_strsplit, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"ascii", &sci_ascii, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"strcat", &sci_strcat, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(Function::createFunction(L"string", &sci_string, MODULE_NAME));
     return true;
 }
index 3a9e514..2804741 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_string.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_stripblanks.cpp"
                                >
                        </File>
index 40fe305..640a7ca 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
        ProjectType="Visual C++"
        Version="9,00"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_string.c"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\..\sci_gateway\c\sci_strncpy.c"
                                >
                        </File>
index 821e5ab..9094f94 100644 (file)
@@ -14,6 +14,21 @@ if string(1)<>'1' then pause,end
 //===============================
 if string(1.5)<>'1.5' then pause,end
 //===============================
+// Special display cases :
+if (string(0+%i) <> "%i") then pause, end
+if (string(0-%i) <> "-%i") then pause, end
+if (string(0+0*%i) <> "0") then pause, end
+if (string(-1+%i) <> "-1+%i") then pause, end
+if (string(-1-%i) <> "-1-%i") then pause, end
+if (string(1+%i) <> "1+%i") then pause, end
+if (string(1-%i) <> "1-%i") then pause, end
+if (string(0+2*%i) <> "%i*2") then pause, end
+if (string(0-2*%i) <> "-%i*2") then pause, end
+if (string(-2+2*%i) <> "-2+%i*2") then pause, end
+if (string(-2-2*%i) <> "-2-%i*2") then pause, end
+if (string(2+2*%i) <> "2+%i*2") then pause, end
+if (string(2-2*%i) <> "2-%i*2") then pause, end
+//===============================
 if string([])<>[] then pause,end
 //===============================
 if string('')<>'' then pause,end
index ef0a57d..cdcbbb5 100644 (file)
@@ -159,7 +159,6 @@ void AddDoubleComplexValue(wostringstream *_postr, double _dblR, double _dblI, i
        if(!R aa C      -> Ci
        */
 
-       int iSignLen = 0;
 //     *_postr << "|%" << _iTotalWitdh << "%|";
        if(_dblR == 0)
        {//no real part
@@ -170,7 +169,6 @@ void AddDoubleComplexValue(wostringstream *_postr, double _dblR, double _dblI, i
                        ostemp << (_dblI < 0 ? MINUS_STRING : NO_SIGN);
                        Config_Stream(&ostemp, _iWidthI, _iPrec, ' ');
                        ostemp << left << 0;
-                       iSignLen = SIGN_LENGTH;
                }
                else
                {//imaginary part
@@ -183,7 +181,6 @@ void AddDoubleComplexValue(wostringstream *_postr, double _dblR, double _dblI, i
                                PrintDoubleVar(&ostemp, _dblI);
                        }
                        ostemp << left << SYMBOL_I;
-                       iSignLen = SIGN_LENGTH;
                }
        }
        else
@@ -195,7 +192,6 @@ void AddDoubleComplexValue(wostringstream *_postr, double _dblR, double _dblI, i
                        ostemp << (_dblR < 0 ? MINUS_STRING : NO_SIGN);
                        Config_Stream(&ostemp, _iWidthR, _iPrec, ' ');
                        PrintDoubleVar(&ostemp, _dblR);
-                       iSignLen = SIGN_LENGTH;
                }
                else
                {//imaginary part
@@ -214,7 +210,6 @@ void AddDoubleComplexValue(wostringstream *_postr, double _dblR, double _dblI, i
                                PrintDoubleVar(&ostemp, _dblI);
                        }
                        ostemp << left << SYMBOL_I;
-                       iSignLen = SIGN_LENGTH * 2;
                }
        }
 
@@ -238,7 +233,7 @@ void PrintDoubleVar(wostringstream *_postr,  double _dblVal)
        {//Inf
                Config_Stream(_postr, 0, 0, ' ');
                *_postr << left << "Inf";
-       }       
+       }
 
 }
 void Add_Space(wostringstream *_postr, int _iSpace)