utf: module output_stream 2 71/17671/2
Antoine ELIAS [Mon, 11 Jan 2016 20:14:50 +0000 (21:14 +0100)]
Change-Id: I472e65a9ce84a7e5db9961cffd4f39fe1e50878a

scilab/modules/output_stream/includes/scilab_sprintf.hxx
scilab/modules/output_stream/sci_gateway/cpp/output_stream_gw.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_diary.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_disp.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_mprintf.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_msprintf.cpp
scilab/modules/output_stream/src/cpp/diary_manager.cpp
scilab/modules/output_stream/src/cpp/diary_manager.hxx
scilab/modules/output_stream/src/cpp/scilab_sprintf.cpp

index e1ac488..d4f0d7d 100644 (file)
@@ -18,7 +18,7 @@
 
 struct TokenDef
 {
-    char* pwstToken;
+    char* pstToken;
     types::InternalType::ScilabType outputType;
     bool length;
     int width;
@@ -30,7 +30,7 @@ struct TokenDef
     int col;
 
     TokenDef() :
-        pwstToken(nullptr),
+        pstToken(nullptr),
         outputType(types::InternalType::ScilabNull),
         length(false),
         width(0),
index 418da7f..4b1c369 100644 (file)
@@ -19,15 +19,15 @@ extern "C"
 #include "gw_output_stream.h"
 }
 
-#define MODULE_NAME L"output_stream"
+#define MODULE_NAME "output_stream"
 
 int OutputStreamModule::Load()
 {
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"disp", &sci_disp, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"msprintf", &sci_msprintf, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"sprintf", &sci_msprintf, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"printf", &sci_mprintf, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"mprintf", &sci_mprintf, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"diary", &sci_diary, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("disp", &sci_disp, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("msprintf", &sci_msprintf, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("sprintf", &sci_msprintf, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("printf", &sci_mprintf, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("mprintf", &sci_mprintf, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction("diary", &sci_diary, MODULE_NAME));
     return 1;
 }
index fbc3c78..b1c4fb2 100644 (file)
@@ -23,20 +23,20 @@ extern "C"
 #include "freeArrayOfString.h"
 }
 /*--------------------------------------------------------------------------*/
-#define DIARY_SECOND_ARG_LIST L"list"
-#define DIARY_SECOND_ARG_CLOSE L"close"
-#define DIARY_SECOND_ARG_PAUSE L"pause"
-#define DIARY_SECOND_ARG_OFF L"off"
-#define DIARY_SECOND_ARG_RESUME L"resume"
-#define DIARY_SECOND_ARG_ON L"on"
-#define DIARY_SECOND_ARG_NEW L"new"
-#define DIARY_SECOND_ARG_APPEND L"append"
-#define DIARY_SECOND_ARG_EXISTS L"exists"
-#define DIARY_THIRD_ARG_FILTER_COMMAND L"filter=command"
-#define DIARY_THIRD_ARG_FILTER_OUTPUT L"filter=output"
-#define DIARY_THIRD_ARG_PREFIX_UNIX_EPOCH L"prefix=U"
-#define DIARY_THIRD_ARG_PREFIX_DEFAULT L"prefix=YYYY-MM-DD hh:mm:ss"
-#define DIARY_THIRD_ARG_PREFIX_ONLY_COMMANDS L"prefix-only-commands"
+#define DIARY_SECOND_ARG_LIST "list"
+#define DIARY_SECOND_ARG_CLOSE "close"
+#define DIARY_SECOND_ARG_PAUSE "pause"
+#define DIARY_SECOND_ARG_OFF "off"
+#define DIARY_SECOND_ARG_RESUME "resume"
+#define DIARY_SECOND_ARG_ON "on"
+#define DIARY_SECOND_ARG_NEW "new"
+#define DIARY_SECOND_ARG_APPEND "append"
+#define DIARY_SECOND_ARG_EXISTS "exists"
+#define DIARY_THIRD_ARG_FILTER_COMMAND "filter=command"
+#define DIARY_THIRD_ARG_FILTER_OUTPUT "filter=output"
+#define DIARY_THIRD_ARG_PREFIX_UNIX_EPOCH "prefix=U"
+#define DIARY_THIRD_ARG_PREFIX_DEFAULT "prefix=YYYY-MM-DD hh:mm:ss"
+#define DIARY_THIRD_ARG_PREFIX_ONLY_COMMANDS "prefix-only-commands"
 /*--------------------------------------------------------------------------*/
 static int sci_diary_no_rhs(char *fname, void* pvApiCtx);
 static int sci_diary_one_rhs(char *fname, void* pvApiCtx);
@@ -44,11 +44,11 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx);
 static int sci_diary_three_rhs(char *fname, void* pvApiCtx);
 /*--------------------------------------------------------------------------*/
 static double *getInputArgumentOneIDs(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror);
-static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror);
-static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror);
-static wchar_t **getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror);
+static char** getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror);
+static char* getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror);
+static char** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror);
 static int checkExistByIDs(char *fname, void* pvApiCtx, double *IDs, int size_IDs);
-static int checkExistByFilenames(char *fname, void* pvApiCtx, wchar_t **wcFilenames, int size_IDs);
+static int checkExistByFilenames(char *fname, void* pvApiCtx, char** filenames, int size_IDs);
 static int CloseByFilenames(char *fname, void* pvApiCtx);
 static int CloseByIds(char *fname, void* pvApiCtx);
 static int PauseByFilenames(char *fname, void* pvApiCtx);
@@ -93,9 +93,9 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
     // [ids, filenames] = diary([],"list")
     SciErr sciErr;
     int nb_diary_ids = 0;
-    double *diary_ids  = getDiaryIDsAsDouble(&nb_diary_ids);
+    double *diary_ids = getDiaryIDsAsDouble(&nb_diary_ids);
 
-    if ( (diary_ids) && (nb_diary_ids > 0) )
+    if ((diary_ids) && (nb_diary_ids > 0))
     {
         sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, nb_diary_ids, 1, diary_ids);
         if (sciErr.iErr)
@@ -107,7 +107,7 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
 
         LhsVar(1) = Rhs + 1;
 
-        delete [] diary_ids;
+        delete[] diary_ids;
         diary_ids = NULL;
         nb_diary_ids = 0;
     }
@@ -126,7 +126,7 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
 
             if (diary_ids)
             {
-                delete [] diary_ids;
+                delete[] diary_ids;
                 diary_ids = NULL;
                 nb_diary_ids = 0;
             }
@@ -141,11 +141,11 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
     if (Lhs == 2)
     {
         int nb_diary_filenames = 0;
-        wchar_t **wcdiary_filenames = getDiaryFilenames(&nb_diary_filenames);
+        char **diary_filenames = getDiaryFilenames(&nb_diary_filenames);
 
-        if ( (wcdiary_filenames) && (nb_diary_filenames > 0) )
+        if ((diary_filenames) && (nb_diary_filenames > 0))
         {
-            sciErr = createMatrixOfWideString(pvApiCtx, Rhs + 2, nb_diary_filenames, 1, wcdiary_filenames);
+            sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, nb_diary_filenames, 1, diary_filenames);
             if (sciErr.iErr)
             {
                 printError(&sciErr, 0);
@@ -155,7 +155,7 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
 
             LhsVar(2) = Rhs + 2;
 
-            freeArrayOfWideString(wcdiary_filenames, nb_diary_filenames);
+            freeArrayOfString(diary_filenames, nb_diary_filenames);
             nb_diary_filenames = 0;
         }
         else
@@ -171,9 +171,9 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
                 }
 
                 LhsVar(2) = Rhs + 2;
-                if (wcdiary_filenames)
+                if (diary_filenames)
                 {
-                    freeArrayOfWideString(wcdiary_filenames, nb_diary_filenames);
+                    freeArrayOfString(diary_filenames, nb_diary_filenames);
                     nb_diary_filenames = 0;
                 }
             }
