Changeset 24774

Show
Ignore:
Timestamp:
11/25/08 02:27:04 (5 years ago)
Author:
saturday06
Message:

miriioo

Location:
lang/cplusplus/i3/trunk
Files:
16 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/trunk/src/Common.h

    r24540 r24774  
    2020#include <iconv.h> 
    2121#include <libintl.h> 
     22 
     23// disable POSIX/XSI format strings 
     24#undef fprintf 
     25#undef vfprintf 
     26#undef printf 
     27#undef vprintf 
     28#undef sprintf 
     29#undef vsprintf 
     30#undef snprintf 
     31#undef vsnprintf 
     32 
    2233//#include <argtable2.h> 
    2334#ifdef HAVE_POPT_H 
     
    94105#define UTF8_TO_UTF16LE_ALLOCA(data8, data16) \ 
    95106    wchar_t* data16 = NULL; \ 
    96     do { \ 
     107    for (;;) { \ 
    97108        const char* check = data8; check; \ 
    98109        unsigned int num_elements = MultiByteToWideChar(CP_UTF8, 0, data8, -1, NULL, 0); \ 
     
    116127            break; \ 
    117128        } \ 
    118     } while (0) 
     129        break; \ 
     130    } 
    119131 
    120132#define UTF16LE_TO_UTF8_ALLOCA(data16, data8) \ 
    121133    char* data8 = NULL; \ 
    122     do { \ 
     134    for (;;) { \ 
    123135        const wchar_t* check = data16; check; \ 
    124136        unsigned int num_elements = WideCharToMultiByte( CP_UTF8, 0, data16, -1, NULL, 0, 0, 0); \ 
     
    137149            break; \ 
    138150        } \ 
    139     } while (0) 
     151        break; \ 
     152    } 
    140153 
    141154 
  • lang/cplusplus/i3/trunk/src/Config.cpp

    r24540 r24774  
    33#include "Mediator.h" 
    44#include "Config.h" 
     5 
     6#include <vector> 
     7#include <list> 
    58 
    69namespace i3 
     
    113116}; 
    114117*/ 
    115 struct MyIniLoader : public grammar<MyIniLoader> 
     118struct MyIniLoader : public grammar<MyIniLoader>, public boost::noncopyable 
    116119{ 
    117120    struct integer_value 
     
    299302} 
    300303 
    301 void load_config(Config& destination, const TCHAR* str) 
     304i3::Config parse_config(const TCHAR* str) 
    302305{ 
    303306    using namespace i3::config; 
    304307    using namespace boost::spirit; 
    305     i3::config::ConfigTemp c; 
     308 
     309    i3::config::ConfigTemp c = {}; 
     310    i3::Config destination; 
    306311 
    307312    MyIniLoader i(c); 
     
    358363        abort(); 
    359364    } 
     365    return destination; 
    360366} 
    361367 
  • lang/cplusplus/i3/trunk/src/Config.h

    r24540 r24774  
    4242 
    4343 
    44 void copy_config(Config& destination, const Config& source); 
    45 void load_config(Config& destination, const TCHAR* str); 
     44Config parse_config(const TCHAR* str); 
    4645 
    4746} 
  • lang/cplusplus/i3/trunk/src/Mediator.cpp

    r23069 r24774  
    2121exit_status Mediator::start() 
    2222{ 
    23     if (true) 
    24     { 
     23#if 1 
    2524        // threaded 
     25        inputWindow.createUI(); 
    2626        completionWindow.start(); 
    2727        outputWindow.start(); 
    2828        shellManager.start(); 
    2929        inputWindow.run(); 
    30     } 
    31     else 
    32     { 
     30#else 
    3331        // no threaded gui 
    3432        completionWindow.createUI(); 
     
    3836 
    3937        global_loop(); 
    40     } 
    41  
     38#endif 
    4239    return 0; 
    4340} 
  • lang/cplusplus/i3/trunk/src/gui-windows/InputWindowCore.cpp

    r23153 r24774  
    2929void InputWindowCore<InputWindow>::createUI() 
    3030{ 
     31    if (getWindow()) { 
     32        return; 
     33    } 
     34 
    3135    LoadLibrary(_T("RICHED32.DLL")); 
    3236    //LoadLibrary(_T("Riched20.dll")); // required? 
  • lang/cplusplus/i3/trunk/src/mol/include/mol/Thread.h

    r23714 r24774  
    5959    void start() 
    6060    { 
     61#if MOL_OS_WINDOWS 
     62        Sleep(100); 
     63#else 
     64#endif 
    6165        core.start(); 
    6266    } 
  • lang/cplusplus/i3/trunk/src/mol/src/DebugLogger.cpp

    r23048 r24774  
    11#include <mol/PrecompiledHeaders.h> 
    22#include <mol/Mol.h> 
     3#include <mol/Debug.h> 
    34 
    45using namespace std; 
     
    910void clear_mapped_file(HANDLE mapped_file) 
    1011{ 
    11  
    1212    int8_t (*const view)[sizeof(DebugMappedFile)] = (int8_t(*const)[sizeof(DebugMappedFile)])MapViewOfFile( 
    1313                mapped_file, FILE_MAP_WRITE, 0, 0, sizeof(DebugMappedFile)); 
  • lang/cplusplus/i3/trunk/src/mol/src/Test2.cpp

    r23153 r24774  
    33#include <mol/MscCrt.h> 
    44#include <boost/test/unit_test.hpp> 
     5 
     6#if defined(_MSC_VER) && !defined(NDEBUG) 
     7#pragma warning (disable: 4189) 
     8#endif 
    59 
    610template <typename T> 
  • lang/cplusplus/i3/trunk/src/mol/src/windows/WindowProcedureTest.cpp

    r22570 r24774  
    7979        MSG msg = {}; 
    8080        unsigned int loop = 100; 
    81         while (true) 
     81        for (;;) 
    8282        { 
    8383            Sleep(1); 
  • lang/cplusplus/i3/trunk/src/os-windows/CygwinPty.cpp

    r23153 r24774  
    9191 
    9292    if (!DuplicateHandle(GetCurrentProcess(),hMyStdInput ,GetCurrentProcess(),NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) || 
    93             !DuplicateHandle(GetCurrentProcess(),hMyStdOutput,GetCurrentProcess(),NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) || 
    94             !DuplicateHandle(GetCurrentProcess(),hMyStdError ,GetCurrentProcess(),NULL, 0, FALSE, DUPLICATE_SAME_ACCESS)) 
     93        !DuplicateHandle(GetCurrentProcess(),hMyStdOutput,GetCurrentProcess(),NULL, 0, FALSE, DUPLICATE_SAME_ACCESS) || 
     94        !DuplicateHandle(GetCurrentProcess(),hMyStdError ,GetCurrentProcess(),NULL, 0, FALSE, DUPLICATE_SAME_ACCESS)) 
    9595    { 
    9696 
  • lang/cplusplus/i3/trunk/src/os-windows/Os.cpp

    r24540 r24774  
    6767    } 
    6868 
    69     TCHAR locale_dir[1000] = {}; 
     69    TCHAR locale_dir[3000] = {}; 
    7070    DWORD result = GetModuleFileName( 
    7171                       GetModuleHandle(NULL), 
    7272                       locale_dir, 
    7373                       _countof(locale_dir)); 
    74     if (result == 0 || result == _countof(locale_dir))   // error 
    75     { 
    76         memset(locale_dir, 0, sizeof(locale_dir)); 
    77         return; 
    78     } 
     74    if (result == 0 || result == _countof(locale_dir)) 
     75    { 
     76        //memset(locale_dir, 0, sizeof(locale_dir)); 
     77        return; 
     78    } 
     79 
    7980    if (PathRemoveFileSpec(locale_dir) == FALSE) 
    8081    { 
    81         memset(locale_dir, 0, sizeof(locale_dir)); 
    82         return; 
    83     } 
    84     if (0 != _tcscat_s(locale_dir, _T("\\locale"))) 
    85     { 
    86         memset(locale_dir, 0, sizeof(locale_dir)); 
     82        //memset(locale_dir, 0, sizeof(locale_dir)); 
     83        return; 
     84    } 
     85 
     86    TCHAR more[] = _T("locale"); 
     87    if (_countof(locale_dir) <= _countof(more) + _tcslen(locale_dir) + 1) 
     88    { 
     89        //memset(locale_dir, 0, sizeof(locale_dir)); 
     90        return; 
     91    } 
     92 
     93    if (PathAppend(locale_dir, more) == FALSE) 
     94    { 
     95        //memset(locale_dir, 0, sizeof(locale_dir)); 
    8796        return; 
    8897    } 
  • lang/cplusplus/i3/trunk/src/os-windows/OsTest1.cpp

    r23153 r24774  
    8080    BOOST_CHECK(true); 
    8181} 
     82 
     83 
     84#if defined(_MSC_VER) && !defined(NDEBUG) 
     85#pragma warning (disable: 4309) 
     86#endif 
    8287 
    8388char testdata_utf8[] = 
  • lang/cplusplus/i3/trunk/src/os-windows/OsTest2.cpp

    r23617 r24774  
    33 
    44#include "Common.h" 
     5#include "Config.h" 
    56#include "Utf8ToUtf16Stream.h" 
     7 
     8#include <iostream> 
     9#include <fstream> 
    610 
    711#define WINDOWS_PATH_MAX_ELEMENTS 4000 
    812 
    913using namespace std; 
     14 
     15BOOST_AUTO_TEST_CASE(bcooooiodefgffffh) 
     16{ 
     17    i3::Config config = i3::parse_config(_T("foo")); 
     18    const TCHAR* foo = config.string_key; 
     19} 
    1020 
    1121BOOST_AUTO_TEST_CASE(bcooooiodefgh) 
     
    1525    cygwin1_cygwin_dll_init(); 
    1626 
    17     FARPROC cygwin1_mkdir = GetProcAddress(cygwin1, "rmdir"); 
    18     int result = ((int (*)(const char *pathname))cygwin1_mkdir)("/test"); 
     27    int (*cygwin1_rmdir)(const char*)  = (decltype(cygwin1_rmdir))GetProcAddress(cygwin1, "rmdir"); 
     28    int result = cygwin1_rmdir("/test"); 
    1929    FreeLibrary(cygwin1); 
    2030} 
  • lang/cplusplus/i3/trunk/src/os-windows/msvc/win_iconv.c

    r24539 r24774  
    2626 
    2727#include <windows.h> 
    28 #include <errno.h> 
    2928#include <string.h> 
    3029#include <stdlib.h> 
     30 
     31#ifndef _WIN32_WCE 
     32#include <errno.h> 
     33#else 
     34 
     35#ifdef _MSC_VER 
     36__declspec (thread) int errno = 0; 
     37#else 
     38//_thread int errno = 0; 
     39int errno = 0; 
     40#endif 
     41 
     42static int* _errno(void) 
     43{ 
     44    return &errno; 
     45} 
     46 
     47#define E2BIG           7       /* Arg list too long */ 
     48#define ENOMEM          12      /* Not enough space */ 
     49#define EINVAL          22      /* Invalid argument */ 
     50#define EILSEQ          42      /* Illegal byte sequence */ 
     51#undef GetProcAddress 
     52#define GetProcAddress(hModule, lpProcName) GetProcAddressW(hModule, L##lpProcName) 
     53#endif 
    3154 
    3255#if 0 
     
    14231446    hr = ConvertINetUnicodeToMultiByte(&cv->mode, cv->codepage, 
    14241447            (const wchar_t *)wbuf, &wbufsize, tmpbuf, &tmpsize); 
    1425     if (hr != S_OK || insize != wbufsize) { 
     1448    if (hr != S_OK || insize != wbufsize) 
    14261449        return_error(EILSEQ); 
    1427     } else if (bufsize < tmpsize) { 
     1450    else if (bufsize < tmpsize) 
    14281451        return_error(E2BIG); 
    1429     } else if (cv->mblen(cv, (uchar *)tmpbuf, tmpsize) != tmpsize) { 
     1452    else if (cv->mblen(cv, (uchar *)tmpbuf, tmpsize) != tmpsize) 
    14301453        return_error(EILSEQ); 
    1431     } 
    1432  
    1433     if (tmpsize >= sizeof(tmpbuf)) { 
    1434         return_error(E2BIG); 
    1435     } 
    14361454    memcpy(buf, tmpbuf, tmpsize); 
    14371455    return tmpsize; 
     
    15031521utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize) 
    15041522{ 
    1505     uint wc = 0; 
     1523    uint wc; 
    15061524 
    15071525    if (bufsize < 4) 
     
    17001718{ 
    17011719    iso2022_esc_t *iesc = iso2022jp_esc; 
    1702     char tmp[MB_CHAR_MAX] = {0}; 
     1720    char tmp[MB_CHAR_MAX]; 
    17031721    int tmpsize = MB_CHAR_MAX; 
    17041722    int insize = wbufsize; 
    17051723    HRESULT hr; 
    17061724    DWORD dummy = 0; 
    1707     int len = 0; 
    1708     int esc_len = 0; 
    1709     int cs = 0; 
    1710     int shift = 0; 
    1711     int i = 0; 
     1725    int len; 
     1726    int esc_len; 
     1727    int cs; 
     1728    int shift; 
     1729    int i; 
    17121730 
    17131731    /* 
  • lang/cplusplus/i3/trunk/windows/i3_test.vcproj

    r23849 r24774  
    136136                                EnableFiberSafeOptimizations="true" 
    137137                                AdditionalIncludeDirectories="..\src\;&quot;..\src\gui-windows&quot;;&quot;..\src\os-windows&quot;;&quot;..\src\os-windows\msvc&quot;;..\src\mol\include;..\src\intl" 
    138                                 PreprocessorDefinitions="WIN32;NDEBUG" 
     138                                PreprocessorDefinitions="WIN32;NDEBUG;BOOST_NO_TYPEID" 
    139139                                StringPooling="true" 
    140140                                RuntimeLibrary="2" 
     
    399399                        </File> 
    400400                        <File 
    401                                 RelativePath="..\src\os-windows\win_iconv.c" 
     401                                RelativePath="..\src\os-windows\msvc\win_iconv.c" 
    402402                                > 
    403403                                <FileConfiguration 
  • lang/cplusplus/i3/trunk/windows/mol_test.vcproj

    r23823 r24774  
    138138                                EnableFiberSafeOptimizations="false" 
    139139                                AdditionalIncludeDirectories="..\src\mol\include" 
    140                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
     140                                PreprocessorDefinitions="WIN32;NDEBUG;BOOST_NO_TYPEID;_CONSOLE" 
    141141                                ExceptionHandling="2" 
    142142                                RuntimeLibrary="2" 
     
    295295                        </File> 
    296296                        <File 
    297                                 RelativePath="..\src\mol\src\DebugLogger.cpp" 
    298                                 > 
    299                         </File> 
    300                         <File 
    301297                                RelativePath="..\src\mol\include\mol\StaticData.cpp" 
    302298                                > 
     
    349345                        </File> 
    350346                        <File 
     347                                RelativePath="..\src\mol\include\mol\Debug.h" 
     348                                > 
     349                        </File> 
     350                        <File 
    351351                                RelativePath="..\src\mol\include\mol\os-windows\Debug.h" 
    352                                 > 
    353                         </File> 
    354                         <File 
    355                                 RelativePath="..\src\mol\include\mol\Debug.h" 
    356352                                > 
    357353                        </File>