display of some types and lines function fixed. 87/15587/10
Cedric Delamarre [Tue, 25 Nov 2014 08:34:29 +0000 (09:34 +0100)]
digits='abcdefghijklmnopqrstuvwxyz';
numbers='1234567890';
txt = [numbers numbers; digits+digits+digits digits+digits+digits]
[txt' txt']

lines(0,50)
numbers='1234567890';
txt = [numbers numbers; digits+digits+digits digits+digits+digits]
[txt' txt']

lines(0,24);
format(25);
%pi
[%pi %pi]

test_run("core","display",["no_check_error_output" ]);

// lines fixed
oldLines = lines()
lines(0,50)
lines(oldLines)

Change-Id: Ia43c309cf2b9b4b6d194a9dc937d7ccf34737f3e

scilab/modules/ast/includes/types/int.hxx
scilab/modules/ast/includes/types/tostring_common.hxx
scilab/modules/ast/src/cpp/types/double.cpp
scilab/modules/ast/src/cpp/types/polynom.cpp
scilab/modules/ast/src/cpp/types/string.cpp
scilab/modules/ast/src/cpp/types/tostring_common.cpp
scilab/modules/console/sci_gateway/cpp/sci_lines.cpp
scilab/modules/core/tests/unit_tests/display.dia.ref
scilab/modules/core/tests/unit_tests/display.tst
scilab/modules/overloading/macros/%r_p.sci

index 665155d..89b702d 100644 (file)
@@ -275,7 +275,7 @@ private :
                 }
 
                 iLen = iWidth + static_cast<int>(ostemp.str().size());
-                if (iLen > iLineLen)
+                if (iLen > iLineLen && iLastVal != i)
                 {
                     //Max length, new line
                     iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
@@ -285,7 +285,7 @@ private :
                         return false;
                     }
 
-                    ostr << std::endl << L"       column " << iLastVal + 1 << L" to " << i << std::endl << std::endl;
+                    addColumnString(ostr, iLastVal + 1, i);
                     ostr << ostemp.str() << std::endl;
                     ostemp.str(L"");
                     iLastVal = i;
@@ -303,8 +303,9 @@ private :
 
             if (iLastVal != 0)
             {
-                ostr << std::endl << L"       column " << iLastVal + 1 << L" to " << GenericType::getCols() << std::endl << std::endl;
+                addColumnString(ostr, iLastVal + 1, GenericType::getCols());
             }
+
             ostemp << std::endl;
             ostr << ostemp.str();
         }
@@ -339,7 +340,7 @@ private :
                     piSize[iCols1] = std::max(piSize[iCols1], iWidth);
                 }
 
-                if (iLen + piSize[iCols1] > iLineLen)
+                if (iLen + piSize[iCols1] > iLineLen && iCols1 != iLastCol)
                 {
                     //find the limit, print this part
                     for (int iRows2 = this->m_iRows2PrintState ; iRows2 < this->getRows() ; iRows2++)
@@ -352,8 +353,9 @@ private :
                             if (this->m_iRows2PrintState == 0 && iRows2 != 0)
                             {
                                 //add header
-                                ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                                addColumnString(ostr, iLastCol + 1, iCols1);
                             }
+
                             ostr << ostemp.str();
                             this->m_iRows2PrintState = iRows2;
                             this->m_iCols1PrintState = iLastCol;
@@ -383,7 +385,7 @@ private :
                     if (this->m_iRows2PrintState == 0)
                     {
                         iCurrentLine += 3;
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, iCols1);
                     }
 
                     ostr << ostemp.str();
@@ -404,7 +406,7 @@ private :
                     if (this->m_iRows2PrintState == 0 && iLastCol != 0)
                     {
                         //add header
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << GenericType::getCols() << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, GenericType::getCols());
                     }
 
                     ostr << ostemp.str();
@@ -433,8 +435,9 @@ private :
 
             if (this->m_iRows2PrintState == 0 && iLastCol != 0)
             {
-                ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << GenericType::getCols() << std::endl << std::endl;
+                addColumnString(ostr, iLastCol + 1, GenericType::getCols());
             }
+
             ostr << ostemp.str();
         }
 
