ICU-20593 Data docs tweaks and fixing UDATA_DEBUG build.

This commit is contained in:
Shane Carr 2019-06-11 10:46:16 -07:00 committed by Shane F. Carr
parent 6ce3295e4d
commit a3956a8d8b
2 changed files with 21 additions and 15 deletions

View file

@ -45,11 +45,14 @@ Unix or when building the data package on Windows. For example:
ICU_DATA_FILTER_FILE=filters.json path/to/icu4c/source/runConfigureICU Linux
The ICU Data Build Tool will work out of the box with a default Python
installation. In order to use Hjson syntax, the `hjson` pip module must be
installed on your system. You should also consider installing the
`jsonschema` module to print messages when errors are found in your config
file.
You must have the data sources in order to use the ICU Data Build Tool.
Check for the file icu4c/source/data/locales/root.txt. If that file is
missing, you need to download "icu4c-*-data.zip" and replace the contents of
icu4c/source/data with the data directory from the zip file.
In order to use Hjson syntax, the `hjson` pip module must be installed on
your system. You should also consider installing the `jsonschema` module to
print messages when errors are found in your config file.
$ pip3 install --user hjson jsonschema
@ -558,6 +561,10 @@ back to a txt file, you can run this command from *icu4c/source*:
That will produce a file *en.txt* in your current directory, which is the
original *data/unit/en.txt* but after resource filters were applied.
*Tip:* derb expects your res files to be rooted in a directory named
`icudt64l` (corresponding to your current ICU version and endianness). If your
files are not in such a directory, derb fails with U_MISSING_RESOURCE_ERROR.
**Put complex rules first** and **use the wildcard `*` sparingly:** The order
of the filter rules matters a great deal in how effective your data size
reduction can be, and the wildcard `*` can sometimes produce behavior that is

View file

@ -321,7 +321,7 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err)
retVal = el->item;
}
#ifdef UDATA_DEBUG
fprintf(stderr, "Cache: [%s] -> %p\n", baseName, retVal);
fprintf(stderr, "Cache: [%s] -> %p\n", baseName, (void*) retVal);
#endif
return retVal;
}
@ -384,7 +384,7 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
#ifdef UDATA_DEBUG
fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name,
newElement->item, u_errorName(subErr), newElement->item->vFuncs);
(void*) newElement->item, u_errorName(subErr), (void*) newElement->item->vFuncs);
#endif
if (subErr == U_USING_DEFAULT_WARNING || U_FAILURE(subErr)) {
@ -478,7 +478,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
nextPath = itemPath.data();
}
#ifdef UDATA_DEBUG
fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, inSuffix);
fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, (void*) inSuffix);
#endif
/** Suffix **/
@ -493,12 +493,11 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
/* pathBuffer will hold the output path strings returned by this iterator */
#ifdef UDATA_DEBUG
fprintf(stderr, "%p: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
iter,
fprintf(stderr, "0: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
item,
path,
basename,
suffix,
suffix.data(),
itemPath.data(),
nextPath,
checkLastFour?"TRUE":"false");
@ -554,7 +553,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
fprintf(stderr, "rest of path (IDD) = %s\n", currentPath);
fprintf(stderr, " ");
{
uint32_t qqq;
int32_t qqq;
for(qqq=0;qqq<pathLen;qqq++)
{
fprintf(stderr, " ");
@ -575,7 +574,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
uprv_strlen(pathBasename)==(basenameLen+4)) { /* base+suffix = full len */
#ifdef UDATA_DEBUG
fprintf(stderr, "Have %s file on the path: %s\n", suffix, pathBuffer.data());
fprintf(stderr, "Have %s file on the path: %s\n", suffix.data(), pathBuffer.data());
#endif
/* do nothing */
}
@ -1071,13 +1070,13 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
/* look up the data piece in the common data */
pHeader=pCommonData->vFuncs->Lookup(pCommonData, tocEntryName, &length, subErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, pHeader, u_errorName(*subErrorCode));
fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode));
#endif
if(pHeader!=NULL) {
pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "pEntryData=%p\n", pEntryData);
fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData);
#endif
if (U_FAILURE(*pErrorCode)) {
return NULL;