intl/icu/source/tools/toolutil/udbgutil.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

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

mercurial