index 09fac76..20e5897 100644 (file)
@@ -62,6 +62,7 @@ EXTERN_AST void addDoubleComplexValue(std::wostringstream *_postr, double _dblR,
 /*Common*/
 EXTERN_AST void configureStream(std::wostringstream *_postr, int _iWidth, int _iPrec, char _cFill);
 EXTERN_AST void addSpaces(std::wostringstream *_postr, int _iSpace);
+void addColumnString(std::wostringstream& ostr, int _iFrom, int _iTo);
 
 /*int*/
 /*
index 38798ad..acda250 100644 (file)
@@ -412,7 +412,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                 DoubleFormat df;
                 getDoubleFormat(ZeroIsZero(m_pRealData[iPos]), &df);
                 iLen = static_cast<int>(ostemp.str().size()) + SIZE_BETWEEN_TWO_VALUES + df.iSignLen + df.iWidth;
-                if (iLen >= iLineLen - 1)
+                if (iLen >= iLineLen - 1 && iLastVal != i)
                 {
                     //Max length, new line
                     iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
@@ -423,7 +423,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                         return false;
                     }
 
-                    ostr << endl << L"       column " << iLastVal + 1 << L" to " << i << endl << endl;
+                    addColumnString(ostr, iLastVal + 1, i);
                     ostr << ostemp.str() << endl;
                     ostemp.str(L"");
                     iLastVal = i;
@@ -435,7 +435,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
             if (iLastVal != 0)
             {
-                ostr << endl << L"       column " << iLastVal + 1 << L" to " << getCols() << endl << endl;
+                addColumnString(ostr, iLastVal + 1, getCols());
             }
             ostemp << endl;
             ostr << ostemp.str();
@@ -454,7 +454,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                 DoubleFormat dfR, dfI;
                 getComplexFormat(ZeroIsZero(m_pRealData[iPos]), ZeroIsZero(m_pImgData[iPos]), &iTotalLen, &dfR, &dfI);
                 iLen = static_cast<int>(ostemp.str().size()) + SIZE_BETWEEN_TWO_VALUES + iTotalLen;
-                if (iLen >= iLineLen - 1)
+                if (iLen >= iLineLen - 1 && iLastVal != i)
                 {
                     //Max length, new line
                     iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
@@ -464,7 +464,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                         return false;
                     }
 
-                    ostr << endl << L"       column " << iLastVal + 1 << L" to " << i << endl << endl;
+                    addColumnString(ostr, iLastVal + 1, i);
                     ostr << ostemp.str() << endl;
                     ostemp.str(L"");
                     iLastVal = i;
@@ -476,7 +476,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
             if (iLastVal != 0)
             {
-                ostr << endl << L"       column " << iLastVal + 1 << L" to " << getCols() << endl << endl;
+                addColumnString(ostr, iLastVal + 1, getCols());
             }
             ostemp << endl;
             ostr << ostemp.str();
@@ -514,7 +514,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     }
                 }
 
-                if (iLen + piSize[iCols1] > iLineLen)
+                if (iLen + piSize[iCols1] > iLineLen && iCols1 != iLastCol)
                 {
                     //find the limit, print this part
                     for (int iRows2 = m_iRows2PrintState ; iRows2 < getRows() ; iRows2++)
@@ -527,7 +527,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                             if (m_iRows2PrintState == 0 && iRows2 != 0)
                             {
                                 //add header
-                                ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                                addColumnString(ostr, iLastCol + 1, iCols1);
                             }
                             ostr << ostemp.str();
                             m_iRows2PrintState = iRows2;
@@ -558,7 +558,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     if (m_iRows2PrintState == 0)
                     {
                         iCurrentLine += 3;
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, iCols1);
                     }
                     ostr << ostemp.str();
                     ostemp.str(L"");
@@ -578,7 +578,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     if (m_iRows2PrintState == 0 && iLastCol != 0)
                     {
                         //add header
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, getCols());
                     }
 
                     ostr << ostemp.str();
@@ -605,7 +605,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
             if (m_iRows2PrintState == 0 && iLastCol != 0)
             {
-                ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
+                addColumnString(ostr, iLastCol + 1, getCols());
             }
             ostr << ostemp.str();
         }
@@ -631,7 +631,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     }
                 }
 
-                if (iLen + piSize[iCols1] > iLineLen)
+                if (iLen + piSize[iCols1] > iLineLen && iCols1 != iLastCol)
                 {
                     //find the limit, print this part
                     for (int iRows2 = m_iRows2PrintState ; iRows2 < getRows() ; iRows2++)
@@ -644,7 +644,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                             if (m_iRows2PrintState == 0 && iRows2 != 0)
                             {
                                 //add header
-                                ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                                addColumnString(ostr, iLastCol + 1, iCols1);
                             }
                             ostr << ostemp.str();
                             m_iRows2PrintState = iRows2;
@@ -674,7 +674,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     if (m_iRows2PrintState == 0)
                     {
                         iCurrentLine += 3;
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, iCols1);
                     }
                     ostr << ostemp.str();
                     ostemp.str(L"");
@@ -694,7 +694,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     if (m_iRows2PrintState == 0 && iLastCol != 0)
                     {
                         //add header
-                        ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
+                        addColumnString(ostr, iLastCol + 1, getCols());
                     }
 
                     ostr << ostemp.str();
@@ -721,7 +721,7 @@ bool Double::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
             if (m_iRows2PrintState == 0 && iLastCol != 0)
             {
-                ostr << endl << L"       column " << iLastCol + 1 << L" to " << getCols() << endl << endl;
+                addColumnString(ostr, iLastCol + 1, getCols());
             }
             ostr << ostemp.str();
         }
index ab15552..bfc04c8 100644 (file)
@@ -529,8 +529,7 @@ wstring Polynom::getMatrixString(int* _piDims, int /*_iDims*/, bool _bComplex)
     {
         for (int iRows1 = 0 ; iRows1 < getRows() ; iRows1++)
         {
-            // FIXME : iLen shadow previous declaration
-            int iLen = 0;
+            int iLength = 0;
             _piDims[0] = iRows1;
             _piDims[1] = iCols1;
             int iPos = getIndex(_piDims);
@@ -547,27 +546,26 @@ wstring Polynom::getMatrixString(int* _piDims, int /*_iDims*/, bool _bComplex)
             {
                 for (it_Exp = listExpR.begin() ; it_Exp != listExpR.end() ; it_Exp++)
                 {
-                    iLen += static_cast<int>((*it_Exp).size());
+                    iLength += static_cast<int>((*it_Exp).size());
                 }
             }
             else
             {
                 if (listExpR.front().size() != 0)
                 {
-                    iLen = static_cast<int>(listExpR.front().size());
+                    iLength = static_cast<int>(listExpR.front().size());
                 }
                 else
                 {
-                    iLen = static_cast<int>(listCoefR.front().size());
+                    iLength = static_cast<int>(listCoefR.front().size());
                 }
             }
-            piMaxLen[iCols1] = std::min(std::max(piMaxLen[iCols1], iLen), iLineLen);
+            piMaxLen[iCols1] = std::min(std::max(piMaxLen[iCols1], iLength), iLineLen);
             listExpR.clear();
             listCoefR.clear();
         }
 
         //We know the length of the column
-
         if (static_cast<int>(iLen + piMaxLen[iCols1]) >= iLineLen && iLen != 0)
         {
             //if the max length exceeded
@@ -631,15 +629,7 @@ wstring Polynom::getMatrixString(int* _piDims, int /*_iDims*/, bool _bComplex)
             iLen    = piMaxLen[iCols1];
 
             //write "column x to y"
-            if (iLastCol + 1 == iCols1)
-            {
-                ostr << endl << L"         Column " << iCols1 << endl << endl;
-            }
-            else
-            {
-                ostr << endl << L"         Column " << iLastCol + 1 << L" to " << iCols1 << endl << endl;
-            }
-
+            addColumnString(ostr, iLastCol + 1, iCols1);
             ostr << ostemp.str() << endl;
 
             iLastCol = iCols1;
@@ -652,14 +642,7 @@ wstring Polynom::getMatrixString(int* _piDims, int /*_iDims*/, bool _bComplex)
 
     if (bWordWarp)
     {
-        if (iLastCol + 1 == getCols())
-        {
-            ostr << endl << L"         Column " << getCols() << endl << endl;
-        }
-        else
-        {
-            ostr << endl << L"         Column " << iLastCol + 1 << L" to " << getCols() << endl << endl;
-        }
+        addColumnString(ostr, iLastCol + 1, getCols());
     }
 
     //print the end
@@ -756,15 +739,7 @@ wstring Polynom::getRowString(int* _piDims, int /*_iDims*/, bool _bComplex)
         if (iLen != 0 && static_cast<int>(listExpR.front().size()) + iLen >= iLineLen - 1)
         {
             //flush strean
-            if (i == iLastFlush + 1)
-            {
-                ostr << endl << L"         Column " << i << endl << endl;
-            }
-            else
-            {
-                ostr << endl << L"         Column " << iLastFlush + 1 /* 2 is better than 1, no ? */ << L" to " << i << endl << endl;
-            }
-
+            addColumnString(ostr, iLastFlush + 1, i);
             iLastFlush = i;
             iLen = 0;
             ostr << osExp.str() << endl;
@@ -802,14 +777,7 @@ wstring Polynom::getRowString(int* _piDims, int /*_iDims*/, bool _bComplex)
     if (iLastFlush != 0)
     {
         //last line of a multiline output
-        if (iLastFlush + 1 == getSize())
-        {
-            ostr << endl << L"         Column " << getSize() << endl << endl;
-        }
-        else
-        {
-            ostr << endl << L"         Column " << iLastFlush + 1 << L" to " << getSize() << endl << endl;
-        }
+        addColumnString(ostr, iLastFlush + 1, getSize());
     }
     ostr << osExp.str() << endl;
     ostr << osCoef.str() << endl;
index 3909143..2dbcba0 100644 (file)
@@ -145,15 +145,48 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
     int iMaxLines = ConfigVariable::getConsoleLines();
     int iCurrentLine = 0;
 
+    // less the two "!" (or two " " in scalar case)
+    // for iLineLen = 50 we will write "!48char!"
+    int iStrMaxSize = iLineLen - 2;
+
     if (isScalar())
     {
-        _piDims[0] = 0;
-        _piDims[1] = 0;
+        int iMaxLen = 0;
+        _piDims[0]  = 0;
+        _piDims[1]  = 0;
+
         int iPos = getIndex(_piDims);
-        ostr << L" " << get(iPos) << endl;
+        wchar_t* wcsStr = get(iPos);
+        int iCurLen = wcslen(wcsStr);
+        iMaxLen = std::max(iMaxLen, iCurLen);
+        iMaxLen = std::min(iMaxLen, iStrMaxSize);
+
+        if (iCurLen > iMaxLen)
+        {
+            int iStrPos = 0;
+            while (iCurLen > iStrMaxSize)
+            {
+                ostr << L" ";
+                ostr.write(wcsStr + iStrPos, iStrMaxSize);
+                ostr << L" " << std::endl;
+                iCurLen -= iStrMaxSize;
+                iStrPos += iStrMaxSize;
+            }
+
+            ostr << L" ";
+            configureStream(&ostr, iStrMaxSize, iPrecision, ' ');
+            ostr << left << wcsStr + iStrPos;
+        }
+        else
+        {
+            ostr << L" " << wcsStr << endl;
+        }
     }
     else if (getCols() == 1)
     {
+        std::wstring spaces(L"");
+
+        // compte max string size
         int iMaxLen = 0;
         for (int i = 0 ; i < getRows() ; i++)
         {
@@ -161,9 +194,17 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
             _piDims[0] = i;
             int iPos = getIndex(_piDims);
             iMaxLen = std::max(iMaxLen, static_cast<int>(wcslen(get(iPos))));
+            iMaxLen = std::min(iMaxLen, iStrMaxSize);
         }
 
-        iMaxLen += 2;
+        int iEmptyLineSize = iMaxLen;
+        if (iMaxLen != iStrMaxSize)
+        {
+            // count SPACE_BETWEEN_TWO_STRING_VALUES size in padding of empty line
+            // only if all lines have not a size greater than max size of a line.
+            iEmptyLineSize += SIZE_BETWEEN_TWO_STRING_VALUES;
+            spaces = SPACE_BETWEEN_TWO_STRING_VALUES;
+        }
 
         for (int i = m_iRows1PrintState ; i < getRows() ; i++)
         {
@@ -177,16 +218,37 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
             _piDims[1] = 0;
             _piDims[0] = i;
             int iPos = getIndex(_piDims);
+            wchar_t* wcsStr = get(iPos);
+            int iCurLen = wcslen(wcsStr);
 
             ostr << L"!";
-            configureStream(&ostr, iMaxLen, iPrecision, ' ');
-            ostr << left << get(iPos);
+            if (iCurLen > iMaxLen)
+            {
+                int iStrPos = 0;
+                while (iCurLen > iStrMaxSize)
+                {
+                    ostr.write(wcsStr + iStrPos, iStrMaxSize);
+                    ostr << L"!" << std::endl << L"!";
+                    iCurLen -= iStrMaxSize;
+                    iStrPos += iStrMaxSize;
+                }
+
+                configureStream(&ostr, iStrMaxSize, iPrecision, ' ');
+                ostr << left << wcsStr + iStrPos;
+            }
+            else
+            {
+                configureStream(&ostr, iMaxLen, iPrecision, ' ');
+                ostr << left << wcsStr << spaces;
+            }
+
             ostr << L"!" << endl;
+
             if ((i + 1) < m_iSize)
             {
                 //for all but last one
                 ostr << L"!";
-                configureStream(&ostr, iMaxLen, iPrecision, ' ');
+                configureStream(&ostr, iEmptyLineSize, iPrecision, ' ');
                 ostr << left << L" ";
                 ostr << L"!" << endl;
             }
@@ -206,7 +268,7 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
             int iLen = 0;
             int iCurLen = static_cast<int>(wcslen(get(iPos)));
             iLen = iCurLen + SIZE_BETWEEN_TWO_STRING_VALUES + static_cast<int>(ostemp.str().size());
-            if (iLen > iLineLen)
+            if (iLen > iLineLen && iLastVal != i)
             {
                 //Max length, new line
                 iCurrentLine += 4; //"column x to Y" + empty line + value + empty line
@@ -216,20 +278,40 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     return false;
                 }
 
-                ostr << endl << L"       column " << iLastVal + 1 << L" to " << i << endl << endl;
+                addColumnString(ostr, iLastVal + 1, i);
                 ostr << L"!" << ostemp.str() << L"!" << endl;
                 ostemp.str(L"");
                 iLastVal = i;
             }
 
-            configureStream(&ostemp, iCurLen + 2, iPrecision, ' ');
-            ostemp << left << get(iPos);
+            // Manage case where string length is greater than max line size.
+            if (iStrMaxSize < iCurLen)
+            {
+                wchar_t* wcsStr = get(iPos);
+                int iStrPos = 0;
+                while (iCurLen > iStrMaxSize) // -2 because of two "!"
+                {
+                    ostemp.write(wcsStr + iStrPos, iStrMaxSize);
+                    ostemp << L"!" << std::endl << L"!";
+                    iCurLen -= iStrMaxSize;
+                    iStrPos += iStrMaxSize;
+                }
+
+                configureStream(&ostemp, iStrMaxSize, iPrecision, ' ');
+                ostemp << left << wcsStr + iStrPos;
+            }
+            else
+            {
+                configureStream(&ostemp, iCurLen + 2, iPrecision, ' ');
+                ostemp << left << get(iPos);
+            }
         }
 
         if (iLastVal != 0)
         {
-            ostr << endl << L"       column " << iLastVal + 1 << L" to " << getCols() << endl << endl;
+            addColumnString(ostr, iLastVal + 1, getCols());
         }
+
         ostr << L"!" << ostemp.str() << L"!" << endl;
     }
     else //Matrix
@@ -244,15 +326,26 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
         for (int iCols1 = m_iCols1PrintState ; iCols1 < getCols() ; iCols1++)
         {
+            std::wstring spaces(L"");
             for (int iRows1 = 0 ; iRows1 < getRows() ; iRows1++)
             {
                 _piDims[1] = iCols1;
                 _piDims[0] = iRows1;
                 int iPos = getIndex(_piDims);
                 piSize[iCols1] = std::max(piSize[iCols1], static_cast<int>(wcslen(get(iPos))));
+                piSize[iCols1] = std::min(piSize[iCols1], iStrMaxSize);
+            }
+
+            int iEmptyLineSize = piSize[iLastCol];
+            if (piSize[iLastCol] != iStrMaxSize)
+            {
+                // count SPACE_BETWEEN_TWO_STRING_VALUES size in padding of empty line
+                // only if all lines have not a size greater than max size of a line.
+                iEmptyLineSize += SIZE_BETWEEN_TWO_STRING_VALUES;
+                spaces = SPACE_BETWEEN_TWO_STRING_VALUES;
             }
 
-            if (iLen + piSize[iCols1] > iLineLen)
+            if (iLen + piSize[iCols1] > iLineLen && iLastCol != iCols1)
             {
                 //find the limit, print this part
                 for (int iRows2 = m_iRows2PrintState ; iRows2 < getRows() ; iRows2++)
@@ -265,7 +358,7 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                         if (m_iRows2PrintState == 0 && iRows2 != 0)
                         {
                             //add header
-                            ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                            addColumnString(ostr, iLastCol + 1, iCols1);
                         }
                         ostr << ostemp.str();
                         m_iRows2PrintState = iRows2;
@@ -274,20 +367,42 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                     }
 
                     ostemp << L"!";
-                    for (int iCols2 = iLastCol ; iCols2 < iCols1 ; iCols2++)
+                    for (int iCols2 = iLastCol; iCols2 < iCols1; iCols2++)
                     {
                         _piDims[0] = iRows2;
                         _piDims[1] = iCols2;
                         int iPos = getIndex(_piDims);
-                        configureStream(&ostemp, piSize[iCols2], iPrecision, ' ');
-                        ostemp << left << get(iPos) << SPACE_BETWEEN_TWO_STRING_VALUES;
-                    }
+                        wchar_t* wcsStr = get(iPos);
+                        int iLenStr = wcslen(wcsStr);
 
+                        // Manage case where string length is greater than max line size.
+                        if (iLenStr > iStrMaxSize)
+                        {
+                            int iStrPos = 0;
+                            while (iLenStr > iStrMaxSize)
+                            {
+                                ostemp.write(wcsStr + iStrPos, iStrMaxSize);
+                                ostemp << L"!" << std::endl << L"!";
+                                iLenStr -= iStrMaxSize;
+                                iStrPos += iStrMaxSize;
+                            }
+
+                            configureStream(&ostemp, iStrMaxSize, iPrecision, ' ');
+                            ostemp << left << wcsStr + iStrPos;
+                        }
+                        else
+                        {
+                            configureStream(&ostemp, piSize[iCols2], iPrecision, ' ');
+                            ostemp << left << get(iPos) << spaces;
+                        }
+                    }
                     ostemp << L"!" << endl;
+
                     if ((iRows2 + 1) != m_iRows)
                     {
                         ostemp << L"!";
-                        configureStream(&ostemp, iLen, iPrecision, ' ');
+                        // -2 because of two "!"
+                        configureStream(&ostemp, iEmptyLineSize, iPrecision, ' ');
                         ostemp << left << L" ";
                         ostemp << L"!" << endl;
                     }
@@ -298,8 +413,9 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                 if (m_iRows2PrintState == 0)
                 {
                     iCurrentLine += 3;
-                    ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << iCols1 << std::endl << std::endl;
+                    addColumnString(ostr, iLastCol + 1, iCols1);
                 }
+
                 ostr << ostemp.str();
                 ostemp.str(L"");
                 iLastCol = iCols1;
@@ -311,13 +427,14 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
         for (int iRows2 = m_iRows2PrintState ; iRows2 < getRows() ; iRows2++)
         {
+            std::wstring spaces(L"");
             iCurrentLine += 2;
             if ((iMaxLines == 0 && iCurrentLine >= MAX_LINES) || (iMaxLines != 0 && iCurrentLine >= iMaxLines))
             {
                 if (m_iRows2PrintState == 0 && iLastCol != 0)
                 {
                     //add header
-                    ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
+                    addColumnString(ostr, iLastCol + 1, getCols());
                 }
 
                 ostr << ostemp.str();
@@ -326,6 +443,16 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                 return false;
             }
 
+            int iEmptyLineSize = piSize[iLastCol];
+            if (piSize[iLastCol] != iStrMaxSize)
+            {
+                // count SPACE_BETWEEN_TWO_STRING_VALUES size in padding of empty line
+                // only if all lines have not a size greater than max size of a line.
+                iEmptyLineSize += SIZE_BETWEEN_TWO_STRING_VALUES;
+                spaces = SPACE_BETWEEN_TWO_STRING_VALUES;
+            }
+
+
             ostemp << L"!";
             iLen = 0;
             for (int iCols2 = iLastCol ; iCols2 < getCols() ; iCols2++)
@@ -333,12 +460,34 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
                 _piDims[0] = iRows2;
                 _piDims[1] = iCols2;
                 int iPos = getIndex(_piDims);
+                wchar_t* wcsStr = get(iPos);
+                int iLenStr = wcslen(wcsStr);
+
+                // Manage case where string length is greater than max line size.
+                if (iStrMaxSize < iLenStr)
+                {
+                    int iStrPos = 0;
+                    while (iLenStr > iStrMaxSize)
+                    {
+                        ostemp.write(wcsStr + iStrPos, iStrMaxSize);
+                        ostemp << L"!" << std::endl << L"!";
+                        iLenStr -= iStrMaxSize;
+                        iStrPos += iStrMaxSize;
+                    }
 
-                configureStream(&ostemp, piSize[iCols2], iPrecision, ' ');
-                ostemp << left << get(iPos) << SPACE_BETWEEN_TWO_STRING_VALUES;
-                iLen += piSize[iCols2] + SIZE_BETWEEN_TWO_STRING_VALUES;
+                    configureStream(&ostemp, iStrMaxSize, iPrecision, ' ');
+                    ostemp << wcsStr + iStrPos << left;
+                    iLen = iStrMaxSize;
+                }
+                else
+                {
+                    configureStream(&ostemp, piSize[iCols2], iPrecision, ' ');
+                    ostemp << left << get(iPos) << spaces;
+                    iLen += piSize[iCols2] + spaces.size();
+                }
             }
             ostemp << L"!" << endl;
+
             if ((iRows2 + 1) != m_iRows)
             {
                 ostemp << L"!";
@@ -350,7 +499,7 @@ bool String::subMatrixToString(wostringstream& ostr, int* _piDims, int /*_iDims*
 
         if (m_iRows2PrintState == 0 && iLastCol != 0)
         {
-            ostr << std::endl << L"       column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
+            addColumnString(ostr, iLastCol + 1, getCols());
         }
         ostr << ostemp.str();
     }
index 345bf0b..306379b 100644 (file)
@@ -428,3 +428,15 @@ void configureStream(wostringstream * _postr, int _iWidth, int _iPrec, char _cFi
     _postr->precision(_iPrec);
     _postr->fill(_cFill);
 }
+
+void addColumnString(std::wostringstream& ostr, int _iFrom, int _iTo)
+{
+    if (_iFrom == _iTo)
+    {
+        ostr << std::endl << L"         column " << _iFrom << std::endl << std::endl;
+    }
+    else
+    {
+        ostr << std::endl << L"         column " << _iFrom << L" to " << _iTo << std::endl << std::endl;
+    }
+}
index 450ec7c..68c667b 100644 (file)
@@ -1,6 +1,6 @@
 /*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+* Copyright (C) 2011-2014 - DIGITEO - Cedric DELAMARRE
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
@@ -33,31 +33,56 @@ types::Function::ReturnValue sci_lines(types::typed_list &in, int _iRetCount, ty
 
     if (in.size() == 0)
     {
-        double size[] = {(double)ConfigVariable::getConsoleWidth(),
-                         (double)ConfigVariable::getConsoleLines()
-                        };
         types::Double* pDbl = new types::Double(1, 2);
-        pDbl->set(size);
+        double* pdblSize = pDbl->get();
+        pdblSize[0] = (double)ConfigVariable::getConsoleWidth();
+        pdblSize[1] = (double)ConfigVariable::getConsoleLines();
         out.push_back(pDbl);
         return types::Function::OK;
     }
 
-    if (in.size() == 2)
+    if (in.size() == 1)
     {
-        if ((in[1]->isDouble() == false) || !in[1]->getAs<types::Double>()->isScalar())
+        if ((in[0]->isDouble() == false))
         {
-            Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "lines", 2);
+            Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "lines", 1);
             return types::Function::Error;
         }
-        ConfigVariable::setConsoleWidth((int)in[1]->getAs<types::Double>()->get(0));
+
+        types::Double* pDblIn = in[0]->getAs<types::Double>();
+        double* pdblIn = in[0]->getAs<types::Double>()->get();
+
+        if (pDblIn->isScalar())
+        {
+            ConfigVariable::setConsoleLines((int)pdblIn[0]);
+        }
+        else if (pDblIn->getRows() == 1 && pDblIn->getCols() == 2)
+        {
+            ConfigVariable::setConsoleWidth((int)pdblIn[0]);
+            ConfigVariable::setConsoleLines((int)pdblIn[1]);
+        }
+        else
+        {
+            Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "lines", 1);
+            return types::Function::Error;
+        }
+
+        return types::Function::OK;
     }
 
-    if ((in[0]->isDouble() == false) || !in[0]->getAs<types::Double>()->isScalar())
+    if ((in[0]->isDouble() == false) || in[0]->getAs<types::Double>()->isScalar() == false)
     {
         Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "lines", 1);
         return types::Function::Error;
     }
 
+    if ((in[1]->isDouble() == false) || in[1]->getAs<types::Double>()->isScalar() == false)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "lines", 2);
+        return types::Function::Error;
+    }
+
+    ConfigVariable::setConsoleWidth((int)in[1]->getAs<types::Double>()->get(0));
     ConfigVariable::setConsoleLines((int)in[0]->getAs<types::Double>()->get(0));
 
     return types::Function::OK;
index 14feea4..5ef5c39 100644 (file)
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
-format('v',10)
+format("v",10)
 //display of numbers
 x=2.6533333
- x  =
-    2.6533333  
+x  = 
+    2.6533333
 x=[2.6533333 -0.0002]
- x  =
-    2.6533333  - 0.0002  
+x  = 
+    2.6533333  - 0.0002
 x'
  ans  =
-    2.6533333  
-  - 0.0002     
+    2.6533333
+  - 0.0002
 x=[]
- x  =
-     []
+x  = 
+    []
 //display of polynomials
-z=poly(0,'z')
- z  =
-    z   
-num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
-     z-0.0243497
-      (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
-     z-0.0243497
-     (((1)*z )*z )*z+1
-     0]
- num  =
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
-                                                                        
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
-                                                                        
-         3                                                              
-    1 + z                                                               
-                                                                        
-    0                                                                   
+z=poly(0,"z")
+z  = 
+     
+    z
+num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
+z-0.0243497
+(((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
+z-0.0243497
+(((1)*z )*z )*z+1
+0]
+num  = 
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
+         3
+    1 + z 
+     
+   0
 den = [ ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
 ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
 ((1)*z )*z
 1]
- den  =
-                                      2           3   4  
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
-                                                         
-                                      2           3   4  
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
-                                                         
-     2                                                   
-    z                                                    
-                                                         
-    1                                                    
+den  = 
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
+     2
+    z 
+     
+    1
 num',den'
  ans  =
          column 1
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
          column 2
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
  
          column 3 to 4
-         3       
-    1 + z     0  
+         3     
+    1 + z    0
  ans  =
          column 1
-                                      2           3   4  
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
          column 2 to 4
-                                      2           3   4     2        
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z     z     1   
+                                      2            3    4     2     
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z     z     1
 [num;den]
  ans  =
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
-                                                                        
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
-               5                                                        
-            + z                                                         
-                                                                        
-         3                                                              
-    1 + z                                                               
-                                                                        
-    0                                                                   
-                                                                        
-                                      2           3   4                 
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z                  
-                                                                        
-                                      2           3   4                 
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z                  
-                                                                        
-     2                                                                  
-    z                                                                   
-                                                                        
-    1                                                                   
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
+                                       2             3             4
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z 
+               5
+            + z 
+         3
+    1 + z 
+     
+   0
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
+     2
+    z 
+     
+    1
 [num den]
  ans  =
          column 1
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
+                                       2             3             4    
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z     
                5                                                        
             + z                                                         
-                                                                        
-                                       2            3            4      
-  - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
+                                       2             3             4    
+  - 0.0243497 + 0.2911572z - 1.2916784z  + 2.6887936z  - 2.6533333z     
                5                                                        
             + z                                                         
-                                                                        
          3                                                              
     1 + z                                                               
                                                                         
-    0                                                                   
+   0                                                                    
          column 2
-                                      2           3   4  
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
-                                                         
-                                      2           3   4  
-    0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
-                                                         
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
+                                      2            3    4
+    0.0113508 - 0.168281z + 0.8067352z  - 1.536926z  + z 
      2                                                   
     z                                                    
                                                          
     1                                                    
 //display of polynomials
-z=poly(0,'z')
- z  =
-    z   
+z=poly(0,"z")
+z  = 
+     
+    z
 n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1];
 n2=[n n*n;n*n n**4];d2=[n*n n**4;n n*n];den=d2(1,:);num=n2(2,:);
-p=poly(rand(5,1),'z');q=poly(rand(6,1),'z');
+p=poly(rand(5,1),"z");q=poly(rand(6,1),"z");
 p1=[p,0.1+2.35*z-5.05*z**3];q1=[q,2.56+0.03*z-10.01*z*z+z**5];
 d3=[1+z**10 z**15];
 //display of rationals
 r=num./den
- r  =
-    1     1   
-    -     -   
-    1     1   
+r  = 
+           
+   1   1   
+   --  --  
+           
+   1   1   
 r'
  ans  =
-    1   
-    -   
-    1   
-        
-    1   
-    -   
-    1   
+       
+   1   
+   --  
+       
+   1   
+       
+   1   
+   --  
+       
+   1   
 rlist(d,n)
  ans  =
-              2  
-    1 + 2z + z   
-    ----------   
-      1 + z      
+             2  
+   1 + 2z + z   
+   -----------  
+                
+     1 + z      
 rlist(n,d)
  ans  =
-      1 + z      
-    ---------    
-              2  
-    1 + 2z + z   
+                
+     1 + z      
+   -----------  
+             2  
+   1 + 2z + z   
 rlist(d2,n2)
  ans  =
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
-    ----------     --------------------   
-                                  2       
-      1 + z             1 + 2z + z        
-                                          
-                                  2       
-      1 + z             1 + 2z + z        
-    ---------      --------------------   
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
+   -----------  ---------------------  
+                               2       
+     1 + z           1 + 2z + z        
+                               2       
+     1 + z           1 + 2z + z        
+   -----------  ---------------------  
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
 rlist(n2,d2)
  ans  =
-                                  2       
-      1 + z             1 + 2z + z        
-    ---------      --------------------   
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
-                                          
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
-    ----------     --------------------   
-                                  2       
-      1 + z             1 + 2z + z        
+                               2       
+     1 + z           1 + 2z + z        
+   -----------  ---------------------  
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
+   -----------  ---------------------  
+                               2       
+     1 + z           1 + 2z + z        
 rlist(den,num)
  ans  =
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
-    ----------     --------------------   
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
+   -----------  ---------------------  
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
 rlist(num,den)
  ans  =
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
-    ----------     --------------------   
-              2               2    3   4  
-    1 + 2z + z     1 + 4z + 6z + 4z + z   
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
+   -----------  ---------------------  
+             2             2    3   4  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   
 rlist(p1,q1)
  ans  =
  
+column 1
  
-         column 1
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
-    ------------------------------------------------------------------  
-                                       2            3            4      
-    0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
-                   5   6                                                
-       - 3.6713072z + z                                                 
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
+   -------------------------------------------------------------------  
+                                        2            3            4     
+     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z      
+                  5   6                                                 
+      - 3.6713072z + z                                                  
  
-         column 2
+column 2
  
-                          3     
-       0.1 + 2.35z - 5.05z      
-    -------------------------   
-                         2   5  
-    2.56 + 0.03z - 10.01z + z   
+                         3     
+      0.1 + 2.35z - 5.05z      
+   --------------------------  
+                        2   5  
+   2.56 + 0.03z - 10.01z + z   
+                               
+                               
 rlist(q1,p1)
  ans  =
  
+column 1
  
-         column 1
-                                       2            3            4      
-    0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
-                   5   6                                                
-       - 3.6713072z + z                                                 
-    ------------------------------------------------------------------  
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
+                                        2            3            4     
+     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z      
+                  5   6                                                 
+      - 3.6713072z + z                                                  
+   -------------------------------------------------------------------  
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
  
-         column 2
+column 2
  
-                         2   5  
-    2.56 + 0.03z - 10.01z + z   
-    -------------------------   
-                          3     
-       0.1 + 2.35z - 5.05z      
+                        2   5  
+   2.56 + 0.03z - 10.01z + z   
+   --------------------------  
+                         3     
+      0.1 + 2.35z - 5.05z      
+                               
+                               
 rlist(p,q)
  ans  =
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
-    ------------------------------------------------------------------  
-                                       2            3            4      
-    0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
-                   5   6                                                
-       - 3.6713072z + z                                                 
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
+   -------------------------------------------------------------------  
+                                        2            3            4     
+     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z      
+                  5   6                                                 
+      - 3.6713072z + z                                                  
 rlist(q,p)
  ans  =
-                                       2            3            4      
-    0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
-                   5   6                                                
-       - 3.6713072z + z                                                 
-    ------------------------------------------------------------------  
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
+                                        2            3            4     
+     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z      
+                  5   6                                                 
+      - 3.6713072z + z                                                  
+   -------------------------------------------------------------------  
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
 rlist(p,z)
  ans  =
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
-    ------------------------------------------------------------------  
-                                    z                                   
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
+   -------------------------------------------------------------------  
+                                                                        
+                                   z                                    
 rlist(z,p)
  ans  =
-                                    z                                   
-    -----------------------------------------------------------------   
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
+                                                                        
+                                   z                                    
+   -------------------------------------------------------------------  
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
 rlist(d1,n1)
  ans  =
  
+column 1 to 3
  
-         column 1 to 3
+             2             2    3   4            2  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   1 + 2z + z   
+   -----------  ---------------------  -----------  
+                               2                    
+     1 + z           1 + 2z + z          1 + z      
  
-              2               2    3   4              2  
-    1 + 2z + z     1 + 4z + 6z + 4z + z     1 + 2z + z   
-    ----------     --------------------     ----------   
-                                  2                      
-      1 + z             1 + 2z + z            1 + z      
+column 4
  
-         column 4
-               2    3   4  
-    1 + 4z + 6z + 4z + z   
-    --------------------   
-                   2       
-         1 + 2z + z        
+              2    3   4  
+   1 + 4z + 6z + 4z + z   
+   ---------------------  
+                  2       
+        1 + 2z + z        
 rlist(n1,d1)
  ans  =
  
+column 1 to 3
  
-         column 1 to 3
+                               2                    
+     1 + z           1 + 2z + z          1 + z      
+   -----------  ---------------------  -----------  
+             2             2    3   4            2  
+   1 + 2z + z   1 + 4z + 6z + 4z + z   1 + 2z + z   
  
-                                  2                      
-      1 + z             1 + 2z + z            1 + z      
-    ---------      --------------------     ---------    
-              2               2    3   4              2  
-    1 + 2z + z     1 + 4z + 6z + 4z + z     1 + 2z + z   
-         column 4
+column 4
  
-                   2       
-         1 + 2z + z        
-    --------------------   
-               2    3   4  
-    1 + 4z + 6z + 4z + z   
+                  2       
+        1 + 2z + z        
+   ---------------------  
+              2    3   4  
+   1 + 4z + 6z + 4z + z   
 //display of strings
-digits='abcdefghijklmnopqrstuvwxyz'
- digits  =
- abcdefghijklmnopqrstuvwxyz   
-numbers='1234567890'
- numbers  =
- 1234567890   
-majuscules='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- majuscules  =
- ABCDEFGHIJKLMNOPQRSTUVWXYZ   
-symbols=',./;''[] \ =-!\$%^&*()_+~:""[]| @'
- symbols  =
- ,./;'[] \ =-!\$%^&*()_+~:"[]| @   
+digits="abcdefghijklmnopqrstuvwxyz"
+digits  = 
+ abcdefghijklmnopqrstuvwxyz
+numbers="1234567890"
+numbers  = 
+ 1234567890
+majuscules="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+majuscules  = 
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+symbols=",./;''[] \ =-!\$%^&*()_+~:""[]| @"
+symbols  = 
+ ,./;'[] \ =-!\$%^&*()_+~:"[]| @
 [numbers;digits]
  ans  =
 !1234567890                  !
 !                            !
 !abcdefghijklmnopqrstuvwxyz  !
 [numbers digits;digits numbers]
  ans  =
 !1234567890                  abcdefghijklmnopqrstuvwxyz  !
 !                                                        !
 !abcdefghijklmnopqrstuvwxyz  1234567890                  !
 [numbers digits+digits+digits]
  ans  =
          column 1
 !1234567890  !
          column 2
 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
-!     stuvwxyz                                                         !
+!stuvwxyz                                                              !
 ans';
 [ans ans]
  ans  =
          column 1
 !1234567890                                                            !
 !                                                                      !
 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
-!     stuvwxyz                                                         !
+!stuvwxyz                                                              !
          column 2
 !1234567890                                                            !
 !                                                                      !
 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
-!     stuvwxyz                                                         !
-''
+!stuvwxyz                                                              !
+""
+ ans  =
+oldlines = lines();
+lines(0,50);
+digits="abcdefghijklmnopqrstuvwxyz";
+d = digits+digits+digits;
+n = "1234567890";
+// scalar
+n
+n  = (2)
+ 1234567890
+n+n+n+n+n
+ ans  =
+ 123456789012345678901234567890123456789012345678 
+ 90                                              
+d
+d  = (1)
+ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv 
+ wxyzabcdefghijklmnopqrstuvwxyz                  
+d+d+d+d
+ ans  =
+ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv 
+ wxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr 
+ stuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn 
+ opqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij 
+ klmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef 
+ ghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab 
+ cdefghijklmnopqrstuvwxyz                        
+// column vector
+[n; n; n; n; n]
  ans  =
-    
+!1234567890  !
+!            !
+!1234567890  !
+!            !
+!1234567890  !
+!            !
+!1234567890  !
+!            !
+!1234567890  !
+[d; d; d; d; d]
+ ans  =
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[n+n; n+n; n+n]
+ ans  =
+!12345678901234567890  !
+!                      !
+!12345678901234567890  !
+!                      !
+!12345678901234567890  !
+[n+n; n+n+n; n+n]
+ ans  =
+!12345678901234567890            !
+!                                !
+!123456789012345678901234567890  !
+!                                !
+!12345678901234567890            !
+[n+n; d+d; n+n]
+ ans  =
+!12345678901234567890                            !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
+!stuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn!
+!opqrstuvwxyz                                    !
+!                                                !
+!12345678901234567890                            !
+[d; d]
+ ans  =
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[d; n]
+ ans  =
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+[n; d]
+ ans  =
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[n; n]
+ ans  =
+!1234567890  !
+!            !
+!1234567890  !
+// row vector
+[n n n n n]
+ ans  =
+         column 1 to 4
+!1234567890  1234567890  1234567890  1234567890  !
+         column 5
+!1234567890  !
+[d d d d d]
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 3
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 4
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 5
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[n+n n+n n+n]
+ ans  =
+         column 1 to 2
+!12345678901234567890  12345678901234567890  !
+         column 3
+!12345678901234567890  !
+[n+n n+n+n n+n]
+ ans  =
+         column 1
+!12345678901234567890  !
+         column 2
+!123456789012345678901234567890  !
+         column 3
+!12345678901234567890  !
+[d d]
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[d n]
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!1234567890  !
+[n d]
+ ans  =
+         column 1
+!1234567890  !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[n n]
+ ans  =
+!1234567890  1234567890  !
+// matrix
+nd = [n d];
+dn = [d n];
+[nd nd]
+ ans  =
+         column 1
+!1234567890  !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 3
+!1234567890  !
+         column 4
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[nd; nd]
+ ans  =
+         column 1
+!1234567890  !
+!            !
+!1234567890  !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[nd' nd']
+ ans  =
+         column 1
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[nd'; nd']
+ ans  =
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+[dn dn]
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!1234567890  !
+         column 3
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 4
+!1234567890  !
+[dn; dn]
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+         column 2
+!1234567890  !
+!            !
+!1234567890  !
+[dn' dn']
+ ans  =
+         column 1
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+         column 2
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+[dn'; dn']
+ ans  =
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+!                                                !
+!abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv!
+!wxyzabcdefghijklmnopqrstuvwxyz                  !
+!                                                !
+!1234567890                                      !
+lines(oldlines);
 // display of list
 list()
  ans  =
      ()
 list(1,2,3)
  ans  =
        ans(1)
-    1.  
+    1.
        ans(2)
-    2.  
+    2.
        ans(3)
-    3.  
+    3.
 list(list(1,list()),2)
  ans  =
        ans(1)
         ans(1)(1)
-    1.  
+    1.
         ans(1)(2)
      ()
        ans(2)
-    2.  
+    2.
 list(rlist(q,p),1.23)
  ans  =
        ans(1)
-                                       2            3            4      
-    0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
-                   5   6                                                
-       - 3.6713072z + z                                                 
-    ------------------------------------------------------------------  
-                                       2            3            4      
-  - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
-          5                                                             
-       + z                                                              
+                                        2            3            4     
+     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z      
+                  5   6                                                 
+      - 3.6713072z + z                                                  
+   -------------------------------------------------------------------  
+                                       2            3            4   5  
+   -0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z + z   
        ans(2)
-    1.23  
+    1.23
 // overloading of display
 1:$
  ans  =
- 1:1:$   
+ 1:1:$
 list(1,1:$)
  ans  =
        ans(1)
-    1.  
+    1.
        ans(2)
- 1:1:$   
+ 1:1:$
 list(list(1:$))
  ans  =
        ans(1)
         ans(1)(1)
- 1:1:$   
+ 1:1:$
 list(list(1,$),list())
  ans  =
        ans(1)
         ans(1)(1)
-    1.  
+    1.
         ans(1)(2)
-    $   
+     
+    $
        ans(2)
      ()
 // Tlist overloaded display
-TL=tlist('x',1,2)
- TL  =
+TL=tlist("x",1,2)
+TL  = 
        TL(1)
- x   
+ x
        TL(2)
-    1.  
+    1.
        TL(3)
-    2.  
-deff('%x_p(x)','disp(x(3),x(2),''Mydisplay'')')
+    2.
+deff("%x_p(x)","disp(x(3),x(2),''Mydisplay'')")
 TL
- TL  =
- Mydisplay   
-    1.  
-    2.  
+TL  = (1)
+ Mydisplay
+    1.
+    2.
 list(TL)
  ans  =
        ans(1)
- Mydisplay   
-    1.  
-    2.  
+ Mydisplay
+    1.
+    2.
 list(list(TL))
  ans  =
        ans(1)
         ans(1)(1)
- Mydisplay   
-    1.  
-    2.  
-TL=tlist('x',1:$,2)
- TL  =
- Mydisplay   
- 1:1:$   
-    2.  
+ Mydisplay
+    1.
+    2.
+TL=tlist("x",1:$,2)
+TL  = 
+ Mydisplay
+ 1:1:$
+    2.
 list(TL)
  ans  =
        ans(1)
- Mydisplay   
- 1:1:$   
-    2.  
+ Mydisplay
+ 1:1:$
+    2.
 list(list(TL))
  ans  =
        ans(1)
         ans(1)(1)
- Mydisplay   
- 1:1:$   
-    2.  
+ Mydisplay
+ 1:1:$
+    2.
 TL(2)=TL
- TL  =
- Mydisplay   
- Mydisplay   
- 1:1:$   
-    2.  
-    2.  
+TL  = 
+ Mydisplay
+ Mydisplay
+ 1:1:$
+    2.
+    2.
index 83fbf62..ccef39c 100644 (file)
@@ -6,7 +6,7 @@
 // =============================================================================
 
 
-format('v',10)
+format("v",10)
 //display of numbers
 x=2.6533333
 x=[2.6533333 -0.0002]
@@ -14,13 +14,13 @@ x'
 x=[]
 
 //display of polynomials
-z=poly(0,'z')
-num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
-     z-0.0243497
-      (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
-     z-0.0243497
-     (((1)*z )*z )*z+1
-     0]
+z=poly(0,"z")
+num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
+z-0.0243497
+(((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
+z-0.0243497
+(((1)*z )*z )*z+1
+0]
 den = [ ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
 ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
 ((1)*z )*z
@@ -29,10 +29,10 @@ num',den'
 [num;den]
 [num den]
 //display of polynomials
-z=poly(0,'z')
+z=poly(0,"z")
 n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1];
 n2=[n n*n;n*n n**4];d2=[n*n n**4;n n*n];den=d2(1,:);num=n2(2,:);
-p=poly(rand(5,1),'z');q=poly(rand(6,1),'z');
+p=poly(rand(5,1),"z");q=poly(rand(6,1),"z");
 p1=[p,0.1+2.35*z-5.05*z**3];q1=[q,2.56+0.03*z-10.01*z*z+z**5];
 d3=[1+z**10 z**15];
 //display of rationals
@@ -53,16 +53,65 @@ rlist(z,p)
 rlist(d1,n1)
 rlist(n1,d1)
 //display of strings
-digits='abcdefghijklmnopqrstuvwxyz'
-numbers='1234567890'
-majuscules='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-symbols=',./;''[] \ =-!\$%^&*()_+~:""[]| @'
+digits="abcdefghijklmnopqrstuvwxyz"
+numbers="1234567890"
+majuscules="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+symbols=",./;''[] \ =-!\$%^&*()_+~:""[]| @"
 [numbers;digits]
 [numbers digits;digits numbers]
 [numbers digits+digits+digits]
 ans';
 [ans ans]
-''
+""
+
+oldlines = lines();
+lines(0,50);
+digits="abcdefghijklmnopqrstuvwxyz";
+d = digits+digits+digits;
+n = "1234567890";
+
+// scalar
+n
+n+n+n+n+n
+d
+d+d+d+d
+
+// column vector
+[n; n; n; n; n]
+[d; d; d; d; d]
+[n+n; n+n; n+n]
+[n+n; n+n+n; n+n]
+[n+n; d+d; n+n]
+[d; d]
+[d; n]
+[n; d]
+[n; n]
+
+// row vector
+[n n n n n]
+[d d d d d]
+[n+n n+n n+n]
+[n+n n+n+n n+n]
+[d d]
+[d n]
+[n d]
+[n n]
+
+// matrix
+nd = [n d];
+dn = [d n];
+
+[nd nd]
+[nd; nd]
+[nd' nd']
+[nd'; nd']
+
+[dn dn]
+[dn; dn]
+[dn' dn']
+[dn'; dn']
+
+lines(oldlines);
 
 // display of list
 list()
@@ -75,12 +124,12 @@ list(1,1:$)
 list(list(1:$))
 list(list(1,$),list())
 // Tlist overloaded display
-TL=tlist('x',1,2)
-deff('%x_p(x)','disp(x(3),x(2),''Mydisplay'')')
+TL=tlist("x",1,2)
+deff("%x_p(x)","disp(x(3),x(2),''Mydisplay'')")
 TL
 list(TL)
 list(list(TL))
-TL=tlist('x',1:$,2)
+TL=tlist("x",1:$,2)
 list(TL)
 list(list(TL))
 TL(2)=TL
index 953c23d..b713ce0 100644 (file)
@@ -25,7 +25,7 @@ function %r_p(h)
         if (m == 0) | (n == 0) then
             return
         end
-        del="!"
+        del=" "
         blank=" "
         if m*n==1 then del=" ",end
         height=zeros(m,1)  // to store "height" of each row do be displayed