Changeset 19278

Show
Ignore:
Timestamp:
09/14/08 10:43:06 (5 years ago)
Author:
saturday06
Message:

iroiro

Location:
lang/cplusplus/i3
Files:
6 modified
1 moved

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/TODO.txt

    r19273 r19278  
    1 妄幻夢想白昼夢.txt 
     1妄幻夢想白昼夢.txt 
    22 
    33*(a|b|c|k|z)shと同じkey打ちで、同じ効果!、でも補完は親切に! 
     
    4848*utf8 cygwinでもテストする 
    4949*アプリケーションログを取りたい 
     50*MBCS版はlibintl.dllも別ビルド 
  • lang/cplusplus/i3/intl/wlibintl.h

    r19274 r19278  
    33 
    44#include <windows.h> 
    5 #define WINDOWS_PATH_MAX_ELEMENTS 4000 
     5 
     6#define WLIBINTL_WINDOWS_PATH_MAX_ELEMENTS 4000 
    67 
    78#define WLIBINTL_UTF8_TO_UTF16LE_ALLOCA(data8, data16) \ 
    8     WCHAR* data16 = NULL; \ 
     9    wchar_t* data16 = NULL; \ 
    910    do { \ 
    10         const char* check = data8;                                 \ 
     11        const char* check = data8; check;                                \ 
    1112        unsigned int num_elements = MultiByteToWideChar(CP_UTF8, 0, data8, -1, NULL, 0); \ 
    1213        if (num_elements == 0 || num_elements >= WINDOWS_PATH_MAX_ELEMENTS) { \ 
     
    2324    char* data8 = NULL; \ 
    2425    do { \ 
    25         const WCHAR* check = data16;                                 \ 
     26        const wchar_t* check = data16; check;                           \ 
    2627        unsigned int num_elements = WideCharToMultiByte( CP_UTF8, 0, data16, -1, NULL, 0, 0, 0); \ 
    2728        if (num_elements == 0 || num_elements >= WINDOWS_PATH_MAX_ELEMENTS) { \ 
     
    3536    } while (0) 
    3637 
    37 static inline const WCHAR* wbindtextdomain(const char* domainname,  
    38                                const WCHAR* dirname16) { 
     38static const wchar_t* wbindtextdomain(const char* domainname,  
     39                               const wchar_t* dirname16) { 
    3940    WLIBINTL_UTF16LE_TO_UTF8_ALLOCA(dirname16, dirname8); 
    4041    if (dirname8 == NULL) { 
     
    4748} 
    4849 
     50 
     51//#define _(String) (wgettext(String, L##String)) 
     52static const wchar_t* wgettext(const char* msgid, const wchar_t* wmsgid) 
     53{ 
     54    const char* translated = gettext(msgid); 
     55    return translated != msgid ? (const wchar_t*)translated : wmsgid; 
     56} 
     57 
     58 
     59#ifdef __cplusplus 
     60 
     61template <size_t Size1, size_t Size2> 
     62static inline const wchar_t* wgettext(const char (&msgid)[Size1], const wchar_t (&wmsgid)[Size2]) 
     63{ 
     64    char a[Size1 == 0 ? 1 : -1]; 
     65    char b[Size1 == Size2 ? 1 : -1]; 
     66    a,b; 
     67 
     68    return wgettext((const char*)msgid, (const wchar_t*)wmsgid); 
     69} 
     70 
     71#endif 
     72 
    4973//undef WINDOWS_PATH_MAX_ELEMENTS 
    5074//undef UTF8_TO_UTF16LE_ALLOCA 
    5175 
    52  
    5376#endif // WLIBINTL_H_4985016 
  • lang/cplusplus/i3/src/LibintlConfig.h

  • lang/cplusplus/i3/src/gui-windows/Gui.h

    r19233 r19278  
    22 
    33#include "../os-windows/WindowsCommon.h" 
    4  
    5 #if defined(UNICODE) || defined(_UNICODE) 
    6 #define _(String)   (reinterpret_cast<const TCHAR*>(i3::gettext_utf16(String, L##String))) 
    7 #else 
    8 #define _(String)   (reinterpret_cast<const TCHAR*>(gettext(String))) 
    9 #endif 
    104 
    115namespace i3 
  • lang/cplusplus/i3/src/os-windows/Os.cpp

    r18928 r19278  
    44namespace i3 
    55{ 
     6void init_windows_gettext() 
     7{ 
     8    using namespace std; 
     9     
     10    TCHAR locale_dir[1000] = {}; 
     11    DWORD result = GetModuleFileName( 
     12                       GetModuleHandle(NULL), 
     13                       locale_dir, 
     14                       _countof(locale_dir)); 
     15    if (result == 0 || result == _countof(locale_dir))   // error 
     16    { 
     17        return; 
     18    } 
     19    if (PathRemoveFileSpec(locale_dir) == FALSE) 
     20    { 
     21        return; 
     22    } 
     23    if (0 != _tcscat_s(locale_dir, _T("\\locale"))) 
     24    { 
     25        return; 
     26    } 
     27 
     28    setlocale(LC_ALL, ""); 
     29 
     30#if defined(UNICODE) || defined(_UNICODE) 
     31    wbindtextdomain(PACKAGE_NAME, locale_dir); 
     32    bind_textdomain_codeset(PACKAGE_NAME,"UTF-16LE"); 
     33#else 
     34    bindtextdomain(PACKAGE_NAME, locale_dir); 
     35#endif 
     36 
     37    textdomain(PACKAGE_NAME); 
     38} 
     39 
    640void init_os_global_data(int& argc,char**& argv) 
    741{ 
  • lang/cplusplus/i3/windows/i3.vcproj

    r18001 r19278  
    374374                        </File> 
    375375                        <File 
     376                                RelativePath="..\src\windows\CompletionWindowCore.h" 
     377                                > 
     378                        </File> 
     379                        <File 
    376380                                RelativePath="..\src\gui-windows\CompletionWindowCore.h" 
    377381                                > 
    378382                        </File> 
    379383                        <File 
    380                                 RelativePath="..\src\windows\CompletionWindowCore.h" 
    381                                 > 
    382                         </File> 
    383                         <File 
    384384                                RelativePath="..\src\os-windows\CygwinPty.h" 
    385385                                > 
     
    406406                        </File> 
    407407                        <File 
     408                                RelativePath="..\src\windows\InputWindowCore.h" 
     409                                > 
     410                        </File> 
     411                        <File 
    408412                                RelativePath="..\src\gui-windows\InputWindowCore.h" 
    409                                 > 
    410                         </File> 
    411                         <File 
    412                                 RelativePath="..\src\windows\InputWindowCore.h" 
    413413                                > 
    414414                        </File> 
  • lang/cplusplus/i3/windows/i3_test.vcproj

    r19216 r19278  
    329329                        </File> 
    330330                        <File 
    331                                 RelativePath="..\src\LibintlUtf16le.cpp" 
    332                                 > 
    333                         </File> 
    334                         <File 
    335331                                RelativePath="..\src\Mediator.cpp" 
    336332                                > 
     
    403399                        </File> 
    404400                        <File 
     401                                RelativePath="..\src\gui-windows\CompletionWindowCore.h" 
     402                                > 
     403                        </File> 
     404                        <File 
    405405                                RelativePath="..\src\windows\CompletionWindowCore.h" 
    406406                                > 
    407407                        </File> 
    408408                        <File 
    409                                 RelativePath="..\src\gui-windows\CompletionWindowCore.h" 
    410                                 > 
    411                         </File> 
    412                         <File 
    413409                                RelativePath="..\src\os-windows\CygwinPty.h" 
    414410                                > 
     
    468464                        <File 
    469465                                RelativePath="..\src\os-windows\WindowsCommon.h" 
     466                                > 
     467                        </File> 
     468                        <File 
     469                                RelativePath="..\intl\wlibintl.h" 
    470470                                > 
    471471                        </File>