1 /********************************************************************
3 * Copyright (c) 2007-2012, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
12 #include "unicode/ulocdata.h"
13 #include "unicode/ucnv.h"
16 To add a new enum type
17 (For example: UShoeSize with values USHOE_WIDE=0, USHOE_REGULAR, USHOE_NARROW, USHOE_COUNT)
19 1. udbgutil.h: add UDBG_UShoeSize to the UDebugEnumType enum before UDBG_ENUM_COUNT
20 ( The subsequent steps involve this file, udbgutil.cpp )
21 2. Find the marker "Add new enum types above this line"
22 3. Before that marker, add a #include of any header file you need.
23 4. Each enum type has three things in this section: a #define, a count_, and an array of Fields.
24 It may help to copy and paste a previous definition.
25 5. In the case of the USHOE_... strings above, "USHOE_" is common to all values- six characters
26 " #define LEN_USHOE 6 "
27 6 characters will strip off "USHOE_" leaving enum values of WIDE, REGULAR, and NARROW.
28 6. Define the 'count_' variable, with the number of enum values. If the enum has a _MAX or _COUNT value,
29 that can be helpful for automatically defining the count. Otherwise define it manually.
30 " static const int32_t count_UShoeSize = USHOE_COUNT; "
31 7. Define the field names, in order.
32 " static const Field names_UShoeSize[] = {
33 " FIELD_NAME_STR( LEN_USHOE, USHOE_WIDE ),
34 " FIELD_NAME_STR( LEN_USHOE, USHOE_REGULAR ),
35 " FIELD_NAME_STR( LEN_USHOE, USHOE_NARROW ),
37 ( The following command was usedfor converting ucol.h into partially correct entities )
38 grep "^[ ]*UCOL" < unicode/ucol.h |
39 sed -e 's%^[ ]*\([A-Z]*\)_\([A-Z_]*\).*% FIELD_NAME_STR( LEN_\1, \1_\2 ),%g'
40 8. Now, a bit farther down, add the name of the enum itself to the end of names_UDebugEnumType
41 ( UDebugEnumType is an enum, too!)
42 names_UDebugEnumType[] { ...
43 " FIELD_NAME_STR( LEN_UDBG, UDBG_UShoeSize ), "
44 9. Find the function _udbg_enumCount and add the count macro:
45 " COUNT_CASE(UShoeSize)
46 10. Find the function _udbg_enumFields and add the field macro:
47 " FIELD_CASE(UShoeSize)
48 11. verify that your test code, and Java data generation, works properly.
52 * Structure representing an enum value
55 int32_t prefix
; /**< how many characters to remove in the prefix - i.e. UCHAR_ = 5 */
56 const char *str
; /**< The actual string value */
57 int32_t num
; /**< The numeric value */
61 * Calculate the size of an array.
63 #define DBG_ARRAY_COUNT(x) (sizeof(x)/sizeof(x[0]))
66 * Define another field name. Used in an array of Field s
67 * @param y the common prefix length (i.e. 6 for "USHOE_" )
68 * @param x the actual enum value - it will be copied in both string and symbolic form.
71 #define FIELD_NAME_STR(y,x) { y, #x, x }
74 // TODO: Currently, this whole functionality goes away with UCONFIG_NO_FORMATTING. Should be split up.
75 #if !UCONFIG_NO_FORMATTING
78 #include "unicode/ucal.h"
81 #define LEN_UCAL 5 /* UCAL_ */
82 static const int32_t count_UCalendarDateFields
= UCAL_FIELD_COUNT
;
83 static const Field names_UCalendarDateFields
[] =
85 FIELD_NAME_STR( LEN_UCAL
, UCAL_ERA
),
86 FIELD_NAME_STR( LEN_UCAL
, UCAL_YEAR
),
87 FIELD_NAME_STR( LEN_UCAL
, UCAL_MONTH
),
88 FIELD_NAME_STR( LEN_UCAL
, UCAL_WEEK_OF_YEAR
),
89 FIELD_NAME_STR( LEN_UCAL
, UCAL_WEEK_OF_MONTH
),
90 FIELD_NAME_STR( LEN_UCAL
, UCAL_DATE
),
91 FIELD_NAME_STR( LEN_UCAL
, UCAL_DAY_OF_YEAR
),
92 FIELD_NAME_STR( LEN_UCAL
, UCAL_DAY_OF_WEEK
),
93 FIELD_NAME_STR( LEN_UCAL
, UCAL_DAY_OF_WEEK_IN_MONTH
),
94 FIELD_NAME_STR( LEN_UCAL
, UCAL_AM_PM
),
95 FIELD_NAME_STR( LEN_UCAL
, UCAL_HOUR
),
96 FIELD_NAME_STR( LEN_UCAL
, UCAL_HOUR_OF_DAY
),
97 FIELD_NAME_STR( LEN_UCAL
, UCAL_MINUTE
),
98 FIELD_NAME_STR( LEN_UCAL
, UCAL_SECOND
),
99 FIELD_NAME_STR( LEN_UCAL
, UCAL_MILLISECOND
),
100 FIELD_NAME_STR( LEN_UCAL
, UCAL_ZONE_OFFSET
),
101 FIELD_NAME_STR( LEN_UCAL
, UCAL_DST_OFFSET
),
102 FIELD_NAME_STR( LEN_UCAL
, UCAL_YEAR_WOY
),
103 FIELD_NAME_STR( LEN_UCAL
, UCAL_DOW_LOCAL
),
104 FIELD_NAME_STR( LEN_UCAL
, UCAL_EXTENDED_YEAR
),
105 FIELD_NAME_STR( LEN_UCAL
, UCAL_JULIAN_DAY
),
106 FIELD_NAME_STR( LEN_UCAL
, UCAL_MILLISECONDS_IN_DAY
),
107 FIELD_NAME_STR( LEN_UCAL
, UCAL_IS_LEAP_MONTH
),
111 static const int32_t count_UCalendarMonths
= UCAL_UNDECIMBER
+1;
112 static const Field names_UCalendarMonths
[] =
114 FIELD_NAME_STR( LEN_UCAL
, UCAL_JANUARY
),
115 FIELD_NAME_STR( LEN_UCAL
, UCAL_FEBRUARY
),
116 FIELD_NAME_STR( LEN_UCAL
, UCAL_MARCH
),
117 FIELD_NAME_STR( LEN_UCAL
, UCAL_APRIL
),
118 FIELD_NAME_STR( LEN_UCAL
, UCAL_MAY
),
119 FIELD_NAME_STR( LEN_UCAL
, UCAL_JUNE
),
120 FIELD_NAME_STR( LEN_UCAL
, UCAL_JULY
),
121 FIELD_NAME_STR( LEN_UCAL
, UCAL_AUGUST
),
122 FIELD_NAME_STR( LEN_UCAL
, UCAL_SEPTEMBER
),
123 FIELD_NAME_STR( LEN_UCAL
, UCAL_OCTOBER
),
124 FIELD_NAME_STR( LEN_UCAL
, UCAL_NOVEMBER
),
125 FIELD_NAME_STR( LEN_UCAL
, UCAL_DECEMBER
),
126 FIELD_NAME_STR( LEN_UCAL
, UCAL_UNDECIMBER
)
129 #include "unicode/udat.h"
131 #define LEN_UDAT 5 /* "UDAT_" */
132 static const int32_t count_UDateFormatStyle
= UDAT_SHORT
+1;
133 static const Field names_UDateFormatStyle
[] =
135 FIELD_NAME_STR( LEN_UDAT
, UDAT_FULL
),
136 FIELD_NAME_STR( LEN_UDAT
, UDAT_LONG
),
137 FIELD_NAME_STR( LEN_UDAT
, UDAT_MEDIUM
),
138 FIELD_NAME_STR( LEN_UDAT
, UDAT_SHORT
),
141 * negative enums.. leave out for now.
142 FIELD_NAME_STR( LEN_UDAT, UDAT_NONE ),
143 FIELD_NAME_STR( LEN_UDAT, UDAT_PATTERN ),
149 #include "unicode/uloc.h"
151 #define LEN_UAR 12 /* "ULOC_ACCEPT_" */
152 static const int32_t count_UAcceptResult
= 3;
153 static const Field names_UAcceptResult
[] =
155 FIELD_NAME_STR( LEN_UAR
, ULOC_ACCEPT_FAILED
),
156 FIELD_NAME_STR( LEN_UAR
, ULOC_ACCEPT_VALID
),
157 FIELD_NAME_STR( LEN_UAR
, ULOC_ACCEPT_FALLBACK
),
160 #if !UCONFIG_NO_COLLATION
161 #include "unicode/ucol.h"
162 #define LEN_UCOL 5 /* UCOL_ */
163 static const int32_t count_UColAttributeValue
= UCOL_ATTRIBUTE_VALUE_COUNT
;
164 static const Field names_UColAttributeValue
[] = {
165 FIELD_NAME_STR( LEN_UCOL
, UCOL_PRIMARY
),
166 FIELD_NAME_STR( LEN_UCOL
, UCOL_SECONDARY
),
167 FIELD_NAME_STR( LEN_UCOL
, UCOL_TERTIARY
),
168 // FIELD_NAME_STR( LEN_UCOL, UCOL_CE_STRENGTH_LIMIT ),
169 FIELD_NAME_STR( LEN_UCOL
, UCOL_QUATERNARY
),
171 FIELD_NAME_STR( LEN_UCOL
, UCOL_IDENTICAL
),
172 // FIELD_NAME_STR( LEN_UCOL, UCOL_STRENGTH_LIMIT ),
173 FIELD_NAME_STR( LEN_UCOL
, UCOL_OFF
),
174 FIELD_NAME_STR( LEN_UCOL
, UCOL_ON
),
176 FIELD_NAME_STR( LEN_UCOL
, UCOL_SHIFTED
),
177 FIELD_NAME_STR( LEN_UCOL
, UCOL_NON_IGNORABLE
),
179 FIELD_NAME_STR( LEN_UCOL
, UCOL_LOWER_FIRST
),
180 FIELD_NAME_STR( LEN_UCOL
, UCOL_UPPER_FIRST
),
186 #include "unicode/icuplug.h"
188 #define LEN_UPLUG_REASON 13 /* UPLUG_REASON_ */
189 static const int32_t count_UPlugReason
= UPLUG_REASON_COUNT
;
190 static const Field names_UPlugReason
[] = {
191 FIELD_NAME_STR( LEN_UPLUG_REASON
, UPLUG_REASON_QUERY
),
192 FIELD_NAME_STR( LEN_UPLUG_REASON
, UPLUG_REASON_LOAD
),
193 FIELD_NAME_STR( LEN_UPLUG_REASON
, UPLUG_REASON_UNLOAD
),
196 #define LEN_UPLUG_LEVEL 12 /* UPLUG_LEVEL_ */
197 static const int32_t count_UPlugLevel
= UPLUG_LEVEL_COUNT
;
198 static const Field names_UPlugLevel
[] = {
199 FIELD_NAME_STR( LEN_UPLUG_LEVEL
, UPLUG_LEVEL_INVALID
),
200 FIELD_NAME_STR( LEN_UPLUG_LEVEL
, UPLUG_LEVEL_UNKNOWN
),
201 FIELD_NAME_STR( LEN_UPLUG_LEVEL
, UPLUG_LEVEL_LOW
),
202 FIELD_NAME_STR( LEN_UPLUG_LEVEL
, UPLUG_LEVEL_HIGH
),
205 #define LEN_UDBG 5 /* "UDBG_" */
206 static const int32_t count_UDebugEnumType
= UDBG_ENUM_COUNT
;
207 static const Field names_UDebugEnumType
[] =
209 FIELD_NAME_STR( LEN_UDBG
, UDBG_UDebugEnumType
),
210 #if !UCONFIG_NO_FORMATTING
211 FIELD_NAME_STR( LEN_UDBG
, UDBG_UCalendarDateFields
),
212 FIELD_NAME_STR( LEN_UDBG
, UDBG_UCalendarMonths
),
213 FIELD_NAME_STR( LEN_UDBG
, UDBG_UDateFormatStyle
),
215 FIELD_NAME_STR( LEN_UDBG
, UDBG_UPlugReason
),
216 FIELD_NAME_STR( LEN_UDBG
, UDBG_UPlugLevel
),
217 FIELD_NAME_STR( LEN_UDBG
, UDBG_UAcceptResult
),
218 #if !UCONFIG_NO_COLLATION
219 FIELD_NAME_STR( LEN_UDBG
, UDBG_UColAttributeValue
),
224 // --- Add new enum types above this line ---
226 #define COUNT_CASE(x) case UDBG_##x: return (actual?count_##x:DBG_ARRAY_COUNT(names_##x));
227 #define COUNT_FAIL_CASE(x) case UDBG_##x: return -1;
229 #define FIELD_CASE(x) case UDBG_##x: return names_##x;
230 #define FIELD_FAIL_CASE(x) case UDBG_##x: return NULL;
235 * @param type type of item
236 * @param actual TRUE: for the actual enum's type (UCAL_FIELD_COUNT, etc), or FALSE for the string count
238 static int32_t _udbg_enumCount(UDebugEnumType type
, UBool actual
) {
240 COUNT_CASE(UDebugEnumType
)
241 #if !UCONFIG_NO_FORMATTING
242 COUNT_CASE(UCalendarDateFields
)
243 COUNT_CASE(UCalendarMonths
)
244 COUNT_CASE(UDateFormatStyle
)
246 COUNT_CASE(UPlugReason
)
247 COUNT_CASE(UPlugLevel
)
248 COUNT_CASE(UAcceptResult
)
249 #if !UCONFIG_NO_COLLATION
250 COUNT_CASE(UColAttributeValue
)
252 // COUNT_FAIL_CASE(UNonExistentEnum)
258 static const Field
* _udbg_enumFields(UDebugEnumType type
) {
260 FIELD_CASE(UDebugEnumType
)
261 #if !UCONFIG_NO_FORMATTING
262 FIELD_CASE(UCalendarDateFields
)
263 FIELD_CASE(UCalendarMonths
)
264 FIELD_CASE(UDateFormatStyle
)
266 FIELD_CASE(UPlugReason
)
267 FIELD_CASE(UPlugLevel
)
268 FIELD_CASE(UAcceptResult
)
269 // FIELD_FAIL_CASE(UNonExistentEnum)
270 #if !UCONFIG_NO_COLLATION
271 FIELD_CASE(UColAttributeValue
)
280 int32_t udbg_enumCount(UDebugEnumType type
) {
281 return _udbg_enumCount(type
, FALSE
);
284 int32_t udbg_enumExpectedCount(UDebugEnumType type
) {
285 return _udbg_enumCount(type
, TRUE
);
288 const char * udbg_enumName(UDebugEnumType type
, int32_t field
) {
290 field
>=_udbg_enumCount(type
,FALSE
)) { // also will catch unsupported items
293 const Field
*fields
= _udbg_enumFields(type
);
297 return fields
[field
].str
+ fields
[field
].prefix
;
302 int32_t udbg_enumArrayValue(UDebugEnumType type
, int32_t field
) {
304 field
>=_udbg_enumCount(type
,FALSE
)) { // also will catch unsupported items
307 const Field
*fields
= _udbg_enumFields(type
);
311 return fields
[field
].num
;
316 int32_t udbg_enumByName(UDebugEnumType type
, const char *value
) {
317 if(type
<0||type
>=_udbg_enumCount(UDBG_UDebugEnumType
, TRUE
)) {
318 return -1; // type out of range
320 const Field
*fields
= _udbg_enumFields(type
);
321 for(int32_t field
= 0;field
<_udbg_enumCount(type
, FALSE
);field
++) {
322 if(!strcmp(value
, fields
[field
].str
+ fields
[field
].prefix
)) {
323 return fields
[field
].num
;
326 // try with the prefix
327 for(int32_t field
= 0;field
<_udbg_enumCount(type
, FALSE
);field
++) {
328 if(!strcmp(value
, fields
[field
].str
)) {
329 return fields
[field
].num
;
338 * Print the current platform
340 U_CAPI
const char *udbg_getPlatform(void)
342 #if U_PLATFORM_HAS_WIN32_API
344 #elif U_PLATFORM == U_PF_UNKNOWN
346 #elif U_PLATFORM == U_PF_DARWIN
348 #elif U_PLATFORM == U_PF_QNX
350 #elif U_PLATFORM == U_PF_LINUX
352 #elif U_PLATFORM == U_PF_ANDROID
354 #elif U_PLATFORM == U_PF_CLASSIC_MACOS
355 return "MacOS (Classic)";
356 #elif U_PLATFORM == U_PF_OS390
358 #elif U_PLATFORM == U_PF_OS400
361 return "Other (POSIX-like)";
365 struct USystemParams
;
367 typedef int32_t U_CALLCONV
USystemParameterCallback(const USystemParams
*param
, char *target
, int32_t targetCapacity
, UErrorCode
*status
);
369 struct USystemParams
{
370 const char *paramName
;
371 USystemParameterCallback
*paramFunction
;
372 const char *paramStr
;
376 /* parameter types */
378 paramEmpty(const USystemParams
* /* param */, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
379 if(U_FAILURE(*status
))return 0;
380 return u_terminateChars(target
, targetCapacity
, 0, status
);
384 paramStatic(const USystemParams
*param
, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
385 if(param
->paramStr
==NULL
) return paramEmpty(param
,target
,targetCapacity
,status
);
386 if(U_FAILURE(*status
))return 0;
387 int32_t len
= uprv_strlen(param
->paramStr
);
389 uprv_strncpy(target
,param
->paramStr
,uprv_min(len
,targetCapacity
));
391 return u_terminateChars(target
, targetCapacity
, len
, status
);
394 static const char *nullString
= "(null)";
396 static int32_t stringToStringBuffer(char *target
, int32_t targetCapacity
, const char *str
, UErrorCode
*status
) {
397 if(str
==NULL
) str
=nullString
;
399 int32_t len
= uprv_strlen(str
);
400 if (U_SUCCESS(*status
)) {
402 uprv_strncpy(target
,str
,uprv_min(len
,targetCapacity
));
405 const char *s
= u_errorName(*status
);
406 len
= uprv_strlen(s
);
408 uprv_strncpy(target
,s
,uprv_min(len
,targetCapacity
));
411 return u_terminateChars(target
, targetCapacity
, len
, status
);
414 static int32_t integerToStringBuffer(char *target
, int32_t targetCapacity
, int32_t n
, int32_t radix
, UErrorCode
*status
) {
415 if(U_FAILURE(*status
)) return 0;
417 T_CString_integerToString(str
,n
,radix
);
418 return stringToStringBuffer(target
,targetCapacity
,str
,status
);
422 paramInteger(const USystemParams
*param
, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
423 if(U_FAILURE(*status
))return 0;
424 if(param
->paramStr
==NULL
|| param
->paramStr
[0]=='d') {
425 return integerToStringBuffer(target
,targetCapacity
,param
->paramInt
, 10,status
);
426 } else if(param
->paramStr
[0]=='x') {
427 return integerToStringBuffer(target
,targetCapacity
,param
->paramInt
, 16,status
);
428 } else if(param
->paramStr
[0]=='o') {
429 return integerToStringBuffer(target
,targetCapacity
,param
->paramInt
, 8,status
);
430 } else if(param
->paramStr
[0]=='b') {
431 return integerToStringBuffer(target
,targetCapacity
,param
->paramInt
, 2,status
);
433 *status
= U_INTERNAL_PROGRAM_ERROR
;
440 paramCldrVersion(const USystemParams
* /* param */, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
441 if(U_FAILURE(*status
))return 0;
445 ulocdata_getCLDRVersion(icu
, status
);
446 if(U_SUCCESS(*status
)) {
447 u_versionToString(icu
, str
);
448 return stringToStringBuffer(target
,targetCapacity
,str
,status
);
455 #if !UCONFIG_NO_FORMATTING
457 paramTimezoneDefault(const USystemParams
* /* param */, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
458 if(U_FAILURE(*status
))return 0;
463 len
= ucal_getDefaultTimeZone(buf
, 100, status
);
464 if(U_SUCCESS(*status
)&&len
>0) {
465 u_UCharsToChars(buf
, buf2
, len
+1);
466 return stringToStringBuffer(target
,targetCapacity
, buf2
,status
);
474 paramLocaleDefaultBcp47(const USystemParams
* /* param */, char *target
, int32_t targetCapacity
, UErrorCode
*status
) {
475 if(U_FAILURE(*status
))return 0;
476 const char *def
= uloc_getDefault();
477 return uloc_toLanguageTag(def
,target
,targetCapacity
,FALSE
,status
);
481 /* simple 1-liner param functions */
482 #define STRING_PARAM(func, str) U_CAPI int32_t \
483 func(const USystemParams *, char *target, int32_t targetCapacity, UErrorCode *status) \
484 { return stringToStringBuffer(target,targetCapacity,(str),status); }
486 STRING_PARAM(paramIcudataPath
, u_getDataDirectory())
487 STRING_PARAM(paramPlatform
, udbg_getPlatform())
488 STRING_PARAM(paramLocaleDefault
, uloc_getDefault())
489 #if !UCONFIG_NO_CONVERSION
490 STRING_PARAM(paramConverterDefault
, ucnv_getDefaultName())
493 #if !UCONFIG_NO_FORMATTING
494 STRING_PARAM(paramTimezoneVersion
, ucal_getTZDataVersion(status
))
497 static const USystemParams systemParams
[] = {
498 { "copyright", paramStatic
, U_COPYRIGHT_STRING
,0 },
499 { "product", paramStatic
, "icu4c",0 },
500 { "product.full", paramStatic
, "International Components for Unicode for C/C++",0 },
501 { "version", paramStatic
, U_ICU_VERSION
,0 },
502 { "version.unicode", paramStatic
, U_UNICODE_VERSION
,0 },
503 { "platform.number", paramInteger
, "d",U_PLATFORM
},
504 { "platform.type", paramPlatform
, NULL
,0},
505 { "locale.default", paramLocaleDefault
, NULL
, 0},
506 { "locale.default.bcp47", paramLocaleDefaultBcp47
, NULL
, 0},
507 #if !UCONFIG_NO_CONVERSION
508 { "converter.default", paramConverterDefault
, NULL
, 0},
510 { "icudata.name", paramStatic
, U_ICUDATA_NAME
, 0},
511 { "icudata.path", paramIcudataPath
, NULL
, 0},
513 { "cldr.version", paramCldrVersion
, NULL
, 0},
515 #if !UCONFIG_NO_FORMATTING
516 { "tz.version", paramTimezoneVersion
, NULL
, 0},
517 { "tz.default", paramTimezoneDefault
, NULL
, 0},
520 { "cpu.bits", paramInteger
, "d", (sizeof(void*))*8},
521 { "cpu.big_endian", paramInteger
, "b", U_IS_BIG_ENDIAN
},
522 { "os.wchar_width", paramInteger
, "d", U_SIZEOF_WCHAR_T
},
523 { "os.charset_family", paramInteger
, "d", U_CHARSET_FAMILY
},
525 { "os.host", paramStatic
, U_HOST
, 0},
527 #if defined (U_BUILD)
528 { "build.build", paramStatic
, U_BUILD
, 0},
531 { "build.cc", paramStatic
, U_CC
, 0},
534 { "build.cxx", paramStatic
, U_CXX
, 0},
536 #if defined (CYGWINMSVC)
537 { "build.cygwinmsvc", paramInteger
, "b", 1},
539 { "uconfig.internal_digitlist", paramInteger
, "b", 1}, /* always 1 */
540 { "uconfig.have_parseallinput", paramInteger
, "b", UCONFIG_HAVE_PARSEALLINPUT
},
541 { "uconfig.format_fastpaths_49",paramInteger
, "b", UCONFIG_FORMAT_FASTPATHS_49
},
546 #define U_SYSPARAM_COUNT (sizeof(systemParams)/sizeof(systemParams[0]))
548 U_CAPI
const char *udbg_getSystemParameterNameByIndex(int32_t i
) {
549 if(i
>=0 && i
< (int32_t)U_SYSPARAM_COUNT
) {
550 return systemParams
[i
].paramName
;
557 U_CAPI
int32_t udbg_getSystemParameterValueByIndex(int32_t i
, char *buffer
, int32_t bufferCapacity
, UErrorCode
*status
) {
558 if(i
>=0 && i
< (int32_t)U_SYSPARAM_COUNT
) {
559 return systemParams
[i
].paramFunction(&(systemParams
[i
]),buffer
,bufferCapacity
,status
);
565 U_CAPI
void udbg_writeIcuInfo(FILE *out
) {
567 /* todo: API for writing DTD? */
568 fprintf(out
, " <icuSystemParams type=\"icu4c\">\n");
569 const char *paramName
;
570 for(int32_t i
=0;(paramName
=udbg_getSystemParameterNameByIndex(i
))!=NULL
;i
++) {
571 UErrorCode status2
= U_ZERO_ERROR
;
572 udbg_getSystemParameterValueByIndex(i
, str
,2000,&status2
);
573 if(U_SUCCESS(status2
)) {
574 fprintf(out
," <param name=\"%s\">%s</param>\n", paramName
,str
);
576 fprintf(out
," <!-- n=\"%s\" ERROR: %s -->\n", paramName
, u_errorName(status2
));
579 fprintf(out
, " </icuSystemParams>\n");