intl/icu/source/extra/scrptrun/srtest.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * %W% %E%
michael@0 3 *
michael@0 4 * (C) Copyright IBM Corp. 2001 - All Rights Reserved
michael@0 5 *
michael@0 6 */
michael@0 7
michael@0 8 #include "unicode/utypes.h"
michael@0 9 #include "unicode/uscript.h"
michael@0 10
michael@0 11 #include "scrptrun.h"
michael@0 12
michael@0 13 #include <stdio.h>
michael@0 14
michael@0 15 UChar testChars[] = {
michael@0 16 0x0020, 0x0946, 0x0939, 0x093F, 0x0928, 0x094D, 0x0926, 0x0940, 0x0020,
michael@0 17 0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064A, 0x0629, 0x0020,
michael@0 18 0x0420, 0x0443, 0x0441, 0x0441, 0x043A, 0x0438, 0x0439, 0x0020,
michael@0 19 'E', 'n', 'g', 'l', 'i', 's', 'h', 0x0020,
michael@0 20 0x6F22, 0x5B75, 0x3068, 0x3072, 0x3089, 0x304C, 0x306A, 0x3068,
michael@0 21 0x30AB, 0x30BF, 0x30AB, 0x30CA,
michael@0 22 0xD801, 0xDC00, 0xD801, 0xDC01, 0xD801, 0xDC02, 0xD801, 0xDC03
michael@0 23 };
michael@0 24
michael@0 25 int32_t testLength = sizeof testChars / sizeof testChars[0];
michael@0 26
michael@0 27 void main()
michael@0 28 {
michael@0 29 ScriptRun scriptRun(testChars, 0, testLength);
michael@0 30
michael@0 31 while (scriptRun.next()) {
michael@0 32 int32_t start = scriptRun.getScriptStart();
michael@0 33 int32_t end = scriptRun.getScriptEnd();
michael@0 34 UScriptCode code = scriptRun.getScriptCode();
michael@0 35
michael@0 36 printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, end);
michael@0 37 }
michael@0 38 }

mercurial