| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * | 3 * |
| 4 * Copyright (C) 1999-2013, International Business Machines | 4 * Copyright (C) 1999-2015, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ******************************************************************************* | 7 ******************************************************************************* |
| 8 * file name: derb.c | 8 * file name: derb.cpp |
| 9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
| 10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
| 11 * indentation:4 | 11 * indentation:4 |
| 12 * | 12 * |
| 13 * created on: 2000sep6 | 13 * created on: 2000sep6 |
| 14 * created by: Vladimir Weinstein as an ICU workshop example | 14 * created by: Vladimir Weinstein as an ICU workshop example |
| 15 * maintained by: Yves Arrouye <yves@realnames.com> | 15 * maintained by: Yves Arrouye <yves@realnames.com> |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include "unicode/stringpiece.h" |
| 18 #include "unicode/ucnv.h" | 19 #include "unicode/ucnv.h" |
| 20 #include "unicode/unistr.h" |
| 19 #include "unicode/ustring.h" | 21 #include "unicode/ustring.h" |
| 20 #include "unicode/putil.h" | 22 #include "unicode/putil.h" |
| 21 #include "unicode/ustdio.h" | 23 #include "unicode/ustdio.h" |
| 22 | 24 |
| 25 #include "charstr.h" |
| 23 #include "uresimp.h" | 26 #include "uresimp.h" |
| 24 #include "cmemory.h" | 27 #include "cmemory.h" |
| 25 #include "cstring.h" | 28 #include "cstring.h" |
| 26 #include "uoptions.h" | 29 #include "uoptions.h" |
| 27 #include "toolutil.h" | 30 #include "toolutil.h" |
| 28 #include "ustrfmt.h" | 31 #include "ustrfmt.h" |
| 29 | 32 |
| 30 #if !UCONFIG_NO_FORMATTING | 33 #if !UCONFIG_NO_FORMATTING |
| 31 | 34 |
| 32 #define DERB_VERSION "1.1" | 35 #define DERB_VERSION "1.1" |
| 33 | 36 |
| 34 #define DERB_DEFAULT_TRUNC 80 | 37 #define DERB_DEFAULT_TRUNC 80 |
| 35 | 38 |
| 36 static const int32_t indentsize = 4; | 39 static const int32_t indentsize = 4; |
| 37 static int32_t truncsize = DERB_DEFAULT_TRUNC; | 40 static int32_t truncsize = DERB_DEFAULT_TRUNC; |
| 38 static UBool opt_truncate = FALSE; | 41 static UBool opt_truncate = FALSE; |
| 39 | 42 |
| 40 static const char *getEncodingName(const char *encoding); | 43 static const char *getEncodingName(const char *encoding); |
| 41 static void reportError(const char *pname, UErrorCode *status, const char *when)
; | 44 static void reportError(const char *pname, UErrorCode *status, const char *when)
; |
| 42 static UChar *quotedString(const UChar *string); | 45 static UChar *quotedString(const UChar *string); |
| 43 static void printOutBundle(UFILE *out, UConverter *converter, UResourceBundle *r
esource, int32_t indent, const char *pname, UErrorCode *status); | 46 static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
, const char *pname, UErrorCode *status); |
| 44 static void printString(UFILE *out, UConverter *converter, const UChar *str, int
32_t len); | 47 static void printString(UFILE *out, const UChar *str, int32_t len); |
| 45 static void printCString(UFILE *out, UConverter *converter, const char *str, int
32_t len); | 48 static void printCString(UFILE *out, const char *str, int32_t len); |
| 46 static void printIndent(UFILE *out, UConverter *converter, int32_t indent); | 49 static void printIndent(UFILE *out, int32_t indent); |
| 47 static void printHex(UFILE *out, UConverter *converter, uint8_t what); | 50 static void printHex(UFILE *out, uint8_t what); |
| 48 | 51 |
| 49 static UOption options[]={ | 52 static UOption options[]={ |
| 50 UOPTION_HELP_H, | 53 UOPTION_HELP_H, |
| 51 UOPTION_HELP_QUESTION_MARK, | 54 UOPTION_HELP_QUESTION_MARK, |
| 52 /* 2 */ UOPTION_ENCODING, | 55 /* 2 */ UOPTION_ENCODING, |
| 53 /* 3 */ { "to-stdout", NULL, NULL, NULL, 'c', UOPT_NO_ARG, 0 } , | 56 /* 3 */ { "to-stdout", NULL, NULL, NULL, 'c', UOPT_NO_ARG, 0 } , |
| 54 /* 4 */ { "truncate", NULL, NULL, NULL, 't', UOPT_OPTIONAL_ARG, 0 }, | 57 /* 4 */ { "truncate", NULL, NULL, NULL, 't', UOPT_OPTIONAL_ARG, 0 }, |
| 55 /* 5 */ UOPTION_VERBOSE, | 58 /* 5 */ UOPTION_VERBOSE, |
| 56 /* 6 */ UOPTION_DESTDIR, | 59 /* 6 */ UOPTION_DESTDIR, |
| 57 /* 7 */ UOPTION_SOURCEDIR, | 60 /* 7 */ UOPTION_SOURCEDIR, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 main(int argc, char* argv[]) { | 72 main(int argc, char* argv[]) { |
| 70 const char *encoding = NULL; | 73 const char *encoding = NULL; |
| 71 const char *outputDir = NULL; /* NULL = no output directory, use current */ | 74 const char *outputDir = NULL; /* NULL = no output directory, use current */ |
| 72 const char *inputDir = "."; | 75 const char *inputDir = "."; |
| 73 int tostdout = 0; | 76 int tostdout = 0; |
| 74 int prbom = 0; | 77 int prbom = 0; |
| 75 | 78 |
| 76 const char *pname; | 79 const char *pname; |
| 77 | 80 |
| 78 UResourceBundle *bundle = NULL; | 81 UResourceBundle *bundle = NULL; |
| 79 UErrorCode status = U_ZERO_ERROR; | |
| 80 int32_t i = 0; | 82 int32_t i = 0; |
| 81 | 83 |
| 82 UConverter *converter = NULL; // not used | |
| 83 | |
| 84 const char* arg; | 84 const char* arg; |
| 85 | 85 |
| 86 /* Get the name of tool. */ | 86 /* Get the name of tool. */ |
| 87 pname = uprv_strrchr(*argv, U_FILE_SEP_CHAR); | 87 pname = uprv_strrchr(*argv, U_FILE_SEP_CHAR); |
| 88 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR | 88 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR |
| 89 if (!pname) { | 89 if (!pname) { |
| 90 pname = uprv_strrchr(*argv, U_FILE_ALT_SEP_CHAR); | 90 pname = uprv_strrchr(*argv, U_FILE_ALT_SEP_CHAR); |
| 91 } | 91 } |
| 92 #endif | 92 #endif |
| 93 if (!pname) { | 93 if (!pname) { |
| 94 pname = *argv; | 94 pname = *argv; |
| 95 } else { | 95 } else { |
| 96 ++pname; | 96 ++pname; |
| 97 } | 97 } |
| 98 | 98 |
| 99 /* error handling, printing usage message */ | 99 /* error handling, printing usage message */ |
| 100 argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); | 100 argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options); |
| 101 | 101 |
| 102 /* error handling, printing usage message */ | 102 /* error handling, printing usage message */ |
| 103 if(argc<0) { | 103 if(argc<0) { |
| 104 fprintf(stderr, | 104 fprintf(stderr, |
| 105 "%s: error in command line argument \"%s\"\n", pname, | 105 "%s: error in command line argument \"%s\"\n", pname, |
| 106 argv[-argc]); | 106 argv[-argc]); |
| 107 } | 107 } |
| 108 if(argc<0 || options[0].doesOccur || options[1].doesOccur) { | 108 if(argc<0 || options[0].doesOccur || options[1].doesOccur) { |
| 109 fprintf(argc < 0 ? stderr : stdout, | 109 fprintf(argc < 0 ? stderr : stdout, |
| 110 "%csage: %s [ -h, -?, --help ] [ -V, --version ]\n" | 110 "%csage: %s [ -h, -?, --help ] [ -V, --version ]\n" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 if (options[11].doesOccur) { | 171 if (options[11].doesOccur) { |
| 172 suppressAliases = TRUE; | 172 suppressAliases = TRUE; |
| 173 } | 173 } |
| 174 | 174 |
| 175 fflush(stderr); // use ustderr now. | 175 fflush(stderr); // use ustderr now. |
| 176 ustderr = u_finit(stderr, NULL, NULL); | 176 ustderr = u_finit(stderr, NULL, NULL); |
| 177 | 177 |
| 178 for (i = 1; i < argc; ++i) { | 178 for (i = 1; i < argc; ++i) { |
| 179 static const UChar sp[] = { 0x0020 }; /* " " */ | 179 static const UChar sp[] = { 0x0020 }; /* " " */ |
| 180 char infile[4096]; /* XXX Sloppy. */ | |
| 181 char locale[64]; | |
| 182 const char *thename = 0, *p, *q; | |
| 183 UBool fromICUData = FALSE; | |
| 184 | 180 |
| 185 arg = getLongPathname(argv[i]); | 181 arg = getLongPathname(argv[i]); |
| 186 | 182 |
| 187 if (verbose) { | 183 if (verbose) { |
| 188 u_fprintf(ustderr, "processing bundle \"%s\"\n", argv[i]); | 184 u_fprintf(ustderr, "processing bundle \"%s\"\n", argv[i]); |
| 189 } | 185 } |
| 190 | 186 |
| 191 p = uprv_strrchr(arg, U_FILE_SEP_CHAR); | 187 icu::CharString locale; |
| 192 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR | 188 UErrorCode status = U_ZERO_ERROR; |
| 193 if (p == NULL) { | 189 { |
| 194 p = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); | 190 const char *p = findBasename(arg); |
| 191 const char *q = uprv_strrchr(p, '.'); |
| 192 if (q == NULL) { |
| 193 locale.append(p, status); |
| 194 } else { |
| 195 locale.append(p, (int32_t)(q - p), status); |
| 196 } |
| 195 } | 197 } |
| 196 #endif | 198 if (U_FAILURE(status)) { |
| 197 if (!p) { | 199 return status; |
| 198 p = arg; | |
| 199 } else { | |
| 200 p++; | |
| 201 } | 200 } |
| 202 q = uprv_strrchr(p, '.'); | |
| 203 if (!q) { | |
| 204 for (q = p; *q; ++q) | |
| 205 ; | |
| 206 } | |
| 207 uprv_strncpy(locale, p, q - p); | |
| 208 locale[q - p] = 0; | |
| 209 | 201 |
| 210 if (!(fromICUData = !uprv_strcmp(inputDir, "-"))) { | 202 icu::CharString infile; |
| 203 const char *thename = NULL; |
| 204 UBool fromICUData = !uprv_strcmp(inputDir, "-"); |
| 205 if (!fromICUData) { |
| 211 UBool absfilename = *arg == U_FILE_SEP_CHAR; | 206 UBool absfilename = *arg == U_FILE_SEP_CHAR; |
| 212 #if U_PLATFORM_HAS_WIN32_API | 207 #if U_PLATFORM_HAS_WIN32_API |
| 213 if (!absfilename) { | 208 if (!absfilename) { |
| 214 absfilename = (uprv_strlen(arg) > 2 && isalpha(arg[0]) | 209 absfilename = (uprv_strlen(arg) > 2 && isalpha(arg[0]) |
| 215 && arg[1] == ':' && arg[2] == U_FILE_SEP_CHAR); | 210 && arg[1] == ':' && arg[2] == U_FILE_SEP_CHAR); |
| 216 } | 211 } |
| 217 #endif | 212 #endif |
| 218 if (absfilename) { | 213 if (absfilename) { |
| 219 thename = arg; | 214 thename = arg; |
| 220 } else { | 215 } else { |
| 221 q = uprv_strrchr(arg, U_FILE_SEP_CHAR); | 216 const char *q = uprv_strrchr(arg, U_FILE_SEP_CHAR); |
| 222 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR | 217 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR |
| 223 if (q == NULL) { | 218 if (q == NULL) { |
| 224 q = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); | 219 q = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); |
| 225 } | 220 } |
| 226 #endif | 221 #endif |
| 227 uprv_strcpy(infile, inputDir); | 222 infile.append(inputDir, status); |
| 228 if(q != NULL) { | 223 if(q != NULL) { |
| 229 uprv_strcat(infile, U_FILE_SEP_STRING); | 224 infile.appendPathPart(icu::StringPiece(arg, (int32_t)(q - ar
g)), status); |
| 230 strncat(infile, arg, q-arg); | |
| 231 } | 225 } |
| 232 thename = infile; | 226 if (U_FAILURE(status)) { |
| 227 return status; |
| 228 } |
| 229 thename = infile.data(); |
| 233 } | 230 } |
| 234 } | 231 } |
| 235 status = U_ZERO_ERROR; | |
| 236 if (thename) { | 232 if (thename) { |
| 237 bundle = ures_openDirect(thename, locale, &status); | 233 bundle = ures_openDirect(thename, locale.data(), &status); |
| 238 } else { | 234 } else { |
| 239 bundle = ures_open(fromICUData ? 0 : inputDir, locale, &status); | 235 bundle = ures_open(fromICUData ? 0 : inputDir, locale.data(), &statu
s); |
| 240 } | 236 } |
| 241 if (status == U_ZERO_ERROR) { | 237 if (U_SUCCESS(status)) { |
| 242 UFILE *out = NULL; | 238 UFILE *out = NULL; |
| 243 | 239 |
| 244 const char *filename = 0; | 240 const char *filename = 0; |
| 245 const char *ext = 0; | 241 const char *ext = 0; |
| 246 | 242 |
| 247 if (!locale[0] || !tostdout) { | 243 if (locale.isEmpty() || !tostdout) { |
| 248 filename = uprv_strrchr(arg, U_FILE_SEP_CHAR); | 244 filename = findBasename(arg); |
| 249 | 245 ext = uprv_strrchr(filename, '.'); |
| 250 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR | |
| 251 if (!filename) { | |
| 252 filename = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); | |
| 253 } | |
| 254 #endif | |
| 255 if (!filename) { | |
| 256 filename = arg; | |
| 257 } else { | |
| 258 ++filename; | |
| 259 } | |
| 260 ext = uprv_strrchr(arg, '.'); | |
| 261 if (!ext) { | 246 if (!ext) { |
| 262 ext = filename + uprv_strlen(filename); | 247 ext = uprv_strchr(filename, 0); |
| 263 } | 248 } |
| 264 } | 249 } |
| 265 | 250 |
| 266 if (tostdout) { | 251 if (tostdout) { |
| 267 out = u_get_stdout(); | 252 out = u_get_stdout(); |
| 268 } else { | 253 } else { |
| 269 char thefile[4096], *tp; | 254 icu::CharString thefile; |
| 270 int32_t len; | 255 if (outputDir) { |
| 256 thefile.append(outputDir, status); |
| 257 } |
| 258 thefile.appendPathPart(filename, status); |
| 259 if (*ext) { |
| 260 thefile.truncate(thefile.length() - (int32_t)uprv_strlen(ext
)); |
| 261 } |
| 262 thefile.append(".txt", status); |
| 263 if (U_FAILURE(status)) { |
| 264 return status; |
| 265 } |
| 271 | 266 |
| 272 if (outputDir) { | 267 out = u_fopen(thefile.data(), "w", NULL, encoding); |
| 273 uprv_strcpy(thefile, outputDir); | |
| 274 uprv_strcat(thefile, U_FILE_SEP_STRING); | |
| 275 } else { | |
| 276 *thefile = 0; | |
| 277 } | |
| 278 uprv_strcat(thefile, filename); | |
| 279 tp = thefile + uprv_strlen(thefile); | |
| 280 len = (int32_t)uprv_strlen(ext); | |
| 281 if (len) { | |
| 282 tp -= len - 1; | |
| 283 } else { | |
| 284 *tp++ = '.'; | |
| 285 } | |
| 286 uprv_strcpy(tp, "txt"); | |
| 287 | |
| 288 out = u_fopen(thefile, "w", NULL, encoding); | |
| 289 if (!out) { | 268 if (!out) { |
| 290 u_fprintf(ustderr, "%s: couldn't create %s\n", pname, thefile)
; | 269 u_fprintf(ustderr, "%s: couldn't create %s\n", pname, thefile.
data()); |
| 291 u_fclose(ustderr); | 270 u_fclose(ustderr); |
| 292 return 4; | 271 return 4; |
| 293 } | 272 } |
| 294 } | 273 } |
| 295 | 274 |
| 296 // now, set the callback. | 275 // now, set the callback. |
| 297 ucnv_setFromUCallBack(u_fgetConverter(out), UCNV_FROM_U_CALLBACK_ESC
APE, UCNV_ESCAPE_C, 0, 0, &status); | 276 ucnv_setFromUCallBack(u_fgetConverter(out), UCNV_FROM_U_CALLBACK_ESC
APE, UCNV_ESCAPE_C, 0, 0, &status); |
| 298 if (U_FAILURE(status)) { | 277 if (U_FAILURE(status)) { |
| 299 u_fprintf(ustderr, "%s: couldn't configure converter for encoding\
n", pname); | 278 u_fprintf(ustderr, "%s: couldn't configure converter for encoding\
n", pname); |
| 300 u_fclose(ustderr); | 279 u_fclose(ustderr); |
| 301 if(!tostdout) { | 280 if(!tostdout) { |
| 302 u_fclose(out); | 281 u_fclose(out); |
| 303 } | 282 } |
| 304 return 3; | 283 return 3; |
| 305 } | 284 } |
| 306 | 285 |
| 307 if (prbom) { /* XXX: Should be done only for UTFs */ | 286 if (prbom) { /* XXX: Should be done only for UTFs */ |
| 308 u_fputc(0xFEFF, out); | 287 u_fputc(0xFEFF, out); |
| 309 } | 288 } |
| 310 u_fprintf(out, "// -*- Coding: %s; -*-\n//\n", encoding ? encoding :
getEncodingName(ucnv_getDefaultName())); | 289 u_fprintf(out, "// -*- Coding: %s; -*-\n//\n", encoding ? encoding :
getEncodingName(ucnv_getDefaultName())); |
| 311 u_fprintf(out, "// This file was dumped by derb(8) from "); | 290 u_fprintf(out, "// This file was dumped by derb(8) from "); |
| 312 if (thename) { | 291 if (thename) { |
| 313 u_fprintf(out, "%s", thename); | 292 u_fprintf(out, "%s", thename); |
| 314 } else if (fromICUData) { | 293 } else if (fromICUData) { |
| 315 u_fprintf(out, "the ICU internal %s locale", locale); | 294 u_fprintf(out, "the ICU internal %s locale", locale.data()); |
| 316 } | 295 } |
| 317 | 296 |
| 318 u_fprintf(out, "\n// derb(8) by Vladimir Weinstein and Yves Arrouye\
n\n"); | 297 u_fprintf(out, "\n// derb(8) by Vladimir Weinstein and Yves Arrouye\
n\n"); |
| 319 | 298 |
| 320 if (locale[0]) { | 299 if (!locale.isEmpty()) { |
| 321 u_fprintf(out, "%s", locale); | 300 u_fprintf(out, "%s", locale.data()); |
| 322 } else { | 301 } else { |
| 323 u_fprintf(out, "%.*s%.*S", (int32_t)(ext - filename), filename, (
int32_t)(sizeof(sp)/sizeof(*sp)), sp); | 302 u_fprintf(out, "%.*s%.*S", (int32_t)(ext - filename), filename, U
PRV_LENGTHOF(sp), sp); |
| 324 } | 303 } |
| 325 printOutBundle(out, converter, bundle, 0, pname, &status); | 304 printOutBundle(out, bundle, 0, pname, &status); |
| 326 | 305 |
| 327 if (!tostdout) { | 306 if (!tostdout) { |
| 328 u_fclose(out); | 307 u_fclose(out); |
| 329 } | 308 } |
| 330 } | 309 } |
| 331 else { | 310 else { |
| 332 reportError(pname, &status, "opening resource file"); | 311 reportError(pname, &status, "opening resource file"); |
| 333 } | 312 } |
| 334 | 313 |
| 335 ures_close(bundle); | 314 ures_close(bundle); |
| 336 } | 315 } |
| 337 | 316 |
| 338 ucnv_close(converter); | |
| 339 | |
| 340 return 0; | 317 return 0; |
| 341 } | 318 } |
| 342 | 319 |
| 343 static UChar *quotedString(const UChar *string) { | 320 static UChar *quotedString(const UChar *string) { |
| 344 int len = u_strlen(string); | 321 int len = u_strlen(string); |
| 345 int alen = len; | 322 int alen = len; |
| 346 const UChar *sp; | 323 const UChar *sp; |
| 347 UChar *newstr, *np; | 324 UChar *newstr, *np; |
| 348 | 325 |
| 349 for (sp = string; *sp; ++sp) { | 326 for (sp = string; *sp; ++sp) { |
| 350 switch (*sp) { | 327 switch (*sp) { |
| 351 case '\n': | 328 case '\n': |
| 352 case 0x0022: | 329 case 0x0022: |
| 353 ++alen; | 330 ++alen; |
| 354 break; | 331 break; |
| 355 } | 332 } |
| 356 } | 333 } |
| 357 | 334 |
| 358 newstr = (UChar *) uprv_malloc((1 + alen) * sizeof(*newstr)); | 335 newstr = (UChar *) uprv_malloc((1 + alen) * U_SIZEOF_UCHAR); |
| 359 for (sp = string, np = newstr; *sp; ++sp) { | 336 for (sp = string, np = newstr; *sp; ++sp) { |
| 360 switch (*sp) { | 337 switch (*sp) { |
| 361 case '\n': | 338 case '\n': |
| 362 *np++ = 0x005C; | 339 *np++ = 0x005C; |
| 363 *np++ = 0x006E; | 340 *np++ = 0x006E; |
| 364 break; | 341 break; |
| 365 | 342 |
| 366 case 0x0022: | 343 case 0x0022: |
| 367 *np++ = 0x005C; | 344 *np++ = 0x005C; |
| 368 | 345 |
| 369 default: | 346 default: |
| 370 *np++ = *sp; | 347 *np++ = *sp; |
| 371 break; | 348 break; |
| 372 } | 349 } |
| 373 } | 350 } |
| 374 *np = 0; | 351 *np = 0; |
| 375 | 352 |
| 376 return newstr; | 353 return newstr; |
| 377 } | 354 } |
| 378 | 355 |
| 379 | 356 |
| 380 static void printString(UFILE *out, UConverter *converter, const UChar *str, int
32_t len) { | 357 static void printString(UFILE *out, const UChar *str, int32_t len) { |
| 381 u_file_write(str, len, out); | 358 u_file_write(str, len, out); |
| 382 } | 359 } |
| 383 | 360 |
| 384 static void printCString(UFILE *out, UConverter *converter, const char *str, int
32_t len) { | 361 static void printCString(UFILE *out, const char *str, int32_t len) { |
| 385 if(len==-1) { | 362 if(len==-1) { |
| 386 u_fprintf(out, "%s", str); | 363 u_fprintf(out, "%s", str); |
| 387 } else { | 364 } else { |
| 388 u_fprintf(out, "%.*s", len, str); | 365 u_fprintf(out, "%.*s", len, str); |
| 389 } | 366 } |
| 390 } | 367 } |
| 391 | 368 |
| 392 static void printIndent(UFILE *out, UConverter *converter, int32_t indent) { | 369 static void printIndent(UFILE *out, int32_t indent) { |
| 393 UChar inchar[256]; | 370 icu::UnicodeString inchar(indent, 0x20, indent); |
| 394 int32_t i = 0; | 371 printString(out, inchar.getBuffer(), indent); |
| 395 for(i = 0; i<indent; i++) { | |
| 396 inchar[i] = 0x0020; | |
| 397 } | |
| 398 inchar[indent] = 0; | |
| 399 | |
| 400 printString(out, converter, inchar, indent); | |
| 401 } | 372 } |
| 402 | 373 |
| 403 static void printHex(UFILE *out, UConverter *converter, uint8_t what) { | 374 static void printHex(UFILE *out, uint8_t what) { |
| 404 static const char map[] = "0123456789ABCDEF"; | 375 static const char map[] = "0123456789ABCDEF"; |
| 405 UChar hex[2]; | 376 UChar hex[2]; |
| 406 | 377 |
| 407 hex[0] = map[what >> 4]; | 378 hex[0] = map[what >> 4]; |
| 408 hex[1] = map[what & 0xf]; | 379 hex[1] = map[what & 0xf]; |
| 409 | 380 |
| 410 printString(out, converter, hex, (int32_t)(sizeof(hex)/sizeof(*hex))); | 381 printString(out, hex, 2); |
| 411 } | 382 } |
| 412 | 383 |
| 413 static void printOutAlias(UFILE *out, UConverter *converter, UResourceBundle *p
arent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCod
e *status) { | 384 static void printOutAlias(UFILE *out, UResourceBundle *parent, Resource r, cons
t char *key, int32_t indent, const char *pname, UErrorCode *status) { |
| 414 static const UChar cr[] = { '\n' }; | 385 static const UChar cr[] = { 0xA }; // LF |
| 415 int32_t len = 0; | 386 int32_t len = 0; |
| 416 const UChar* thestr = res_getAlias(&(parent->fResData), r, &len); | 387 const UChar* thestr = res_getAlias(&(parent->fResData), r, &len); |
| 417 UChar *string = quotedString(thestr); | 388 UChar *string = quotedString(thestr); |
| 418 if(opt_truncate && len > truncsize) { | 389 if(opt_truncate && len > truncsize) { |
| 419 char msg[128]; | 390 char msg[128]; |
| 420 printIndent(out, converter, indent); | 391 printIndent(out, indent); |
| 421 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n"
, | 392 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n"
, |
| 422 (long)len, (long)truncsize/2); | 393 (long)len, (long)truncsize/2); |
| 423 printCString(out, converter, msg, -1); | 394 printCString(out, msg, -1); |
| 424 len = truncsize; | 395 len = truncsize; |
| 425 } | 396 } |
| 426 if(U_SUCCESS(*status)) { | 397 if(U_SUCCESS(*status)) { |
| 427 static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061,
0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */ | 398 static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061,
0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */ |
| 428 static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "
\" } " */ | 399 static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "
\" } " */ |
| 429 printIndent(out, converter, indent); | 400 printIndent(out, indent); |
| 430 if(key != NULL) { | 401 if(key != NULL) { |
| 431 printCString(out, converter, key, -1); | 402 printCString(out, key, -1); |
| 432 } | 403 } |
| 433 printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(
*openStr))); | 404 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 434 printString(out, converter, string, len); | 405 printString(out, string, len); |
| 435 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeo
f(*closeStr))); | 406 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 436 if(verbose) { | 407 if(verbose) { |
| 437 printCString(out, converter, " // ALIAS", -1); | 408 printCString(out, " // ALIAS", -1); |
| 438 } | 409 } |
| 439 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr))); | 410 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 440 } else { | 411 } else { |
| 441 reportError(pname, status, "getting binary value"); | 412 reportError(pname, status, "getting binary value"); |
| 442 } | 413 } |
| 443 uprv_free(string); | 414 uprv_free(string); |
| 444 } | 415 } |
| 445 | 416 |
| 446 static void printOutBundle(UFILE *out, UConverter *converter, UResourceBundle *r
esource, int32_t indent, const char *pname, UErrorCode *status) | 417 static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
, const char *pname, UErrorCode *status) |
| 447 { | 418 { |
| 448 static const UChar cr[] = { '\n' }; | 419 static const UChar cr[] = { 0xA }; // LF |
| 449 | 420 |
| 450 /* int32_t noOfElements = ures_getSize(resource);*/ | 421 /* int32_t noOfElements = ures_getSize(resource);*/ |
| 451 int32_t i = 0; | 422 int32_t i = 0; |
| 452 const char *key = ures_getKey(resource); | 423 const char *key = ures_getKey(resource); |
| 453 | 424 |
| 454 switch(ures_getType(resource)) { | 425 switch(ures_getType(resource)) { |
| 455 case URES_STRING : | 426 case URES_STRING : |
| 456 { | 427 { |
| 457 int32_t len=0; | 428 int32_t len=0; |
| 458 const UChar* thestr = ures_getString(resource, &len, status); | 429 const UChar* thestr = ures_getString(resource, &len, status); |
| 459 UChar *string = quotedString(thestr); | 430 UChar *string = quotedString(thestr); |
| 460 | 431 |
| 461 /* TODO: String truncation */ | 432 /* TODO: String truncation */ |
| 462 if(opt_truncate && len > truncsize) { | 433 if(opt_truncate && len > truncsize) { |
| 463 char msg[128]; | 434 char msg[128]; |
| 464 printIndent(out, converter, indent); | 435 printIndent(out, indent); |
| 465 sprintf(msg, "// WARNING: this resource, size %li is truncated t
o %li\n", | 436 sprintf(msg, "// WARNING: this resource, size %li is truncated t
o %li\n", |
| 466 (long)len, (long)(truncsize/2)); | 437 (long)len, (long)(truncsize/2)); |
| 467 printCString(out, converter, msg, -1); | 438 printCString(out, msg, -1); |
| 468 len = truncsize/2; | 439 len = truncsize/2; |
| 469 } | 440 } |
| 470 printIndent(out, converter, indent); | 441 printIndent(out, indent); |
| 471 if(key != NULL) { | 442 if(key != NULL) { |
| 472 static const UChar openStr[] = { 0x0020, 0x007B, 0x0020, 0x0022
}; /* " { \"" */ | 443 static const UChar openStr[] = { 0x0020, 0x007B, 0x0020, 0x0022
}; /* " { \"" */ |
| 473 static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D }; /* "
\" }" */ | 444 static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D }; /* "
\" }" */ |
| 474 printCString(out, converter, key, (int32_t)uprv_strlen(key)); | 445 printCString(out, key, (int32_t)uprv_strlen(key)); |
| 475 printString(out, converter, openStr, (int32_t)(sizeof(openStr)/s
izeof(*openStr))); | 446 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 476 printString(out, converter, string, len); | 447 printString(out, string, len); |
| 477 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr)
/ sizeof(*closeStr))); | 448 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 478 } else { | 449 } else { |
| 479 static const UChar openStr[] = { 0x0022 }; /* "\"" */ | 450 static const UChar openStr[] = { 0x0022 }; /* "\"" */ |
| 480 static const UChar closeStr[] = { 0x0022, 0x002C }; /* "\"," */ | 451 static const UChar closeStr[] = { 0x0022, 0x002C }; /* "\"," */ |
| 481 | 452 |
| 482 printString(out, converter, openStr, (int32_t)(sizeof(openStr) /
sizeof(*openStr))); | 453 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 483 printString(out, converter, string, (int32_t)(u_strlen(string)))
; | 454 printString(out, string, (int32_t)(u_strlen(string))); |
| 484 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr)
/ sizeof(*closeStr))); | 455 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 485 } | 456 } |
| 486 | 457 |
| 487 if(verbose) { | 458 if(verbose) { |
| 488 printCString(out, converter, "// STRING", -1); | 459 printCString(out, "// STRING", -1); |
| 489 } | 460 } |
| 490 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)))
; | 461 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 491 | 462 |
| 492 uprv_free(string); | 463 uprv_free(string); |
| 493 } | 464 } |
| 494 break; | 465 break; |
| 495 | 466 |
| 496 case URES_INT : | 467 case URES_INT : |
| 497 { | 468 { |
| 498 static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0
020, 0x007B, 0x0020 }; /* ":int { " */ | 469 static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0
020, 0x007B, 0x0020 }; /* ":int { " */ |
| 499 static const UChar closeStr[] = { 0x0020, 0x007D }; /* " }" */ | 470 static const UChar closeStr[] = { 0x0020, 0x007D }; /* " }" */ |
| 500 UChar num[20]; | 471 UChar num[20]; |
| 501 | 472 |
| 502 printIndent(out, converter, indent); | 473 printIndent(out, indent); |
| 503 if(key != NULL) { | 474 if(key != NULL) { |
| 504 printCString(out, converter, key, -1); | 475 printCString(out, key, -1); |
| 505 } | 476 } |
| 506 printString(out, converter, openStr, (int32_t)(sizeof(openStr) / siz
eof(*openStr))); | 477 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 507 uprv_itou(num, 20, ures_getInt(resource, status), 10, 0); | 478 uprv_itou(num, 20, ures_getInt(resource, status), 10, 0); |
| 508 printString(out, converter, num, u_strlen(num)); | 479 printString(out, num, u_strlen(num)); |
| 509 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / s
izeof(*closeStr))); | 480 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 510 | 481 |
| 511 if(verbose) { | 482 if(verbose) { |
| 512 printCString(out, converter, "// INT", -1); | 483 printCString(out, "// INT", -1); |
| 513 } | 484 } |
| 514 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)))
; | 485 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 515 break; | 486 break; |
| 516 } | 487 } |
| 517 case URES_BINARY : | 488 case URES_BINARY : |
| 518 { | 489 { |
| 519 int32_t len = 0; | 490 int32_t len = 0; |
| 520 const int8_t *data = (const int8_t *)ures_getBinary(resource, &len,
status); | 491 const int8_t *data = (const int8_t *)ures_getBinary(resource, &len,
status); |
| 521 if(opt_truncate && len > truncsize) { | 492 if(opt_truncate && len > truncsize) { |
| 522 char msg[128]; | 493 char msg[128]; |
| 523 printIndent(out, converter, indent); | 494 printIndent(out, indent); |
| 524 sprintf(msg, "// WARNING: this resource, size %li is truncated t
o %li\n", | 495 sprintf(msg, "// WARNING: this resource, size %li is truncated t
o %li\n", |
| 525 (long)len, (long)(truncsize/2)); | 496 (long)len, (long)(truncsize/2)); |
| 526 printCString(out, converter, msg, -1); | 497 printCString(out, msg, -1); |
| 527 len = truncsize; | 498 len = truncsize; |
| 528 } | 499 } |
| 529 if(U_SUCCESS(*status)) { | 500 if(U_SUCCESS(*status)) { |
| 530 static const UChar openStr[] = { 0x003A, 0x0062, 0x0069, 0x006E,
0x0061, 0x0072, 0x0079, 0x0020, 0x007B, 0x0020 }; /* ":binary { " */ | 501 static const UChar openStr[] = { 0x003A, 0x0062, 0x0069, 0x006E,
0x0061, 0x0072, 0x0079, 0x0020, 0x007B, 0x0020 }; /* ":binary { " */ |
| 531 static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* "
} " */ | 502 static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* "
} " */ |
| 532 printIndent(out, converter, indent); | 503 printIndent(out, indent); |
| 533 if(key != NULL) { | 504 if(key != NULL) { |
| 534 printCString(out, converter, key, -1); | 505 printCString(out, key, -1); |
| 535 } | 506 } |
| 536 printString(out, converter, openStr, (int32_t)(sizeof(openStr) /
sizeof(*openStr))); | 507 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 537 for(i = 0; i<len; i++) { | 508 for(i = 0; i<len; i++) { |
| 538 printHex(out, converter, *data++); | 509 printHex(out, *data++); |
| 539 } | 510 } |
| 540 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr)
/ sizeof(*closeStr))); | 511 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 541 if(verbose) { | 512 if(verbose) { |
| 542 printCString(out, converter, " // BINARY", -1); | 513 printCString(out, " // BINARY", -1); |
| 543 } | 514 } |
| 544 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*c
r))); | 515 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 545 } else { | 516 } else { |
| 546 reportError(pname, status, "getting binary value"); | 517 reportError(pname, status, "getting binary value"); |
| 547 } | 518 } |
| 548 } | 519 } |
| 549 break; | 520 break; |
| 550 case URES_INT_VECTOR : | 521 case URES_INT_VECTOR : |
| 551 { | 522 { |
| 552 int32_t len = 0; | 523 int32_t len = 0; |
| 553 const int32_t *data = ures_getIntVector(resource, &len, status); | 524 const int32_t *data = ures_getIntVector(resource, &len, status); |
| 554 if(U_SUCCESS(*status)) { | 525 if(U_SUCCESS(*status)) { |
| 555 static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074,
0x0076, 0x0065, 0x0063, 0x0074, 0x006F, 0x0072, 0x0020, 0x007B, 0x0020 }; /* ":
intvector { " */ | 526 static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074,
0x0076, 0x0065, 0x0063, 0x0074, 0x006F, 0x0072, 0x0020, 0x007B, 0x0020 }; /* ":
intvector { " */ |
| 556 static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* "
} " */ | 527 static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* "
} " */ |
| 557 UChar num[20]; | 528 UChar num[20]; |
| 558 | 529 |
| 559 printIndent(out, converter, indent); | 530 printIndent(out, indent); |
| 560 if(key != NULL) { | 531 if(key != NULL) { |
| 561 printCString(out, converter, key, -1); | 532 printCString(out, key, -1); |
| 562 } | 533 } |
| 563 printString(out, converter, openStr, (int32_t)(sizeof(openStr) /
sizeof(*openStr))); | 534 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 564 for(i = 0; i < len - 1; i++) { | 535 for(i = 0; i < len - 1; i++) { |
| 565 int32_t numLen = uprv_itou(num, 20, data[i], 10, 0); | 536 int32_t numLen = uprv_itou(num, 20, data[i], 10, 0); |
| 566 num[numLen++] = 0x002C; /* ',' */ | 537 num[numLen++] = 0x002C; /* ',' */ |
| 567 num[numLen++] = 0x0020; /* ' ' */ | 538 num[numLen++] = 0x0020; /* ' ' */ |
| 568 num[numLen] = 0; | 539 num[numLen] = 0; |
| 569 printString(out, converter, num, u_strlen(num)); | 540 printString(out, num, u_strlen(num)); |
| 570 } | 541 } |
| 571 if(len > 0) { | 542 if(len > 0) { |
| 572 uprv_itou(num, 20, data[len - 1], 10, 0); | 543 uprv_itou(num, 20, data[len - 1], 10, 0); |
| 573 printString(out, converter, num, u_strlen(num)); | 544 printString(out, num, u_strlen(num)); |
| 574 } | 545 } |
| 575 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr)
/ sizeof(*closeStr))); | 546 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 576 if(verbose) { | 547 if(verbose) { |
| 577 printCString(out, converter, "// INTVECTOR", -1); | 548 printCString(out, "// INTVECTOR", -1); |
| 578 } | 549 } |
| 579 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*c
r))); | 550 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 580 } else { | 551 } else { |
| 581 reportError(pname, status, "getting int vector"); | 552 reportError(pname, status, "getting int vector"); |
| 582 } | 553 } |
| 583 } | 554 } |
| 584 break; | 555 break; |
| 585 case URES_TABLE : | 556 case URES_TABLE : |
| 586 case URES_ARRAY : | 557 case URES_ARRAY : |
| 587 { | 558 { |
| 588 static const UChar openStr[] = { 0x007B }; /* "{" */ | 559 static const UChar openStr[] = { 0x007B }; /* "{" */ |
| 589 static const UChar closeStr[] = { 0x007D, '\n' }; /* "}\n" */ | 560 static const UChar closeStr[] = { 0x007D, '\n' }; /* "}\n" */ |
| 590 | 561 |
| 591 UResourceBundle *t = NULL; | 562 UResourceBundle *t = NULL; |
| 592 ures_resetIterator(resource); | 563 ures_resetIterator(resource); |
| 593 printIndent(out, converter, indent); | 564 printIndent(out, indent); |
| 594 if(key != NULL) { | 565 if(key != NULL) { |
| 595 printCString(out, converter, key, -1); | 566 printCString(out, key, -1); |
| 596 } | 567 } |
| 597 printString(out, converter, openStr, (int32_t)(sizeof(openStr) / siz
eof(*openStr))); | 568 printString(out, openStr, UPRV_LENGTHOF(openStr)); |
| 598 if(verbose) { | 569 if(verbose) { |
| 599 if(ures_getType(resource) == URES_TABLE) { | 570 if(ures_getType(resource) == URES_TABLE) { |
| 600 printCString(out, converter, "// TABLE", -1); | 571 printCString(out, "// TABLE", -1); |
| 601 } else { | 572 } else { |
| 602 printCString(out, converter, "// ARRAY", -1); | 573 printCString(out, "// ARRAY", -1); |
| 603 } | 574 } |
| 604 } | 575 } |
| 605 printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)))
; | 576 printString(out, cr, UPRV_LENGTHOF(cr)); |
| 606 | 577 |
| 607 if(suppressAliases == FALSE) { | 578 if(suppressAliases == FALSE) { |
| 608 while(U_SUCCESS(*status) && ures_hasNext(resource)) { | 579 while(U_SUCCESS(*status) && ures_hasNext(resource)) { |
| 609 t = ures_getNextResource(resource, t, status); | 580 t = ures_getNextResource(resource, t, status); |
| 610 if(U_SUCCESS(*status)) { | 581 if(U_SUCCESS(*status)) { |
| 611 printOutBundle(out, converter, t, indent+indentsize, pname,
status); | 582 printOutBundle(out, t, indent+indentsize, pname, status); |
| 612 } else { | 583 } else { |
| 613 reportError(pname, status, "While processing table"); | 584 reportError(pname, status, "While processing table"); |
| 614 *status = U_ZERO_ERROR; | 585 *status = U_ZERO_ERROR; |
| 615 } | 586 } |
| 616 } | 587 } |
| 617 } else { /* we have to use low level access to do this */ | 588 } else { /* we have to use low level access to do this */ |
| 618 Resource r; | 589 Resource r; |
| 619 int32_t resSize = ures_getSize(resource); | 590 int32_t resSize = ures_getSize(resource); |
| 620 UBool isTable = (UBool)(ures_getType(resource) == URES_TABLE); | 591 UBool isTable = (UBool)(ures_getType(resource) == URES_TABLE); |
| 621 for(i = 0; i < resSize; i++) { | 592 for(i = 0; i < resSize; i++) { |
| 622 /* need to know if it's an alias */ | 593 /* need to know if it's an alias */ |
| 623 if(isTable) { | 594 if(isTable) { |
| 624 r = res_getTableItemByIndex(&resource->fResData, resource->fRe
s, i, &key); | 595 r = res_getTableItemByIndex(&resource->fResData, resource->fRe
s, i, &key); |
| 625 } else { | 596 } else { |
| 626 r = res_getArrayItem(&resource->fResData, resource->fRes, i); | 597 r = res_getArrayItem(&resource->fResData, resource->fRes, i); |
| 627 } | 598 } |
| 628 if(U_SUCCESS(*status)) { | 599 if(U_SUCCESS(*status)) { |
| 629 if(res_getPublicType(r) == URES_ALIAS) { | 600 if(res_getPublicType(r) == URES_ALIAS) { |
| 630 printOutAlias(out, converter, resource, r, key, indent+inden
tsize, pname, status); | 601 printOutAlias(out, resource, r, key, indent+indentsize, pnam
e, status); |
| 631 } else { | 602 } else { |
| 632 t = ures_getByIndex(resource, i, t, status); | 603 t = ures_getByIndex(resource, i, t, status); |
| 633 printOutBundle(out, converter, t, indent+indentsize, pname,
status); | 604 printOutBundle(out, t, indent+indentsize, pname, status); |
| 634 } | 605 } |
| 635 } else { | 606 } else { |
| 636 reportError(pname, status, "While processing table"); | 607 reportError(pname, status, "While processing table"); |
| 637 *status = U_ZERO_ERROR; | 608 *status = U_ZERO_ERROR; |
| 638 } | 609 } |
| 639 } | 610 } |
| 640 } | 611 } |
| 641 | 612 |
| 642 printIndent(out, converter, indent); | 613 printIndent(out, indent); |
| 643 printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / s
izeof(*closeStr))); | 614 printString(out, closeStr, UPRV_LENGTHOF(closeStr)); |
| 644 ures_close(t); | 615 ures_close(t); |
| 645 } | 616 } |
| 646 break; | 617 break; |
| 647 default: | 618 default: |
| 648 break; | 619 break; |
| 649 } | 620 } |
| 650 | 621 |
| 651 } | 622 } |
| 652 | 623 |
| 653 static const char *getEncodingName(const char *encoding) { | 624 static const char *getEncodingName(const char *encoding) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 675 /* Changing stdio.h ustdio.h requires that formatting not be disabled. */ | 646 /* Changing stdio.h ustdio.h requires that formatting not be disabled. */ |
| 676 return 3; | 647 return 3; |
| 677 } | 648 } |
| 678 #endif /* !UCONFIG_NO_FORMATTING */ | 649 #endif /* !UCONFIG_NO_FORMATTING */ |
| 679 | 650 |
| 680 /* | 651 /* |
| 681 * Local Variables: | 652 * Local Variables: |
| 682 * indent-tabs-mode: nil | 653 * indent-tabs-mode: nil |
| 683 * End: | 654 * End: |
| 684 */ | 655 */ |
| OLD | NEW |