Lines Matching defs:cnv
116 * - Added an optional extension table structure at the end of the .cnv file.
931 ucnv_MBCSGetUnicodeSet(const UConverter *cnv,
935 if(cnv->options&_MBCS_OPTION_GB18030) {
939 ucnv_MBCSGetUnicodeSetForUnicode(cnv->sharedData, sa, which, pErrorCode);
957 * @return if(U_FAILURE) return the code point for cnv->fromUChar32
961 _extFromU(UConverter *cnv, const UConverterSharedData *sharedData,
970 cnv->useSubChar1=FALSE;
974 cnv, cx,
985 if((cnv->options&_MBCS_OPTION_GB18030)!=0) {
1009 ucnv_fromUWriteBytes(cnv,
1023 * Input sequence: cnv->toUBytes[0..length[
1028 _extToU(UConverter *cnv, const UConverterSharedData *sharedData,
1039 cnv, cx,
1050 if(length==4 && (cnv->options&_MBCS_OPTION_GB18030)!=0) {
1055 linear=LINEAR_18030(cnv->toUBytes[0], cnv->toUBytes[1], cnv->toUBytes[2], cnv->toUBytes[3]);
1066 ucnv_toUWriteCodePoint(cnv, linear, target, targetLimit, offsets, sourceIndex, pErrorCode);
1186 * This affects only some .cnv file formats with a header.version
1472 /* TODO parse package name out of the prefix of the base name in the extension .cnv file? */
1681 * The .cnv file is prebuilt with an additional stage table with indexes
1754 ucnv_MBCSOpen(UConverter *cnv,
1766 mbcsTable=&cnv->sharedData->mbcs;
1771 cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL;
1783 if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) {
1789 cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL;
1797 cnv->options|=_MBCS_OPTION_GB18030;
1801 cnv->options|=_MBCS_OPTION_KEIS;
1804 cnv->options|=_MBCS_OPTION_JEF;
1807 cnv->options|=_MBCS_OPTION_JIPS;
1812 cnv->maxBytesPerUChar=3; /* SO+DBCS */
1822 if(maxBytesPerUChar>cnv->maxBytesPerUChar) {
1823 cnv->maxBytesPerUChar=maxBytesPerUChar;
1834 cnv->toUnicodeStatus=0; /* offset */
1835 cnv->mode=0; /* state */
1836 cnv->toULength=0; /* byteIndex */
1839 cnv->fromUChar32=0;
1840 cnv->fromUnicodeStatus=1; /* prevLength */
1845 ucnv_MBCSGetName(const UConverter *cnv) {
1846 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=NULL) {
1847 return cnv->sharedData->mbcs.swapLFNLName;
1849 return cnv->sharedData->staticData->name;
1887 UConverter *cnv;
1902 cnv=pArgs->converter;
1909 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
1910 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
1912 stateTable=cnv->sharedData->mbcs.stateTable;
1956 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
1972 cnv->UCharErrorBuffer[0]=c;
1973 cnv->UCharErrorBufferLength=1;
1981 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2008 cnv->toUBytes[0]=*(source-1);
2009 cnv->toULength=_extToU(cnv, cnv->sharedData,
2039 UConverter *cnv;
2053 cnv=pArgs->converter;
2060 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2061 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2063 stateTable=cnv->sharedData->mbcs.stateTable;
2176 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2209 cnv->toUBytes[0]=*(source-1);
2210 cnv->toULength=_extToU(cnv, cnv->sharedData,
2319 UConverter *cnv;
2340 cnv=pArgs->converter;
2342 if(cnv->preToULength>0) {
2347 ucnv_extContinueMatchToU(cnv, pArgs, -1, pErrorCode);
2349 if(U_FAILURE(*pErrorCode) || cnv->preToULength<0) {
2354 if(cnv->sharedData->mbcs.countStates==1) {
2355 if(!(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) {
2370 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2371 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2373 stateTable=cnv->sharedData->mbcs.stateTable;
2375 unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits;
2378 offset=cnv->toUnicodeStatus;
2379 byteIndex=cnv->toULength;
2380 bytes=cnv->toUBytes;
2387 if((state=(uint8_t)(cnv->mode))==0) {
2388 state=cnv->sharedData->mbcs.dbcsOnlyState;
2521 cnv->mode=state;
2542 if(UCNV_TO_U_USE_FALLBACK(cnv) && (entry=(int32_t)ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
2571 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
2585 cnv->UCharErrorBuffer[0]=unicodeCodeUnits[offset];
2586 cnv->UCharErrorBufferLength=1;
2592 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
2604 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2621 cnv->UCharErrorBuffer[0]=c;
2622 cnv->UCharErrorBufferLength=1;
2636 if(cnv->sharedData->mbcs.dbcsOnlyState==0) {
2640 state=(uint8_t)(cnv->mode); /* restore the previous state */
2646 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2678 UBool isDBCSOnly=(UBool)(cnv->sharedData->mbcs.dbcsOnlyState!=0);
2692 cnv->preToULength=(int8_t)(bytesFromThisBuffer-backOutDistance);
2694 uprv_memcpy(cnv->preToU, bytes+i, -cnv->preToULength);
2703 byteIndex=_extToU(cnv, cnv->sharedData,
2719 cnv->toUnicodeStatus=offset;
2720 cnv->mode=state;
2721 cnv->toULength=byteIndex;
2736 UConverter *cnv;
2744 cnv=pArgs->converter;
2747 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2748 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2750 stateTable=cnv->sharedData->mbcs.stateTable;
2772 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2777 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2821 UConverter *cnv;
2835 cnv=pArgs->converter;
2837 if(cnv->preToULength>0) {
2842 if(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SURROGATES) {
2849 } else if(cnv->sharedData->mbcs.countStates==1) {
2857 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2858 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2860 stateTable=cnv->sharedData->mbcs.stateTable;
2862 unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits;
2865 offset=cnv->toUnicodeStatus;
2872 if((state=(uint8_t)(cnv->mode))==0) {
2873 state=cnv->sharedData->mbcs.dbcsOnlyState;
2897 cnv->mode=state;
2918 if(UCNV_TO_U_USE_FALLBACK(cnv) && (c=ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
2931 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
2935 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
2944 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2957 if(cnv->sharedData->mbcs.dbcsOnlyState!=0) {
2959 state=(uint8_t)(cnv->mode); /* restore the previous state */
2965 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2990 cnv->toUnicodeStatus=0;
2991 cnv->mode=state;
3001 uint8_t *bytes=cnv->toUBytes;
3002 cnv->toULength=(int8_t)(source-lastSource);
3015 UBool isDBCSOnly=(UBool)(cnv->sharedData->mbcs.dbcsOnlyState!=0);
3016 uint8_t *bytes=cnv->toUBytes;
3019 cnv->toULength=1;
3028 cnv->toULength=i;
3039 cnv->toUnicodeStatus=0;
3040 cnv->mode=state;
3179 } else if(UCNV_TO_U_USE_FALLBACK(cnv)) {
3193 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
3196 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
3260 UConverter *cnv;
3280 cnv=pArgs->converter;
3281 unicodeMask=cnv->sharedData->mbcs.unicodeMask;
3290 table=cnv->sharedData->mbcs.fromUnicodeTable;
3291 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
3292 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3293 bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3295 bytes=cnv->sharedData->mbcs.fromUnicodeBytes;
3297 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
3300 c=cnv->fromUChar32;
3400 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
3411 c=_extFromU(cnv, cnv->sharedData,
3457 cnv->charErrorBuffer[0]=(char)value;
3458 cnv->charErrorBufferLength=1;
3480 cnv->fromUChar32=c;
3492 UConverter *cnv;
3509 cnv=pArgs->converter;
3516 table=cnv->sharedData->mbcs.fromUnicodeTable;
3517 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3518 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3520 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
3523 if(cnv->useFallback) {
3530 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
3533 c=cnv->fromUChar32;
3617 c=_extFromU(cnv, cnv->sharedData,
3646 cnv->fromUChar32=c;
3668 UConverter *cnv;
3685 cnv=pArgs->converter;
3692 table=cnv->sharedData->mbcs.fromUnicodeTable;
3693 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3694 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3696 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
3698 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
3700 if(cnv->useFallback) {
3709 c=cnv->fromUChar32;
3862 c=_extFromU(cnv, cnv->sharedData,
3914 cnv->fromUChar32=c;
3925 UConverter *cnv;
3950 cnv=pArgs->converter;
3952 if(cnv->preFromUFirstCP>=0) {
3957 ucnv_extContinueMatchFromU(cnv, pArgs, -1, pErrorCode);
3959 if(U_FAILURE(*pErrorCode) || cnv->preFromULength<0) {
3965 outputType=cnv->sharedData->mbcs.outputType;
3966 unicodeMask=cnv->sharedData->mbcs.unicodeMask;
3974 } else if(outputType==MBCS_OUTPUT_2 && cnv->sharedData->mbcs.utf8Friendly) {
3986 table=cnv->sharedData->mbcs.fromUnicodeTable;
3987 if(cnv->sharedData->mbcs.utf8Friendly) {
3988 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
3992 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3993 bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3995 bytes=cnv->sharedData->mbcs.fromUnicodeBytes;
3997 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
4000 c=cnv->fromUChar32;
4003 prevLength=cnv->fromUnicodeStatus;
4019 siLength = getSISOBytes(SI, cnv->options, siBytes);
4020 soLength = getSISOBytes(SO, cnv->options, soBytes);
4102 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4252 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4333 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4453 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
4464 c=_extFromU(cnv, cnv->sharedData,
4471 prevLength=cnv->fromUnicodeStatus; /* restore SISO state */
4542 charErrorBuffer=(uint8_t *)cnv->charErrorBuffer;
4555 cnv->charErrorBufferLength=(int8_t)length;
4621 cnv->charErrorBuffer[0]=(uint8_t)siBytes[1];
4622 cnv->charErrorBufferLength=1;
4634 cnv->charErrorBuffer[0]=(uint8_t)siBytes[0];
4636 cnv->charErrorBuffer[1]=(uint8_t)siBytes[1];
4638 cnv->charErrorBufferLength=siLength;
4645 cnv->fromUChar32=c;
4646 cnv->fromUnicodeStatus=prevLength;
4865 UConverter *utf8, *cnv;
4884 cnv=pFromUArgs->converter;
4890 table=cnv->sharedData->mbcs.fromUnicodeTable;
4891 sbcsIndex=cnv->sharedData->mbcs.sbcsIndex;
4892 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
4893 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
4895 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
4897 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
4899 if(cnv->useFallback) {
4906 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
4955 * (utf8, source, target, limits but not cnv, table, minValue, etc.).
5108 c=_extFromU(cnv, cnv->sharedData,
5117 cnv->fromUChar32=c;
5119 } else if(cnv->preFromUFirstCP>=0) {
5148 cnv->preFromUFirstCP<0 &&
5171 UConverter *utf8, *cnv;
5191 cnv=pFromUArgs->converter;
5197 table=cnv->sharedData->mbcs.fromUnicodeTable;
5198 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
5199 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
5200 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
5202 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
5204 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
5206 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
5378 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
5397 cnv->charErrorBuffer[0]=(char)value;
5398 cnv->charErrorBufferLength=1;
5417 c=_extFromU(cnv, cnv->sharedData,
5426 cnv->fromUChar32=c;
5428 } else if(cnv->preFromUFirstCP>=0) {
5458 cnv->preFromUFirstCP<0 &&
5480 ucnv_MBCSGetStarters(const UConverter* cnv,
5486 state0=cnv->sharedData->mbcs.stateTable[cnv->sharedData->mbcs.dbcsOnlyState];
5506 UConverter *cnv=pArgs->converter;
5512 if( cnv->subChar1!=0 &&
5513 (cnv->sharedData->mbcs.extIndexes!=NULL ?
5514 cnv->useSubChar1 :
5515 (cnv->invalidUCharBuffer[0]<=0xff))
5518 subchar=(char *)&cnv->subChar1;
5522 subchar=(char *)cnv->subChars;
5523 length=cnv->subCharLen;
5527 cnv->useSubChar1=FALSE;
5529 if (cnv->sharedData->mbcs.outputType == MBCS_OUTPUT_2_SISO) {
5535 if(cnv->fromUnicodeStatus==2) {
5537 cnv->fromUnicodeStatus=1;
5543 if(cnv->fromUnicodeStatus<=1) {
5545 cnv->fromUnicodeStatus=2;