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