@@ -193,7 +193,7 @@ static int sci_diary_no_rhs(char *fname, void* pvApiCtx)
 static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
 {
     SciErr sciErr;
-    int iType  = 0;
+    int iType = 0;
     int *piAddressVarOne = NULL;
 
     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
@@ -225,8 +225,8 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
         // diary([])
         // diary(0)
         // close all
-        if ( (IDs_size == 0) ||
-                ((IDs_size == 1) && ((int)IDs[0] == 0)))
+        if ((IDs_size == 0) ||
+            ((IDs_size == 1) && ((int)IDs[0] == 0)))
         {
             diaryCloseAll();
             PutLhsVar();
@@ -239,31 +239,21 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
     else if (iType == sci_strings)
     {
         int ierr = 0;
-        int sizewcFilenames = 0;
-        wchar_t ** wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &sizewcFilenames, &ierr);
+        int sizeFilenames = 0;
+        char ** filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &sizeFilenames, &ierr);
         if (ierr)
         {
             return 0;
         }
 
-        if (sizewcFilenames == 1)
+        if (sizeFilenames == 1)
         {
-            if (diaryExists(wcFilenames[0]))
+            if (diaryExists(filenames[0]))
             {
-                double dID = (double)diaryNew(wcFilenames[0], false);
+                double dID = (double)diaryNew(filenames[0], false);
                 if (dID == -1)
                 {
-                    char *utf_str = wide_string_to_UTF8(wcFilenames[0]);
-                    if (utf_str)
-                    {
-                        Scierror(999, _("%s: error can not create diary: %s.\n"), fname, utf_str);
-                        FREE(utf_str);
-                        utf_str = NULL;
-                    }
-                    else
-                    {
-                        Scierror(999, _("%s: error can not create diary.\n"), fname);
-                    }
+                    Scierror(999, _("%s: error can not create diary: %s.\n"), fname, filenames[0]);
                     return 0;
                 }
 
@@ -279,9 +269,8 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
 
                 if (Lhs == 2)
                 {
-                    wchar_t **wfilenameUsed = new wchar_t*[1];
-                    wfilenameUsed[0] = getDiaryFilename((int)dID);
-                    sciErr = createMatrixOfWideString(pvApiCtx, Rhs + 2, 1, 1, wfilenameUsed);
+                    char* filenameUsed = getDiaryFilename((int)dID);
+                    sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, 1, 1, &filenameUsed);
                     if (sciErr.iErr)
                     {
                         printError(&sciErr, 0);
@@ -290,17 +279,16 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
                     }
 
                     LhsVar(2) = Rhs + 2;
-                    FREE(wfilenameUsed[0]);
-                    delete [] wfilenameUsed;
+                    FREE(filenameUsed);
                 }
             }
             else // diary(filename) exists (close diary)
             {
-                if (diaryClose(wcFilenames[0]))
+                if (diaryClose(filenames[0]))
                 {
-                    if (wcFilenames)
+                    if (filenames)
                     {
-                        freeArrayOfWideString(wcFilenames, 1);
+                        freeArrayOfString(filenames, 1);
                         Scierror(999, _("%s: error can not close diary.\n"), fname);
                         return 0;
                     }
@@ -308,12 +296,12 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
                 LhsVar(1) = 0;
             }
 
-            freeArrayOfWideString(wcFilenames, sizewcFilenames);
+            freeArrayOfString(filenames, sizeFilenames);
             PutLhsVar();
         }
         else
         {
-            freeArrayOfWideString(wcFilenames, sizewcFilenames);
+            freeArrayOfString(filenames, sizeFilenames);
             Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 1);
         }
     }
@@ -327,7 +315,7 @@ static int sci_diary_one_rhs(char *fname, void* pvApiCtx)
 static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
 {
     int ierr = 0;
-    wchar_t *wcArgumentTwo = getInputArgumentTwo(fname, pvApiCtx, &ierr);
+    char *argumentTwo = getInputArgumentTwo(fname, pvApiCtx, &ierr);
     SciErr sciErr;
     int *piAddressVarOne = NULL;
 
@@ -344,11 +332,11 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
         return 0;
     }
 
-    if (wcArgumentTwo)
+    if (argumentTwo)
     {
-        if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_LIST) == 0)
+        if (strcmp(argumentTwo, DIARY_SECOND_ARG_LIST) == 0)
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int m1 = 0, n1 = 0;
             sciErr = getVarDimension(pvApiCtx, piAddressVarOne, &m1, &n1);
             if (sciErr.iErr)
@@ -358,7 +346,7 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
 
-            if ( (m1 == n1) && (n1 == 0) )
+            if ((m1 == n1) && (n1 == 0))
             {
                 // diary() == diary([], "list")
                 return sci_diary_no_rhs(fname, pvApiCtx);
@@ -368,9 +356,9 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 Scierror(999, _("%s: Wrong value for input argument #%d.\n"), fname, 2);
             }
         }
-        else if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_CLOSE) == 0)
+        else if (strcmp(argumentTwo, DIARY_SECOND_ARG_CLOSE) == 0)
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -394,10 +382,10 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
         }
-        else if ( (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_PAUSE) == 0) ||
-                  (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_OFF) == 0) )
+        else if ((strcmp(argumentTwo, DIARY_SECOND_ARG_PAUSE) == 0) ||
+            (strcmp(argumentTwo, DIARY_SECOND_ARG_OFF) == 0))
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -421,10 +409,10 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
         }
-        else if ( (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_RESUME) == 0) ||
-                  (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_ON) == 0) )
+        else if ((strcmp(argumentTwo, DIARY_SECOND_ARG_RESUME) == 0) ||
+            (strcmp(argumentTwo, DIARY_SECOND_ARG_ON) == 0))
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -448,9 +436,9 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
         }
-        else if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_NEW) == 0)
+        else if (strcmp(argumentTwo, DIARY_SECOND_ARG_NEW) == 0)
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -463,8 +451,8 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
             if (iType == sci_strings)
             {
                 return NewByFilenames(fname, pvApiCtx, DIARY_FILTER_INPUT_AND_OUTPUT,
-                                      PREFIX_TIME_FORMAT_UNIX_EPOCH,
-                                      PREFIX_FILTER_NONE, false);
+                    PREFIX_TIME_FORMAT_UNIX_EPOCH,
+                    PREFIX_FILTER_NONE, false);
             }
             else
             {
@@ -472,9 +460,9 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
         }
-        else if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_APPEND) == 0)
+        else if (strcmp(argumentTwo, DIARY_SECOND_ARG_APPEND) == 0)
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -487,8 +475,8 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
             if (iType == sci_strings)
             {
                 return AppendByFilenames(fname, pvApiCtx, DIARY_FILTER_INPUT_AND_OUTPUT,
-                                         PREFIX_TIME_FORMAT_UNIX_EPOCH,
-                                         PREFIX_FILTER_NONE, false);
+                    PREFIX_TIME_FORMAT_UNIX_EPOCH,
+                    PREFIX_FILTER_NONE, false);
             }
             else
             {
@@ -496,9 +484,9 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
         }
-        else if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_EXISTS) == 0)
+        else if (strcmp(argumentTwo, DIARY_SECOND_ARG_EXISTS) == 0)
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             int iType = 0;
             sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
             if (sciErr.iErr)
@@ -524,7 +512,7 @@ static int sci_diary_two_rhs(char *fname, void* pvApiCtx)
         }
         else
         {
-            FREE(wcArgumentTwo);
+            FREE(argumentTwo);
             Scierror(999, _("%s: Wrong value for input argument #%d.\n"), fname, 2);
             return 0;
         }
@@ -541,13 +529,13 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
 {
     int ierr = 0;
     int size_ArgThree = 0;
-    wchar_t **wcArgumentThree = getInputArgumentThree(fname, pvApiCtx, &size_ArgThree, &ierr);
+    char** argumentThree = getInputArgumentThree(fname, pvApiCtx, &size_ArgThree, &ierr);
     if (ierr)
     {
         return 0;
     }
 
-    if (wcArgumentThree)
+    if (argumentThree)
     {
         diary_filter filterMode = DIARY_FILTER_INPUT_AND_OUTPUT;
         diary_prefix_time_format iPrefixMode = PREFIX_TIME_FORMAT_UNIX_EPOCH;
@@ -556,15 +544,15 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
 
         for (int i = 0; i < size_ArgThree; i++)
         {
-            if (wcscmp(wcArgumentThree[i], DIARY_THIRD_ARG_FILTER_COMMAND) == 0)
+            if (strcmp(argumentThree[i], DIARY_THIRD_ARG_FILTER_COMMAND) == 0)
             {
                 filterMode = DIARY_FILTER_ONLY_INPUT; // input only
             }
-            else if (wcscmp(wcArgumentThree[i], DIARY_THIRD_ARG_FILTER_OUTPUT) == 0)
+            else if (strcmp(argumentThree[i], DIARY_THIRD_ARG_FILTER_OUTPUT) == 0)
             {
                 filterMode = DIARY_FILTER_ONLY_OUTPUT; // output only
             }
-            else if (wcscmp(wcArgumentThree[i], DIARY_THIRD_ARG_PREFIX_UNIX_EPOCH) == 0)
+            else if (strcmp(argumentThree[i], DIARY_THIRD_ARG_PREFIX_UNIX_EPOCH) == 0)
             {
                 iPrefixMode = PREFIX_TIME_FORMAT_UNIX_EPOCH;
                 if (iPrefixIoModeFilter == PREFIX_FILTER_NONE)
@@ -572,7 +560,7 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                     iPrefixIoModeFilter = PREFIX_FILTER_INPUT_AND_OUTPUT;
                 }
             }
-            else if (wcscmp(wcArgumentThree[i], DIARY_THIRD_ARG_PREFIX_DEFAULT) == 0)
+            else if (strcmp(argumentThree[i], DIARY_THIRD_ARG_PREFIX_DEFAULT) == 0)
             {
                 iPrefixMode = PREFIX_TIME_FORMAT_ISO_8601;
                 if (iPrefixIoModeFilter == PREFIX_FILTER_NONE)
@@ -580,33 +568,33 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                     iPrefixIoModeFilter = PREFIX_FILTER_INPUT_AND_OUTPUT;
                 }
             }
-            else if (wcscmp(wcArgumentThree[i], DIARY_THIRD_ARG_PREFIX_ONLY_COMMANDS) == 0)
+            else if (strcmp(argumentThree[i], DIARY_THIRD_ARG_PREFIX_ONLY_COMMANDS) == 0)
             {
                 iPrefixIoModeFilter = PREFIX_FILTER_ONLY_INPUT;
             }
-            else if ( (wcscmp(wcArgumentThree[i], DIARY_SECOND_ARG_ON) == 0) || (wcscmp(wcArgumentThree[i], DIARY_SECOND_ARG_RESUME) == 0) )
+            else if ((strcmp(argumentThree[i], DIARY_SECOND_ARG_ON) == 0) || (strcmp(argumentThree[i], DIARY_SECOND_ARG_RESUME) == 0))
             {
                 suspendedDiary = false;
             }
-            else if ( (wcscmp(wcArgumentThree[i], DIARY_SECOND_ARG_OFF) == 0) || (wcscmp(wcArgumentThree[i], DIARY_SECOND_ARG_PAUSE) == 0) )
+            else if ((strcmp(argumentThree[i], DIARY_SECOND_ARG_OFF) == 0) || (strcmp(argumentThree[i], DIARY_SECOND_ARG_PAUSE) == 0))
             {
                 suspendedDiary = true;
             }
             else
             {
-                freeArrayOfWideString(wcArgumentThree, size_ArgThree);
+                freeArrayOfString(argumentThree, size_ArgThree);
                 Scierror(999, _("%s: Wrong value for input argument #%d.\n"), fname, 3);
                 return 0;
             }
         }
