summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-04-20 18:13:48 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-04-20 18:13:48 +0000
commite5786f530f9555469c01435f86039b06aa53feba (patch)
treec868e8d32282422d7d445b729db95c3fcdafb6d0 /Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp
parentebaa1768b43c8606d923d2e861b5286b74207b3e (diff)
new build system: build icu libs and xetex plus misc updates
git-svn-id: svn://tug.org/texlive/trunk@12759 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp')
-rw-r--r--Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp110
1 files changed, 110 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp b/Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp
new file mode 100644
index 00000000000..85fc0e660b4
--- /dev/null
+++ b/Build/source/libs/icu/icu-xetex/samples/legacy/legacy.cpp
@@ -0,0 +1,110 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2001 - 2005, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: main.cpp
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2001jul24
+* created by: Vladimir Weinstein
+*/
+
+/******************************************************************************
+ * main program demonstrating using two versions of ICU in the same project
+ ******************************************************************************/
+
+#include <stdio.h>
+#include "unicode/utypes.h"
+#include "unicode/ustring.h"
+
+extern "C" void test_current(UChar data[][5], uint32_t size, uint32_t maxLen, uint8_t keys[][32]);
+extern "C" void test_legacy(UChar data[][5], uint32_t size, uint32_t maxlen, uint8_t keys[][32]);
+
+void printZTUChar(const UChar *str) {
+ while(*str != 0) {
+ if(*str > 0x1F && *str < 0x80) {
+ fprintf(stdout, "%c", (*str) & 0xFF);
+ } else {
+ fprintf(stdout, "\\u%04X", *str);
+ }
+ str++;
+ }
+}
+
+void printArray(const char* const comment, const UChar UArray[][5], int32_t arraySize) {
+ fprintf (stdout, "%s\n", comment);
+ int32_t i = 0;
+ for(i = 0; i<arraySize; i++) {
+ fprintf(stdout, "%d ", i);
+ printZTUChar(UArray[i]);
+ fprintf(stdout, "\n");
+ }
+}
+
+void printKeys(const char *comment, uint8_t keys[][32], int32_t keySize) {
+ int32_t i = 0;
+ uint8_t *currentKey = NULL;
+ fprintf(stdout, "%s\n", comment);
+ for(i = 0; i<keySize; i++) {
+ currentKey = keys[i];
+ while(*currentKey != 0) {
+ if(*currentKey == 1) {
+ fprintf(stdout, "01 ");
+ } else {
+ fprintf(stdout, "%02X", *currentKey);
+ }
+ currentKey++;
+ }
+ fprintf(stdout, " 00\n");
+ }
+}
+
+
+//int main(int argc, const char * const argv[]) {
+int main(int, const char * const *) {
+ static const char* test[4] = {
+ "\\u304D\\u3085\\u3046\\u0000",
+ "\\u30AD\\u30E6\\u30A6\\u0000",
+ "\\u304D\\u3086\\u3046\\u0000",
+ "\\u30AD\\u30E5\\u30A6\\u0000"
+ };
+
+#if 0
+ static const char* test2[4] = {
+ "dbc\\u0000",
+ "cbc\\u0000",
+ "bbc\\u0000",
+ "abc\\u0000"
+ };
+#endif
+
+ static UChar uTest[4][5];
+
+ static uint8_t keys[4][32];
+
+ uint32_t i = 0;
+
+ for(i = 0; i<4; i++) {
+ u_unescape(test[i], uTest[i], 5);
+ }
+ printArray("Before current", uTest, 4);
+ test_current(uTest, 4, 5, keys);
+ printArray("After current", uTest, 4);
+ printKeys("Current keys", keys, 4);
+
+ for(i = 0; i<4; i++) {
+ u_unescape(test[i], uTest[i], 5);
+ }
+ printArray("Before legacy", uTest, 4);
+ test_legacy(uTest, 4, 5, keys);
+ printArray("After legacy", uTest, 4);
+ printKeys("Legacy keys", keys, 4);
+
+
+ return 0;
+}