/*---------------------------------------------------------------------------* Project: Revolution ENC sample demo File: latin.c Copyright 2006 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: latin.c,v $ Revision 1.2 2006/10/31 08:56:32 yoshioka_yasuhiro Modified the table of ISO-8859-1. Revision 1.1 2006/10/27 12:20:37 yoshioka_yasuhiro Initial commit. $NoKeywords: $ *---------------------------------------------------------------------------*/ #include #include #include "validate.h" #include "demostrings.h" int main() { BOOL test_clear = TRUE; OSReport("\n* LATIN1 str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringLatin1ToUnicode, uni1_win, latin, 8); OSReport("\n* UNICODE str -> LATIN1 str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToLatin1, latin, uni1_iso, 8); OSReport("\n* LATIN2 str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringLatin2ToUnicode, uni2, latin, 8); OSReport("\n* UNICODE str -> LATIN2 str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToLatin2, latin, uni2, 8); OSReport("\n* LATIN3 str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringLatin3ToUnicode, uni3, latin, 8); OSReport("\n* UNICODE str -> LATIN3 str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToLatin3, latin, uni3, 8); OSReport("\n* GREEK str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringGreekToUnicode, unigreek, latin, 8); OSReport("\n* UNICODE str -> GREEK str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToGreek, latin, unigreek, 8); OSReport("\n* LATIN6 str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringLatin6ToUnicode, uni6, latin, 8); OSReport("\n* UNICODE str -> LATIN6 str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToLatin6, latin, uni6, 8); OSReport("\n* LATIN9 str -> UNICODE str *\n"); test_clear = test_clear && ValidateFuncToUnicode(ENCConvertStringLatin9ToUnicode, uni9, latin, 8); OSReport("\n* UNICODE str -> LATIN9 str *\n"); test_clear = test_clear && ValidateFuncFromUnicode(ENCConvertStringUnicodeToLatin9, latin, uni9, 8); /* character */ { u8 char8; u16 char16; u8 lc; u16 wc; s32 srclen, dstlen; s32 err_code; /* LATIN1 char -> UNICODE char */ OSReport("\n* LATIN1 char -> UNICODE char *\n"); lc = 0x80; wc = 0x20AC; srclen = 1; dstlen = 1; err_code = ENCConvertStringLatin1ToUnicode(&char16, &dstlen, &lc, &srclen); if (char16 == wc) { OSReport("SUCCESS\n"); } else { OSReport("FAILURE\n"); test_clear = FALSE; } OSReport("%#x -> %#x\n", lc, wc); /* UNICODE char -> LATIN1 char */ OSReport("\n* UNICODE char -> LATIN1 char *\n"); lc = 0xA9; wc = 0x00A9; srclen = 1; dstlen = 1; err_code = ENCConvertStringUnicodeToLatin1(&char8, &dstlen, &wc, &srclen); if (char8 == lc) { OSReport("SUCCESS\n"); } else { OSReport("FAILURE\n"); test_clear = FALSE; } OSReport("%#x -> %#x\n", wc, char8); } if (test_clear) OSReport("\nTOTAL SUCCESS\n"); else OSReport("\nTOTAL FAILURE\n"); return 0; }