-        freeArrayOfWideString(wcArgumentThree, size_ArgThree);
+        freeArrayOfString(argumentThree, size_ArgThree);
 
-        wchar_t *wcArgumentTwo = getInputArgumentTwo(fname, pvApiCtx, &ierr);
+        char* argumentTwo = getInputArgumentTwo(fname, pvApiCtx, &ierr);
         if (ierr)
         {
             return 0;
         }
-        if (wcArgumentTwo)
+        if (argumentTwo)
         {
             int *piAddressVarOne = NULL;
             SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
@@ -617,7 +605,7 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                 return 0;
             }
 
-            if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_NEW) == 0)
+            if (strcmp(argumentTwo, DIARY_SECOND_ARG_NEW) == 0)
             {
                 int iType = 0;
                 sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
@@ -628,8 +616,8 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                     return 0;
                 }
 
-                FREE(wcArgumentTwo);
-                wcArgumentTwo = NULL;
+                FREE(argumentTwo);
+                argumentTwo = NULL;
                 if (iType == sci_strings)
                 {
                     return NewByFilenames(fname, pvApiCtx, filterMode, iPrefixMode, iPrefixIoModeFilter, suspendedDiary);
@@ -640,7 +628,7 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                     return 0;
                 }
             }
-            else if (wcscmp(wcArgumentTwo, DIARY_SECOND_ARG_APPEND) == 0)
+            else if (strcmp(argumentTwo, DIARY_SECOND_ARG_APPEND) == 0)
             {
                 int iType = 0;
                 sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
@@ -651,8 +639,8 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
                     return 0;
                 }
 
-                FREE(wcArgumentTwo);
-                wcArgumentTwo = NULL;
+                FREE(argumentTwo);
+                argumentTwo = NULL;
                 if (iType == sci_strings)
                 {
                     return AppendByFilenames(fname, pvApiCtx, filterMode, iPrefixMode, iPrefixIoModeFilter, suspendedDiary);
@@ -665,8 +653,8 @@ static int sci_diary_three_rhs(char *fname, void* pvApiCtx)
             }
             else
             {
-                FREE(wcArgumentTwo);
-                wcArgumentTwo = NULL;
+                FREE(argumentTwo);
+                argumentTwo = NULL;
                 Scierror(999, _("%s: Wrong value for input argument #%d.\n"), fname, 2);
                 return 0;
             }
@@ -719,11 +707,11 @@ static double *getInputArgumentOneIDs(char *fname, void* pvApiCtx, int *sizeRetu
             return 0;
         }
 
-        if ( (m1 == 1) || (n1 == 1) )
+        if ((m1 == 1) || (n1 == 1))
         {
             *sizeReturnedArray = m1 * n1;
         }
-        else if ( (m1 == 0) || (n1 == 0) )
+        else if ((m1 == 0) || (n1 == 0))
         {
             *sizeReturnedArray = 0;
             *ierror = 2;
@@ -744,9 +732,9 @@ static double *getInputArgumentOneIDs(char *fname, void* pvApiCtx, int *sizeRetu
     return IDs;
 }
 /*--------------------------------------------------------------------------*/
-static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror)
+static char** getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror)
 {
-    wchar_t** wcFilenames = NULL;
+    char** filenames = NULL;
     *sizeReturnedArray = 0;
     *ierror = 0;
 
@@ -787,7 +775,7 @@ static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *
             Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 1);
             *ierror = 1;
         }
-        else if ( (m1 == 1) || (n1 == 1) )
+        else if ((m1 == 1) || (n1 == 1))
         {
             lenStVarOne = (int *)MALLOC(sizeof(int) * (m1 * n1));
             if (lenStVarOne == NULL)
@@ -797,7 +785,7 @@ static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *
             }
             else
             {
-                sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarOne, &m1, &n1, lenStVarOne, wcFilenames);
+                sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne, &m1, &n1, lenStVarOne, filenames);
                 if (sciErr.iErr)
                 {
                     FREE(lenStVarOne);
@@ -807,8 +795,8 @@ static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *
                     return NULL;
                 }
 
-                wcFilenames = (wchar_t **)MALLOC(sizeof(wchar_t *) * (m1 * n1));
-                if (wcFilenames == NULL)
+                filenames = (char**)MALLOC(sizeof(char*) * (m1 * n1));
+                if (filenames == NULL)
                 {
                     Scierror(999, _("%s: Memory allocation error.\n"), fname);
                     *ierror = 1;
@@ -817,15 +805,15 @@ static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *
                 {
                     for (int i = 0; i < m1 * n1; i++)
                     {
-                        wcFilenames[i] = (wchar_t*)MALLOC(sizeof(wchar_t) * (lenStVarOne[i] + 1));
-                        if (wcFilenames[i] == NULL)
+                        filenames[i] = (char*)MALLOC(sizeof(char) * (lenStVarOne[i] + 1));
+                        if (filenames[i] == NULL)
                         {
                             Scierror(999, _("%s: Memory allocation error.\n"), fname);
                             *ierror = 1;
                         }
                     }
 
-                    sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarOne, &m1, &n1, lenStVarOne, wcFilenames);
+                    sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne, &m1, &n1, lenStVarOne, filenames);
                     FREE(lenStVarOne);
                     if (sciErr.iErr)
                     {
@@ -850,12 +838,12 @@ static wchar_t **getInputArgumentOneFilenames(char *fname, void* pvApiCtx, int *
         Scierror(999, _("%s: Wrong type for input argument #%d: string expected.\n"), fname, 1);
         *ierror = 1;
     }
-    return wcFilenames;
+    return filenames;
 }
 /*--------------------------------------------------------------------------*/
-static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
+static char* getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
 {
-    wchar_t *wcInputArgumentTwo = NULL;
+    char* inputArgumentTwo = NULL;
     *ierror = 0;
 
     int m2 = 0, n2 = 0;
@@ -889,7 +877,7 @@ static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
             return 0;
         }
 
-        if ( (m2 != n2) && (n2 != 1) )
+        if ((m2 != n2) && (n2 != 1))
         {
             Scierror(999, _("%s: Wrong size for input argument #%d: string expected.\n"), fname, 2);
             *ierror = 1;
@@ -897,7 +885,7 @@ static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
         else
         {
             // get length lenStVarTwo
-            sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarTwo, &m2, &n2, &lenStVarTwo, &wcInputArgumentTwo);
+            sciErr = getMatrixOfString(pvApiCtx, piAddressVarTwo, &m2, &n2, &lenStVarTwo, &inputArgumentTwo);
             if (sciErr.iErr)
             {
                 printError(&sciErr, 0);
@@ -905,15 +893,15 @@ static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
                 return 0;
             }
 
-            wcInputArgumentTwo = (wchar_t*)MALLOC(sizeof(wchar_t) * (lenStVarTwo + 1));
+            inputArgumentTwo = (char*)MALLOC(sizeof(char) * (lenStVarTwo + 1));
 
-            if (wcInputArgumentTwo == NULL)
+            if (inputArgumentTwo == NULL)
             {
                 Scierror(999, _("%s: Memory allocation error.\n"), fname);
                 *ierror = 1;
             }
 
-            sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarTwo, &m2, &n2, &lenStVarTwo, &wcInputArgumentTwo);
+            sciErr = getMatrixOfString(pvApiCtx, piAddressVarTwo, &m2, &n2, &lenStVarTwo, &inputArgumentTwo);
             if (sciErr.iErr)
             {
                 printError(&sciErr, 0);
@@ -927,12 +915,12 @@ static wchar_t *getInputArgumentTwo(char *fname, void* pvApiCtx, int *ierror)
         Scierror(999, _("%s: Wrong type for input argument #%d: string expected.\n"), fname, 2);
         *ierror = 1;
     }
-    return wcInputArgumentTwo;
+    return inputArgumentTwo;
 }
 /*--------------------------------------------------------------------------*/
-static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror)
+static char** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeReturnedArray, int *ierror)
 {
-    wchar_t** wcInputArgumentThree = NULL;
+    char** inputArgumentThree = NULL;
     *sizeReturnedArray = 0;
     *ierror = 0;
 
@@ -973,7 +961,7 @@ static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeRet
             Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 3);
             *ierror = 1;
         }
-        else if ( (m3 == 1) || (n3 == 1) )
+        else if ((m3 == 1) || (n3 == 1))
         {
             lenStVarThree = (int *)MALLOC(sizeof(int) * (m3 * n3));
             if (lenStVarThree == NULL)
@@ -983,7 +971,7 @@ static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeRet
             }
             else
             {
-                sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarThree, &m3, &n3, lenStVarThree, wcInputArgumentThree);
+                sciErr = getMatrixOfString(pvApiCtx, piAddressVarThree, &m3, &n3, lenStVarThree, inputArgumentThree);
                 if (sciErr.iErr)
                 {
                     FREE(lenStVarThree);
@@ -993,8 +981,8 @@ static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeRet
                     return NULL;
                 }
 
