1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
3b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho*   Copyright (C) 1999-2010, International Business Machines
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   Corporation and others.  All Rights Reserved.
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   file name:  gentest.c
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   encoding:   US-ASCII
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   tab size:   8 (not used)
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   indentation:4
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created on: 2000mar03
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created by: Madhu Katragadda
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   This program writes a little data file for testing the udata API.
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include <stdio.h>
20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include <stdlib.h>
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h"
22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/putil.h"
23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uclean.h"
24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/udata.h"
2527f654740f2a26ad62a5c155af9199af9e69b889claireho#include "udbgutil.h"
26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unewdata.h"
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "cmemory.h"
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "cstring.h"
29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "uoptions.h"
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "gentest.h"
31c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru#include "toolutil.h"
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DATA_NAME "test"
34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define DATA_TYPE "icu"
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* UDataInfo cf. udata.h */
37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const UDataInfo dataInfo={
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sizeof(UDataInfo),
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0,
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    U_IS_BIG_ENDIAN,
42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    U_CHARSET_FAMILY,
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    sizeof(UChar),
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    0,
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    {0x54, 0x65, 0x73, 0x74},     /* dataFormat="Test" */
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    {1, 0, 0, 0},                 /* formatVersion */
48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    {1, 0, 0, 0}                  /* dataVersion */
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic void createData(const char*, UErrorCode *);
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic int outputJavaStuff(const char * progname, const char *outputDir);
54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic UOption options[]={
56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /*0*/ UOPTION_HELP_H,
57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /*1*/ UOPTION_HELP_QUESTION_MARK,
58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /*2*/ UOPTION_DESTDIR,
59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /*3*/ UOPTION_DEF("genres", 'r', UOPT_NO_ARG),
60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /*4*/ UOPTION_DEF("javastuff", 'j', UOPT_NO_ARG),
61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru};
62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruextern int
64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querumain(int argc, char* argv[]) {
65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UErrorCode errorCode = U_ZERO_ERROR;
66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* preset then read command line options */
68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    options[2].value=u_getDataDirectory();
69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* error handling, printing usage message */
72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(argc<0) {
73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(stderr,
74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "error in command line argument \"%s\"\n",
75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            argv[-argc]);
76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(stderr,
79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "usage: %s [-options]\n"
80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\tcreate the test file " DATA_NAME "." DATA_TYPE " unless the -r option is given.\n"
81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\toptions:\n"
82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\t\t-h or -? or --help  this usage text\n"
83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\t\t-d or --destdir     destination directory, followed by the path\n"
84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\t\t-r or --genres      generate resource file testtable32.txt instead of UData test \n"
85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            "\t\t-j or --javastuff   generate Java source for DebugUtilities. \n",
86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            argv[0]);
87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if( options[4].doesOccur ) {
91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    	return outputJavaStuff( argv[0], options[2].value );
92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    } else if ( options[3].doesOccur ) {
93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return genres32( argv[0], options[2].value );
94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    } else {
95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        /* printf("Generating the test memory mapped file\n"); */
96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        createData(options[2].value, &errorCode);
97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    return U_FAILURE(errorCode);
99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* Create data file ----------------------------------------------------- */
102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic void
103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QuerucreateData(const char* outputDirectory, UErrorCode *errorCode) {
104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UNewDataMemory *pData;
105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    char stringValue[]={'Y', 'E', 'A', 'R', '\0'};
106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint16_t intValue=2000;
107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    long dataLength;
109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uint32_t size;
110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    pData=udata_create(outputDirectory, DATA_TYPE, DATA_NAME, &dataInfo,
112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                       U_COPYRIGHT_STRING, errorCode);
113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(U_FAILURE(*errorCode)) {
114b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru        fprintf(stderr, "gentest: unable to create data memory, %s\n", u_errorName(*errorCode));
115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        exit(*errorCode);
116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* write the data to the file */
119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* a 16 bit value  and a String*/
120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    udata_write16(pData, intValue);
121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    udata_writeString(pData, stringValue, sizeof(stringValue));
122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /* finish up */
124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    dataLength=udata_finish(pData, errorCode);
125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(U_FAILURE(*errorCode)) {
126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(stderr, "gentest: error %d writing the output file\n", *errorCode);
127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        exit(*errorCode);
128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    size=sizeof(stringValue) + sizeof(intValue);
130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(dataLength!=(long)size) {
133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(stderr, "gentest: data length %ld != calculated size %lu\n",
134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            dataLength, (unsigned long)size);
135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        exit(U_INTERNAL_PROGRAM_ERROR);
136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* Create Java file ----------------------------------------------------- */
140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic int
142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruoutputJavaStuff(const char* progname, const char *outputDir) {
143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    int32_t i,t,count;
144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    char file[512];
145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    FILE *out;
146c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    int32_t year = getCurrentYear();
147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uprv_strcpy(file,outputDir);
149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(*outputDir &&  /* don't put a trailing slash if outputDir is empty */
150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        file[strlen(file)-1]!=U_FILE_SEP_CHAR) {
151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            uprv_strcat(file,U_FILE_SEP_STRING);
152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    uprv_strcat(file,"DebugUtilitiesData.java");
154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    out = fopen(file, "w");
155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /*puts(file);*/
156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    printf("%s: Generating %s\n", progname, file);
157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if(out == NULL) {
158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(stderr, "%s: Couldn't create resource test file %s\n",
159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            progname, file);
160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        return 1;
161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
16350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    fprintf(out, "/** Copyright (C) 2007-%d, International Business Machines Corporation and Others. All Rights Reserved. **/\n\n", year);
16450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    fprintf(out, "/* NOTE: this file is AUTOMATICALLY GENERATED by gentest.\n"
16550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                 " * See: {ICU4C}/source/data/icu4j-readme.txt for more information. \n"
16650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                 " **/\n\n");
167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "package com.ibm.icu.dev.test.util;\n\n");
168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "public class DebugUtilitiesData extends Object {\n");
169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    public static final String ICU4C_VERSION=\"%s\";\n", U_ICU_VERSION);
170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    for(t=0;t<UDBG_ENUM_COUNT;t++) {
171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "    public static final int %s = %d;\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    public static final String [] TYPES = { \n");
174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    for(t=0;t<UDBG_ENUM_COUNT;t++) {
175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        \"%s\", /* %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    };\n\n");
178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    public static final String [][] NAMES = { \n");
180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    for(t=0;t<UDBG_ENUM_COUNT;t++) {
181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        count = udbg_enumCount((UDebugEnumType)t);
182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        /* %s, %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        { \n");
184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        for(i=0;i<count;i++) {
185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            fprintf(out,
186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                "           \"%s\", /* %d */ \n", udbg_enumName((UDebugEnumType)t,i), i);
187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        },\n");
189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    };\n\n");
191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    public static final int [][] VALUES = { \n");
193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    for(t=0;t<UDBG_ENUM_COUNT;t++) {
194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        count = udbg_enumCount((UDebugEnumType)t);
195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        /* %s, %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        { \n");
197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        for(i=0;i<count;i++) {
198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            fprintf(out,
199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                "           ");
200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            switch(t) {
20150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if !UCONFIG_NO_FORMATTING
202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case UDBG_UCalendarDateFields:
203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case UDBG_UCalendarMonths:
20450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                /* Temporary workaround for IS_LEAP_MONTH #6051 */
205c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                if (t == UDBG_UCalendarDateFields && i == 22) {
20650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                  fprintf(out, "com.ibm.icu.util.ChineseCalendar.%s, /* %d */", udbg_enumName((UDebugEnumType)t,i), i);
20750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                } else {
20850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                  fprintf(out, "com.ibm.icu.util.Calendar.%s, /* %d */", udbg_enumName((UDebugEnumType)t,i), i);
20950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                }
210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                break;
21150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif
212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            case UDBG_UDebugEnumType:
213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            default:
214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                fprintf(out,"%d, /* %s */", i, udbg_enumName((UDebugEnumType)t,i));
215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            }
216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            fprintf(out,"\n");
217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        fprintf(out, "        },\n");
219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "    };\n\n");
221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fprintf(out, "}\n");
222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    fclose(out);
224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    return 0;
226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
228