这篇教程C++ uprv_strcat函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uprv_strcat函数的典型用法代码示例。如果您正苦于以下问题:C++ uprv_strcat函数的具体用法?C++ uprv_strcat怎么用?C++ uprv_strcat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uprv_strcat函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: rbUCAUCAConformanceTest::UCAConformanceTest() :rbUCA(NULL),testFile(NULL),status(U_ZERO_ERROR){ UCA = ucol_open("root", &status); if(U_FAILURE(status)) { errln("ERROR - UCAConformanceTest: Unable to open UCA collator!"); } uprv_strcpy(testDataPath, IntlTest::loadTestData(status)); if (U_FAILURE(status)) { errln("ERROR: could not open test data %s", u_errorName(status)); return; } char* index = 0; index=strrchr(testDataPath,(char)U_FILE_SEP_CHAR); if((unsigned int)(index-testDataPath) != (strlen(testDataPath)-1)){ *(index+1)=0; } uprv_strcat(testDataPath,".."U_FILE_SEP_STRING); uprv_strcat(testDataPath, "CollationTest_");}
开发者ID:andrewleech,项目名称:firebird,代码行数:25,
示例2: string_write_java/* Writing Functions */static void string_write_java(struct SResource *res,UErrorCode *status) { if(uprv_strcmp(srBundle->fKeys+res->fKey,"%%UCARULES")==0 ){ char fileName[1024] ={0}; const char* file = "UCARules.utf8"; FileStream* datFile = NULL; const char* type = "new ICUListResourceBundle.ResourceString("; char* dest = (char*) uprv_malloc( 8 * res->u.fString.fLength); int32_t len = 0; if(outDir){ uprv_strcat(fileName,outDir); if(outDir[uprv_strlen(outDir)-1]!=U_FILE_SEP_CHAR){ uprv_strcat(fileName,U_FILE_SEP_STRING); } } uprv_strcat(fileName,file);/* UCARULES.utf8 UTF-8 file */ write_tabs(out); T_FileStream_write(out, type, (int32_t)uprv_strlen(type)); T_FileStream_write(out, "/"", 1); T_FileStream_write(out, file, (int32_t)uprv_strlen(file)); T_FileStream_write(out, "/")/n", 3); datFile=T_FileStream_open(fileName,"w"); if(!dest){ *status=U_MEMORY_ALLOCATION_ERROR; } u_strToUTF8(dest,8*res->u.fString.fLength,&len,res->u.fString.fChars,res->u.fString.fLength,status); if(U_FAILURE(*status)){ T_FileStream_close(datFile); uprv_free(dest); return; } T_FileStream_write(datFile,dest,len); T_FileStream_close(datFile); uprv_free(dest); }else{ str_write_java(res->u.fString.fChars,res->u.fString.fLength,TRUE,status); if(uprv_strcmp(srBundle->fKeys+res->fKey,"Rule")==0){ UChar* buf = (UChar*) uprv_malloc(sizeof(UChar)*res->u.fString.fLength); uprv_memcpy(buf,res->u.fString.fChars,res->u.fString.fLength); uprv_free(buf); } }}
开发者ID:gitpan,项目名称:ponie,代码行数:51,
示例3: sortKeyToString/* this function makes a string with representation of a sortkey */static char* U_EXPORT2 sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len) { int32_t strength = UCOL_PRIMARY; uint32_t res_size = 0; UBool doneCase = FALSE; UErrorCode errorCode = U_ZERO_ERROR; char *current = buffer; const uint8_t *currentSk = sortkey; uprv_strcpy(current, "["); while(strength <= UCOL_QUATERNARY && strength <= ucol_getStrength(coll)) { if(strength > UCOL_PRIMARY) { uprv_strcat(current, " . "); } while(*currentSk != 0x01 && *currentSk != 0x00) { /* print a level */ uprv_appendByteToHexString(current, *currentSk++); uprv_strcat(current, " "); } if(ucol_getAttribute(coll, UCOL_CASE_LEVEL, &errorCode) == UCOL_ON && strength == UCOL_SECONDARY && doneCase == FALSE) { doneCase = TRUE; } else if(ucol_getAttribute(coll, UCOL_CASE_LEVEL, &errorCode) == UCOL_OFF || doneCase == TRUE || strength != UCOL_SECONDARY) { strength ++; } if (*currentSk) { uprv_appendByteToHexString(current, *currentSk++); /* This should print '01' */ } if(strength == UCOL_QUATERNARY && ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &errorCode) == UCOL_NON_IGNORABLE) { break; } } if(ucol_getStrength(coll) == UCOL_IDENTICAL) { uprv_strcat(current, " . "); while(*currentSk != 0) { uprv_appendByteToHexString(current, *currentSk++); uprv_strcat(current, " "); } uprv_appendByteToHexString(current, *currentSk++); } uprv_strcat(current, "]"); if(res_size > *len) { return NULL; } return buffer;}
开发者ID:icu-project,项目名称:icu4c,代码行数:50,
示例4: getID/*get ID for each element. ID is globally unique.*/static char* getID(const char* id, const char* curKey, char* result) { if(curKey == NULL) { result = (char *)uprv_malloc(sizeof(char)*uprv_strlen(id) + 1); uprv_memset(result, 0, sizeof(char)*uprv_strlen(id) + 1); uprv_strcpy(result, id); } else { result = (char *)uprv_malloc(sizeof(char)*(uprv_strlen(id) + 1 + uprv_strlen(curKey)) + 1); uprv_memset(result, 0, sizeof(char)*(uprv_strlen(id) + 1 + uprv_strlen(curKey)) + 1); if(id[0]!='/0'){ uprv_strcpy(result, id); uprv_strcat(result, "_"); } uprv_strcat(result, curKey); } return result;}
开发者ID:ACSOP,项目名称:android_external_icu4c,代码行数:17,
示例5: idForLocalestatic voididForLocale(const char* locale, char* buffer, int capacity, UErrorCode* ec){ // !!! this is internal only, assumes buffer is not null and capacity is sufficient // Extract the country name and variant name. We only // recognize two variant names, EURO and PREEURO. char variant[ULOC_FULLNAME_CAPACITY]; uloc_getCountry(locale, buffer, capacity, ec); uloc_getVariant(locale, variant, sizeof(variant), ec); if (0 == uprv_strcmp(variant, VAR_PRE_EURO) || 0 == uprv_strcmp(variant, VAR_EURO)) { uprv_strcat(buffer, VAR_DELIM); uprv_strcat(buffer, variant); }}
开发者ID:gitpan,项目名称:ponie,代码行数:16,
示例6: openTZRegKeystatic LONG openTZRegKey(HKEY *hkey, const char *winid){ char subKeyName[110]; /* TODO: why 96?? */ char *name; LONG result; /* This isn't thread safe, but it's good enough because the result should be constant per system. */ if (gWinType <= 0) { gWinType = detectWindowsType(); } uprv_strcpy(subKeyName, TZ_REGKEY[(gWinType != WIN_9X_ME_TYPE)]); name = &subKeyName[strlen(subKeyName)]; uprv_strcat(subKeyName, winid); if (gWinType == WIN_9X_ME_TYPE) { /* Remove " Standard Time" */ char *pStd = uprv_strstr(subKeyName, STANDARD_TIME_REGKEY); if (pStd) { *pStd = 0; } } result = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subKeyName, 0, KEY_QUERY_VALUE, hkey); return result;}
开发者ID:AaronNGray,项目名称:texlive-libs,代码行数:30,
示例7: testTrieRanges2static voidtestTrieRanges2(const char *testName, const SetRange setRanges[], int32_t countSetRanges, const CheckRange checkRanges[], int32_t countCheckRanges, UBool dataIs32) { char name[40]; testTrieRanges(testName, setRanges, countSetRanges, checkRanges, countCheckRanges, dataIs32, FALSE); testTrieRangesWithMalloc(testName, setRanges, countSetRanges, checkRanges, countCheckRanges, dataIs32, FALSE); uprv_strcpy(name, testName); uprv_strcat(name, "-latin1Linear"); testTrieRanges(name, setRanges, countSetRanges, checkRanges, countCheckRanges, dataIs32, TRUE); testTrieRangesWithMalloc(name, setRanges, countSetRanges, checkRanges, countCheckRanges, dataIs32, TRUE);}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:27,
示例8: initMsgstatic void initMsg(const char *pname) { static int ps = 0; if (!ps) { char dataPath[2048]; /* XXX Sloppy: should be PATH_MAX. */ UErrorCode err = U_ZERO_ERROR; ps = 1; /* Set up our static data - if any */#ifdef UCONVMSG_LINK udata_setAppData(UCONVMSG, (const void*) uconvmsg_dat, &err); if (U_FAILURE(err)) { fprintf(stderr, "%s: warning, problem installing our static resource bundle data uconvmsg: %s - trying anyways./n", pname, u_errorName(err)); err = U_ZERO_ERROR; /* It may still fail */ }#endif /* Get messages. */ gBundle = u_wmsg_setPath(UCONVMSG, &err); if (U_FAILURE(err)) { fprintf(stderr, "%s: warning: couldn't open bundle %s: %s/n", pname, UCONVMSG, u_errorName(err));#ifdef UCONVMSG_LINK fprintf(stderr, "%s: setAppData was called, internal data %s failed to load/n", pname, UCONVMSG);#endif err = U_ZERO_ERROR; /* that was try #1, try again with a path */ uprv_strcpy(dataPath, u_getDataDirectory()); uprv_strcat(dataPath, U_FILE_SEP_STRING); uprv_strcat(dataPath, UCONVMSG); gBundle = u_wmsg_setPath(dataPath, &err); if (U_FAILURE(err)) { fprintf(stderr, "%s: warning: still couldn't open bundle %s: %s/n", pname, dataPath, u_errorName(err)); fprintf(stderr, "%s: warning: messages will not be displayed/n", pname); } } }}
开发者ID:gitpan,项目名称:ponie,代码行数:47,
示例9: sortKeyToString/* this function makes a string with representation of a sortkey */static char* U_EXPORT2 sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len) { int32_t strength = UCOL_PRIMARY; uint32_t res_size = 0; UBool doneCase = FALSE; char *current = buffer; const uint8_t *currentSk = sortkey; uprv_strcpy(current, "["); while(strength <= UCOL_QUATERNARY && strength <= coll->strength) { if(strength > UCOL_PRIMARY) { uprv_strcat(current, " . "); } while(*currentSk != 0x01 && *currentSk != 0x00) { /* print a level */ uprv_appendByteToHexString(current, *currentSk++); uprv_strcat(current, " "); } if(coll->caseLevel == UCOL_ON && strength == UCOL_SECONDARY && doneCase == FALSE) { doneCase = TRUE; } else if(coll->caseLevel == UCOL_OFF || doneCase == TRUE || strength != UCOL_SECONDARY) { strength ++; } uprv_appendByteToHexString(current, *currentSk++); /* This should print '01' */ if(strength == UCOL_QUATERNARY && coll->alternateHandling == UCOL_NON_IGNORABLE) { break; } } if(coll->strength == UCOL_IDENTICAL) { uprv_strcat(current, " . "); while(*currentSk != 0) { uprv_appendByteToHexString(current, *currentSk++); uprv_strcat(current, " "); } uprv_appendByteToHexString(current, *currentSk++); } uprv_strcat(current, "]"); if(res_size > *len) { return NULL; } return buffer;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:47,
示例10: TestSwapDatastatic voidTestSwapData() { char name[100]; UDataMemory *pData; uint8_t *buffer; const char *pkg, *nm; UErrorCode errorCode; int32_t i; buffer=(uint8_t *)uprv_malloc(2*SWAP_BUFFER_SIZE); if(buffer==NULL) { log_err("unable to allocate %d bytes/n", 2*SWAP_BUFFER_SIZE); return; } for(i=0; i<LENGTHOF(swapCases); ++i) { /* build the name for logging */ errorCode=U_ZERO_ERROR; if(swapCases[i].name[0]=='*') { pkg=loadTestData(&errorCode); nm=swapCases[i].name+1; uprv_strcpy(name, "testdata"); } else { pkg=NULL; nm=swapCases[i].name; uprv_strcpy(name, "NULL"); } uprv_strcat(name, "/"); uprv_strcat(name, nm); uprv_strcat(name, "."); uprv_strcat(name, swapCases[i].type); pData=udata_open(pkg, swapCases[i].type, nm, &errorCode); if(U_SUCCESS(errorCode)) { TestSwapCase(pData, name, swapCases[i].swapFn, buffer, buffer+SWAP_BUFFER_SIZE); udata_close(pData); } else { log_data_err("udata_open(%s) failed - %s/n", name, u_errorName(errorCode)); } } uprv_free(buffer);}
开发者ID:andrewleech,项目名称:firebird,代码行数:45,
示例11: fclosevoid UCAConformanceTest::openTestFile(const char *type){ const char *ext = ".txt"; if(testFile) { fclose(testFile); } char buffer[1024]; uprv_strcpy(buffer, testDataPath); uprv_strcat(buffer, type); int32_t bufLen = (int32_t)uprv_strlen(buffer); // we try to open 3 files: // path/CollationTest_type.txt // path/CollationTest_type_SHORT.txt // path/CollationTest_type_STUB.txt // we are going to test with the first one that we manage to open. uprv_strcpy(buffer+bufLen, ext); testFile = fopen(buffer, "rb"); if(testFile == 0) { uprv_strcpy(buffer+bufLen, "_SHORT"); uprv_strcat(buffer, ext); testFile = fopen(buffer, "rb"); if(testFile == 0) { uprv_strcpy(buffer+bufLen, "_STUB"); uprv_strcat(buffer, ext); testFile = fopen(buffer, "rb"); if (testFile == 0) { *(buffer+bufLen) = 0; dataerrln("Could not open any of the conformance test files, tried opening base %s/n", buffer); return; } else { infoln( "INFO: Working with the stub file./n" "If you need the full conformance test, please/n" "download the appropriate data files from:/n" "http://unicode.org/cldr/trac/browser/trunk/common/uca"); } } }}
开发者ID:MIPS,项目名称:external-icu,代码行数:45,
示例12: ucbuf_resolveFileNameU_CAPI const char* U_EXPORT2ucbuf_resolveFileName(const char* inputDir, const char* fileName, char* target, int32_t* len, UErrorCode* status){ int32_t requiredLen = 0; int32_t dirlen = 0; int32_t filelen = 0; if(status==NULL || U_FAILURE(*status)){ return NULL; } if(inputDir == NULL || fileName == NULL || len==NULL || (target==NULL && *len>0)){ *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } dirlen = (int32_t)uprv_strlen(inputDir); filelen = (int32_t)uprv_strlen(fileName); if(inputDir[dirlen-1] != U_FILE_SEP_CHAR) { requiredLen = dirlen + filelen + 2; if((*len < requiredLen) || target==NULL){ *len = requiredLen; *status = U_BUFFER_OVERFLOW_ERROR; return NULL; } target[0] = '/0'; /* * append the input dir to openFileName if the first char in * filename is not file seperation char and the last char input directory is not '.'. * This is to support : * genrb -s. /home/icu/data * genrb -s. icu/data * The user cannot mix notations like * genrb -s. /icu/data --- the absolute path specified. -s redundant * user should use * genrb -s. icu/data --- start from CWD and look in icu/data dir */ if( (fileName[0] != U_FILE_SEP_CHAR) && (inputDir[dirlen-1] !='.')){ uprv_strcpy(target, inputDir); target[dirlen] = U_FILE_SEP_CHAR; } target[dirlen + 1] = '/0'; } else { requiredLen = dirlen + filelen + 1; if((*len < requiredLen) || target==NULL){ *len = requiredLen; *status = U_BUFFER_OVERFLOW_ERROR; return NULL; } uprv_strcpy(target, inputDir); } uprv_strcat(target, fileName); return target;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:56,
示例13: whileconst char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quote){ char buffer[1024]; while(l != NULL) { if(l->str) { uprv_strncpy(buffer, l->str, 1023); buffer[1023]=0; if(uprv_strlen(l->str) >= 1023) { fprintf(stderr, "%s:%d: Internal error, line too long (greater than 1023 chars)/n", __FILE__, __LINE__); exit(0); } if(quote < 0) { /* remove quotes */ if(buffer[uprv_strlen(buffer)-1] == '"') { buffer[uprv_strlen(buffer)-1] = '/0'; } if(buffer[0] == '"') { uprv_strcpy(buffer, buffer+1); } } else if(quote > 0) { /* add quotes */ if(l->str[0] != '"') { uprv_strcpy(buffer, "/""); uprv_strcat(buffer, l->str); } if(l->str[uprv_strlen(l->str)-1] != '"') { uprv_strcat(buffer, "/""); } } T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer)); } if(l->next && delim) { T_FileStream_write(s, delim, (int32_t)uprv_strlen(delim)); } l = l->next; } return NULL;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:42,
示例14: testTrieRanges4static voidtestTrieRanges4(const char *testName, const SetRange setRanges[], int32_t countSetRanges, const CheckRange checkRanges[], int32_t countCheckRanges) { char name[40]; uprv_strcpy(name, testName); uprv_strcat(name, ".32"); testTrieRanges2(name, setRanges, countSetRanges, checkRanges, countCheckRanges, TRUE); uprv_strcpy(name, testName); uprv_strcat(name, ".16"); testTrieRanges2(name, setRanges, countSetRanges, checkRanges, countCheckRanges, FALSE);}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:20,
示例15: pathToFullPathstatic char *pathToFullPath(const char *path, const char *source) { int32_t length; int32_t newLength; char *fullPath; int32_t n; length = (uint32_t)(uprv_strlen(path) + 1); newLength = (length + 1 + (int32_t)uprv_strlen(source)); fullPath = uprv_malloc(newLength); if(source != NULL) { uprv_strcpy(fullPath, source); uprv_strcat(fullPath, U_FILE_SEP_STRING); } else { fullPath[0] = 0; } n = (int32_t)uprv_strlen(fullPath); fullPath[n] = 0; /* Suppress compiler warning for unused variable n */ /* when conditional code below is not compiled. */ uprv_strcat(fullPath, path);#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) /* replace tree separator (such as '/') with file sep char (such as ':' or '//') */ for(;fullPath[n];n++) { if(fullPath[n] == U_FILE_ALT_SEP_CHAR) { fullPath[n] = U_FILE_SEP_CHAR; } }#endif#endif#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) /* replace tree separator (such as '/') with file sep char (such as ':' or '//') */ for(;fullPath[n];n++) { if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) { fullPath[n] = U_FILE_SEP_CHAR; } }#endif return fullPath;}
开发者ID:00zhengfu00,项目名称:third_party,代码行数:41,
示例16: idForLocale/** * @see VARIANT_IS_EURO * @see VARIANT_IS_PREEURO */static uint32_tidForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCode* ec){ uint32_t variantType = 0; // !!! this is internal only, assumes buffer is not null and capacity is sufficient // Extract the country name and variant name. We only // recognize two variant names, EURO and PREEURO. char variant[ULOC_FULLNAME_CAPACITY]; uloc_getCountry(locale, countryAndVariant, capacity, ec); uloc_getVariant(locale, variant, sizeof(variant), ec); if (variant[0] != 0) { variantType = (0 == uprv_strcmp(variant, VAR_EURO)) | ((0 == uprv_strcmp(variant, VAR_PRE_EURO)) << 1); if (variantType) { uprv_strcat(countryAndVariant, VAR_DELIM_STR); uprv_strcat(countryAndVariant, variant); } } return variantType;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:25,
示例17: pathToFullPathstatic char * pathToFullPath(const char *path) { int32_t length; int32_t newLength; char *fullPath; int32_t n; length = (uint32_t)(uprv_strlen(path) + 1); newLength = (length + 1 + (int32_t)uprv_strlen(options[10].value)); fullPath = uprv_malloc(newLength); if(options[10].doesOccur) { uprv_strcpy(fullPath, options[10].value); uprv_strcat(fullPath, U_FILE_SEP_STRING); } else { fullPath[0] = 0; } n = (int32_t)uprv_strlen(fullPath); uprv_strcat(fullPath, path);#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) /* replace tree separator (such as '/') with file sep char (such as ':' or '//') */ for(;fullPath[n];n++) { if(fullPath[n] == U_FILE_ALT_SEP_CHAR) { fullPath[n] = U_FILE_SEP_CHAR; } }#endif#endif#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) /* replace tree separator (such as '/') with file sep char (such as ':' or '//') */ for(;fullPath[n];n++) { if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) { fullPath[n] = U_FILE_SEP_CHAR; } }#endif return fullPath;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:39,
示例18: appendShortStringElementstatic void appendShortStringElement(const char *src, int32_t len, char *result, int32_t *resultSize, int32_t capacity, char arg){ if(len) { if(*resultSize) { if(*resultSize < capacity) { uprv_strcat(result, "_"); } (*resultSize)++; } *resultSize += len + 1; if(*resultSize < capacity) { uprv_strncat(result, &arg, 1); uprv_strncat(result, src, len); } }}
开发者ID:00zhengfu00,项目名称:third_party,代码行数:16,
示例19: TinyString_appendstatic void TinyString_append(TinyString *This, const char *what) { int32_t newLen; newLen = This->length + (int32_t)uprv_strlen(what); if (newLen >= This->fCapacity) { int32_t newCapacity = newLen * 2; char *newBuf = (char *)uprv_malloc(newCapacity+1); if (newBuf != NULL) { uprv_strcpy(newBuf, This->s); if (This->s != This->fStaticBuf) { uprv_free(This->s); } This->s = newBuf; This->fCapacity = newCapacity; } } if (newLen < This->fCapacity) { uprv_strcat(This->s+This->length, what); This->length = newLen; } }
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:20,
示例20: rbUCAUCAConformanceTest::UCAConformanceTest() :rbUCA(NULL),testFile(NULL),status(U_ZERO_ERROR){ UCA = (RuleBasedCollator *)Collator::createInstance(Locale::getRoot(), status); if(U_FAILURE(status)) { dataerrln("Error - UCAConformanceTest: Unable to open UCA collator! - %s", u_errorName(status)); } const char *srcDir = IntlTest::getSourceTestData(status); if (U_FAILURE(status)) { dataerrln("Could not open test data %s", u_errorName(status)); return; } uprv_strcpy(testDataPath, srcDir); uprv_strcat(testDataPath, "CollationTest_"); UVersionInfo uniVersion; static const UVersionInfo v62 = { 6, 2, 0, 0 }; u_getUnicodeVersion(uniVersion); isAtLeastUCA62 = uprv_memcmp(uniVersion, v62, 4) >= 0;}
开发者ID:MIPS,项目名称:external-icu,代码行数:23,
示例21: ucol_sit_dumpSpecsstaticint32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity, UErrorCode *status){ int32_t i = 0, j = 0; int32_t len = 0; char optName; if(U_SUCCESS(*status)) { for(i = 0; i < UCOL_SIT_ITEMS_COUNT; i++) { if(s->entries[i].start) { if(len) { if(len < capacity) { uprv_strcat(destination, "_"); } len++; } optName = *(s->entries[i].start); if(optName == languageArg || optName == regionArg || optName == variantArg || optName == keywordArg) { for(j = 0; j < s->entries[i].len; j++) { if(len + j < capacity) { destination[len+j] = uprv_toupper(*(s->entries[i].start+j)); } } len += s->entries[i].len; } else { len += s->entries[i].len; if(len < capacity) { uprv_strncat(destination,s->entries[i].start, s->entries[i].len); } } } } return len; } else { return 0; }}
开发者ID:cran,项目名称:stringi,代码行数:36,
示例22: main//.........这里部分代码省略......... setShowWarning(FALSE); } if(options[STRICT].doesOccur) { setStrict(TRUE); } if(options[COPYRIGHT].doesOccur){ setIncludeCopyright(TRUE); } if(options[SOURCEDIR].doesOccur) { inputDir = options[SOURCEDIR].value; } if(options[DESTDIR].doesOccur) { outputDir = options[DESTDIR].value; } if(options[PACKAGE_NAME].doesOccur) { gPackageName = options[PACKAGE_NAME].value; if(!strcmp(gPackageName, "ICUDATA")) { gPackageName = U_ICUDATA_NAME; } if(gPackageName[0] == 0) { gPackageName = NULL; } } if(options[ENCODING].doesOccur) { encoding = options[ENCODING].value; } if(options[ICUDATADIR].doesOccur) { u_setDataDirectory(options[ICUDATADIR].value); } /* Initialize ICU */ u_init(&status); if (U_FAILURE(status) && status != U_FILE_ACCESS_ERROR) { /* Note: u_init() will try to open ICU property data. * failures here are expected when building ICU from scratch. * ignore them. */ fprintf(stderr, "%s: can not initialize ICU. status = %s/n", argv[0], u_errorName(status)); exit(1); } status = U_ZERO_ERROR; if(options[WRITE_JAVA].doesOccur) { write_java = TRUE; outputEnc = options[WRITE_JAVA].value; } if(options[BUNDLE_NAME].doesOccur) { bundleName = options[BUNDLE_NAME].value; } if(options[WRITE_XLIFF].doesOccur) { write_xliff = TRUE; if(options[WRITE_XLIFF].value != NULL){ xliffOutputFileName = options[WRITE_XLIFF].value; } } if(options[NO_BINARY_COLLATION].doesOccur) { initParser(FALSE); } else { initParser(TRUE); } /*added by Jing*/ if(options[LANGUAGE].doesOccur) { language = options[LANGUAGE].value; } /* generate the binary files */ for(i = 1; i < argc; ++i) { status = U_ZERO_ERROR; arg = getLongPathname(argv[i]); if (inputDir) { uprv_strcpy(theCurrentFileName, inputDir); uprv_strcat(theCurrentFileName, U_FILE_SEP_STRING); } else { *theCurrentFileName = 0; } uprv_strcat(theCurrentFileName, arg); if (isVerbose()) { printf("Processing file /"%s/"/n", theCurrentFileName); } processFile(arg, encoding, inputDir, outputDir, gPackageName, &status); } /* Dont return warnings as a failure */ if (! U_FAILURE(status)) { return 0; } return status;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:101,
示例23: make_res_filename/* Generate the target .res file name from the input file name */static char*make_res_filename(const char *filename, const char *outputDir, const char *packageName, UErrorCode *status) { char *basename; char *dirname; char *resName; int32_t pkgLen = 0; /* length of package prefix */ if (U_FAILURE(*status)) { return 0; } if(packageName != NULL) { pkgLen = (int32_t)(1 + uprv_strlen(packageName)); } /* setup */ basename = dirname = resName = 0; /* determine basename, and compiled file names */ basename = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename) + 1)); if(basename == 0) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_basename(basename, filename); dirname = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename) + 1)); if(dirname == 0) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_dirname(dirname, filename); if (outputDir == NULL) { /* output in same dir as .txt */ resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname) + pkgLen + uprv_strlen(basename) + uprv_strlen(RES_SUFFIX) + 8)); if(resName == 0) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } uprv_strcpy(resName, dirname); if(packageName != NULL) { uprv_strcat(resName, packageName); uprv_strcat(resName, "_"); } uprv_strcat(resName, basename); } else { int32_t dirlen = (int32_t)uprv_strlen(outputDir); int32_t basenamelen = (int32_t)uprv_strlen(basename); resName = (char*) uprv_malloc(sizeof(char) * (dirlen + pkgLen + basenamelen + 8)); if (resName == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } uprv_strcpy(resName, outputDir); if(outputDir[dirlen] != U_FILE_SEP_CHAR) { resName[dirlen] = U_FILE_SEP_CHAR; resName[dirlen + 1] = '/0'; } if(packageName != NULL) { uprv_strcat(resName, packageName); uprv_strcat(resName, "_"); } uprv_strcat(resName, basename); }finish: uprv_free(basename); uprv_free(dirname); return resName;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:95,
示例24: processFile/* Process a file */static voidprocessFile(const char *filename, const char *cp, const char *inputDir, const char *outputDir, const char *packageName, UErrorCode *status) { /*FileStream *in = NULL;*/ struct SRBRoot *data = NULL; UCHARBUF *ucbuf = NULL; char *rbname = NULL; char *openFileName = NULL; char *inputDirBuf = NULL; char outputFileName[256]; int32_t dirlen = 0; int32_t filelen = 0; if (status==NULL || U_FAILURE(*status)) { return; } if(filename==NULL){ *status=U_ILLEGAL_ARGUMENT_ERROR; return; }else{ filelen = (int32_t)uprv_strlen(filename); } if(inputDir == NULL) { const char *filenameBegin = uprv_strrchr(filename, U_FILE_SEP_CHAR); openFileName = (char *) uprv_malloc(dirlen + filelen + 2); openFileName[0] = '/0'; if (filenameBegin != NULL) { /* * When a filename ../../../data/root.txt is specified, * we presume that the input directory is ../../../data * This is very important when the resource file includes * another file, like UCARules.txt or thaidict.brk. */ int32_t filenameSize = (int32_t)(filenameBegin - filename + 1); inputDirBuf = uprv_strncpy((char *)uprv_malloc(filenameSize), filename, filenameSize); /* test for NULL */ if(inputDirBuf == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } inputDirBuf[filenameSize - 1] = 0; inputDir = inputDirBuf; dirlen = (int32_t)uprv_strlen(inputDir); } }else{ dirlen = (int32_t)uprv_strlen(inputDir); if(inputDir[dirlen-1] != U_FILE_SEP_CHAR) { openFileName = (char *) uprv_malloc(dirlen + filelen + 2); /* test for NULL */ if(openFileName == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } openFileName[0] = '/0'; /* * append the input dir to openFileName if the first char in * filename is not file seperation char and the last char input directory is not '.'. * This is to support : * genrb -s. /home/icu/data * genrb -s. icu/data * The user cannot mix notations like * genrb -s. /icu/data --- the absolute path specified. -s redundant * user should use * genrb -s. icu/data --- start from CWD and look in icu/data dir */ if( (filename[0] != U_FILE_SEP_CHAR) && (inputDir[dirlen-1] !='.')){ uprv_strcpy(openFileName, inputDir); openFileName[dirlen] = U_FILE_SEP_CHAR; } openFileName[dirlen + 1] = '/0'; } else { openFileName = (char *) uprv_malloc(dirlen + filelen + 1); /* test for NULL */ if(openFileName == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } uprv_strcpy(openFileName, inputDir); } } uprv_strcat(openFileName, filename); ucbuf = ucbuf_open(openFileName, &cp,getShowWarning(),TRUE, status); if(*status == U_FILE_ACCESS_ERROR) { fprintf(stderr, "couldn't open file %s/n", openFileName == NULL ? filename : openFileName); goto finish; }//.........这里部分代码省略.........
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:101,
示例25: main//.........这里部分代码省略.........#endif if (!p) { p = arg; } else { p++; } q = uprv_strrchr(p, '.'); if (!q) { for (q = p; *q; ++q) ; } uprv_strncpy(locale, p, q - p); locale[q - p] = 0; if (!(fromICUData = !uprv_strcmp(inputDir, "-"))) { UBool absfilename = *arg == U_FILE_SEP_CHAR;#ifdef U_WINDOWS if (!absfilename) { absfilename = (uprv_strlen(arg) > 2 && isalpha(arg[0]) && arg[1] == ':' && arg[2] == U_FILE_SEP_CHAR); }#endif if (absfilename) { thename = arg; } else { q = uprv_strrchr(arg, U_FILE_SEP_CHAR);#if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR if (q == NULL) { q = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); }#endif uprv_strcpy(infile, inputDir); if(q != NULL) { uprv_strcat(infile, U_FILE_SEP_STRING); strncat(infile, arg, q-arg); } thename = infile; } } status = U_ZERO_ERROR; if (thename) { bundle = ures_openDirect(thename, locale, &status); } else { bundle = ures_open(fromICUData ? 0 : inputDir, locale, &status); } if (status == U_ZERO_ERROR) { FILE *out; const char *filename = 0; const char *ext = 0; if (!locale || !tostdout) { filename = uprv_strrchr(arg, U_FILE_SEP_CHAR);#if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR if (!filename) { filename = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR); }#endif if (!filename) { filename = arg; } else { ++filename; } ext = uprv_strrchr(arg, '.'); if (!ext) {
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:67,
示例26: pkg_mode_commonvoid pkg_mode_common(UPKGOptions *o, FileStream *makefile, UErrorCode *status){ char tmp[1024]; CharList *tail = NULL; uprv_strcpy(tmp, UDATA_CMN_PREFIX); uprv_strcat(tmp, o->shortName); uprv_strcat(tmp, UDATA_CMN_SUFFIX); if(!uprv_strcmp(o->mode, "common")) { /* If we're not the main mode.. don't change the output file list */ /* We should be the only item. So we don't care about the order. */ o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp)); if(o->nooutput || o->verbose) { fprintf(stdout, "# Output file: %s%s%s/n", o->targetDir, U_FILE_SEP_STRING, tmp); } if(o->nooutput) { *status = U_ZERO_ERROR; return; } sprintf(tmp, "# File to make:/nTARGET=%s%s%s/n/nTARGETNAME=%s/n", o->targetDir, U_FILE_SEP_STRING, o->outFiles->str, o->outFiles->str); T_FileStream_writeLine(makefile, tmp); } else { /* We're in another mode. but, set the target so they can find us.. */ T_FileStream_writeLine(makefile, "TARGET="); T_FileStream_writeLine(makefile, tmp); T_FileStream_writeLine(makefile, "/n/n"); } /* end [check to make sure we are in mode 'common' ] */ sprintf(tmp, "# List file for gencmn:/n" "CMNLIST=%s%s%s_common.lst/n/n", o->tmpDir, U_FILE_SEP_STRING, o->shortName); T_FileStream_writeLine(makefile, tmp); sprintf(tmp, "all: $(TARGET)/n/n"); T_FileStream_writeLine(makefile, tmp); T_FileStream_writeLine(makefile, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)/n" "/t$(INVOKE) $(GENCMN) -n $(CNAME) -c -s $(SRCDIR) -d $(TARGETDIR) 0 $(CMNLIST)/n/n"); if(o->hadStdin == FALSE) { /* shortcut */ T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)/n" "/tcat $(LISTFILES) > $(CMNLIST)/n/n"); } else { T_FileStream_writeLine(makefile, "$(CMNLIST): /n" "/[email C++ uprv_strcmp函数代码示例 C++ uprv_memset函数代码示例
|