virtual bool load(const string& i_base_folder) { setlocale(LC_ALL, "Japanese"); #ifdef _WINDOWS _setmbcp(_MB_CP_LOCALE); #endif return true; }
void main() { unsigned char string[10]; unsigned char *p; int i; _setmbcp( 932 ); p = string; _mbvtop( '.', p ); p++; _mbvtop( '1', p ); p++; _mbvtop( 'A', p ); p++; _mbvtop( 0x8140, p ); p += 2; _mbvtop( 0x8260, p ); p += 2; _mbvtop( 0x82A6, p ); p += 2; _mbvtop( '\0', p ); for( i = 0; i < 10; i++ ) printf( "%2.2x ", string[i] ); printf( "\n" ); }
// Initialize the console, depending on the OS and language/code page settings void init_console() { #ifdef WIN32 #ifdef CH_USE_UNICODE SetConsoleOutputCP(65001); // use UTF-8 (Unicode) setlocale(LC_ALL,"English_United States.437"); // Windows does not support UTF-8/Unicode for setlocale, sorry #endif #ifdef CH_USE_CP437 SetConsoleOutputCP(437); // use Code Page 437 (US English code page made by IBM for DOS) setlocale(LC_ALL,"English_United States.437"); #endif #ifdef CH_USE_ASCII_HACK SetConsoleOutputCP(437); // use Code Page 437 (US English code page made by IBM for DOS) setlocale(LC_ALL,"English_United States.437"); #endif _setmbcp(_MB_CP_LOCALE); // use same code page as multibyte code page #else // WIN32 #ifdef CH_USE_UNICODE setlocale(LC_ALL,"en_US.UTF-8"); // POSIX-compliant OSes DO support UTF-8/Unicode for setlocale #endif #ifdef CH_USE_CP437 setlocale(LC_ALL,"en_US.CP437"); #endif #ifdef CH_USE_ASCII_HACK setlocale(LC_ALL,"en_US.CP437"); #endif #endif // WIN32 #ifdef CH_USE_UNICODE setup_unicode(); #endif }
void main() { _setmbcp( 932 ); printf( "%#6.4x\n", mb1[0] << 8 | mb1[1] ); _mbccpy( mb1, mb2 ); printf( "%#6.4x\n", mb1[0] << 8 | mb1[1] ); }
void main() { _setmbcp( 932 ); if( _strnicoll( buffer, "Hello" ) < 0 ) { printf( "Less than\n" ); } }
void Nls::setCodePage( int cp ) { #if !defined( __UNIX__ ) && !defined( __APPLE__ ) _setmbcp( cp ); //doesn't do much of anything in OW #endif std::string path( Environment.value( "WIPFC" ) ); if( path.length() ) #if !defined( __UNIX__ ) && !defined( __APPLE__ ) path += '\\'; #else path += '/'; #endif path += "enti"; if( cp == 850 || cp == 437) path += "ty"; else { char code[ 6 ]; std::sprintf( code, "%4.4d", cp ); path.append( code, 4 ); } path += ".txt"; std::FILE* entty( std::fopen( path.c_str(), "r" ) ); if( entty == 0 ) throw FatalError( ERR_COUNTRY ); readEntityFile( entty ); std::fclose( entty ); country.codePage = static_cast< STD1::uint16_t >( cp ); }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) printf( "%s\n", types[ 1+_mbsbtype( chars, i ) ] ); }
void main() { int i, j; _setmbcp( 932 ); for( i = 0; i < sizeof(chars); i += j ) { j = _mbclen( &chars[i] ); printf( "%d bytes in character\n", j ); } }
//--------------------------------------------------------------------------- int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { switch(reason){ case DLL_PROCESS_ATTACH: { InitSys(); char bf[512]; ::GetModuleFileName(hinst, bf, sizeof(bf)); ::SetDirName(sys.m_BgnDir, bf); _setmbcp(_MB_CP_ANSI); HWND hMM = ::FindWindow("TMmsstv", NULL); if( hMM != NULL ) Application->Handle = hMM; if( sys.m_BitPixel < 24 ){ sys.m_pBitmapTemp = new Graphics::TBitmap; sys.m_pBitmapTemp->Width = 1; sys.m_pBitmapTemp->Height = 1; } } break; case DLL_PROCESS_DETACH: sys.m_fMultProc = NULL; if( sys.m_pDefStg != NULL ){ CItem *pItem = new CItem; pItem->Create(NULL, 0); pItem->SaveToInifile("Default", ININAME); delete pItem; delete sys.m_pDefStg; sys.m_pDefStg = NULL; } if( sys.m_pTextList != NULL ){ SaveStringsToIniFile(sys.m_pTextList, "Strings", ININAME, TRUE); delete sys.m_pTextList; sys.m_pTextList = NULL; } if( sys.m_pStyleList != NULL ){ SaveStringsToIniFile(sys.m_pStyleList, "Styles", ININAME, FALSE); delete sys.m_pStyleList; sys.m_pStyleList = NULL; } if( sys.m_pFontList != NULL ){ delete sys.m_pFontList; sys.m_pFontList = NULL; } if( sys.m_pBitmapTemp != NULL ){ delete sys.m_pBitmapTemp; sys.m_pBitmapTemp = NULL; } break; } return 1; }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x - %#6.4x\n", chars[ i ], _mbctokata( chars[ i ] ) ); } }
void main( int argc, char *argv[] ) { int exitcode; /*** Initialize ***/ #ifdef __SW_BW FILE * my_stdout; my_stdout = freopen( "tmp.log", "a", stdout ); if( my_stdout == NULL ) { fprintf( stderr, "Unable to redirect stdout\n" ); exit( -1 ); } #endif strcpy( ProgramName, strlwr(argv[0]) ); /* store executable filename */ if( _setmbcp( 932 ) != 0 ) { printf( "Cannot initialize code page.\n\n" ); exit( EXIT_FAILURE ); } /***********************************************************************/ /* set constraint-handler */ /***********************************************************************/ set_constraint_handler_s( my_constraint_handler ); /*** Test various functions ***/ TestToWide(); /* conversion to wide chars */ TestFromWide(); /* conversion from wide chars */ TestAddendum(); /* Normative Addendum stuff */ /*** Print a pass/fail message and quit ***/ if( NumErrors == 0 ) { printf( "%s: SUCCESS.\n", ProgramName ); #ifdef __SW_BW fprintf( stderr, "%s: SUCCESS.\n", ProgramName ); #endif exitcode = EXIT_SUCCESS; } else { printf( "%s: FAILURE (%d errors).\n", ProgramName, NumErrors ); #ifdef __SW_BW fprintf( stderr, "%s: FAILURE (%d errors).\n", ProgramName, NumErrors ); #endif exitcode = EXIT_FAILURE; } #ifdef __SW_BW fclose( my_stdout ); _dwShutDown(); #endif exit( exitcode ); }
void main() { int i; unsigned int c; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { c = _mbctombb( alphabet[ i ] ); printf( "%c", c ); } printf( "\n" ); }
void main() { unsigned int c; unsigned char *str; _setmbcp( 932 ); str = set; for( ; *str != '\0'; ) { str = _mbgetcode( str, &c ); printf( "Character code 0x%2.2x\n", c ); } }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa valid " "multibyte symbol character\n", chars[i], ( _ismbcsymbol( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa single-byte " "Katakana alphabetic character\n", chars[i], ( _ismbbkalpha( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa single-byte alphanumeric\n" " or Katakana non-punctuation character\n", chars[i], ( _ismbbalnum( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; unsigned short c; _setmbcp( 932 ); for( i = 0; i < sizeof( alphabet ) - 1; i++ ) { c = _mbbtombc( alphabet[ i ] ); printf( "%c%c", c>>8, c ); } printf( "\n" ); }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa single-byte printable " "non-space character\n", chars[i], ( _ismbbgraph( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa valid " "multibyte alphanumeric character\n", chars[i], ( _ismbcalnum( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { printf( "%#6.4x is %sa valid " "Hiragana character\n", chars[i], ( _ismbchira( chars[i] ) ) ? "" : "not " ); } }
void main() { int i; unsigned int c; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { c = _mbctoupper( chars[ i ] ); if( c > 0xff ) printf( "%c%c", c>>8, c ); else printf( "%c", c ); }
// Address range: 0x401c14 - 0x401c3c int32_t function_401c14(char a1, int32_t a2) { // 0x401c14 _qm_AfxGetModuleState__YGPAVAFX_MODULE_STATE__XZ((int32_t)a1); *(char *)(g1 + 20) = a1; *(int32_t *)(g1 + 0x1040) = a2; if (a1 == 0) { // 0x401c2e _setmbcp(-3); // branch -> 0x401c37 } // 0x401c37 return 1; }
void main() { int i, j; _setmbcp( 932 ); for( i = 0; i < SIZE; i++ ) { j = wctob( wc[i] ); if( j == EOF ) { printf( "%#6.4x EOF\n", wc[i] ); } else { printf( "%#6.4x->%#6.4x\n", wc[i], j ); } } }
/********************************************************************* * Init */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(%p, %s, %p) pid(%x), tid(%x), tls(%u)\n", hinstDLL, msvcrt_get_reason(fdwReason), lpvReserved, GetCurrentProcessId(), GetCurrentThreadId(), msvcrt_tls_index); switch (fdwReason) { case DLL_PROCESS_ATTACH: if (!msvcrt_init_tls()) return FALSE; msvcrt_init_mt_locks(); if(!MSVCRT_setlocale(0, "C")) { msvcrt_free_mt_locks(); msvcrt_free_tls_mem(); return FALSE; } msvcrt_init_math(); msvcrt_init_io(); msvcrt_init_console(); msvcrt_init_args(); msvcrt_init_signals(); _setmbcp(_MB_CP_LOCALE); /* don't allow unloading msvcrt, we can't setup file handles twice */ LdrAddRefDll( 0, hinstDLL ); TRACE("finished process init\n"); break; case DLL_THREAD_ATTACH: break; case DLL_PROCESS_DETACH: msvcrt_free_mt_locks(); msvcrt_free_io(); msvcrt_free_console(); msvcrt_free_args(); msvcrt_free_signals(); msvcrt_free_tls_mem(); if (!msvcrt_free_tls()) return FALSE; MSVCRT__free_locale(MSVCRT_locale); TRACE("finished process free\n"); break; case DLL_THREAD_DETACH: msvcrt_free_tls_mem(); TRACE("finished thread free\n"); break; } return TRUE; }
void main() { int i, j, k; _setmbcp( 932 ); k = 0; for( i = 0; i < SIZE; i++ ) { j = _mbbtype( chars[i], k ); printf( "%s\n", types[ 1 + j ] ); if( j == _MBC_LEAD ) k = 1; else k = 0; } }
static void test_splitpath(void) { const char* path = "c:\\\x83\x5c\x83\x74\x83\x67.bin"; char drive[3], dir[MAX_PATH], fname[MAX_PATH], ext[MAX_PATH]; int prev_cp = _getmbcp(); /* SBCS codepage */ _setmbcp(1252); _splitpath(path, drive, dir, fname, ext); ok(!strcmp(drive, "c:"), "got %s\n", drive); ok(!strcmp(dir, "\\\x83\x5c"), "got %s\n", dir); ok(!strcmp(fname, "\x83\x74\x83\x67"), "got %s\n", fname); ok(!strcmp(ext, ".bin"), "got %s\n", ext); /* MBCS (Japanese) codepage */ _setmbcp(932); _splitpath(path, drive, dir, fname, ext); ok(!strcmp(drive, "c:"), "got %s\n", drive); ok(!strcmp(dir, "\\"), "got %s\n", dir); ok(!strcmp(fname, "\x83\x5c\x83\x74\x83\x67"), "got %s\n", fname); ok(!strcmp(ext, ".bin"), "got %s\n", ext); _setmbcp(prev_cp); }
void main() { int test; _setmbcp( 932 ); test = _stricoll( buffer, "Hello" ); if( test < 0 ) { printf( "Less than\n" ); } else if( test == 0 ) { printf( "Equal\n" ); } else { printf( "Greater than\n" ); } }
void main() { int i; _setmbcp( 932 ); i = _mbcicmp( mb1, mb2 ); if( i == _NLSCMPERROR ) printf( "Error in multibyte character\n" ); else if( i < 0 ) printf( "Less than\n" ); else if( i == 0 ) printf( "Equal to\n" ); else printf( "Greater than\n" ); }
BOOL AFXAPI AfxInitialize(BOOL bDLL, DWORD dwVersion) { AFX_MODULE_STATE* pModuleState = AfxGetModuleState(); pModuleState->m_bDLL = (BYTE)bDLL; ASSERT(dwVersion <= _MFC_VER); UNUSED(dwVersion); // not used in release build #ifdef _AFXDLL pModuleState->m_dwVersion = dwVersion; #endif #ifdef _MBCS // set correct multi-byte code-page for Win32 apps if (!bDLL) _setmbcp(_MB_CP_ANSI); #endif //_MBCS return TRUE; }
void main() { unsigned char chars2[20]; int i; _setmbcp( 932 ); _mbsnset( chars2, 0xFF, 20 ); _mbsnbcpy( chars2, chars, 11 ); for( i = 0; i < 20; i++ ) printf( "%2.2x ", chars2[i] ); printf( "\n" ); _mbsnbcpy( chars2, chars, 20 ); for( i = 0; i < 20; i++ ) printf( "%2.2x ", chars2[i] ); printf( "\n" ); }