- remove unicode support (it was mess, a few places only accepting char and then...
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 8 Oct 2007 00:18:01 +0000 (00:18 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 8 Oct 2007 00:18:01 +0000 (00:18 +0000)
- rewrite line extraction (currently if'0)
- add Wine gettimeofday implementation (currently if'0)
- apply sources changes to SymbolFile class
- remove unicode support class
- fix a bug in the createProcess version for windows hosts which randomly led to invalid boot hdd error messages

svn path=/trunk/; revision=29450

16 files changed:
reactos/tools/sysreg/conf_parser.cpp
reactos/tools/sysreg/conf_parser.h
reactos/tools/sysreg/env_var.cpp
reactos/tools/sysreg/file_reader.cpp
reactos/tools/sysreg/namedpipe_reader.cpp
reactos/tools/sysreg/namedpipe_reader.h
reactos/tools/sysreg/os_support.cpp
reactos/tools/sysreg/os_support.h
reactos/tools/sysreg/pipe_reader.cpp
reactos/tools/sysreg/rosboot_test.cpp
reactos/tools/sysreg/sym_file.cpp
reactos/tools/sysreg/sysreg.cpp
reactos/tools/sysreg/sysreg.mak
reactos/tools/sysreg/unicode.cpp [deleted file]
reactos/tools/sysreg/unicode.h [deleted file]
reactos/tools/sysreg/user_types.h

index 7994f39..7412b3e 100644 (file)
@@ -29,14 +29,9 @@ namespace Sysreg_
        }
 
 //---------------------------------------------------------------------------------------
-       bool ConfigParser::parseFile(TCHAR * FileName)
+       bool ConfigParser::parseFile(char * FileName)
        {
-               FILE * file;
-#ifdef UNICODE
-               file = _tfopen(FileName, _T("rt,ccs=UNICODE"));
-#else
-               file = fopen(FileName, "rt");
-#endif
+               FILE * file = fopen(FileName, "rt");
                if (!file)
                {
                        cerr << "Error: ConfigParser::parseFile failed to open configuration file " << FileName << endl;
@@ -45,16 +40,16 @@ namespace Sysreg_
                bool ret = false;
                while (!feof(file))
                {
-                       TCHAR buffer[500];
-                       TCHAR * buf;
+                       char buffer[500];
+                       char * buf;
 
-                       buf = _fgetts(buffer, sizeof(buffer) / sizeof(TCHAR), file);
+                       buf = fgets(buffer, sizeof(buffer) / sizeof(char), file);
                        if (buf)
                        {
-                               if (buffer[0] != _T(';'))
+                               if (buffer[0] != ';')
                                {
                                        string s_buffer = string(buffer);
-                                       string::size_type ws_pos = s_buffer.find_first_of (_T("="));
+                                       string::size_type ws_pos = s_buffer.find_first_of ("=");
 
                                        if (ws_pos != string::npos && ws_pos > 0 && ws_pos < s_buffer.size())
                                        {
@@ -101,7 +96,7 @@ namespace Sysreg_
                        return false;
                }
 
-        ConfValue = _tcstod(it->second.c_str(), NULL);
+        ConfValue = strtod(it->second.c_str(), NULL);
         return true;
     }
 //-----------------------------------------------------------------------------------------
@@ -114,7 +109,7 @@ namespace Sysreg_
                        return false;
                }
 
-        ConfValue = _tcstol(it->second.c_str(), NULL, 10);
+        ConfValue = strtol(it->second.c_str(), NULL, 10);
         return true;
     }
 
index d7875ae..adb3272 100644 (file)
@@ -62,7 +62,7 @@ namespace Sysreg_
 /// @param FileName path to configuration file
 /// @return bool
 
-       bool parseFile(TCHAR * FileName);
+       bool parseFile(char * FileName);
 
 //--------------------------------------------------------------------------------------
 ///
index 282d1eb..c96b503 100644 (file)
@@ -39,7 +39,7 @@ namespace System_
                        return true;
                }
                
-               TCHAR * value = _tgetenv(EnvName.c_str ());
+               char * value = getenv(EnvName.c_str ());
                
                if (!value)
                {
@@ -47,7 +47,7 @@ namespace System_
                        return false;
                }
 
-               if (!_tcslen(value))
+               if (!strlen(value))
                {
                        cerr << "EnvironmentVariable::getValue found no value for " << EnvName << endl;
                        return false;
index f150879..8a31b4e 100644 (file)
@@ -23,11 +23,7 @@ namespace System_
 //---------------------------------------------------------------------------------------
     bool FileReader::openSource(const string & filename)
        {
-#ifdef UNICODE
-               m_File = (FILE*)_tfopen(filename.c_str(), _T("rb,ccs=UNICODE"));
-#else
                m_File = fopen((char*)filename.c_str(), (char*)"rb");
-#endif
 
                if (m_File)
                {
@@ -69,34 +65,18 @@ namespace System_
                char szBuffer[256];
                int readoffset = 0;
 
-#ifdef UNICODE
-               wchar_t wbuf[512];
-               int wbuf_offset = 0;
-
-               if (m_BufferedLines.length ())
-               {
-                       wcscpy(wbuf, m_BufferedLines.c_str ());
-                       wbuf_offset = m_BufferedLines.length ();
-               }
-#else
                if (m_BufferedLines.length())
                {
                        strcpy(szBuffer, m_BufferedLines.c_str());
                        readoffset = m_BufferedLines.length();
                }
-#endif
 
                do
                {
                        if (total_length < num)
                        {
-#ifdef UNICODE
-                               memmove(wbuf, &wbuf[total_length], (num - total_length) * sizeof(wchar_t));
-                               wbuf_offset = num - total_length;
-#else
                                memmove(szBuffer, &szBuffer[total_length], num - total_length);
                                readoffset = num - total_length;
-#endif
                        }
 
                        num = fread(&szBuffer[readoffset], 
@@ -113,32 +93,16 @@ namespace System_
                                }
                                break;
                        }
-                       TCHAR * ptr;
-#ifdef UNICODE
-                       int i = 0;
-                       int conv;
-                       while((conv = mbtowc(&wbuf[wbuf_offset+i], &szBuffer[i], num)))
-                       {
-                               i += conv;
-                               if (i == num)
-                                       break;
-
-                               assert(wbuf_offset + i < 512);
-                       }
-                       wbuf[wbuf_offset + num] = L'\0';
-
-                       TCHAR * offset = wbuf;
-#else
+                       char * ptr;
+                       char * offset = szBuffer;
 
-                       TCHAR * offset = szBuffer;
-#endif
                        total_length = 0;
-                       while((ptr = _tcsstr(offset, _T("\x0D\x0A"))) != NULL)
+                       while((ptr = strstr(offset, "\x0D\x0A")) != NULL)
                        {
                                long length = ((long )ptr - (long)offset);
-                               length /= sizeof(TCHAR);
+                               length /= sizeof(char);
 
-                               offset[length] = _T('\0');
+                               offset[length] = '\0';
 
                                string line = offset;
                                lines.push_back (line);
@@ -155,11 +119,7 @@ namespace System_
 
                if (total_length < num)
                {
-#ifdef UNICODE
-               m_BufferedLines = &wbuf[total_length];
-#else
-               m_BufferedLines = &szBuffer[total_length];
-#endif
+                   m_BufferedLines = &szBuffer[total_length];
                }
 
                return ret;
index 93af74a..a3bcf41 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include "namedpipe_reader.h"
-#include "unicode.h"
 
 #include <iostream>
 #include <assert.h>
@@ -18,13 +17,15 @@ namespace System_
 {
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
 
+#ifdef __LINUX__
+    const char * NamedPipeReader::s_LineBreak = "\x0A\0";
+#else
+    const char * NamedPipeReader::s_LineBreak = "\x0D\x0A\0";
+#endif
        using std::vector;
 //---------------------------------------------------------------------------------------
     NamedPipeReader::NamedPipeReader() : DataSource(), h_Pipe(NULLVAL), m_Buffer(0)
        {
-#ifdef UNICODE
-        m_WBuffer = 0;
-#endif
        }
 
 //---------------------------------------------------------------------------------------
@@ -32,10 +33,6 @@ namespace System_
        {
         if (m_Buffer)
             free(m_Buffer);
-#ifdef UNICODE
-        if (m_WBuffer)
-            free(m_WBuffer);
-#endif
        }
 
        bool NamedPipeReader::isSourceOpen()
@@ -76,14 +73,7 @@ namespace System_
                 m_BufferLength = 100;
                 m_Buffer = (char*)malloc(sizeof(char) * m_BufferLength);
             }
-
-#ifdef UNICODE
-            if (!m_WBuffer)
-            {
-                m_WBuffer = (WCHAR*)malloc(sizeof(WCHAR) * m_BufferLength);
-            }
-#endif
-                   ConnectNamedPipe(h_Pipe,
+            ConnectNamedPipe(h_Pipe,
                                         0);
             return true;
                }
@@ -112,6 +102,7 @@ namespace System_
 
        bool NamedPipeReader::closeSource() 
        {
+        cerr << "NamedPipeReader::closePipe> entered" << endl;
                if (h_Pipe == NULLVAL)
                {
                        cerr << "NamedPipeReader::closePipe> pipe is not open" << endl;
@@ -127,19 +118,87 @@ namespace System_
                return true;
        }
 //---------------------------------------------------------------------------------------
-       void NamedPipeReader::extractLines(TCHAR * buffer, std::vector<string> & vect, bool & append_line, unsigned long cbRead)
+    void NamedPipeReader::insertLine(std::vector<string> & vect, string line, bool append_line)
+    {
+        if (append_line && vect.size ())
+        {
+            string prev = vect[vect.size () - 1];
+            prev += line;
+            vect[vect.size () - 1] = prev;
+        }
+        else
+        {
+            vect.push_back (line);
+        }
+
+    }
+//---------------------------------------------------------------------------------------
+       void NamedPipeReader::extractLines(char * buffer, std::vector<string> & vect, bool & append_line, unsigned long cbRead)
        {
-               TCHAR * offset = _tcschr(buffer, _T('\x0D'));
-               DWORD buf_offset = 0;
+#if 0
+        long  offset = 0;
+        size_t start_size = vect.size ();
+        char * start = buffer;
+        buffer[cbRead] = _T('\0');
+               char * end = strstr(buffer, s_LineBreak);
+
+        //cout << "extractLines entered with append_line: " << append_line << " cbRead: " << cbRead << "buffer: " << buffer << endl;
+
+        do
+        {
+            if (end)
+            {
+                end[0] = _T('\0');
+                string line = start;
+                end += (sizeof(s_LineBreak) / sizeof(char));
+                start = end;
+                offset += line.length() + (sizeof(s_LineBreak) / sizeof(char));
+
+              //  cout << "Offset: "<< offset << "cbRead: " << cbRead << "line: " << line << endl;
+                insertLine(vect, line, append_line);
+                if (append_line)
+                {
+                    append_line = false;
+                }
+            }
+            else
+            {
+                string line = start;
+//                cout << "inserting line start_size: " << start_size << "current: " << vect.size () << "line length: "<< line.length () << endl;
+                if (!line.length ())
+                {
+                    if (start_size == vect.size ())
+                        append_line = true;
+                    break;
+                }
+                if (start_size == vect.size ())
+                {
+                    insertLine(vect, line, true);
+                }
+                else
+                {
+                    insertLine(vect, line, false);
+                }
+                append_line = true;
+                break;
+            }
+
+            end = strstr(end, s_LineBreak);
+
+        }while(append_line);
+
+#else
+        DWORD buf_offset = 0;
+               char * offset = strchr(buffer, '\x0D');
                while(offset)
                {
                        ///
                        /// HACKHACK
-                       /// due to some mysterious reason, _tcschr / _tcsstr sometimes returns
+                       /// due to some mysterious reason, strchr / strstr sometimes returns
                        /// not always the offset to the CR character but to the next LF
                        /// in MSVC 2005 (Debug Modus)
 
-                       if (offset[0] == _T('\x0A'))
+                       if (offset[0] == '\x0A')
                        {
                                if (buf_offset)
                                {
@@ -152,10 +211,10 @@ namespace System_
                                }
                        }
 
-                       if (offset[0] == _T('\x0D'))
+                       if (offset[0] == '\x0D')
                        {
                                buf_offset += 2;
-                               offset[0] = _T('\0');
+                               offset[0] = '\0';
                                offset +=2;
                        }
                        else
@@ -188,11 +247,11 @@ namespace System_
                        }
                        buffer = offset;
 
-                       offset = _tcsstr(buffer, _T("\n"));
+                       offset = strstr(buffer, "\n");
                }
                if (buf_offset < cbRead)
                {
-                       buffer[cbRead - buf_offset] = _T('\0');
+                       buffer[cbRead - buf_offset] = '\0';
                        string line = buffer;
                        if (append_line)
                        {
@@ -212,6 +271,7 @@ namespace System_
                {
                        append_line = false;
                }
+#endif
        }
 //---------------------------------------------------------------------------------------
     bool NamedPipeReader::readPipe(char * buffer, int bufferlength, long & bytesread)
@@ -254,32 +314,16 @@ namespace System_
             return false;
         }
 
-#ifdef UNICODE
-        if (!m_WBuffer)
-        {
-            cerr << "Error: no memory" << endl;
-            return false;
-        }
-#endif
-
                bool append_line = false;
                do
                {
             memset(m_Buffer, 0x0, m_BufferLength * sizeof(char));
             long cbRead = 0;
-                    
+
             if (!readPipe(m_Buffer, m_BufferLength-1, cbRead))
                 break;
 
-#ifdef UNICODE
-            memset(m_WBuffer, 0x0, m_BufferLength * sizeof(WCHAR));
-            if (!UnicodeConverter::ansi2Unicode(m_Buffer, m_WBuffer, cbRead))
-                break;
-            extractLines(m_WBuffer, vect, append_line, cbRead);
-#else
             extractLines(m_Buffer, vect, append_line, cbRead);
-#endif
-
         }while (append_line);
 
     return (vect.size () - lines);
index 6146ace..901dc60 100644 (file)
@@ -118,7 +118,8 @@ protected:
 /// @param vect vector storing the extracted lines
 /// @param append_line if the line isnt fully read, the line is appended
 
-       void extractLines(TCHAR * buffer, std::vector<string> & vect, bool & append_line, unsigned long cbRead);
+       void extractLines(char * buffer, std::vector<string> & vect, bool & append_line, unsigned long cbRead);
+    void insertLine(std::vector<string> & vect, string line, bool append_line);
 
     bool readPipe(char * buffer, int bufferlength, long & read);
 
@@ -130,6 +131,7 @@ protected:
     WCHAR * m_WBuffer;
 #endif
 
+    static const char * s_LineBreak;
        }; // end of class NamedPipeReader
 
 } // end of namespace System_
index ebe4896..3912543 100644 (file)
@@ -14,11 +14,15 @@ namespace System_
 
     OsSupport::TimeEntryVector OsSupport::s_Entries;
 
+    //int gettimeofday(struct timeval *tv, void * tz);
+
     void OsSupport::checkAlarms()
     {
         struct timeval tm;
                size_t i;
-        gettimeofday(&tm, 0);
+#if 0
+//        gettimeofday(&tm, 0);
+#endif
         for (i = 0; i < s_Entries.size(); i++)
         {
             long diffsec = s_Entries[i]->tm.tv_sec - tm.tv_sec;
@@ -67,6 +71,40 @@ namespace System_
 
     HANDLE OsSupport::s_hThread = 0;
     static HANDLE hTimer;
+#if 0
+__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+    FILETIME        ft;
+    LARGE_INTEGER   li;
+    __int64         t;
+    static int      tzflag;
+
+    if (tv)
+    {
+        GetSystemTimeAsFileTime(&ft);
+        li.LowPart  = ft.dwLowDateTime;
+        li.HighPart = ft.dwHighDateTime;
+        t  = li.QuadPart;       /* In 100-nanosecond intervals */
+        t -= EPOCHFILETIME;     /* Offset to the Epoch time */
+        t /= 10;                /* In microseconds */
+        tv->tv_sec  = (long)(t / 1000000);
+        tv->tv_usec = (long)(t % 1000000);
+    }
+
+    if (tz)
+    {
+        if (!tzflag)
+        {
+            _tzset();
+            tzflag++;
+        }
+        tz->tz_minuteswest = _timezone / 60;
+        tz->tz_dsttime = _daylight;
+    }
+
+    return 0;
+}
+#endif
        bool OsSupport::terminateProcess(OsSupport::ProcessID pid, int exitcode)
        {
                HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
@@ -80,14 +118,14 @@ namespace System_
                return ret;
        }
 
-       OsSupport::ProcessID OsSupport::createProcess(TCHAR *procname, int procargsnum, TCHAR **procargs, bool wait)
+       OsSupport::ProcessID OsSupport::createProcess(char *procname, int procargsnum, char **procargs, bool wait)
        {
                STARTUPINFO siStartInfo;
                PROCESS_INFORMATION piProcInfo; 
                OsSupport::ProcessID pid;
         DWORD length = 0;
-        TCHAR * szBuffer;
-        TCHAR * cmd;
+        char * szBuffer;
+        char * cmd;
                ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
                ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
 
@@ -99,29 +137,36 @@ namespace System_
         {
             for (int i = 1; i < procargsnum; i++)
             {
-                length += _tcslen(procargs[i]);
+                length += strlen(procargs[i]);
             }
 
             length += procargsnum;
-            szBuffer = (TCHAR*)malloc(length * sizeof(TCHAR));
+            szBuffer = (char*)malloc(length * sizeof(char));
             length = 0;
             for (int i = 1; i < procargsnum; i++)
             {
-                _tcscpy(&szBuffer[length], procargs[i]);
-                length += _tcslen(procargs[i]);
-                szBuffer[length] = _T(' ');
+                strcpy(&szBuffer[length], procargs[i]);
+                length += strlen(procargs[i]);
+                if (i + 1 < procargsnum)
+                {
+                    szBuffer[length] = ' ';
+                }
+                else
+                {
+                    szBuffer[length] = '\0';
+                }
                 length++;
             }
-            length = _tcslen(procname) + _tcslen(szBuffer) + 2;
-            cmd = (TCHAR*)malloc(length * sizeof(TCHAR));
-            _tcscpy(cmd, procname);
-            _tcscat(cmd, _T(" "));
-            _tcscat(cmd, szBuffer);
+            length = strlen(procname) + strlen(szBuffer) + 2;
+            cmd = (char*)malloc(length * sizeof(char));
+            strcpy(cmd, procname);
+            strcat(cmd, " ");
+            strcat(cmd, szBuffer);
             free(szBuffer);
         }
         else
         {
-            cmd = _tcsdup(procname);
+            cmd = _strdup(procname);
 
         }
                if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &siStartInfo, &piProcInfo))
@@ -151,7 +196,7 @@ namespace System_
     {
         LARGE_INTEGER   liDueTime;
 
-        hTimer = CreateWaitableTimer(NULL, TRUE, _T("SysRegTimer"));
+        hTimer = CreateWaitableTimer(NULL, TRUE, "SysRegTimer");
         if (!hTimer)
         {
             return 0;
@@ -168,13 +213,16 @@ namespace System_
 
     void OsSupport::setAlarm(long secs, OsSupport::ProcessID pid)
     {
-
+        return;
         PTIME_ENTRY entry = (PTIME_ENTRY) malloc(sizeof(TIME_ENTRY));
         if (entry)
         {
             cout << "secs: " << secs << endl;
             struct timeval tm;
+#if 0
             gettimeofday(&tm, 0);
+#else
+#endif
             tm.tv_sec += secs;
 
             entry->tm = tm;
@@ -194,7 +242,7 @@ namespace System_
        struct sigaction OsSupport::s_sact;
 
 
-       OsSupport::ProcessID OsSupport::createProcess(TCHAR *procname, int procargsnum, TCHAR **procargs, bool bWait)
+       OsSupport::ProcessID OsSupport::createProcess(char *procname, int procargsnum, char **procargs, bool bWait)
        {
                ProcessID pid;
 
index 3b327d6..a4a54b9 100644 (file)
 #include "user_types.h"
 #include <ctime>
 #include <vector>
+
+#ifndef _MSC_VER
 #include <sys/time.h>
+#endif
 
 #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
 
@@ -66,7 +69,7 @@ namespace System_
 ///
 ///
 
-               static ProcessID createProcess(TCHAR * procname, int procargsnum, TCHAR ** procargs, bool wait);
+               static ProcessID createProcess(char * procname, int procargsnum, char ** procargs, bool wait);
 
 //---------------------------------------------------------------------------------------
 ///
index fa8d821..bf115a2 100644 (file)
@@ -83,12 +83,12 @@ namespace System_
 
        bool PipeReader::readSource(vector<string> & lines)
        {
-               TCHAR * buf = (TCHAR*)malloc(100 * sizeof(TCHAR));
+               char * buf = (char*)malloc(100 * sizeof(char));
 //#ifdef NDEBUG
-               memset(buf, 0x0, sizeof(TCHAR) * 100);
+               memset(buf, 0x0, sizeof(char) * 100);
 //#endif
 
-               TCHAR * res = _fgetts(buf, 100, m_File);
+               char * res = fgets(buf, 100, m_File);
                if (!res)
                {
                        //cerr << "Error: PipeReader::readPipe failed" << endl;
index 6e5a330..af22bd2 100644 (file)
@@ -45,25 +45,25 @@ namespace Sysreg_
        using std::ofstream;
 #endif
 
-       string RosBootTest::ROS_EMU_TYPE= _T("ROS_EMU_TYPE");
-       string RosBootTest::EMU_TYPE_QEMU = _T("qemu");
-       string RosBootTest::EMU_TYPE_VMWARE = _T("vmware");
-       string RosBootTest::ROS_HDD_IMAGE= _T("ROS_HDD_IMAGE");
-       string RosBootTest::ROS_CD_IMAGE = _T("ROS_CD_IMAGE");
-       string RosBootTest::ROS_MAX_TIME = _T("ROS_MAX_TIME");
-       string RosBootTest::ROS_LOG_FILE = _T("ROS_LOG_FILE");
-       string RosBootTest::ROS_SYM_DIR = _T("ROS_SYM_DIR");
-       string RosBootTest::ROS_DELAY_READ = _T("ROS_DELAY_READ");
-       string RosBootTest::ROS_SYSREG_CHECKPOINT = _T("SYSREG_CHECKPOINT:");
-       string RosBootTest::ROS_CRITICAL_IMAGE = _T("ROS_CRITICAL_IMAGE");
-       string RosBootTest::ROS_EMU_KILL = _T("ROS_EMU_KILL");
-       string RosBootTest::ROS_EMU_MEM = _T("ROS_EMU_MEM");
-       string RosBootTest::ROS_BOOT_CMD = _T("ROS_BOOT_CMD");
+       string RosBootTest::ROS_EMU_TYPE= "ROS_EMU_TYPE";
+       string RosBootTest::EMU_TYPE_QEMU = "qemu";
+       string RosBootTest::EMU_TYPE_VMWARE = "vmware";
+       string RosBootTest::ROS_HDD_IMAGE= "ROS_HDD_IMAGE";
+       string RosBootTest::ROS_CD_IMAGE = "ROS_CD_IMAGE";
+       string RosBootTest::ROS_MAX_TIME = "ROS_MAX_TIME";
+       string RosBootTest::ROS_LOG_FILE = "ROS_LOG_FILE";
+       string RosBootTest::ROS_SYM_DIR = "ROS_SYM_DIR";
+       string RosBootTest::ROS_DELAY_READ = "ROS_DELAY_READ";
+       string RosBootTest::ROS_SYSREG_CHECKPOINT = "SYSREG_CHECKPOINT:";
+       string RosBootTest::ROS_CRITICAL_IMAGE = "ROS_CRITICAL_IMAGE";
+       string RosBootTest::ROS_EMU_KILL = "ROS_EMU_KILL";
+       string RosBootTest::ROS_EMU_MEM = "ROS_EMU_MEM";
+       string RosBootTest::ROS_BOOT_CMD = "ROS_BOOT_CMD";
 
 #ifdef __LINUX__
-    string RosBootTest::ROS_EMU_PATH = _T("ROS_EMU_PATH_LIN");
+    string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_LIN";
 #else
-    string RosBootTest::ROS_EMU_PATH = _T("ROS_EMU_PATH_WIN");
+    string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_WIN";
 #endif
 
 //---------------------------------------------------------------------------------------
@@ -88,7 +88,7 @@ namespace Sysreg_
         pBuf = (char*)m_BootCmd.c_str ();
         if (pBuf)
         {
-            pBuf = strtok(pBuf, _T(" "));
+            pBuf = strtok(pBuf, " ");
             while(pBuf != NULL)
             {
                 if (!numargs)
@@ -96,7 +96,7 @@ namespace Sysreg_
 
                 args[numargs] = pBuf;
                 numargs++;
-                pBuf = _tcstok(NULL, _T(" "));
+                pBuf = strtok(NULL, " ");
             }
             args[numargs++] = 0;
         }
@@ -128,20 +128,30 @@ namespace Sysreg_
 //---------------------------------------------------------------------------------------
     void RosBootTest::getDefaultHDDImage(string & img)
     {
+#ifndef __LINUX__
+        char buffer[MAX_PATH];
+        if (GetCurrentDirectory(MAX_PATH, buffer))
+        {
+            img = buffer;
+            img += "\\output-i386";
+
+        }
+        else
+#endif
         img = "output-i386";
 
-        EnvironmentVariable::getValue(_T("ROS_OUTPUT"), img);
+        EnvironmentVariable::getValue("ROS_OUTPUT", img);
 #ifdef __LINUX__
-        img += _T("/ros.hd");
+        img += "/ros.hd";
 #else
-        img += _T("\\ros.hd");
+        img += "\\ros.hd";
 #endif
     }
 //---------------------------------------------------------------------------------------
     bool RosBootTest::isFileExisting(string output)
     {
         FILE * file;
-        file = _tfopen(output.c_str(), _T("r"));
+        file = fopen(output.c_str(), "r");
         
         if (file)
         {
@@ -174,38 +184,38 @@ namespace Sysreg_
 
 
 #ifdef __LINUX__
-        qemuimgdir += _T("/qemu-img");
+        qemuimgdir += "/qemu-img";
 
 #else
-        qemuimgdir += _T("\\qemu-img.exe");
+        qemuimgdir += "\\qemu-img.exe";
 #endif  
 
        if (!isFileExisting(qemuimgdir))
         {
-            cerr << "Error: ROS_EMU_PATH must contain the path to qemu and qemu-img    " << qemuimgdir << endl;
+            cerr << "Error: ROS_EMU_PATH must contain the path to qemu and qemu-img " << qemuimgdir << endl;
             return false;
         }
-       _tremove(image.c_str ());
+       remove(image.c_str ());
 
-        TCHAR * options[] = {NULL,
-                             _T("create"),
-                             _T("-f"),
+        char * options[] = {NULL,
+                             "create",
+                             "-f",
 #ifdef __LINUX__
                             _T("raw"),
 #else
-                            _T("vmdk"),
+                            "vmdk",
 #endif
                             NULL,
-                            _T("100M"),
+                            "100M",
                             NULL
                             };
 
 
-        options[0] = (TCHAR*)qemuimgdir.c_str();
-        options[4] = (TCHAR*)image.c_str();
+        options[0] = (char*)qemuimgdir.c_str();
+        options[4] = (char*)image.c_str();
             
         cerr << "Creating HDD Image ..." << image << endl;
-        OsSupport::createProcess ((TCHAR*)qemuimgdir.c_str(), 6, options, true);
+        OsSupport::createProcess ((char*)qemuimgdir.c_str(), 6, options, true);
         if (isFileExisting(image))
         {
             m_HDDImage = image;
@@ -223,7 +233,7 @@ namespace Sysreg_
             /* the boot cmd is already provided 
              * check if path to qemu is valid
              */
-            string::size_type pos = m_BootCmd.find_first_of(_T(" "));
+            string::size_type pos = m_BootCmd.find_first_of(" ");
             if (pos == string::npos)
             {
                 /* the bootcmd is certainly not valid */
@@ -256,9 +266,9 @@ namespace Sysreg_
         string::size_type pos;
 
 #ifdef __LINUX__
-        pos = m_EmuPath.find_last_of(_T("/"));
+        pos = m_EmuPath.find_last_of("/");
 #else       
-        pos = m_EmuPath.find_last_of(_T("\\"));
+        pos = m_EmuPath.find_last_of("\\");
 #endif
         if (pos == string::npos)
         {
@@ -281,14 +291,14 @@ namespace Sysreg_
         }
 
 #ifdef __LINUX__
-        pipe = _T("pipe:/tmp/qemu");
-               m_Src = _T("/tmp/qemu");
-        qemudir = _T("/usr/share/qemu");
-        m_DebugPort = _T("pipe");
+        pipe = "pipe:/tmp/qemu";
+               m_Src = "/tmp/qemu";
+        qemudir = "/usr/share/qemu";
+        m_DebugPort = "pipe";
 #else          
-               pipe = _T("pipe:qemu");
-               m_Src = _T("\\\\.\\pipe\\qemu");
-        m_DebugPort = _T("pipe");
+               pipe = "pipe:qemu";
+               m_Src = "\\\\.\\pipe\\qemu";
+        m_DebugPort = "pipe";
         if (!getQemuDir(qemudir))
         {
             return false;
@@ -296,24 +306,24 @@ namespace Sysreg_
 #endif  
 
         
-        m_BootCmd = m_EmuPath + _T(" -L ") + qemudir + _T(" -m ") + m_MaxMem + _T(" -serial ") + pipe;
+        m_BootCmd = m_EmuPath + " -L " + qemudir + " -m " + m_MaxMem + " -serial " + pipe;
 
         if (m_CDImage.length())
         {
             /* boot from cdrom */
-            m_BootCmd +=  _T(" -boot d -cdrom ") + m_CDImage;
+            m_BootCmd +=  " -boot d -cdrom " + m_CDImage;
 
             if (m_HDDImage.length ())
             {
                 /* add disk when specified */
-                m_BootCmd += _T(" -hda ") + m_HDDImage;
+                m_BootCmd += " -hda " + m_HDDImage;
             }
 
         }
         else if (m_HDDImage.length ())
         {
             /* boot from hdd */
-            m_BootCmd += _T(" -boot c -hda ") + m_HDDImage;
+            m_BootCmd += " -boot c -hda " + m_HDDImage;
         }
         else
         {
@@ -329,17 +339,17 @@ namespace Sysreg_
                  * to terminate the emulator in case of errors
                  * on windows we can get pid as return of CreateProcess
                  */
-        m_PidFile = _T("output-i386");
-        EnvironmentVariable::getValue(_T("ROS_OUTPUT"), m_PidFile);
-        m_PidFile += _T("/pid.txt");
-        m_BootCmd += _T(" -pidfile ");
+        m_PidFile = "output-i386";
+        EnvironmentVariable::getValue("ROS_OUTPUT", m_PidFile);
+        m_PidFile += "/pid.txt";
+        m_BootCmd += " -pidfile ";
         m_BootCmd += m_PidFile;
-               m_BootCmd += _T(" -vnc :0");
+               m_BootCmd += " -vnc :0";
 #else
 
         if (hasQemuNoRebootOption())
         {
-            m_BootCmd += _T(" -no-reboot ");
+            m_BootCmd += " -no-reboot ";
         }
 #endif
         return true;
@@ -347,7 +357,7 @@ namespace Sysreg_
 //----------------------------------------------------------------------------------------
     bool RosBootTest::extractPipeFromBootCmd()
     {
-               string::size_type pos = m_BootCmd.find(_T("-serial"));
+               string::size_type pos = m_BootCmd.find("-serial");
         if (pos == string::npos)
         {
             /* no debug options provided */
@@ -355,11 +365,11 @@ namespace Sysreg_
         }
 
         string pipe = m_BootCmd.substr(pos + 7, m_BootCmd.size() - pos -7);
-           pos = pipe.find(_T("pipe:"));
+           pos = pipe.find("pipe:");
                if (pos == 0)
                {
                    pipe = pipe.substr(pos + 5, pipe.size() - pos - 5);
-            pos = pipe.find(_T(" "));
+            pos = pipe.find(" ");
             if (pos != string::npos)
             {
                 pipe = pipe.substr(0, pos);
@@ -367,17 +377,17 @@ namespace Sysreg_
 #ifdef __LINUX__
             m_Src = pipe;
 #else
-                       m_Src = _T("\\\\.\\pipe\\") + pipe.substr(0, pos);
+                       m_Src = "\\\\.\\pipe\\" + pipe.substr(0, pos);
 #endif
-            m_DebugPort = _T("pipe");
+            m_DebugPort = "pipe";
             return true;
         }
-        pos = pipe.find(_T("stdio"));
+        pos = pipe.find("stdio");
         if (pos == 0)
                {
 #ifdef __LINUX__
                        m_Src = m_BootCmd;
-            m_DebugPort = _T("stdio");
+            m_DebugPort = "stdio";
             return true;
 #else                                  
                        cerr << "Error: reading from stdio is not supported for windows hosts - use pipes" << endl;
@@ -433,13 +443,13 @@ namespace Sysreg_
          */
 
         bool hdaboot = false;
-        string::size_type pos = m_BootCmd.find (_T("-boot c"));
+        string::size_type pos = m_BootCmd.find ("-boot c");
         if (pos != string::npos)
         {
             hdaboot = true;
         }
 
-        pos = m_BootCmd.find(_T("-hda "));
+        pos = m_BootCmd.find("-hda ");
         if (pos != string::npos)
         {
             string hdd = m_BootCmd.substr(pos + 5, m_BootCmd.length() - pos - 5);
@@ -486,18 +496,18 @@ namespace Sysreg_
                     return true;
                 }
             }
-            if (isFileExisting(_T("ReactOS-RegTest.iso")))
+            if (isFileExisting("ReactOS-RegTest.iso"))
             {
-                m_CDImage = _T("ReactOS-RegTest.iso");
+                m_CDImage = "ReactOS-RegTest.iso";
                 cerr << "Falling back to default CDROM image " << m_CDImage << endl;
                 return true;
             }
             cerr << "No CDROM image found, boot device is HDD" << endl;
-            m_CDImage = _T("");
+            m_CDImage = "";
             return true;
         }
         
-        string::size_type pos = m_BootCmd.find(_T("-boot "));
+        string::size_type pos = m_BootCmd.find("-boot ");
         if (pos == string::npos)
         {
             /* ROS_BOOT_CMD must provide a boot parameter*/
@@ -512,19 +522,19 @@ namespace Sysreg_
             cerr << "Error: ROS_BOOT_CMD misses boot parameter" << endl;
             return false;
         }
-        if (rest[0] != _T('c') && rest[0] != _T('d'))
+        if (rest[0] != 'c' && rest[0] != 'd')
         {
             cerr << "Error: ROS_BOOT_CMD has invalid boot parameter" << endl;
             return false;
         }
 
-        if (rest[0] == _T('c'))
+        if (rest[0] == 'c')
         {
             /* ROS_BOOT_CMD boots from hdd */
             return true;
         }
 
-        pos = m_BootCmd.find(_T("-cdrom "));
+        pos = m_BootCmd.find("-cdrom ");
         if (pos == string::npos)
         {
             cerr << "Error: ROS_BOOT_CMD misses cdrom parameter" << endl;
@@ -536,7 +546,7 @@ namespace Sysreg_
             cerr << "Error: ROS_BOOT_CMD misses cdrom parameter" << endl;
             return false;
         }
-        pos = rest.find(_T(" "));
+        pos = rest.find(" ");
         if (pos != string::npos)
         {
             rest = rest.substr(0, pos);
@@ -591,7 +601,7 @@ namespace Sysreg_
         if (m_PidFile.length () && isFileExisting(m_PidFile))
         {
             cerr << "Deleting pid file " << m_PidFile << endl;
-            _tremove(m_PidFile.c_str ());
+            remove(m_PidFile.c_str ());
         }
 
         cerr << "Opening Data Source:" << m_BootCmd << endl;
@@ -638,7 +648,7 @@ namespace Sysreg_
             conf_parser.getStringValue (RosBootTest::ROS_CD_IMAGE, m_CDImage);
         }
         /* reset boot cmd */
-        m_BootCmd = _T("");
+        m_BootCmd = "";
 
 
         conf_parser.getIntValue (RosBootTest::ROS_MAX_TIME, m_MaxTime);
@@ -668,7 +678,7 @@ namespace Sysreg_
 
         if (m_PidFile.length ())
         {
-            _tremove(m_PidFile.c_str ());
+            remove(m_PidFile.c_str ());
         }
        }
     
@@ -797,7 +807,7 @@ namespace Sysreg_
                        {
                                line.erase (0, line.find (RosBootTest::ROS_SYSREG_CHECKPOINT) +
                                                          RosBootTest::ROS_SYSREG_CHECKPOINT.length ());
-                               if (!_tcsncmp(line.c_str (), m_Checkpoint.c_str (), m_Checkpoint.length ()))
+                               if (!strncmp(line.c_str (), m_Checkpoint.c_str (), m_Checkpoint.length ()))
                                {
                                        state = DebugStateCPReached;
                                        break;
@@ -806,7 +816,7 @@ namespace Sysreg_
                        }
 
 
-                       if (line.find (_T("*** Fatal System Error")) != string::npos)
+                       if (line.find ("*** Fatal System Error") != string::npos)
                        {
                                cerr << "Blue Screen of Death detected" <<endl;
                                if (m_Checkpoints.size ())
@@ -818,7 +828,7 @@ namespace Sysreg_
                                                m_Checkpoints.erase (m_Checkpoints.begin ());
                                                cerr << cp << endl;
                                        }while(m_Checkpoints.size ());
-                                       cerr << _T("----------------------------------") << endl;
+                                       cerr << "----------------------------------" << endl;
                                }
                                if (i + 1 < debug_data.size () )
                                {
@@ -829,14 +839,14 @@ namespace Sysreg_
                                                cerr << data << endl;
                                                i++;
                                        }
-                                       cerr << _T("----------------------------------") << endl;
+                                       cerr << "----------------------------------" << endl;
                                }
                                state = DebugStateBSODDetected;
                                break;
                        }
-                       else if (line.find (_T("Unhandled exception")) != string::npos)
+                       else if (line.find ("Unhandled exception") != string::npos)
                        {
-                               if (m_CriticalImage == _T("IGNORE"))
+                               if (m_CriticalImage == "IGNORE")
                                {
                                        ///
                                        /// ignoring all user-mode exceptions
@@ -859,7 +869,7 @@ namespace Sysreg_
                                /// 
 
                                string address = debug_data[i+2];
-                               string::size_type pos = address.find_last_of (_T(" "));
+                               string::size_type pos = address.find_last_of (" ");
                                if (pos == string::npos)
                                {
                                        cerr << "Error: trace is not available (corrupted debug info" << endl;
@@ -874,7 +884,7 @@ namespace Sysreg_
                                ///
                                string modulename = debug_data[i+3];
                                
-                               pos = modulename.find_last_of (_T("\\"));
+                               pos = modulename.find_last_of ("\\");
                                if (pos == string::npos)
                                {
                                        cerr << "Error: trace is not available (corrupted debug info" << endl;
@@ -891,7 +901,7 @@ namespace Sysreg_
                                        continue;
                                }
 
-                               pos = appname.find_last_of (_T("."));
+                               pos = appname.find_last_of (".");
                                if (pos == string::npos)
                                {
                                        cerr << "Error: trace is not available (corrupted debug info" << endl;
@@ -940,7 +950,7 @@ namespace Sysreg_
 
         if (m_DebugFile.length ())
                {
-                       _tremove(m_DebugFile.c_str ());
+                       remove(m_DebugFile.c_str ());
                        file.open (m_DebugFile.c_str ());
                }
 
@@ -973,7 +983,6 @@ namespace Sysreg_
                        }
                        lines += (vect.size() -prev_count); //WTF?
         }
-               m_DataSource->closeSource();
                if (write_log)
                {
                        file.close();
index 2936f69..62852f1 100644 (file)
@@ -27,10 +27,10 @@ namespace System_
 {
 
        using std::vector;
-       string SymbolFile::VAR_ROS_OUTPUT = _T("ROS_OUTPUT");
-       string SymbolFile::ROS_ADDR2LINE = _T("ROS_ADDR2LINE");
-       string SymbolFile::m_SymbolPath= _T("");
-       string SymbolFile::m_SymResolver= _T("");
+       string SymbolFile::VAR_ROS_OUTPUT = "ROS_OUTPUT";
+       string SymbolFile::ROS_ADDR2LINE = "ROS_ADDR2LINE";
+       string SymbolFile::m_SymbolPath= "";
+       string SymbolFile::m_SymResolver= "";
        SymbolFile::SymbolMap SymbolFile::m_Map;
 
 //---------------------------------------------------------------------------------------
@@ -51,9 +51,9 @@ namespace System_
                vector<string> vect;
                string current_dir;
 
-               if (Path == _T(""))
+               if (Path == "")
                {
-                       current_dir = _T("output-i386");
+                       current_dir = "output-i386";
                        EnvironmentVariable::getValue(SymbolFile::VAR_ROS_OUTPUT, current_dir);
                }
                else
@@ -70,10 +70,10 @@ namespace System_
                }
 
                string val = current_dir;
-               val.insert (val.length()-1, _T("\\*"));
+               val.insert (val.length()-1, "\\*");
 
-               struct _tfinddatai64_t c_file;
-               intptr_t hFile = _tfindfirsti64(val.c_str(), &c_file);
+               struct _finddatai64_t c_file;
+               intptr_t hFile = _findfirsti64(val.c_str(), &c_file);
 
                if (hFile == -1L)
                {
@@ -86,16 +86,16 @@ namespace System_
 
                        do
                        {
-                               TCHAR * pos;
-                               if ((pos = _tcsstr(c_file.name, _T(".nostrip."))))
+                               char * pos;
+                               if ((pos = strstr(c_file.name, ".nostrip.")))
                                {
-                                       size_t len = _tcslen(pos);
+                                       size_t len = strlen(pos);
                                        string modulename = c_file.name;
                                        string filename = modulename;
                                        modulename.erase(modulename.length() - len, len);
 
                                        string path = current_dir;
-                                       path.insert (path.length () -1, _T("\\"));
+                                       path.insert (path.length () -1, "\\");
                                        path.insert (path.length () -1, filename);
 #ifdef NDEBUG                          
                                        cerr << "Module Name " << modulename << endl << "File Name " << path << endl;
@@ -109,7 +109,7 @@ namespace System_
                                        if (c_file.name[0] != _T('.'))
                                        {
                                                string path = current_dir;
-                                               path.insert (path.length ()-1, _T("\\"));
+                                               path.insert (path.length ()-1, "\\");
                                                path.insert (path.length ()-1, c_file.name);
                                                vect.push_back (path);
                                        }
@@ -125,7 +125,7 @@ namespace System_
                                current_dir = vect.front ();
                                vect.erase (vect.begin());
                                val = current_dir;
-                               val.insert (val.length() -1, _T("\\*"));
+                               val.insert (val.length() -1, "\\*");
                                hFile = _tfindfirsti64(val.c_str(), &c_file);
                                if (hFile != -1L)
                                {
@@ -149,32 +149,27 @@ namespace System_
        {
                SymbolMap::const_iterator it = m_Map.find (module_name);
 
-               if (it == m_Map.end () || m_SymResolver == _T(""))
+               if (it == m_Map.end () || m_SymResolver == "")
                {
                        cerr << "SymbolFile::resolveAddress> no symbol file or ROS_ADDR2LINE not set" << endl;
                        return false;
                }
 
-               TCHAR szCmd[300];
+               char szCmd[300];
 
-               _stprintf(szCmd, _T("%s %s %s"), m_SymResolver.c_str (), it->second.c_str (), module_address.c_str());  
+               sprintf(szCmd, "%s %s %s", m_SymResolver.c_str (), it->second.c_str (), module_address.c_str());        
                string pipe_cmd(szCmd);
-
+        vector<string> vect;        
                PipeReader pipe_reader;
 
-               if (!pipe_reader.openPipe (pipe_cmd))
+               if (!pipe_reader.openSource(pipe_cmd))
                {
                        cerr << "SymbolFile::resolveAddress> failed to open pipe" <<pipe_cmd <<endl;
                        return false;
                }
 
-               if (Buffer.capacity () < 100)
-               {
-                       Buffer.reserve (500);
-               }
-
-               bool ret = pipe_reader.readPipe (Buffer);
-               pipe_reader.closePipe ();
+               bool ret = pipe_reader.readSource (vect);
+               pipe_reader.closeSource ();
                return ret;
        }
 
index b2db2d2..8d60b3c 100644 (file)
@@ -22,17 +22,17 @@ using Sysreg_::RosBootTest;
 using System_::SymbolFile;
 #endif
 
-static const TCHAR USAGE[] = 
-_T("sysreg.exe [conf_file]\nconfiguration file (default: sysreg.cfg)");
+static const char USAGE[] = 
+"sysreg.exe [conf_file]\nconfiguration file (default: sysreg.cfg)";
 
 
 
 
-int _tmain(int argc, TCHAR * argv[])
+int main(int argc, char * argv[])
 {
        ConfigParser config;
-       TCHAR DefaultConfig[] = _T("sysreg.cfg");
-       TCHAR *ConfigFile;
+       char DefaultConfig[] = "sysreg.cfg";
+       char *ConfigFile;
 
        if ((argc > 2))
        {
@@ -65,7 +65,7 @@ int _tmain(int argc, TCHAR * argv[])
        }
        
        string envvar;
-       string ros = _T("ROS_OUTPUT");
+       string ros = "ROS_OUTPUT";
        config.getStringValue (ros, envvar);
 #if 0
        SymbolFile::initialize (config, envvar);
index ac3ef21..b83f486 100644 (file)
@@ -26,7 +26,6 @@ SYSREGBUILD_SOURCES = $(addprefix $(SYSREGBUILD_BASE_),\
        sysreg.cpp \
        file_reader.cpp \
        os_support.cpp \
-       unicode.cpp \
        )
 
 SYSREGBUILD_OBJECTS = \
@@ -85,10 +84,6 @@ $(SYSREGBUILD_INT_)os_support.o: $(SYSREGBUILD_BASE_)os_support.cpp | $(SYSREGBU
        $(ECHO_CC)
        ${host_gpp} $(SYSREGBUILD_HOST_CFLAGS) -c $< -o $@
 
-$(SYSREGBUILD_INT_)unicode.o: $(SYSREGBUILD_BASE_)unicode.cpp | $(SYSREGBUILD_INT)
-       $(ECHO_CC)
-       ${host_gpp} $(SYSREGBUILD_HOST_CFLAGS) -c $< -o $@
-
 .PHONY: sysregbuild_clean
 sysreg_clean:
        -@$(rm) $(SYSREGBUILD_TARGET) $(SYSREGBUILD_OBJECTS) 2>$(NUL)
diff --git a/reactos/tools/sysreg/unicode.cpp b/reactos/tools/sysreg/unicode.cpp
deleted file mode 100644 (file)
index cba5ca8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "unicode.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-namespace System_
-{
-//---------------------------------------------------------------------------------------
-       bool UnicodeConverter::ansi2Unicode(char * abuf, wchar_t *outbuf, size_t length)
-       {
-               size_t i = 0;
-               int conv;
-
-               while((conv = mbtowc(&outbuf[i], &abuf[i], length - i)))
-               {
-                       i += conv;
-                       if (i == length)
-                               break;
-               }
-               outbuf[i] = L'\0';
-
-               if (i)
-               {
-                       return true;
-               }
-               else
-               {
-                       return false;
-               }
-       }
-} // end of namespace System_
diff --git a/reactos/tools/sysreg/unicode.h b/reactos/tools/sysreg/unicode.h
deleted file mode 100644 (file)
index 86d5cad..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef UNICODE_H__
-#define UNICODE_H__ // unicode.h
-
-#include "user_types.h"
-
-namespace System_
-{
-
-       class UnicodeConverter
-       {
-       public:
-//---------------------------------------------------------------------------------------
-///
-/// UnicodeConverter
-///
-/// Description: destructor of class UnicodeConverter
-
-       virtual ~UnicodeConverter()
-       {}
-
-//---------------------------------------------------------------------------------------
-///
-/// UnicodeConverter
-///
-/// Description: converts an ANSI buffer to wide character buffer
-/// using standard c routines
-///
-/// Note: make sure before calling that outbuf is big enough to receive the result
-///
-/// @param abuf ansi buffer used a source
-/// @param outbuf wide character buffer receives result
-/// @param length length of abuf
-///
-/// @return bool
-
-       static bool ansi2Unicode(char * abuf, wchar_t * outbuf, size_t length);
-
-
-       protected:
-//---------------------------------------------------------------------------------------
-///
-/// UnicodeConverter
-///
-/// Description: constructor of class UnicodeConverter
-
-               UnicodeConverter()
-               {}
-
-       }; // end of class UnicodeConverter
-
-
-
-} // end of namespace System_
-
-#endif /* end of UNICODE_H__ */
index 742fa81..36e7c01 100644 (file)
 #include <iostream>
 
 #ifndef __LINUX__
- #include <tchar.h>
-#else
- #define TCHAR char
- #define tstrcpy strcpy
- #define _tcstok strtok
- #define _tcschr strchr
- #define _tcscat strcat
- #define _tcscpy(str1, str2) strcpy(str1, str2)
- #define _tcslen(str1) strlen(str1)
- #define _tcstod strtod
- #define _tcscmp strcmp
- #define _tcstoul strtoul
- #define _tcsncmp strncmp
- #define _tremove remove
- #define _ttoi atoi
- #define _T(x) x
- #define _tfopen fopen
- #define _tcsstr strstr
- #define _fgetts fgets
- #define _tgetenv getenv
- #define _tmain main
- #define _tcstol strtol
+#define popen _popen
+#define pclose _pclose
 #endif
 
-       typedef std::basic_string<TCHAR> string;
-       typedef std::basic_istringstream<TCHAR> istringstream;
+       typedef std::basic_string<char> string;
+       typedef std::basic_istringstream<char> istringstream;
 
 
 #ifdef UNICODE