]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/gentest/genres32.c
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 2003-2006, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
10 * file name: genres32.c
12 * tab size: 8 (not used)
15 * created on: 2003sep10
16 * created by: Markus W. Scherer
18 * Write an ICU resource bundle with a table whose
19 * number of key characters and number of items both exceed 64k.
20 * Writing it as the root table tests also that
21 * the new table type is recognized for the root resource by the reader code.
24 #include "unicode/putil.h"
29 incKey(char *key
, char *limit
) {
44 genres32(const char *prog
, const char *path
) {
46 * key string, gets incremented binary numbers
47 * letter 'o'=0 and digit '1'=1 so that data swapping can be tested
48 * with reordering (ASCII: '1'<'o' EBCDIC: '1'>'o')
50 * need 17 digits for >64k unique items
52 char key
[20]="ooooooooooooooooo";
58 uprv_strcpy(file
,path
);
59 if(file
[strlen(file
)-1]!=U_FILE_SEP_CHAR
) {
60 uprv_strcat(file
,U_FILE_SEP_STRING
);
62 uprv_strcat(file
,"testtable32.txt");
63 out
= fopen(file
, "w");
65 puts("Generating testtable32.txt");
67 fprintf(stderr
, "%s: Couldn't create resource test file %s\n",
72 /* find the limit of the key string */
73 for(limit
=key
; *limit
!=0; ++limit
) {
76 /* output the beginning of the bundle */
81 /* output the table entries */
82 for(i
=0; i
<66000; ++i
) {
85 * every 10th entry contains a string with
86 * the entry index as its code point
88 fprintf(out
, "%s{\"\\U%08x\"}\n", key
, i
);
90 /* other entries contain their index as an integer */
91 fprintf(out
, "%s:int{%d}\n", key
, i
);
97 /* output the end of the bundle */