2 *******************************************************************************
4 * Copyright (C) 1998-2014, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 05/25/99 stephen Creation.
15 * 5/10/01 Ram removed ustdio dependency
16 *******************************************************************************
20 #include "unicode/uclean.h"
22 #include "ucmndata.h" /* TODO: for reading the pool bundle */
25 void processFile(const char *filename
, const char* cp
, const char *inputDir
, const char *outputDir
,
26 const char *packageName
, UBool omitBinaryCollation
, UErrorCode
*status
);
27 static char *make_res_filename(const char *filename
, const char *outputDir
,
28 const char *packageName
, UErrorCode
*status
);
31 #define RES_SUFFIX ".res"
32 #define COL_SUFFIX ".col"
34 static char theCurrentFileName
[2048];
35 const char *gCurrentFileName
= theCurrentFileName
;
68 UOPTION_HELP_QUESTION_MARK
,
78 UOPTION_DEF("java-package", '\x01', UOPT_REQUIRES_ARG
),
80 UOPTION_DEF("write-xliff", 'x', UOPT_OPTIONAL_ARG
),
81 UOPTION_DEF("strict", 'k', UOPT_NO_ARG
), /* 14 */
82 UOPTION_DEF("noBinaryCollation", 'C', UOPT_NO_ARG
),/* 15 */
83 UOPTION_DEF("language", 'l', UOPT_REQUIRES_ARG
), /* 16 */
84 UOPTION_DEF("omitCollationRules", 'R', UOPT_NO_ARG
),/* 17 */
85 UOPTION_DEF("formatVersion", '\x01', UOPT_REQUIRES_ARG
),/* 18 */
86 UOPTION_DEF("writePoolBundle", '\x01', UOPT_NO_ARG
),/* 19 */
87 UOPTION_DEF("usePoolBundle", '\x01', UOPT_OPTIONAL_ARG
),/* 20 */
88 UOPTION_DEF("includeUnihanColl", '\x01', UOPT_NO_ARG
),/* 21 */ /* temporary, don't display in usage info */
91 static UBool write_java
= FALSE
;
92 static UBool write_xliff
= FALSE
;
93 static const char* outputEnc
="";
94 static struct SRBRoot
*newPoolBundle
= NULL
;
96 /* TODO: separate header file for ResFile? */
97 typedef struct ResFile
{
99 const int32_t *fIndexes
;
106 static ResFile poolBundle
= { NULL
};
109 static const char* language
= NULL
;
110 static const char* xliffOutputFileName
= NULL
;
115 UErrorCode status
= U_ZERO_ERROR
;
116 const char *arg
= NULL
;
117 const char *outputDir
= NULL
; /* NULL = no output directory, use current */
118 const char *inputDir
= NULL
;
119 const char *encoding
= "";
121 UBool illegalArg
= FALSE
;
123 U_MAIN_INIT_ARGS(argc
, argv
);
125 options
[JAVA_PACKAGE
].value
= "com.ibm.icu.impl.data";
126 options
[BUNDLE_NAME
].value
= "LocaleElements";
127 argc
= u_parseArgs(argc
, argv
, (int32_t)(sizeof(options
)/sizeof(options
[0])), options
);
129 /* error handling, printing usage message */
131 fprintf(stderr
, "%s: error in command line argument \"%s\"\n", argv
[0], argv
[-argc
]);
135 if(options
[WRITE_POOL_BUNDLE
].doesOccur
&& options
[USE_POOL_BUNDLE
].doesOccur
) {
136 fprintf(stderr
, "%s: cannot combine --writePoolBundle and --usePoolBundle\n", argv
[0]);
139 if(options
[FORMAT_VERSION
].doesOccur
) {
140 const char *s
= options
[FORMAT_VERSION
].value
;
141 if(uprv_strlen(s
) != 1 || (s
[0] != '1' && s
[0] != '2')) {
142 fprintf(stderr
, "%s: unsupported --formatVersion %s\n", argv
[0], s
);
144 } else if(s
[0] == '1' &&
145 (options
[WRITE_POOL_BUNDLE
].doesOccur
|| options
[USE_POOL_BUNDLE
].doesOccur
)
147 fprintf(stderr
, "%s: cannot combine --formatVersion 1 with --writePoolBundle or --usePoolBundle\n", argv
[0]);
150 setFormatVersion(s
[0] - '0');
154 if(options
[VERSION
].doesOccur
) {
156 "%s version %s (ICU version %s).\n"
158 argv
[0], GENRB_VERSION
, U_ICU_VERSION
, U_COPYRIGHT_STRING
);
164 } else if((options
[JAVA_PACKAGE
].doesOccur
|| options
[BUNDLE_NAME
].doesOccur
) &&
165 !options
[WRITE_JAVA
].doesOccur
) {
167 "%s error: command line argument --java-package or --bundle-name "
168 "without --write-java\n",
173 if(illegalArg
|| options
[HELP1
].doesOccur
|| options
[HELP2
].doesOccur
) {
175 * Broken into chunks because the C89 standard says the minimum
176 * required supported string length is 509 bytes.
179 "Usage: %s [OPTIONS] [FILES]\n"
180 "\tReads the list of resource bundle source files and creates\n"
181 "\tbinary version of resource bundles (.res files)\n",
185 "\t-h or -? or --help this usage text\n"
186 "\t-q or --quiet do not display warnings\n"
187 "\t-v or --verbose print extra information when processing files\n"
188 "\t-V or --version prints out version number and exits\n"
189 "\t-c or --copyright include copyright notice\n");
191 "\t-e or --encoding encoding of source files\n"
192 "\t-d of --destdir destination directory, followed by the path, defaults to %s\n"
193 "\t-s or --sourcedir source directory for files followed by path, defaults to %s\n"
194 "\t-i or --icudatadir directory for locating any needed intermediate data files,\n"
195 "\t followed by path, defaults to %s\n",
196 u_getDataDirectory(), u_getDataDirectory(), u_getDataDirectory());
198 "\t-j or --write-java write a Java ListResourceBundle for ICU4J, followed by optional encoding\n"
199 "\t defaults to ASCII and \\uXXXX format.\n"
200 "\t --java-package For --write-java: package name for writing the ListResourceBundle,\n"
201 "\t defaults to com.ibm.icu.impl.data\n");
203 "\t-b or --bundle-name For --write-java: root resource bundle name for writing the ListResourceBundle,\n"
204 "\t defaults to LocaleElements\n"
205 "\t-x or --write-xliff write an XLIFF file for the resource bundle. Followed by\n"
206 "\t an optional output file name.\n"
207 "\t-k or --strict use pedantic parsing of syntax\n"
209 "\t-l or --language for XLIFF: language code compliant with BCP 47.\n");
211 "\t-C or --noBinaryCollation do not generate binary collation image;\n"
212 "\t makes .res file smaller but collator instantiation much slower;\n"
213 "\t maintains ability to get tailoring rules\n"
214 "\t-R or --omitCollationRules do not include collation (tailoring) rules;\n"
215 "\t makes .res file smaller and maintains collator instantiation speed\n"
216 "\t but tailoring rules will not be available (they are rarely used)\n");
218 "\t --formatVersion write a .res file compatible with the requested formatVersion (single digit);\n"
219 "\t for example, --formatVersion 1\n");
221 "\t --writePoolBundle write a pool.res file with all of the keys of all input bundles\n"
222 "\t --usePoolBundle [path-to-pool.res] point to keys from the pool.res keys pool bundle if they are available there;\n"
223 "\t makes .res files smaller but dependent on the pool bundle\n"
224 "\t (--writePoolBundle and --usePoolBundle cannot be combined)\n");
226 return illegalArg
? U_ILLEGAL_ARGUMENT_ERROR
: U_ZERO_ERROR
;
229 if(options
[VERBOSE
].doesOccur
) {
233 if(options
[QUIET
].doesOccur
) {
234 setShowWarning(FALSE
);
236 if(options
[STRICT
].doesOccur
) {
239 if(options
[COPYRIGHT
].doesOccur
){
240 setIncludeCopyright(TRUE
);
243 if(options
[SOURCEDIR
].doesOccur
) {
244 inputDir
= options
[SOURCEDIR
].value
;
247 if(options
[DESTDIR
].doesOccur
) {
248 outputDir
= options
[DESTDIR
].value
;
251 if(options
[ENCODING
].doesOccur
) {
252 encoding
= options
[ENCODING
].value
;
255 if(options
[ICUDATADIR
].doesOccur
) {
256 u_setDataDirectory(options
[ICUDATADIR
].value
);
260 if (U_FAILURE(status
) && status
!= U_FILE_ACCESS_ERROR
) {
261 /* Note: u_init() will try to open ICU property data.
262 * failures here are expected when building ICU from scratch.
265 fprintf(stderr
, "%s: can not initialize ICU. status = %s\n",
266 argv
[0], u_errorName(status
));
269 status
= U_ZERO_ERROR
;
270 if(options
[WRITE_JAVA
].doesOccur
) {
272 outputEnc
= options
[WRITE_JAVA
].value
;
275 if(options
[WRITE_XLIFF
].doesOccur
) {
277 if(options
[WRITE_XLIFF
].value
!= NULL
){
278 xliffOutputFileName
= options
[WRITE_XLIFF
].value
;
285 if(options
[LANGUAGE
].doesOccur
) {
286 language
= options
[LANGUAGE
].value
;
289 if(options
[WRITE_POOL_BUNDLE
].doesOccur
) {
290 newPoolBundle
= bundle_open(NULL
, TRUE
, &status
);
291 if(U_FAILURE(status
)) {
292 fprintf(stderr
, "unable to create an empty bundle for the pool keys: %s\n", u_errorName(status
));
295 const char *poolResName
= "pool.res";
296 char *nameWithoutSuffix
= uprv_malloc(uprv_strlen(poolResName
) + 1);
297 if (nameWithoutSuffix
== NULL
) {
298 fprintf(stderr
, "out of memory error\n");
299 return U_MEMORY_ALLOCATION_ERROR
;
301 uprv_strcpy(nameWithoutSuffix
, poolResName
);
302 *uprv_strrchr(nameWithoutSuffix
, '.') = 0;
303 newPoolBundle
->fLocale
= nameWithoutSuffix
;
307 if(options
[USE_POOL_BUNDLE
].doesOccur
) {
308 const char *poolResName
= "pool.res";
309 FileStream
*poolFile
;
310 int32_t poolFileSize
;
313 * TODO: Consolidate inputDir/filename handling from main() and processFile()
314 * into a common function, and use it here as well.
315 * Try to create toolutil functions for dealing with dir/filenames and
316 * loading ICU data files without udata_open().
317 * Share code with icupkg?
318 * Also, make_res_filename() seems to be unused. Review and remove.
320 if (options
[USE_POOL_BUNDLE
].value
!=NULL
) {
321 uprv_strcpy(theCurrentFileName
, options
[USE_POOL_BUNDLE
].value
);
322 uprv_strcat(theCurrentFileName
, U_FILE_SEP_STRING
);
323 } else if (inputDir
) {
324 uprv_strcpy(theCurrentFileName
, inputDir
);
325 uprv_strcat(theCurrentFileName
, U_FILE_SEP_STRING
);
327 *theCurrentFileName
= 0;
329 uprv_strcat(theCurrentFileName
, poolResName
);
330 poolFile
= T_FileStream_open(theCurrentFileName
, "rb");
331 if (poolFile
== NULL
) {
332 fprintf(stderr
, "unable to open pool bundle file %s\n", theCurrentFileName
);
335 poolFileSize
= T_FileStream_size(poolFile
);
336 if (poolFileSize
< 32) {
337 fprintf(stderr
, "the pool bundle file %s is too small\n", theCurrentFileName
);
340 poolBundle
.fBytes
= (uint8_t *)uprv_malloc((poolFileSize
+ 15) & ~15);
341 if (poolFileSize
> 0 && poolBundle
.fBytes
== NULL
) {
342 fprintf(stderr
, "unable to allocate memory for the pool bundle file %s\n", theCurrentFileName
);
343 return U_MEMORY_ALLOCATION_ERROR
;
346 const DataHeader
*header
;
347 int32_t bytesRead
= T_FileStream_read(poolFile
, poolBundle
.fBytes
, poolFileSize
);
349 if (bytesRead
!= poolFileSize
) {
350 fprintf(stderr
, "unable to read the pool bundle file %s\n", theCurrentFileName
);
354 * Swap the pool bundle so that a single checked-in file can be used.
355 * The swapper functions also test that the data looks like
356 * a well-formed .res file.
358 ds
= udata_openSwapperForInputData(poolBundle
.fBytes
, bytesRead
,
359 U_IS_BIG_ENDIAN
, U_CHARSET_FAMILY
, &status
);
360 if (U_FAILURE(status
)) {
361 fprintf(stderr
, "udata_openSwapperForInputData(pool bundle %s) failed: %s\n",
362 theCurrentFileName
, u_errorName(status
));
365 ures_swap(ds
, poolBundle
.fBytes
, bytesRead
, poolBundle
.fBytes
, &status
);
366 udata_closeSwapper(ds
);
367 if (U_FAILURE(status
)) {
368 fprintf(stderr
, "ures_swap(pool bundle %s) failed: %s\n",
369 theCurrentFileName
, u_errorName(status
));
372 header
= (const DataHeader
*)poolBundle
.fBytes
;
373 if (header
->info
.formatVersion
[0]!=2) {
374 fprintf(stderr
, "invalid format of pool bundle file %s\n", theCurrentFileName
);
375 return U_INVALID_FORMAT_ERROR
;
377 poolBundle
.fKeys
= (const char *)header
+ header
->dataHeader
.headerSize
;
378 poolBundle
.fIndexes
= (const int32_t *)poolBundle
.fKeys
+ 1;
379 indexLength
= poolBundle
.fIndexes
[URES_INDEX_LENGTH
] & 0xff;
380 if (indexLength
<= URES_INDEX_POOL_CHECKSUM
) {
381 fprintf(stderr
, "insufficient indexes[] in pool bundle file %s\n", theCurrentFileName
);
382 return U_INVALID_FORMAT_ERROR
;
384 keysBottom
= (1 + indexLength
) * 4;
385 poolBundle
.fKeys
+= keysBottom
;
386 poolBundle
.fKeysLength
= (poolBundle
.fIndexes
[URES_INDEX_KEYS_TOP
] * 4) - keysBottom
;
387 poolBundle
.fChecksum
= poolBundle
.fIndexes
[URES_INDEX_POOL_CHECKSUM
];
389 for (i
= 0; i
< poolBundle
.fKeysLength
; ++i
) {
390 if (poolBundle
.fKeys
[i
] == 0) {
391 ++poolBundle
.fKeysCount
;
394 T_FileStream_close(poolFile
);
395 setUsePoolBundle(TRUE
);
398 if(options
[INCLUDE_UNIHAN_COLL
].doesOccur
) {
399 puts("genrb option --includeUnihanColl ignored: \n"
400 "CLDR 26/ICU 54 unihan data is small, except\n"
401 "the ucadata-unihan.icu version of the collation root data\n"
402 "is about 300kB larger than the ucadata-implicithan.icu version.");
406 printf("genrb number of files: %d\n", argc
- 1);
408 /* generate the binary files */
409 for(i
= 1; i
< argc
; ++i
) {
410 status
= U_ZERO_ERROR
;
411 arg
= getLongPathname(argv
[i
]);
414 uprv_strcpy(theCurrentFileName
, inputDir
);
415 uprv_strcat(theCurrentFileName
, U_FILE_SEP_STRING
);
417 *theCurrentFileName
= 0;
419 uprv_strcat(theCurrentFileName
, arg
);
422 printf("Processing file \"%s\"\n", theCurrentFileName
);
424 processFile(arg
, encoding
, inputDir
, outputDir
, NULL
,
425 options
[NO_BINARY_COLLATION
].doesOccur
,
429 uprv_free(poolBundle
.fBytes
);
431 if(options
[WRITE_POOL_BUNDLE
].doesOccur
) {
432 char outputFileName
[256];
433 bundle_write(newPoolBundle
, outputDir
, NULL
, outputFileName
, sizeof(outputFileName
), &status
);
434 bundle_close(newPoolBundle
, &status
);
435 if(U_FAILURE(status
)) {
436 fprintf(stderr
, "unable to write the pool bundle: %s\n", u_errorName(status
));
442 /* Dont return warnings as a failure */
443 if (U_SUCCESS(status
)) {
453 const char *filename
, const char *cp
, const char *inputDir
, const char *outputDir
, const char *packageName
,
454 UBool omitBinaryCollation
, UErrorCode
*status
) {
455 /*FileStream *in = NULL;*/
456 struct SRBRoot
*data
= NULL
;
457 UCHARBUF
*ucbuf
= NULL
;
459 char *openFileName
= NULL
;
460 char *inputDirBuf
= NULL
;
462 char outputFileName
[256];
468 if (status
==NULL
|| U_FAILURE(*status
)) {
472 *status
=U_ILLEGAL_ARGUMENT_ERROR
;
475 filelen
= (int32_t)uprv_strlen(filename
);
478 if(inputDir
== NULL
) {
479 const char *filenameBegin
= uprv_strrchr(filename
, U_FILE_SEP_CHAR
);
480 openFileName
= (char *) uprv_malloc(dirlen
+ filelen
+ 2);
481 openFileName
[0] = '\0';
482 if (filenameBegin
!= NULL
) {
484 * When a filename ../../../data/root.txt is specified,
485 * we presume that the input directory is ../../../data
486 * This is very important when the resource file includes
487 * another file, like UCARules.txt or thaidict.brk.
489 int32_t filenameSize
= (int32_t)(filenameBegin
- filename
+ 1);
490 inputDirBuf
= uprv_strncpy((char *)uprv_malloc(filenameSize
), filename
, filenameSize
);
493 if(inputDirBuf
== NULL
) {
494 *status
= U_MEMORY_ALLOCATION_ERROR
;
498 inputDirBuf
[filenameSize
- 1] = 0;
499 inputDir
= inputDirBuf
;
500 dirlen
= (int32_t)uprv_strlen(inputDir
);
503 dirlen
= (int32_t)uprv_strlen(inputDir
);
505 if(inputDir
[dirlen
-1] != U_FILE_SEP_CHAR
) {
506 openFileName
= (char *) uprv_malloc(dirlen
+ filelen
+ 2);
509 if(openFileName
== NULL
) {
510 *status
= U_MEMORY_ALLOCATION_ERROR
;
514 openFileName
[0] = '\0';
516 * append the input dir to openFileName if the first char in
517 * filename is not file seperation char and the last char input directory is not '.'.
518 * This is to support :
519 * genrb -s. /home/icu/data
521 * The user cannot mix notations like
522 * genrb -s. /icu/data --- the absolute path specified. -s redundant
524 * genrb -s. icu/data --- start from CWD and look in icu/data dir
526 if( (filename
[0] != U_FILE_SEP_CHAR
) && (inputDir
[dirlen
-1] !='.')){
527 uprv_strcpy(openFileName
, inputDir
);
528 openFileName
[dirlen
] = U_FILE_SEP_CHAR
;
530 openFileName
[dirlen
+ 1] = '\0';
532 openFileName
= (char *) uprv_malloc(dirlen
+ filelen
+ 1);
535 if(openFileName
== NULL
) {
536 *status
= U_MEMORY_ALLOCATION_ERROR
;
540 uprv_strcpy(openFileName
, inputDir
);
545 uprv_strcat(openFileName
, filename
);
547 ucbuf
= ucbuf_open(openFileName
, &cp
,getShowWarning(),TRUE
, status
);
548 if(*status
== U_FILE_ACCESS_ERROR
) {
550 fprintf(stderr
, "couldn't open file %s\n", openFileName
== NULL
? filename
: openFileName
);
553 if (ucbuf
== NULL
|| U_FAILURE(*status
)) {
554 fprintf(stderr
, "An error occured processing file %s. Error: %s\n", openFileName
== NULL
? filename
: openFileName
,u_errorName(*status
));
557 /* auto detected popular encodings? */
558 if (cp
!=NULL
&& isVerbose()) {
559 printf("autodetected encoding %s\n", cp
);
561 /* Parse the data into an SRBRoot */
562 data
= parse(ucbuf
, inputDir
, outputDir
, filename
,
563 !omitBinaryCollation
, options
[NO_COLLATION_RULES
].doesOccur
, status
);
565 if (data
== NULL
|| U_FAILURE(*status
)) {
566 fprintf(stderr
, "couldn't parse the file %s. Error:%s\n", filename
,u_errorName(*status
));
569 if(options
[WRITE_POOL_BUNDLE
].doesOccur
) {
570 int32_t newKeysLength
;
571 const char *newKeys
, *newKeysLimit
;
572 bundle_compactKeys(data
, status
);
573 newKeys
= bundle_getKeyBytes(data
, &newKeysLength
);
574 bundle_addKeyBytes(newPoolBundle
, newKeys
, newKeysLength
, status
);
575 if(U_FAILURE(*status
)) {
576 fprintf(stderr
, "bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s\n",
577 filename
, u_errorName(*status
));
580 /* count the number of just-added key strings */
581 for(newKeysLimit
= newKeys
+ newKeysLength
; newKeys
< newKeysLimit
; ++newKeys
) {
583 ++newPoolBundle
->fKeysCount
;
588 if(options
[USE_POOL_BUNDLE
].doesOccur
) {
589 data
->fPoolBundleKeys
= poolBundle
.fKeys
;
590 data
->fPoolBundleKeysLength
= poolBundle
.fKeysLength
;
591 data
->fPoolBundleKeysCount
= poolBundle
.fKeysCount
;
592 data
->fPoolChecksum
= poolBundle
.fChecksum
;
595 /* Determine the target rb filename */
596 rbname
= make_res_filename(filename
, outputDir
, packageName
, status
);
597 if(U_FAILURE(*status
)) {
598 fprintf(stderr
, "couldn't make the res fileName for bundle %s. Error:%s\n", filename
,u_errorName(*status
));
601 if(write_java
== TRUE
){
602 bundle_write_java(data
,outputDir
,outputEnc
, outputFileName
, sizeof(outputFileName
),
603 options
[JAVA_PACKAGE
].value
, options
[BUNDLE_NAME
].value
, status
);
604 }else if(write_xliff
==TRUE
){
605 bundle_write_xml(data
,outputDir
,outputEnc
, filename
, outputFileName
, sizeof(outputFileName
),language
, xliffOutputFileName
,status
);
607 /* Write the data to the file */
608 bundle_write(data
, outputDir
, packageName
, outputFileName
, sizeof(outputFileName
), status
);
610 if (U_FAILURE(*status
)) {
611 fprintf(stderr
, "couldn't write bundle %s. Error:%s\n", outputFileName
,u_errorName(*status
));
613 bundle_close(data
, status
);
617 if (inputDirBuf
!= NULL
) {
618 uprv_free(inputDirBuf
);
621 if (openFileName
!= NULL
) {
622 uprv_free(openFileName
);
634 /* Generate the target .res file name from the input file name */
636 make_res_filename(const char *filename
,
637 const char *outputDir
,
638 const char *packageName
,
639 UErrorCode
*status
) {
644 int32_t pkgLen
= 0; /* length of package prefix */
647 if (U_FAILURE(*status
)) {
651 if(packageName
!= NULL
)
653 pkgLen
= (int32_t)(1 + uprv_strlen(packageName
));
657 basename
= dirname
= resName
= 0;
659 /* determine basename, and compiled file names */
660 basename
= (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename
) + 1));
662 *status
= U_MEMORY_ALLOCATION_ERROR
;
666 get_basename(basename
, filename
);
668 dirname
= (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename
) + 1));
670 *status
= U_MEMORY_ALLOCATION_ERROR
;
674 get_dirname(dirname
, filename
);
676 if (outputDir
== NULL
) {
677 /* output in same dir as .txt */
678 resName
= (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname
)
680 + uprv_strlen(basename
)
681 + uprv_strlen(RES_SUFFIX
) + 8));
683 *status
= U_MEMORY_ALLOCATION_ERROR
;
687 uprv_strcpy(resName
, dirname
);
689 if(packageName
!= NULL
)
691 uprv_strcat(resName
, packageName
);
692 uprv_strcat(resName
, "_");
695 uprv_strcat(resName
, basename
);
698 int32_t dirlen
= (int32_t)uprv_strlen(outputDir
);
699 int32_t basenamelen
= (int32_t)uprv_strlen(basename
);
701 resName
= (char*) uprv_malloc(sizeof(char) * (dirlen
+ pkgLen
+ basenamelen
+ 8));
703 if (resName
== NULL
) {
704 *status
= U_MEMORY_ALLOCATION_ERROR
;
708 uprv_strcpy(resName
, outputDir
);
710 if(outputDir
[dirlen
] != U_FILE_SEP_CHAR
) {
711 resName
[dirlen
] = U_FILE_SEP_CHAR
;
712 resName
[dirlen
+ 1] = '\0';
715 if(packageName
!= NULL
)
717 uprv_strcat(resName
, packageName
);
718 uprv_strcat(resName
, "_");
721 uprv_strcat(resName
, basename
);
733 * indent-tabs-mode: nil