-                wcInputArgumentThree = (wchar_t **)MALLOC(sizeof(wchar_t *) * (m3 * n3));
-                if (wcInputArgumentThree == NULL)
+                inputArgumentThree = (char**)MALLOC(sizeof(char*) * (m3 * n3));
+                if (inputArgumentThree == NULL)
                 {
                     FREE(lenStVarThree);
                     Scierror(999, _("%s: Memory allocation error.\n"), fname);
@@ -1004,10 +992,10 @@ static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeRet
                 {
                     for (int i = 0; i < m3 * n3; i++)
                     {
-                        wcInputArgumentThree[i] = (wchar_t*)MALLOC(sizeof(wchar_t) * (lenStVarThree[i] + 1));
+                        inputArgumentThree[i] = (char*)MALLOC(sizeof(char) * (lenStVarThree[i] + 1));
                     }
 
-                    sciErr = getMatrixOfWideString(pvApiCtx, piAddressVarThree, &m3, &n3, lenStVarThree, wcInputArgumentThree);
+                    sciErr = getMatrixOfString(pvApiCtx, piAddressVarThree, &m3, &n3, lenStVarThree, inputArgumentThree);
                     FREE(lenStVarThree);
                     if (sciErr.iErr)
                     {
@@ -1031,7 +1019,7 @@ static wchar_t** getInputArgumentThree(char *fname, void* pvApiCtx, int *sizeRet
         Scierror(999, _("%s: Wrong type for input argument #%d: string expected.\n"), fname, 3);
         *ierror = 1;
     }
-    return wcInputArgumentThree;
+    return inputArgumentThree;
 }
 /*--------------------------------------------------------------------------*/
 static int checkExistByIDs(char *fname, void* pvApiCtx, double *IDs, int size_IDs)
@@ -1051,13 +1039,13 @@ static int checkExistByIDs(char *fname, void* pvApiCtx, double *IDs, int size_ID
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-static int checkExistByFilenames(char *fname, void* pvApiCtx, wchar_t **wcFilenames, int size_IDs)
+static int checkExistByFilenames(char *fname, void* pvApiCtx, char** filenames, int size_IDs)
 {
-    if (wcFilenames)
+    if (filenames)
     {
         for (int i = 0; i < size_IDs; i++)
         {
-            if (diaryExists(wcFilenames[i]))
+            if (diaryExists(filenames[i]))
             {
                 Scierror(999, _("%s: Wrong value for input argument #%d: diary filename not exists.\n"), fname, 1);
                 return 1;
@@ -1070,34 +1058,34 @@ static int checkExistByFilenames(char *fname, void* pvApiCtx, wchar_t **wcFilena
 /*--------------------------------------------------------------------------*/
 static int CloseByFilenames(char *fname, void* pvApiCtx)
 {
-    wchar_t **wcFilenames = NULL;
+    char **filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
 
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
     }
 
-    ierr = checkExistByFilenames(fname, pvApiCtx, wcFilenames, dIDs_size);
+    ierr = checkExistByFilenames(fname, pvApiCtx, filenames, dIDs_size);
     if (ierr)
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         return 0;
     }
 
     for (int i = 0; i < dIDs_size; i++)
     {
-        if (diaryClose(wcFilenames[i]))
+        if (diaryClose(filenames[i]))
         {
-            freeArrayOfWideString(wcFilenames, dIDs_size);
+            freeArrayOfString(filenames, dIDs_size);
             Scierror(999, _("%s: Wrong value for input argument #%d: error can not close diary.\n"), fname);
             return 0;
         }
     }
 
-    freeArrayOfWideString(wcFilenames, dIDs_size);
+    freeArrayOfString(filenames, dIDs_size);
     PutLhsVar();
     return 0;
 }
@@ -1142,34 +1130,34 @@ static int CloseByIds(char *fname, void* pvApiCtx)
 /*--------------------------------------------------------------------------*/
 static int PauseByFilenames(char *fname, void* pvApiCtx)
 {
-    wchar_t **wcFilenames = NULL;
+    char** filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
 
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
     }
 
-    ierr = checkExistByFilenames(fname, pvApiCtx, wcFilenames, dIDs_size);
+    ierr = checkExistByFilenames(fname, pvApiCtx, filenames, dIDs_size);
     if (ierr)
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         return 0;
     }
 
     for (int i = 0; i < dIDs_size; i++)
     {
-        if (diaryPause(wcFilenames[i]))
+        if (diaryPause(filenames[i]))
         {
-            freeArrayOfWideString(wcFilenames, dIDs_size);
+            freeArrayOfString(filenames, dIDs_size);
             Scierror(999, _("%s: Wrong value for input argument #%d: error can not pause diary.\n"), fname);
             return 0;
         }
     }
 
-    freeArrayOfWideString(wcFilenames, dIDs_size);
+    freeArrayOfString(filenames, dIDs_size);
 
     PutLhsVar();
     return 0;
@@ -1216,33 +1204,33 @@ static int PauseByIds(char *fname, void* pvApiCtx)
 /*--------------------------------------------------------------------------*/
 static int ResumeByFilenames(char *fname, void* pvApiCtx)
 {
-    wchar_t **wcFilenames = NULL;
+    char** filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
     }
 
-    ierr = checkExistByFilenames(fname, pvApiCtx, wcFilenames, dIDs_size);
+    ierr = checkExistByFilenames(fname, pvApiCtx, filenames, dIDs_size);
     if (ierr)
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         return 0;
     }
 
     for (int i = 0; i < dIDs_size; i++)
     {
-        if (diaryResume(wcFilenames[i]))
+        if (diaryResume(filenames[i]))
         {
-            freeArrayOfWideString(wcFilenames, dIDs_size);
+            freeArrayOfString(filenames, dIDs_size);
             Scierror(999, _("%s: Wrong value for input argument #%d: error can not resume diary.\n"), fname);
             return 0;
         }
     }
 
-    freeArrayOfWideString(wcFilenames, dIDs_size);
+    freeArrayOfString(filenames, dIDs_size);
 
     PutLhsVar();
 
@@ -1290,10 +1278,10 @@ static int ResumeByIds(char *fname, void* pvApiCtx)
 /*--------------------------------------------------------------------------*/
 static int ExistByFilenames(char *fname, void* pvApiCtx)
 {
-    wchar_t **wcFilenames = NULL;
+    char** filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
@@ -1302,24 +1290,24 @@ static int ExistByFilenames(char *fname, void* pvApiCtx)
     int *resultExist = (int*)MALLOC(sizeof(int) * dIDs_size);
     if (resultExist == NULL)
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         Scierror(999, _("%s: Memory allocation error.\n"), fname);
         return 0;
     }
 
     for (int i = 0; i < dIDs_size; i++)
     {
-        int bExists = diaryExists(wcFilenames[i]);
-        if ( bExists == 0)
+        int bExists = diaryExists(filenames[i]);
+        if (bExists == 0)
         {
-            resultExist[i]  = TRUE;
+            resultExist[i] = TRUE;
         }
         else
         {
-            resultExist[i]  = FALSE;
+            resultExist[i] = FALSE;
         }
     }
-    freeArrayOfWideString(wcFilenames, dIDs_size);
+    freeArrayOfString(filenames, dIDs_size);
 
     SciErr sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, 1, dIDs_size, resultExist);
     if (sciErr.iErr)
@@ -1359,13 +1347,13 @@ static int ExistByIds(char *fname, void* pvApiCtx)
     for (int i = 0; i < dIDs_size; i++)
     {
         int bExists = diaryExists((int)dIDs[i]);
-        if ( bExists == 0)
+        if (bExists == 0)
         {
-            resultExist[i]  = TRUE;
+            resultExist[i] = TRUE;
         }
         else
         {
-            resultExist[i]  = FALSE;
+            resultExist[i] = FALSE;
         }
     }
 
@@ -1386,17 +1374,17 @@ static int ExistByIds(char *fname, void* pvApiCtx)
 }
 /*--------------------------------------------------------------------------*/
 static int AppendByFilenames(char *fname, void* pvApiCtx,
-                             diary_filter filterMode,
-                             diary_prefix_time_format prefixMode,
-                             diary_prefix_time_filter prefixModeFilter,
-                             bool suspended)
+    diary_filter filterMode,
+    diary_prefix_time_format prefixMode,
+    diary_prefix_time_filter prefixModeFilter,
+    bool suspended)
 {
     SciErr sciErr;
-    wchar_t **wcFilenames = NULL;
+    char** filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
 
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
@@ -1404,25 +1392,15 @@ static int AppendByFilenames(char *fname, void* pvApiCtx,
 
     if (dIDs_size == 1)
     {
-        double dID = (double)diaryAppend(wcFilenames[0]);
+        double dID = (double)diaryAppend(filenames[0]);
         if (dID == -1)
         {
-            char *utf_str = wide_string_to_UTF8(wcFilenames[0]);
-            if (utf_str)
-            {
-                Scierror(999, _("%s: error can not create diary: %s.\n"), fname, utf_str);
-                FREE(utf_str);
-                utf_str = NULL;
-            }
-            else
-            {
-                Scierror(999, _("%s: error can not create diary.\n"), fname);
-            }
-            freeArrayOfWideString(wcFilenames, dIDs_size);
+            Scierror(999, _("%s: error can not create diary: %s.\n"), fname, filenames[0]);
+            freeArrayOfString(filenames, dIDs_size);
             return 0;
         }
 
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
 
         diarySetFilterMode((int)dID, filterMode);
         diarySetPrefixMode((int)dID, prefixMode);
@@ -1444,9 +1422,8 @@ static int AppendByFilenames(char *fname, void* pvApiCtx,
 
         if (Lhs == 2)
         {
-            wchar_t **wfilenameUsed = new wchar_t*[1];
-            wfilenameUsed[0] = getDiaryFilename((int)dID);
-            sciErr = createMatrixOfWideString(pvApiCtx, Rhs + 2, 1, 1, wfilenameUsed);
+            char* filenameUsed = getDiaryFilename((int)dID);
+            sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, 1, 1, &filenameUsed);
             if (sciErr.iErr)
             {
                 printError(&sciErr, 0);
@@ -1455,13 +1432,13 @@ static int AppendByFilenames(char *fname, void* pvApiCtx,
             }
 
             LhsVar(2) = Rhs + 2;
-            freeArrayOfWideString(wfilenameUsed, 1);
+            freeArrayOfString(&filenameUsed, 1);
         }
         PutLhsVar();
     }
     else
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         Scierror(999, _("%s: Wrong size for input argument #%d: string expected.\n"), fname, 1);
     }
 
@@ -1469,16 +1446,16 @@ static int AppendByFilenames(char *fname, void* pvApiCtx,
 }
 /*--------------------------------------------------------------------------*/
 static int NewByFilenames(char *fname, void* pvApiCtx,
-                          diary_filter filterMode,
-                          diary_prefix_time_format prefixMode,
-                          diary_prefix_time_filter prefixModeFilter,
-                          bool suspended)
+    diary_filter filterMode,
+    diary_prefix_time_format prefixMode,
+    diary_prefix_time_filter prefixModeFilter,
+    bool suspended)
 {
-    wchar_t **wcFilenames = NULL;
+    char** filenames = NULL;
     int dIDs_size = 0;
     int ierr = 0;
 
-    wcFilenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
+    filenames = getInputArgumentOneFilenames(fname, pvApiCtx, &dIDs_size, &ierr);
     if (ierr)
     {
         return 0;
@@ -1486,25 +1463,15 @@ static int NewByFilenames(char *fname, void* pvApiCtx,
 
     if (dIDs_size == 1)
     {
-        double dID = (double)diaryNew(wcFilenames[0], true);
+        double dID = (double)diaryNew(filenames[0], true);
         if (dID == -1)
         {
-            char *utf_str = wide_string_to_UTF8(wcFilenames[0]);
-            if (utf_str)
-            {
-                Scierror(999, _("%s: error can not create diary: %s.\n"), fname, utf_str);
-                FREE(utf_str);
-                utf_str = NULL;
-            }
-            else
-            {
-                Scierror(999, _("%s: error can not create diary.\n"), fname);
-            }
-            freeArrayOfWideString(wcFilenames, dIDs_size);
+            Scierror(999, _("%s: error can not create diary: %s.\n"), fname, filenames[0]);
+            freeArrayOfString(filenames, dIDs_size);
             return 0;
         }
 
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
 
         diarySetFilterMode((int)dID, filterMode);
         diarySetPrefixMode((int)dID, prefixMode);
@@ -1519,9 +1486,8 @@ static int NewByFilenames(char *fname, void* pvApiCtx,
 
         if (Lhs == 2)
         {
-            wchar_t **wfilenameUsed = new wchar_t*[1];
-            wfilenameUsed[0] = getDiaryFilename((int)dID);
-            sciErr = createMatrixOfWideString(pvApiCtx, Rhs + 2, 1, 1, wfilenameUsed);
+            char* filenameUsed = getDiaryFilename((int)dID);
+            sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, 1, 1, &filenameUsed);
             if (sciErr.iErr)
             {
                 printError(&sciErr, 0);
@@ -1530,14 +1496,13 @@ static int NewByFilenames(char *fname, void* pvApiCtx,
             }
 
             LhsVar(2) = Rhs + 2;
-            FREE(wfilenameUsed[0]);
-            delete [] wfilenameUsed;
+            FREE(filenameUsed);
         }
         PutLhsVar();
     }
     else
     {
-        freeArrayOfWideString(wcFilenames, dIDs_size);
+        freeArrayOfString(filenames, dIDs_size);
         Scierror(999, _("%s: Wrong size for input argument #%d: string expected.\n"), fname, 1);
     }
 
index 4c4e85c..bbd1033 100644 (file)
@@ -34,7 +34,7 @@ types::Function::ReturnValue sci_disp(types::typed_list &in, int _iRetCount, typ
 
     for (it = in.rbegin() ; it != in.rend() ; it++)
     {
-        scilabForcedWriteW(L"\n");
+        scilabForcedWrite("\n");
         if (VariableToString(*it, SPACES_LIST) == types::Function::Error)
         {
             return types::Function::Error;
index 67d2e45..c55074b 100644 (file)
@@ -50,17 +50,16 @@ types::Callable::ReturnValue sci_mprintf(types::typed_list &in, int _iRetCount,
     {
         if (in[i]->isDouble() == false && in[i]->isString() == false)
         {
-            std::wstring wstFuncName = L"%" + in[i]->getShortTypeStr() + L"_mprintf";
-            return Overload::call(wstFuncName, in, _iRetCount, out);
+            std::string stFuncName = "%" + in[i]->getShortTypeStr() + "_mprintf";
+            return Overload::call(stFuncName, in, _iRetCount, out);
         }
     }
 
     int iOutputRows = 0;
     int iNewLine = 0;
-    wchar_t* pwstInput = in[0]->getAs<types::String>()->get()[0];
-    wchar_t** pwstOutput = scilab_sprintf("mprintf", pwstInput, in, &iOutputRows, &iNewLine);
-
-    if (pwstOutput == NULL)
+    char* pstInput = in[0]->getAs<types::String>()->get()[0];
+    char** pstOutput = scilab_sprintf("mprintf", pstInput, in, &iOutputRows, &iNewLine);
+    if (pstOutput == NULL)
     {
         //error already set by scilab_sprintf
         return types::Function::Error;
@@ -70,21 +69,21 @@ types::Callable::ReturnValue sci_mprintf(types::typed_list &in, int _iRetCount,
     {
         if (i)
         {
-            scilabForcedWriteW(L"\n");
+            scilabForcedWrite("\n");
         }
 
-        scilabForcedWriteW(pwstOutput[i]);
+        scilabForcedWrite(pstOutput[i]);
 
         fflush(NULL);
-        FREE(pwstOutput[i]);
+        FREE(pstOutput[i]);
     }
 
     if (iNewLine)
     {
-        scilabForcedWriteW(L"\n");
+        scilabForcedWrite("\n");
     }
 
-    FREE(pwstOutput);
+    FREE(pstOutput);
     return types::Function::OK;
 }
 /*--------------------------------------------------------------------------*/
index 37b5961..ad2bfff 100644 (file)
@@ -44,24 +44,24 @@ types::Callable::ReturnValue sci_msprintf(types::typed_list &in, int _iRetCount,
     {
         if (in[i]->isDouble() == false && in[i]->isString() == false)
         {
-            std::wstring wstFuncName = L"%" + in[i]->getShortTypeStr() + L"_msprintf";
-            return Overload::call(wstFuncName, in, _iRetCount, out);
+            std::string stFuncName = "%" + in[i]->getShortTypeStr() + "_msprintf";
+            return Overload::call(stFuncName, in, _iRetCount, out);
         }
     }
 
     int iOutputRows = 0;
     int iNewLine = 0;
-    wchar_t* pwstInput = in[0]->getAs<types::String>()->get()[0];
-    wchar_t** pwstOutput = scilab_sprintf("msprintf", pwstInput, in, &iOutputRows, &iNewLine);
+    char* pstInput = in[0]->getAs<types::String>()->get()[0];
+    char** pstOutput = scilab_sprintf("msprintf", pstInput, in, &iOutputRows, &iNewLine);
 
-    if (pwstOutput == NULL)
+    if (pstOutput == NULL)
     {
         return types::Function::Error;
     }
 
     types::String* pOut = new types::String(iOutputRows, 1);
-    pOut->set(pwstOutput);
-    freeArrayOfWideString(pwstOutput, iOutputRows);
+    pOut->set(pstOutput);
+    freeArrayOfString(pstOutput, iOutputRows);
     out.push_back(pOut);
     return types::Function::OK;
 }
index 7874132..0605d62 100644 (file)
@@ -133,7 +133,7 @@ int diaryClose(int _iId)
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryClose(char *filename)
+int diaryClose(const char *filename)
 {
     if (SCIDIARY)
     {
@@ -169,7 +169,7 @@ int diaryPause(int _iId)
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryPause(char *filename)
+int diaryPause(const char *filename)
 {
     if (SCIDIARY)
     {
@@ -203,7 +203,7 @@ int diaryResume(int _iId)
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryResume(char *filename)
+int diaryResume(const char *filename)
 {
     if (SCIDIARY)
     {
@@ -229,7 +229,7 @@ int diaryExists(int _iId)
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryExists(char *filename)
+int diaryExists(const char *filename)
 {
     if (SCIDIARY)
     {
@@ -241,7 +241,7 @@ int diaryExists(char *filename)
     return 1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryNew(char *filename, bool autorename)
+int diaryNew(const char *filename, bool autorename)
 {
     createDiaryManager();
 
@@ -253,7 +253,7 @@ int diaryNew(char *filename, bool autorename)
     return -1;
 }
 /*--------------------------------------------------------------------------*/
-int diaryAppend(char *filename)
+int diaryAppend(const char *filename)
 {
     createDiaryManager();
     if (SCIDIARY)
index 2398603..9c47ba8 100644 (file)
@@ -66,7 +66,7 @@ OUTPUT_STREAM_IMPEXP int diaryClose(int _iId);
 * @param[in] filename
 * @return 0 (OK) 1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryClose(char* filename);
+OUTPUT_STREAM_IMPEXP int diaryClose(const char* filename);
 
 /**
 * Pause all diaries
@@ -86,7 +86,7 @@ OUTPUT_STREAM_IMPEXP int diaryPause(int _iId);
 * @param[in] filename
 * @return 0 (OK) 1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryPause(char* filename);
+OUTPUT_STREAM_IMPEXP int diaryPause(const char* filename);
 
 /**
 * Resume All diaries
@@ -106,7 +106,7 @@ OUTPUT_STREAM_IMPEXP int diaryResume(int _iId);
 * @param[in] filename
 * @return 0 (OK) 1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryResume(char* filename);
+OUTPUT_STREAM_IMPEXP int diaryResume(const char* filename);
 
 /**
 * check if a ID exists
@@ -120,21 +120,21 @@ OUTPUT_STREAM_IMPEXP int diaryExists(int _iId);
 * @param[in] filename
 * @return 0 (OK) 1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryExists(char* filename);
+OUTPUT_STREAM_IMPEXP int diaryExists(const char* filename);
 
 /**
 * create a new diary
 * @param[in] filename
 * @return ID or -1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryNew(char* filename, bool autorename);
+OUTPUT_STREAM_IMPEXP int diaryNew(const char* filename, bool autorename);
 
 /**
 * append to a diary
 * @param[in] filename
 * @return ID or -1 (NOK)
 */
-OUTPUT_STREAM_IMPEXP int diaryAppend(char* filename);
+OUTPUT_STREAM_IMPEXP int diaryAppend(const char* filename);
 
 /*
 * Set filter mode (input, output)
index c52fd68..80850c3 100644 (file)
@@ -31,23 +31,23 @@ extern "C"
 #include "os_string.h"
 }
 
-static wchar_t* replaceAndCountLines(const wchar_t* _pwstInput, int* _piLines, int* _piNewLine);
-static wchar_t* addl(TokenDef* token);
+static char* replaceAndCountLines(const char* _pstInput, int* _piLines, int* _piNewLine);
+static char* addl(TokenDef* token);
 static void updatel(TokenDef* token);
 
-#define NanString L"Nan"
-#define InfString L"Inf"
-#define NegInfString L"-Inf"
+#define NanString "Nan"
+#define InfString "Inf"
+#define NegInfString "-Inf"
 
-wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput, types::typed_list &in, int* _piOutputRows, int* _piNewLine)
+char** scilab_sprintf(const std::string& funcname, const char* _pwstInput, types::typed_list &in, int* _piOutputRows, int* _piNewLine)
 {
     /* Force Windows display to have two-digit exponent. */
 #ifdef _MSC_VER
     _set_output_format(_TWO_DIGIT_EXPONENT);
 #endif
-    wchar_t** pwstOutput = nullptr;
+    char** pstOutput = nullptr;
     int rhs = in.size();
-    wchar_t* pwstFirstOutput = nullptr;
+    char* pstFirstOutput = nullptr;
     *_piNewLine = 0;
     int col = 0;
 
@@ -74,7 +74,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
     //\n \n\r \r \t to string
     //find number of lines
     // replace \\n \\t... by \n \t...
-    pwstFirstOutput = replaceAndCountLines(_pwstInput, _piOutputRows, _piNewLine);
+    pstFirstOutput = replaceAndCountLines(_pwstInput, _piOutputRows, _piNewLine);
 
     std::list<TokenDef*> token;
 
@@ -82,29 +82,29 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
     size_t end = 0;
     bool finish = false;
 
-    wchar_t* pwstStart = pwstFirstOutput;
+    char* pstStart = pstFirstOutput;
     bool percentpercent = false;
 
     while (finish == false)
     {
-        wchar_t* pwstEnd = wcsstr(pwstStart + (token.size() == 0 ? 0 : 1), L"%");
-        start = pwstStart - pwstFirstOutput;
+        char* pstEnd = strstr(pstStart + (token.size() == 0 ? 0 : 1), "%");
+        start = pstStart - pstFirstOutput;
         percentpercent = false;
-        if (pwstEnd != nullptr)
+        if (pstEnd != nullptr)
         {
-            if (token.size() && pwstStart[1] == L'%')
+            if (token.size() && pstStart[1] == '%')
             {
                 //manage "%%"
-                pwstEnd = wcsstr(pwstEnd + 1, L"%");
-                if (pwstEnd == nullptr)
+                pstEnd = strstr(pstEnd + 1, "%");
+                if (pstEnd == nullptr)
                 {
                     //end of string
-                    end = wcslen(pwstFirstOutput);
+                    end = strlen(pstFirstOutput);
                     finish = true;
                 }
                 else
                 {
-                    end = pwstEnd - pwstFirstOutput;
+                    end = pstEnd - pstFirstOutput;
                 }
 
                 // skip the first %
@@ -113,37 +113,37 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
             }
             else
             {
-                end = pwstEnd - pwstFirstOutput;
+                end = pstEnd - pstFirstOutput;
             }
         }
         else
         {
             //end of string
-            end = wcslen(pwstFirstOutput);
+            end = strlen(pstFirstOutput);
             finish = true;
         }
 
         TokenDef* tok = new TokenDef;
-        tok->pwstToken = new wchar_t[end - start + 1];
-        wcsncpy(tok->pwstToken, pwstFirstOutput + start, end - start);
-        tok->pwstToken[end - start] = L'\0';
+        tok->pstToken = new char[end - start + 1];
+        strncpy(tok->pstToken, pstFirstOutput + start, end - start);
+        tok->pstToken[end - start] = L'\0';
         token.push_back(tok);
 
-        wchar_t* pwstPercent = wcsstr(tok->pwstToken, L"%");
-        if (pwstPercent != nullptr && percentpercent == false)
+        char* pstPercent = strstr(tok->pstToken, "%");
+        if (pstPercent != nullptr && percentpercent == false)
         {
             //looking for flags
-            if (*(pwstPercent + 1) == L'-' ||
-                    *(pwstPercent + 1) == L'+' ||
-                    *(pwstPercent + 1) == L' ' ||
-                    *(pwstPercent + 1) == L'#' ||
-                    *(pwstPercent + 1) == L'0')
+            if (*(pstPercent + 1) == '-' ||
+                    *(pstPercent + 1) == '+' ||
+                    *(pstPercent + 1) == ' ' ||
+                    *(pstPercent + 1) == '#' ||
+                    *(pstPercent + 1) == '0')
             {
-                pwstPercent++;
+                pstPercent++;
             }
 
             //looking for width
-            if (*(pwstPercent + 1) == L'*')
+            if (*(pstPercent + 1) == '*')
             {
                 if (itPos == inPos.end())
                 {
@@ -166,35 +166,35 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                 tok->width = static_cast<int>(dbl->get()[0]);
                 tok->widthStar = true;
                 ++itPos;
-                ++pwstPercent;
+                ++pstPercent;
             }
             else
             {
                 //number
-                if (iswdigit(*(pwstPercent + 1)))
+                if (isdigit(*(pstPercent + 1)))
                 {
-                    tok->width = os_wtoi(pwstPercent + 1);
-                    while (iswdigit(*(pwstPercent + 1)))
+                    tok->width = atoi(pstPercent + 1);
+                    while (isdigit(*(pstPercent + 1)))
                     {
-                        pwstPercent++;
+                        pstPercent++;
                     }
                 }
             }
 
             //looking for precision
-            if (*(pwstPercent + 1) == L'.')
+            if (*(pstPercent + 1) == '.')
             {
-                pwstPercent++;
+                pstPercent++;
 
-                if (iswdigit(*(pwstPercent + 1)))
+                if (isdigit(*(pstPercent + 1)))
                 {
-                    tok->prec = os_wtoi(pwstPercent + 1);
-                    while (iswdigit(*(pwstPercent + 1)))
+                    tok->prec = atoi(pstPercent + 1);
+                    while (isdigit(*(pstPercent + 1)))
                     {
-                        pwstPercent++;
+                        pstPercent++;
                     }
                 }
-                else if (*(pwstPercent + 1) == L'*')
+                else if (*(pstPercent + 1) == '*')
                 {
                     if (itPos == inPos.end())
                     {
@@ -216,30 +216,30 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     tok->prec = static_cast<int>(dbl->get()[0]);
                     tok->precStar = true;
                     ++itPos;
-                    ++pwstPercent;
+                    ++pstPercent;
                 }
             }
 
             //looking for length
-            if (*(pwstPercent + 1) == L'h' ||
-                    *(pwstPercent + 1) == L'l' ||
-                    *(pwstPercent + 1) == L'L')
+            if (*(pstPercent + 1) == 'h' ||
+                    *(pstPercent + 1) == 'l' ||
+                    *(pstPercent + 1) == 'L')
             {
                 tok->length = true;
-                pwstPercent++;
+                pstPercent++;
             }
 
-            wchar_t wcType = *(pwstPercent + 1);
-            tok->typePos = (pwstPercent + 1) - tok->pwstToken;
+            char type = *(pstPercent + 1);
+            tok->typePos = (pstPercent + 1) - tok->pstToken;
 
-            switch (wcType)
+            switch (type)
             {
-                case L'i': //integer
-                case L'd': //integer
+                case 'i': //integer
+                case 'd': //integer
                 {
                     if (itPos == inPos.end())
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -249,7 +249,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     int c = (*itPos).second;
                     if (in[p]->getType() != types::InternalType::ScilabDouble)
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -261,14 +261,14 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     ++itPos;
                     break;
                 }
-                case L'o': //octal
-                case L'u': //unsigned
-                case L'x': //hex
-                case L'X': //HEX
+                case 'o': //octal
+                case 'u': //unsigned
+                case 'x': //hex
+                case 'X': //HEX
                 {
                     if (itPos == inPos.end())
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -278,7 +278,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     int c = (*itPos).second;
                     if (in[p]->getType() != types::InternalType::ScilabDouble)
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -290,15 +290,15 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     ++itPos;
                     break;
                 }
-                case L'f': //float
-                case L'e': //exp
-                case L'E': //EXP
-                case L'g': //shorter between float or exp
-                case L'G': //shorter between float or EXP
+                case 'f': //float
+                case 'e': //exp
+                case 'E': //EXP
+                case 'g': //shorter between float or exp
+                case 'G': //shorter between float or EXP
                 {
                     if (itPos == inPos.end())
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -308,7 +308,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     int c = (*itPos).second;
                     if (in[p]->getType() != types::InternalType::ScilabDouble)
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -320,12 +320,12 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     ++itPos;
                     break;
                 }
-                case L's':
-                case L'c':
+                case 's':
+                case 'c':
                 {
                     if (itPos == inPos.end())
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -335,7 +335,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     int c = (*itPos).second;
                     if (in[p]->getType() != types::InternalType::ScilabString)
                     {
-                        FREE(pwstFirstOutput);
+                        FREE(pstFirstOutput);
                         Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                         *_piOutputRows = 0;
                         return nullptr;
@@ -353,7 +353,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     break;
                 }
                 default:
-                    FREE(pwstFirstOutput);
+                    FREE(pstFirstOutput);
                     Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), funcname.data());
                     *_piOutputRows = 0;
                     return nullptr;
@@ -362,11 +362,11 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
         }
 
         //continue
-        pwstStart = pwstEnd;
+        pstStart = pstEnd;
     }
 
-    FREE(pwstFirstOutput);
-    pwstFirstOutput = nullptr;
+    FREE(pstFirstOutput);
+    pstFirstOutput = nullptr;
 
     int iLoop = 1;
     if (token.size() > 1)
@@ -392,12 +392,12 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
     //    return nullptr;
     //}
 
-    std::wostringstream oFirstOutput;
+    std::ostringstream oFirstOutput;
     for (int j = 0; j < iLoop; j++)
     {
         //copy the 0th token
         TokenDef* f = token.front();
-        oFirstOutput << f->pwstToken;
+        oFirstOutput << f->pstToken;
 
         //start at 1, the 0th is always without %
         std::list<TokenDef*>::iterator it = std::next(token.begin());
@@ -408,7 +408,7 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
             {
                 case types::InternalType::ScilabDouble:
                 {
-                    wchar_t pwstTemp[bsiz];
+                    char pstTemp[bsiz];
                     double dblVal = in[tok->pos]->getAs<types::Double>()->get(j, tok->col);
 
                     if (std::isfinite(dblVal))
@@ -417,51 +417,51 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, tok->prec, dblVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, tok->prec, dblVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, dblVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, dblVal);
                             }
                         }
                         else
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->prec, dblVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->prec, dblVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, dblVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, dblVal);
                             }
                         }
                     }
                     else
                     {
-                        wchar_t* newToken = addl(tok);
+                        char* newToken = addl(tok);
 
                         if (std::isnan(dblVal))
                         {
-                            os_swprintf(pwstTemp, bsiz, newToken, NanString);
+                            os_sprintf(pstTemp, bsiz, newToken, NanString);
                         }
                         else if (std::signbit(dblVal))
                         {
-                            os_swprintf(pwstTemp, bsiz, newToken, NegInfString);
+                            os_sprintf(pstTemp, bsiz, newToken, NegInfString);
                         }
                         else
                         {
-                            os_swprintf(pwstTemp, bsiz, newToken, InfString);
+                            os_sprintf(pstTemp, bsiz, newToken, InfString);
                         }
 
                         delete[] newToken;
                     }
 
-                    oFirstOutput << pwstTemp;
+                    oFirstOutput << pstTemp;
                     break;
                 }
                 case types::InternalType::ScilabInt32:
                 {
-                    wchar_t pwstTemp[bsiz];
+                    char pstTemp[bsiz];
                     double dblVal = in[tok->pos]->getAs<types::Double>()->get(j, tok->col);
                     int iVal = (int)dblVal;
                     if (std::isfinite(dblVal))
@@ -470,54 +470,54 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, tok->prec, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, tok->prec, iVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, iVal);
                             }
                         }
                         else
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->prec, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->prec, iVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, iVal);
                             }
                         }
                     }
                     else
                     {
-                        wchar_t* newToken = addl(tok);
+                        char* newToken = addl(tok);
 
                         if (std::isnan(dblVal))
                         {
-                            os_swprintf(pwstTemp, bsiz, newToken, NanString);
+                            os_sprintf(pstTemp, bsiz, newToken, NanString);
                         }
                         else
                         {
                             if (std::signbit(dblVal))
                             {
-                                os_swprintf(pwstTemp, bsiz, newToken, NegInfString);
+                                os_sprintf(pstTemp, bsiz, newToken, NegInfString);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, newToken, InfString);
+                                os_sprintf(pstTemp, bsiz, newToken, InfString);
                             }
                         }
 
                         delete[] newToken;
                     }
 
-                    oFirstOutput << pwstTemp;
+                    oFirstOutput << pstTemp;
                     break;
                 }
                 case types::InternalType::ScilabUInt32:
                 {
-                    wchar_t pwstTemp[bsiz];
+                    char pstTemp[bsiz];
                     double dblVal = in[tok->pos]->getAs<types::Double>()->get(j, tok->col);
                     unsigned int iVal = (unsigned int)dblVal;
 
@@ -527,81 +527,81 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, tok->prec, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, tok->prec, iVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->width, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->width, iVal);
                             }
                         }
                         else
                         {
                             if (tok->precStar)
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, tok->prec, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, tok->prec, iVal);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, tok->pwstToken, iVal);
+                                os_sprintf(pstTemp, bsiz, tok->pstToken, iVal);
                             }
                         }
                     }
                     else
                     {
-                        wchar_t* newToken = addl(tok);
+                        char* newToken = addl(tok);
 
                         if (std::isnan(dblVal))
                         {
-                            os_swprintf(pwstTemp, bsiz, newToken, NanString);
+                            os_sprintf(pstTemp, bsiz, newToken, NanString);
                         }
                         else
                         {
                             if (std::signbit(dblVal))
                             {
-                                os_swprintf(pwstTemp, bsiz, newToken, NegInfString);
+                                os_sprintf(pstTemp, bsiz, newToken, NegInfString);
                             }
                             else
                             {
-                                os_swprintf(pwstTemp, bsiz, newToken, InfString);
+                                os_sprintf(pstTemp, bsiz, newToken, InfString);
                             }
                         }
 
                         delete[] newToken;
                     }
 
-                    oFirstOutput << pwstTemp;
+                    oFirstOutput << pstTemp;
                     break;
                 }
                 case types::InternalType::ScilabString:
                 {
-                    wchar_t* pwstStr = nullptr;
-                    std::wstring NaN = NanString;
-                    std::wstring nInf = NegInfString;
-                    std::wstring pInf = InfString;
+                    char* pstStr = nullptr;
+                    std::string NaN = NanString;
+                    std::string nInf = NegInfString;
+                    std::string pInf = InfString;
 
                     types::InternalType* it = in[tok->pos];
                     if (it->isDouble() && std::isnan(it->getAs<types::Double>()->get(0)))
                     {
-                        pwstStr = const_cast<wchar_t*>(NaN.c_str());
+                        pstStr = const_cast<char*>(NaN.c_str());
                     }
                     else if (it->isDouble() && std::isfinite(it->getAs<types::Double>()->get(0)) == false)
                     {
                         if (std::signbit(it->getAs<types::Double>()->get(0)))
                         {
-                            pwstStr = const_cast<wchar_t*>(nInf.c_str());
+                            pstStr = const_cast<char*>(nInf.c_str());
                         }
                         else
                         {
-                            pwstStr = const_cast<wchar_t*>(pInf.c_str());
+                            pstStr = const_cast<char*>(pInf.c_str());
                         }
                     }
                     else
                     {
-                        pwstStr = it->getAs<types::String>()->get(j, tok->col);
+                        pstStr = it->getAs<types::String>()->get(j, tok->col);
                     }
 
-                    int posC = (int)wcscspn(tok->pwstToken, L"c");
-                    int posS = (int)wcscspn(tok->pwstToken, L"s");
+                    int posC = (int)strcspn(tok->pstToken, "c");
+                    int posS = (int)strcspn(tok->pstToken, "s");
 
                     if (posS == 0 || posC == 0)
                     {
@@ -615,80 +615,80 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
                     {
                         if (bC == false)
                         {
-                            len = std::min(std::abs(tok->prec), (int)wcslen(pwstStr));
+                            len = std::min(std::abs(tok->prec), (int)strlen(pstStr));
                         }
                     }
                     else
                     {
                         if (bC == false)
                         {
-                            len = (int)wcslen(pwstStr);
+                            len = (int)strlen(pstStr);
                         }
                     }
 
-                    int tokenLen = (int)wcslen(tok->pwstToken);
+                    int tokenLen = (int)strlen(tok->pstToken);
                     len += tokenLen;
                     len = std::max(len, std::abs(tok->width));
                     //add len of string after token like "%20s>>>" add space for ">>>"
                     len += (tokenLen - (bC ? posC : posS));
-                    wchar_t* pwstTemp = (wchar_t*)MALLOC((len + 1) * sizeof(wchar_t));
+                    char* pstTemp = (char*)MALLOC((len + 1) * sizeof(char));
 
                     if (bC)
                     {
                         if (tok->widthStar)
                         {
-                            os_swprintf(pwstTemp, len + 1, tok->pwstToken, tok->width, pwstStr[0]);
+                            os_sprintf(pstTemp, len + 1, tok->pstToken, tok->width, pstStr[0]);
                         }
                         else
                         {
-                            os_swprintf(pwstTemp, len + 1, tok->pwstToken, pwstStr[0]);
+                            os_sprintf(pstTemp, len + 1, tok->pstToken, pstStr[0]);
                         }
                     }
                     else
                     {
                         if (tok->widthStar)
                         {
-                            os_swprintf(pwstTemp, len + 1, tok->pwstToken, tok->width, pwstStr);
+                            os_sprintf(pstTemp, len + 1, tok->pstToken, tok->width, pstStr);
                         }
                         else
                         {
-                            os_swprintf(pwstTemp, len + 1, tok->pwstToken, pwstStr);
+                            os_sprintf(pstTemp, len + 1, tok->pstToken, pstStr);
                         }
                     }
 
-                    oFirstOutput << pwstTemp;
-                    FREE(pwstTemp);
+                    oFirstOutput << pstTemp;
+                    FREE(pstTemp);
                     break;
                 }
                 default:
                     // management of %%
-                    oFirstOutput << tok->pwstToken;
+                    oFirstOutput << tok->pstToken;
                     break;
             }
         }
     }
 
