2 ************************************************************************
3 * Copyright (c) 2008-2015, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ************************************************************************
8 /** C Utilities to aid in debugging **/
13 #include "unicode/utypes.h"
17 UDBG_UDebugEnumType
= 0, /* Self-referential, strings for UDebugEnumType. Count=ENUM_COUNT. */
18 #if !UCONFIG_NO_FORMATTING
19 UDBG_UCalendarDateFields
, /* UCalendarDateFields. Count=UCAL_FIELD_COUNT. Unsupported if UCONFIG_NO_FORMATTING. */
20 UDBG_UCalendarMonths
, /* UCalendarMonths. Count= (UCAL_UNDECIMBER+1) */
21 UDBG_UDateFormatStyle
, /* Count = UDAT_SHORT=1 */
23 #if UCONFIG_ENABLE_PLUGINS
24 UDBG_UPlugReason
, /* Count = UPLUG_REASON_COUNT */
25 UDBG_UPlugLevel
, /* COUNT = UPLUG_LEVEL_COUNT */
27 UDBG_UAcceptResult
, /* Count = ULOC_ACCEPT_FALLBACK+1=3 */
29 /* All following enums may be discontiguous. */
31 #if !UCONFIG_NO_COLLATION
32 UDBG_UColAttributeValue
, /* UCOL_ATTRIBUTE_VALUE_COUNT */
35 UDBG_HIGHEST_CONTIGUOUS_ENUM
= UDBG_UAcceptResult
, /**< last enum in this list with contiguous (testable) values. */
36 UDBG_INVALID_ENUM
= -1 /** Invalid enum value **/
39 typedef enum UDebugEnumType UDebugEnumType
;
42 * @param type the type of enum
43 * Print how many enums are contained for this type.
44 * Should be equal to the appropriate _COUNT constant or there is an error. Return -1 if unsupported.
46 U_CAPI
int32_t U_EXPORT2
udbg_enumCount(UDebugEnumType type
);
49 * Convert an enum to a string
50 * @param type type of enum
51 * @param field field number
52 * @return string of the format "ERA", "YEAR", etc, or NULL if out of range or unsupported
54 U_CAPI
const char * U_EXPORT2
udbg_enumName(UDebugEnumType type
, int32_t field
);
57 * for consistency checking
58 * @param type the type of enum
59 * Print how many enums should be contained for this type.
60 * This is equal to the appropriate _COUNT constant or there is an error. Returns -1 if unsupported.
62 U_CAPI
int32_t U_EXPORT2
udbg_enumExpectedCount(UDebugEnumType type
);
65 * For consistency checking, returns the expected enum ordinal value for the given index value.
66 * @param type which type
67 * @param field field number
68 * @return should be equal to 'field' or -1 if out of range.
70 U_CAPI
int32_t U_EXPORT2
udbg_enumArrayValue(UDebugEnumType type
, int32_t field
);
73 * Locate the specified field value by name.
74 * @param type which type
75 * @param name name of string (case sensitive)
76 * @return should be a field value or -1 if not found.
78 U_CAPI
int32_t U_EXPORT2
udbg_enumByName(UDebugEnumType type
, const char *name
);
82 * Return the Platform (U_PLATFORM) as a string
84 U_CAPI
const char *udbg_getPlatform(void);
87 * Get the nth system parameter's name
88 * @param i index of name, starting from zero
89 * @return name, or NULL if off the end
90 * @see udbg_getSystemParameterValue
92 U_CAPI
const char *udbg_getSystemParameterNameByIndex(int32_t i
);
95 * Get the nth system parameter's value, in a user supplied buffer
96 * @parameter i index of value, starting from zero
97 * @param status error status
98 * @return length written (standard termination rules)
99 * @see udbg_getSystemParameterName
101 U_CAPI
int32_t udbg_getSystemParameterValueByIndex(int32_t i
, char *buffer
, int32_t bufferCapacity
, UErrorCode
*status
);
104 * Write ICU info as XML
106 U_CAPI
void udbg_writeIcuInfo(FILE *f
);
109 * \def UDBG_KNOWNISSUE_LEN
110 * Length of output buffer for udbg_knownIssueURLFrom
112 #define UDBG_KNOWNISSUE_LEN 255
115 * Convert a "known issue" string into a URL
116 * @param ticket ticket string such as "10245" or "cldrbug:5013"
117 * @param buf output buffer - must be UDBG_KNOWNISSUE_LEN in size
118 * @return pointer to output buffer, or NULL on err
120 U_CAPI
char *udbg_knownIssueURLFrom(const char *ticket
, char *buf
);
123 * Open (or reopen) a 'known issue' table.
124 * @param ptr pointer to 'table'. Opaque.
125 * @return new or existing ptr
127 U_CAPI
void *udbg_knownIssue_openU(void *ptr
, const char *ticket
, char *where
, const UChar
*msg
, UBool
*firstForTicket
,
128 UBool
*firstForWhere
);
132 * Open (or reopen) a 'known issue' table.
133 * @param ptr pointer to 'table'. Opaque.
134 * @return new or existing ptr
136 U_CAPI
void *udbg_knownIssue_open(void *ptr
, const char *ticket
, char *where
, const char *msg
, UBool
*firstForTicket
,
137 UBool
*firstForWhere
);
140 * Print 'known issue' table, to std::cout.
141 * @param ptr pointer from udbg_knownIssue
142 * @return TRUE if there were any issues.
144 U_CAPI UBool
udbg_knownIssue_print(void *ptr
);
147 * Close 'known issue' table.
150 U_CAPI
void udbg_knownIssue_close(void *ptr
);