]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/gentest/genres32.c
2 *******************************************************************************
4 * Copyright (C) 2003-2004, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: genres32.c
10 * tab size: 8 (not used)
13 * created on: 2003sep10
14 * created by: Markus W. Scherer
16 * Write an ICU resource bundle with a table whose
17 * number of key characters and number of items both exceed 64k.
18 * Writing it as the root table tests also that
19 * the new table type is recognized for the root resource by the reader code.
22 #include "unicode/putil.h"
27 incKey(char *key
, char *limit
) {
42 genres32(const char *prog
, const char *path
) {
44 * key string, gets incremented binary numbers
45 * letter 'o'=0 and digit '1'=1 so that data swapping can be tested
46 * with reordering (ASCII: '1'<'o' EBCDIC: '1'>'o')
48 * need 17 digits for >64k unique items
50 char key
[20]="ooooooooooooooooo";
56 uprv_strcpy(file
,path
);
57 if(file
[strlen(file
)-1]!=U_FILE_SEP_CHAR
) {
58 uprv_strcat(file
,U_FILE_SEP_STRING
);
60 uprv_strcat(file
,"testtable32.txt");
61 out
= fopen(file
, "w");
64 fprintf(stderr
, "%s: Couldn't create resource test file %s\n",
69 /* find the limit of the key string */
70 for(limit
=key
; *limit
!=0; ++limit
) {
73 /* output the beginning of the bundle */
78 /* output the table entries */
79 for(i
=0; i
<66000; ++i
) {
82 * every 10th entry contains a string with
83 * the entry index as its code point
85 fprintf(out
, "%s{\"\\U%08x\"}\n", key
, i
);
87 /* other entries contain their index as an integer */
88 fprintf(out
, "%s:int{%d}\n", key
, i
);
94 /* output the end of the bundle */