-    pwstFirstOutput = os_wcsdup((wchar_t*)oFirstOutput.str().c_str());
+    pstFirstOutput = os_strdup(oFirstOutput.str().c_str());
 
     for (auto & tok : token)
     {
-        delete[] tok->pwstToken;
+        delete[] tok->pstToken;
         delete tok;
     }
 
-    pwstOutput = (wchar_t**)MALLOC((*_piOutputRows) * sizeof(wchar_t*));
+    pstOutput = (char**)MALLOC((*_piOutputRows) * sizeof(char*));
 
-    size_t iLen = wcslen(pwstFirstOutput);
+    size_t iLen = strlen(pstFirstOutput);
     int iStart = 0;
     int j = 0;
     for (int i = 0; i < iLen; i++)
     {
-        if (pwstFirstOutput[i] == L'\n')
+        if (pstFirstOutput[i] == '\n')
         {
             int iSize = i - iStart;
-            pwstOutput[j] = (wchar_t*)MALLOC(sizeof(wchar_t) * (iSize + 1));
-            wcsncpy(pwstOutput[j], pwstFirstOutput + iStart, iSize);
-            pwstOutput[j][iSize] = L'\0';
+            pstOutput[j] = (char*)MALLOC(sizeof(char) * (iSize + 1));
+            strncpy(pstOutput[j], pstFirstOutput + iStart, iSize);
+            pstOutput[j][iSize] = '\0';
             iStart = i + 1;
             j++;
         }
@@ -696,108 +696,108 @@ wchar_t** scilab_sprintf(const std::string& funcname, const wchar_t* _pwstInput,
 
     if (j == (*_piOutputRows) - 1)
     {
-        pwstOutput[j] = os_wcsdup(pwstFirstOutput + iStart);
+        pstOutput[j] = os_strdup(pstFirstOutput + iStart);
     }
 
-    FREE(pwstFirstOutput);
-    return pwstOutput;
+    FREE(pstFirstOutput);
+    return pstOutput;
 }
 /*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
 // replace "\\n" "\\r" "\\t" "\\r\\n" by '\n' '\r' '\t' '\n'
 // count number of lines
 // indicate if one '\n' is at the end of string
-static wchar_t* replaceAndCountLines(const wchar_t* _pwstInput, int* _piLines, int* _piNewLine)
+static char* replaceAndCountLines(const char* _pstInput, int* _piLines, int* _piNewLine)
 {
-    size_t iInputLen = wcslen(_pwstInput);
-    wchar_t* pwstFirstOutput = (wchar_t*)MALLOC(sizeof(wchar_t) * (iInputLen + 1));
+    size_t iInputLen = strlen(_pstInput);
+    char* pstFirstOutput = (char*)MALLOC(sizeof(char) * (iInputLen + 1));
 
     int iPos = 0;
     *_piLines = 1;
 
     for (int i = 0; i < iInputLen; i++)
     {
-        if (_pwstInput[i] == L'\\')
+        if (_pstInput[i] == '\\')
         {
             if (iInputLen == i + 1)
             {
                 continue;
             }
 
-            switch (_pwstInput[i + 1])
+            switch (_pstInput[i + 1])
             {
-                case L'n':
-                    pwstFirstOutput[iPos++] = L'\n';
+                case 'n':
+                    pstFirstOutput[iPos++] = '\n';
                     (*_piLines)++;
                     i++;
                     break;
-                case L'r':
-                    if (iInputLen > i + 3 && _pwstInput[i + 2] == L'\\' && _pwstInput[i + 3] == L'n')
+                case 'r':
+                    if (iInputLen > i + 3 && _pstInput[i + 2] == '\\' && _pstInput[i + 3] == 'n')
                     {
-                        pwstFirstOutput[iPos++] = L'\n';
+                        pstFirstOutput[iPos++] = '\n';
                         (*_piLines)++;
                         i += 3;
                     }
                     else
                     {
-                        pwstFirstOutput[iPos++] = L'\r';
+                        pstFirstOutput[iPos++] = '\r';
                         i++;
                     }
                     break;
-                case L't':
-                    pwstFirstOutput[iPos++] = L'\t';
+                case 't':
+                    pstFirstOutput[iPos++] = '\t';
                     i++;
                     break;
-                case L'\\':
-                    pwstFirstOutput[iPos++] = L'\\';
+                case '\\':
+                    pstFirstOutput[iPos++] = '\\';
                     i++;
                     break;
                 default:
                     break;
             }
         }
-        else if (_pwstInput[i] == 0x0A) // ascii(10) == "\n"
+        else if (_pstInput[i] == 0x0A) // ascii(10) == "\n"
         {
-            pwstFirstOutput[iPos++] = L'\n';
+            pstFirstOutput[iPos++] = '\n';
             (*_piLines)++;
         }
         else
         {
-            pwstFirstOutput[iPos++] = _pwstInput[i];
+            pstFirstOutput[iPos++] = _pstInput[i];
         }
     }
 
     // do not count '\n' if it's at the end of string
     // it will be manage by piNewLine
-    if (pwstFirstOutput[iPos - 1] == '\n')
+    if (pstFirstOutput[iPos - 1] == '\n')
     {
         (*_piLines)--;
         (*_piNewLine) = 1;
     }
 
-    pwstFirstOutput[iPos] = 0;
-    return pwstFirstOutput;
+    pstFirstOutput[iPos] = 0;
+    return pstFirstOutput;
 }
 /*--------------------------------------------------------------------------*/
-wchar_t* addl(TokenDef* token)
+char* addl(TokenDef* token)
 {
     //replace %s or %c by %ls or %lc to wide char compatibility
     int iPos = token->typePos;
-    int sizeTotal = (int)wcslen(token->pwstToken);
-    wchar_t* pwstToken = new wchar_t[sizeTotal + 2];
+    int sizeTotal = (int)strlen(token->pstToken);
+    char* pstToken = new char[sizeTotal + 2];
 
-    wcsncpy(pwstToken, token->pwstToken, iPos);
-    pwstToken[iPos] = L'l';
-    pwstToken[iPos + 1] = L's';
-    wcsncpy(&pwstToken[iPos + 2], token->pwstToken + iPos + 1, sizeTotal - (iPos + 1));
-    pwstToken[sizeTotal + 1] = L'\0';
+    strncpy(pstToken, token->pstToken, iPos);
+    pstToken[iPos] = 'l';
+    pstToken[iPos + 1] = 's';
+    strncpy(&pstToken[iPos + 2], token->pstToken + iPos + 1, sizeTotal - (iPos + 1));
+    pstToken[sizeTotal + 1] = '\0';
 
-    return pwstToken;
+    return pstToken;
 }
 /*--------------------------------------------------------------------------*/
 void updatel(TokenDef* token)
 {
-    wchar_t* newToken = addl(token);
-    delete[] token->pwstToken;
-    token->pwstToken = newToken;
+    char* newToken = addl(token);
+    delete[] token->pstToken;
+    token->pstToken = newToken;
 }