add print function 51/18851/6
Antoine ELIAS [Thu, 5 Jan 2017 17:29:05 +0000 (18:29 +0100)]
test_run output_stream print

Change-Id: Ifacde17d93a5e27f080a99721aa822a2a54336e7

scilab/modules/fileio/includes/mputl.h [moved from scilab/modules/fileio/src/cpp/mputl.h with 100% similarity]
scilab/modules/output_stream/Makefile.am
scilab/modules/output_stream/Makefile.in
scilab/modules/output_stream/includes/output_stream_gw.hxx
scilab/modules/output_stream/sci_gateway/c/sci_print.c [deleted file]
scilab/modules/output_stream/sci_gateway/cpp/output_stream_gw.cpp
scilab/modules/output_stream/sci_gateway/cpp/output_stream_gw/output_stream_gw.vcxproj
scilab/modules/output_stream/sci_gateway/cpp/output_stream_gw/output_stream_gw.vcxproj.filters
scilab/modules/output_stream/sci_gateway/cpp/sci_print.cpp [new file with mode: 0644]
scilab/modules/output_stream/tests/unit_tests/print.dia.ref
scilab/modules/output_stream/tests/unit_tests/print.tst

index a467f2b..34e2835 100644 (file)
@@ -29,7 +29,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_disp.cpp \
        sci_gateway/cpp/output_stream_gw.cpp \
        sci_gateway/cpp/sci_msprintf.cpp \
-       sci_gateway/cpp/sci_mprintf.cpp
+       sci_gateway/cpp/sci_mprintf.cpp \
+       sci_gateway/cpp/sci_print.cpp
 
 OUTPUT_STREAM_C_SOURCES = \
        src/c/erro.c \
index c0e4ff5..6f14818 100644 (file)
@@ -220,7 +220,8 @@ am__objects_4 = sci_gateway/cpp/libscioutput_stream_la-sci_diary.lo \
        sci_gateway/cpp/libscioutput_stream_la-sci_disp.lo \
        sci_gateway/cpp/libscioutput_stream_la-output_stream_gw.lo \
        sci_gateway/cpp/libscioutput_stream_la-sci_msprintf.lo \
