12e5b6d6dSopenharmony_ci// © 2016 and later: Unicode, Inc. and others. 22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 32e5b6d6dSopenharmony_ci/* 42e5b6d6dSopenharmony_ci * %W% %E% 52e5b6d6dSopenharmony_ci * 62e5b6d6dSopenharmony_ci * (C) Copyright IBM Corp. 2001-2016 - All Rights Reserved 72e5b6d6dSopenharmony_ci * 82e5b6d6dSopenharmony_ci */ 92e5b6d6dSopenharmony_ci 102e5b6d6dSopenharmony_ci#include "unicode/utypes.h" 112e5b6d6dSopenharmony_ci#include "unicode/uscript.h" 122e5b6d6dSopenharmony_ci 132e5b6d6dSopenharmony_ci#include "cmemory.h" 142e5b6d6dSopenharmony_ci#include "scrptrun.h" 152e5b6d6dSopenharmony_ci 162e5b6d6dSopenharmony_ci#include <stdio.h> 172e5b6d6dSopenharmony_ci 182e5b6d6dSopenharmony_ciUChar testChars[] = { 192e5b6d6dSopenharmony_ci 0x0020, 0x0946, 0x0939, 0x093F, 0x0928, 0x094D, 0x0926, 0x0940, 0x0020, 202e5b6d6dSopenharmony_ci 0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064A, 0x0629, 0x0020, 212e5b6d6dSopenharmony_ci 0x0420, 0x0443, 0x0441, 0x0441, 0x043A, 0x0438, 0x0439, 0x0020, 222e5b6d6dSopenharmony_ci 'E', 'n', 'g', 'l', 'i', 's', 'h', 0x0020, 232e5b6d6dSopenharmony_ci 0x6F22, 0x5B75, 0x3068, 0x3072, 0x3089, 0x304C, 0x306A, 0x3068, 242e5b6d6dSopenharmony_ci 0x30AB, 0x30BF, 0x30AB, 0x30CA, 252e5b6d6dSopenharmony_ci 0xD801, 0xDC00, 0xD801, 0xDC01, 0xD801, 0xDC02, 0xD801, 0xDC03 262e5b6d6dSopenharmony_ci}; 272e5b6d6dSopenharmony_ci 282e5b6d6dSopenharmony_ciint32_t testLength = UPRV_LENGTHOF(testChars); 292e5b6d6dSopenharmony_ci 302e5b6d6dSopenharmony_ciint main() 312e5b6d6dSopenharmony_ci{ 322e5b6d6dSopenharmony_ci icu::ScriptRun scriptRun(testChars, 0, testLength); 332e5b6d6dSopenharmony_ci 342e5b6d6dSopenharmony_ci while (scriptRun.next()) { 352e5b6d6dSopenharmony_ci int32_t start = scriptRun.getScriptStart(); 362e5b6d6dSopenharmony_ci int32_t end = scriptRun.getScriptEnd(); 372e5b6d6dSopenharmony_ci UScriptCode code = scriptRun.getScriptCode(); 382e5b6d6dSopenharmony_ci 392e5b6d6dSopenharmony_ci printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, end); 402e5b6d6dSopenharmony_ci } 412e5b6d6dSopenharmony_ci return 0; 422e5b6d6dSopenharmony_ci} 43