<commit_before>// MediaInfo_CLI - A Command Line Interface for MediaInfoLib
// Copyright (C) 2002-2011 MediaArea.net SARL, <EMAIL>
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include <iostream>
#include "ZenLib/Ztring.h"

//---------------------------------------------------------------------------
//Get command line args in main()
#ifdef UNICODE
    #ifdef _WIN32
        #undef __TEXT
        #include <windows.h>
            #define GETCOMMANDLINE() \
                MediaInfoNameSpace::Char** argv=CommandLineToArgvW(GetCommandLineW(), &argc); \

    #else //WIN32
        #define GETCOMMANDLINE() \
            std::vector<MediaInfoNameSpace::String> argv; \
            for (int Pos=0; Pos<argc; Pos++) \
            { \
                    ZenLib::Ztring A; \
                    A.From_Local(argv_ansi[Pos]); \
                    argv.push_back(A); \
            } \

    #endif //WIN32
#else //UNICODE
    #define GETCOMMANDLINE() \
        MediaInfoNameSpace::Char** argv=argv_ansi; \

#endif //UNICODE

//---------------------------------------------------------------------------
//Write to terminal
inline void TEXTOUT(const char* Text)
{
    std::cout<<Text<<std::endl;
}

inline void STRINGOUT(ZenLib::Ztring Text)
{
    #ifdef UNICODE
        #ifdef __WINDOWS__
            DWORD CharsWritten;
            std::string Buffer = Text.To_UTF8();
            UINT Cp_Old = GetConsoleOutputCP();
            SetConsoleOutputCP(CP_UTF8);
            WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), Buffer.c_str(), Buffer.length(), &CharsWritten, NULL);
            SetConsoleOutputCP(Cp_Old);
        #else //__WINDOWS__
            std::cout<<Text.To_Local().c_str()<<std::endl;
        #endif //__WINDOWS__
    #else // UNICODE
            std::cout<<Text.c_str()<<std::endl;
    #endif // UNICODE
}

<commit_msg>x CLI, STRINGOUT() was without carriage return on Windows Unicode.<commit_after>// MediaInfo_CLI - A Command Line Interface for MediaInfoLib
// Copyright (C) 2002-2011 MediaArea.net SARL, <EMAIL>
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include <iostream>
#include "ZenLib/Ztring.h"

//---------------------------------------------------------------------------
//Get command line args in main()
#ifdef UNICODE
    #ifdef _WIN32
        #undef __TEXT
        #include <windows.h>
            #define GETCOMMANDLINE() \
                MediaInfoNameSpace::Char** argv=CommandLineToArgvW(GetCommandLineW(), &argc); \

    #else //WIN32
        #define GETCOMMANDLINE() \
            std::vector<MediaInfoNameSpace::String> argv; \
            for (int Pos=0; Pos<argc; Pos++) \
            { \
                    ZenLib::Ztring A; \
                    A.From_Local(argv_ansi[Pos]); \
                    argv.push_back(A); \
            } \

    #endif //WIN32
#else //UNICODE
    #define GETCOMMANDLINE() \
        MediaInfoNameSpace::Char** argv=argv_ansi; \

#endif //UNICODE

//---------------------------------------------------------------------------
//Write to terminal
inline void TEXTOUT(const char* Text)
{
    std::cout<<Text<<std::endl;
}

inline void STRINGOUT(ZenLib::Ztring Text)
{
    #ifdef UNICODE
        #ifdef __WINDOWS__
            DWORD CharsWritten;
            std::string Buffer = Text.To_UTF8();
            UINT Cp_Old = GetConsoleOutputCP();
            SetConsoleOutputCP(CP_UTF8);
            WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), Buffer.c_str(), Buffer.length(), &CharsWritten, NULL);
            WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &CharsWritten, NULL);
            SetConsoleOutputCP(Cp_Old);
        #else //__WINDOWS__
            std::cout<<Text.To_Local().c_str()<<std::endl;
        #endif //__WINDOWS__
    #else // UNICODE
            std::cout<<Text.c_str()<<std::endl;
    #endif // UNICODE
}


{'fraction_non_alphanumeric': 0.21708920187793426, 'fraction_numerical': 0.006948356807511737, 'mean_word_length': 2.1854066985645932, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2804616', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1440, 'n_words': 420}