/* check for multiple text file suffixes to see if this list name is a text file name */ static UBool
isListTextFile(constchar *listname) { constchar *listNameEnd=strchr(listname, 0); constchar *suffix;
int32_t i, length; for(i=0; i<UPRV_LENGTHOF(listFileSuffixes); ++i) {
suffix=listFileSuffixes[i].suffix;
length=listFileSuffixes[i].length; if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix, length)) { returntrue;
}
} returnfalse;
}
/* * Read a file list. * If the listname ends with ".txt", then read the list file * (in the system/ invariant charset). * If the listname ends with ".dat", then read the ICU .dat package file. * Otherwise, read the file itself as a single-item list.
*/
U_CAPI Package * U_EXPORT2
readList(constchar *filesPath, constchar *listname, UBool readContents, Package *listPkgIn) {
Package *listPkg = listPkgIn;
FILE *file; constchar *listNameEnd;
// check first non-whitespace character and // skip empty lines and // skip lines starting with reserved characters
start=u_skipWhitespace(line); if(*start==0 || nullptr!=strchr(U_PKG_RESERVED_CHARS, *start)) { continue;
}
// take whitespace-separated items from the line for(;;) { // find whitespace after the item or the end of the line for(end=(char *)start; *end!=0 && *end!=' ' && *end!='\t'; ++end) {} if(*end==0) { // this item is the last one on the line
end=nullptr;
} else { // the item is terminated by whitespace, terminate it with NUL
*end=0;
} if(readContents) {
listPkg->addFile(filesPath, start);
} else {
listPkg->addItem(start);
}
// find the start of the next item or exit the loop if(end==nullptr || *(start=u_skipWhitespace(end+1))==0) { break;
}
}
}
fclose(file);
} elseif((listNameEnd-listname)>4 && 0==memcmp(listNameEnd-4, ".dat", 4)) { // read the ICU .dat package // Accept a .dat file whose name differs from the ToC prefixes.
listPkg->setAutoPrefix();
listPkg->readPackage(listname);
} else { // list the single file itself if(readContents) {
listPkg->addFile(filesPath, listname);
} else {
listPkg->addItem(listname);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.