-       sci_gateway/cpp/libscioutput_stream_la-sci_mprintf.lo
+       sci_gateway/cpp/libscioutput_stream_la-sci_mprintf.lo \
+       sci_gateway/cpp/libscioutput_stream_la-sci_print.lo
 am_libscioutput_stream_la_OBJECTS = $(am__objects_4)
 libscioutput_stream_la_OBJECTS = $(am_libscioutput_stream_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscioutput_stream_la_rpath =
@@ -633,7 +634,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_disp.cpp \
        sci_gateway/cpp/output_stream_gw.cpp \
        sci_gateway/cpp/sci_msprintf.cpp \
-       sci_gateway/cpp/sci_mprintf.cpp
+       sci_gateway/cpp/sci_mprintf.cpp \
+       sci_gateway/cpp/sci_print.cpp
 
 OUTPUT_STREAM_C_SOURCES = \
        src/c/erro.c \
@@ -987,6 +989,9 @@ sci_gateway/cpp/libscioutput_stream_la-sci_msprintf.lo:  \
 sci_gateway/cpp/libscioutput_stream_la-sci_mprintf.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
+sci_gateway/cpp/libscioutput_stream_la-sci_print.lo:  \
+       sci_gateway/cpp/$(am__dirstamp) \
+       sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
 
 libscioutput_stream.la: $(libscioutput_stream_la_OBJECTS) $(libscioutput_stream_la_DEPENDENCIES) $(EXTRA_libscioutput_stream_la_DEPENDENCIES) 
        $(AM_V_CXXLD)$(CXXLINK) $(am_libscioutput_stream_la_rpath) $(libscioutput_stream_la_OBJECTS) $(libscioutput_stream_la_LIBADD) $(LIBS)
@@ -1010,6 +1015,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_disp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_mprintf.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_msprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_print.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscioutput_stream_algo_la-Scierror.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscioutput_stream_algo_la-cerro.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscioutput_stream_algo_la-erro.Plo@am__quote@
@@ -1246,6 +1252,13 @@ sci_gateway/cpp/libscioutput_stream_la-sci_mprintf.lo: sci_gateway/cpp/sci_mprin
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscioutput_stream_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscioutput_stream_la-sci_mprintf.lo `test -f 'sci_gateway/cpp/sci_mprintf.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_mprintf.cpp
 
+sci_gateway/cpp/libscioutput_stream_la-sci_print.lo: sci_gateway/cpp/sci_print.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscioutput_stream_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscioutput_stream_la-sci_print.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_print.Tpo -c -o sci_gateway/cpp/libscioutput_stream_la-sci_print.lo `test -f 'sci_gateway/cpp/sci_print.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_print.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_print.Tpo sci_gateway/cpp/$(DEPDIR)/libscioutput_stream_la-sci_print.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='sci_gateway/cpp/sci_print.cpp' object='sci_gateway/cpp/libscioutput_stream_la-sci_print.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscioutput_stream_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscioutput_stream_la-sci_print.lo `test -f 'sci_gateway/cpp/sci_print.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_print.cpp
+
 .f.o:
        $(AM_V_F77)$(F77COMPILE) -c -o $@ $<
 
index 08bb435..527a24b 100644 (file)
@@ -40,5 +40,6 @@ public :
 CPP_GATEWAY_PROTOTYPE(sci_disp);
 CPP_GATEWAY_PROTOTYPE(sci_msprintf);
 CPP_GATEWAY_PROTOTYPE(sci_mprintf);
+CPP_GATEWAY_PROTOTYPE(sci_print);
 
 #endif /* !__OUTPUTSTREAM_GW_HXX__ */
diff --git a/scilab/modules/output_stream/sci_gateway/c/sci_print.c b/scilab/modules/output_stream/sci_gateway/c/sci_print.c
deleted file mode 100644 (file)
index 73e4e3c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Allan CORNET
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- */
-/*--------------------------------------------------------------------------*/
-#include "gw_output_stream.h"
-#include "machine.h" /* C2F */
-/*--------------------------------------------------------------------------*/
-extern int C2F(intprint)(); /* fortran subroutine */
-/*--------------------------------------------------------------------------*/
-int sci_print(char *fname, unsigned long fname_len)
-{
-    // FIXME : implement this.
-    //C2F(intprint)();
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
index e4af497..62535b2 100644 (file)
@@ -32,5 +32,6 @@ int OutputStreamModule::Load()
     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(L"print", &sci_print, MODULE_NAME));
     return 1;
 }
index 4fcee55..ee891d2 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../fileio/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;OUTPUT_STREAM_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../fileio/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;OUTPUT_STREAM_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../fileio/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;OUTPUT_STREAM_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../includes;../../../src/cpp;../../../../../libs/intl;../../../../functions_manager/includes;../../../../core/includes;../../../../localization/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../console/includes;../../../../dynamic_link/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../fileio/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;OUTPUT_STREAM_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     <ClCompile Include="..\sci_mprintf.cpp" />
     <ClCompile Include="..\sci_msprintf.cpp" />
     <ClCompile Include="..\..\..\src\cpp\scilab_sprintf.cpp" />
+    <ClCompile Include="..\sci_print.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\includes\dynlib_output_stream_gw.h" />
       <Project>{c6e2bc17-34d8-46e4-85f3-6293cb21adcd}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\..\fileio\fileio.vcxproj">
+      <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\..\localization\src\localization.vcxproj">
       <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index e4feadd..b13395f 100644 (file)
@@ -33,6 +33,9 @@
     <ClCompile Include="..\..\..\src\cpp\scilab_sprintf.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\sci_print.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\includes\output_stream_gw.hxx">
diff --git a/scilab/modules/output_stream/sci_gateway/cpp/sci_print.cpp b/scilab/modules/output_stream/sci_gateway/cpp/sci_print.cpp
new file mode 100644 (file)
index 0000000..371c394
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2017 - Scilab Enterprises - ELIAS Antoine
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#include "output_stream_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+#include "double.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+#include "expandPathVariable.h"
+#include "mopen.h"
+#include "mclose.h"
+#include "mputl.h"
+}
+
+static const char fname[] = "print";
+
+types::Function::ReturnValue sci_print(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int fid = 0;
+    bool bCloseFile = false;
+    wchar_t* newLine = L"";
+
+    if (in.size() <= 1)
+    {
+        Scierror(999, _("%s: Wrong number of input arguments: at least %d expected.\n"), fname, 2);
+        return types::Function::Error;
+    }
+
+    if (in[0]->isString())
+    {
+        types::String* pS = in[0]->getAs<types::String>();
+        if (pS->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A single string expected.\n"), fname, 1);
+            return types::Function::Error;
+        }
+
+        wchar_t *expandedFileName = expandPathVariableW(in[0]->getAs<types::String>()->get(0));
+
+        int iErr = mopen(expandedFileName, L"wt", 0, &fid);
+
+        if (iErr)
+        {
+            char* pst = wide_string_to_UTF8(expandedFileName);
+            switch (iErr)
+            {
+                case MOPEN_NO_MORE_LOGICAL_UNIT:
+                    Scierror(66, _("%s: Too many files opened!\n"), "mgetl");
+                    break;
+                case MOPEN_CAN_NOT_OPEN_FILE:
+                    Scierror(999, _("%s: Cannot open file %s.\n"), "mgetl", pst);
+                    break;
+                case MOPEN_NO_MORE_MEMORY:
+                    Scierror(999, _("%s: No more memory.\n"), "mgetl");
+                    break;
+                case MOPEN_INVALID_FILENAME:
+                    Scierror(999, _("%s: invalid filename %s.\n"), "mgetl", pst);
+                    break;
+                default: //MOPEN_INVALID_STATUS
+                    Scierror(999, _("%s: invalid status.\n"), "mgetl");
+                    break;
+            }
+
+            FREE(pst);
+            FREE(expandedFileName);
+            return types::Function::Error;
+        }
+        FREE(expandedFileName);
+        bCloseFile = true;
+
+    }
+    else if (in[0]->isDouble())
+    {
+        types::Double* pD = in[0]->getAs<types::Double>();
+        if (pD->isScalar() == false)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A scalar expected.\n"), fname, 1);
+            return types::Function::Error;
+        }
+
+        fid = static_cast<int>(pD->get()[0]);
+        //stdin
+        if (fid == 5)
+        {
+            Scierror(999, _("%s: Wrong file descriptor: %d.\n"), fname, fid);
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A real or String expected.\n"), fname, 1);
+        return types::Function::Error;
+    }
+
+    mputl(fid, &newLine, 1);
+    for (int i = (int)in.size() - 1; i > 0 ; --i)
+    {
+        std::wostringstream ostr;
+        in[i]->toString(ostr);
+        wchar_t* tmp = os_wcsdup(ostr.str().c_str());
+        mputl(fid, &tmp, 1);
+        FREE(tmp);
+    }
+
+    if (bCloseFile)
+    {
+        mclose(fid);
+    }
+
+    return types::Function::OK;
+}
\ No newline at end of file
index 88f7f46..396dce5 100644 (file)
@@ -7,12 +7,6 @@
 // <-- CLI SHELL MODE -->
 // stdout
 print(%io(2), "Hello World")
- Hello World   
 //stdin
-try
-    print(%io(1), "Hello World")
-catch
-    ierr = lasterror();
-    assert_checkequal(ierr, 49);
-end
+msg = msprintf(_("%s: Wrong file descriptor: %d.\n"), "print", 5);
+assert_checkerror("print(%io(1), ""Hello World"")", msg);
index f52290a..40ddb48 100644 (file)
@@ -11,9 +11,5 @@
 print(%io(2), "Hello World")
 
 //stdin
-try
-    print(%io(1), "Hello World")
-catch
-    ierr = lasterror();
-    assert_checkequal(ierr, 49);
-end
+msg = msprintf(_("%s: Wrong file descriptor: %d.\n"), "print", 5);
+assert_checkerror("print(%io(1), ""Hello World"")", msg);