Lines Matching refs:cnv
114 * - Added an optional extension table structure at the end of the .cnv file.
928 ucnv_MBCSGetUnicodeSet(const UConverter *cnv,
932 if(cnv->options&_MBCS_OPTION_GB18030) {
936 ucnv_MBCSGetUnicodeSetForUnicode(cnv->sharedData, sa, which, pErrorCode);
954 * @return if(U_FAILURE) return the code point for cnv->fromUChar32
958 _extFromU(UConverter *cnv, const UConverterSharedData *sharedData,
967 cnv->useSubChar1=FALSE;
971 cnv, cx,
982 if((cnv->options&_MBCS_OPTION_GB18030)!=0) {
1006 ucnv_fromUWriteBytes(cnv,
1020 * Input sequence: cnv->toUBytes[0..length[
1025 _extToU(UConverter *cnv, const UConverterSharedData *sharedData,
1036 cnv, cx,
1047 if(length==4 && (cnv->options&_MBCS_OPTION_GB18030)!=0) {
1052 linear=LINEAR_18030(cnv->toUBytes[0], cnv->toUBytes[1], cnv->toUBytes[2], cnv->toUBytes[3]);
1063 ucnv_toUWriteCodePoint(cnv, linear, target, targetLimit, offsets, sourceIndex, pErrorCode);
1183 * This affects only some .cnv file formats with a header.version
1470 /* TODO parse package name out of the prefix of the base name in the extension .cnv file? */
1679 * The .cnv file is prebuilt with an additional stage table with indexes
1752 ucnv_MBCSOpen(UConverter *cnv,
1764 mbcsTable=&cnv->sharedData->mbcs;
1769 cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL;
1781 if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) {
1787 cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL;
1795 cnv->options|=_MBCS_OPTION_GB18030;
1799 cnv->options|=_MBCS_OPTION_KEIS;
1802 cnv->options|=_MBCS_OPTION_JEF;
1805 cnv->options|=_MBCS_OPTION_JIPS;
1810 cnv->maxBytesPerUChar=3; /* SO+DBCS */
1820 if(maxBytesPerUChar>cnv->maxBytesPerUChar) {
1821 cnv->maxBytesPerUChar=maxBytesPerUChar;
1832 cnv->toUnicodeStatus=0; /* offset */
1833 cnv->mode=0; /* state */
1834 cnv->toULength=0; /* byteIndex */
1837 cnv->fromUChar32=0;
1838 cnv->fromUnicodeStatus=1; /* prevLength */
1843 ucnv_MBCSGetName(const UConverter *cnv) {
1844 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=NULL) {
1845 return cnv->sharedData->mbcs.swapLFNLName;
1847 return cnv->sharedData->staticData->name;
1885 UConverter *cnv;
1900 cnv=pArgs->converter;
1907 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
1908 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
1910 stateTable=cnv->sharedData->mbcs.stateTable;
1954 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
1970 cnv->UCharErrorBuffer[0]=c;
1971 cnv->UCharErrorBufferLength=1;
1979 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2006 cnv->toUBytes[0]=*(source-1);
2007 cnv->toULength=_extToU(cnv, cnv->sharedData,
2037 UConverter *cnv;
2051 cnv=pArgs->converter;
2058 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2059 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2061 stateTable=cnv->sharedData->mbcs.stateTable;
2174 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2207 cnv->toUBytes[0]=*(source-1);
2208 cnv->toULength=_extToU(cnv, cnv->sharedData,
2317 UConverter *cnv;
2338 cnv=pArgs->converter;
2340 if(cnv->preToULength>0) {
2345 ucnv_extContinueMatchToU(cnv, pArgs, -1, pErrorCode);
2347 if(U_FAILURE(*pErrorCode) || cnv->preToULength<0) {
2352 if(cnv->sharedData->mbcs.countStates==1) {
2353 if(!(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) {
2368 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2369 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2371 stateTable=cnv->sharedData->mbcs.stateTable;
2373 unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits;
2376 offset=cnv->toUnicodeStatus;
2377 byteIndex=cnv->toULength;
2378 bytes=cnv->toUBytes;
2385 if((state=(uint8_t)(cnv->mode))==0) {
2386 state=cnv->sharedData->mbcs.dbcsOnlyState;
2519 cnv->mode=state;
2540 if(UCNV_TO_U_USE_FALLBACK(cnv) && (entry=(int32_t)ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
2569 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
2583 cnv->UCharErrorBuffer[0]=unicodeCodeUnits[offset];
2584 cnv->UCharErrorBufferLength=1;
2590 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
2602 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2619 cnv->UCharErrorBuffer[0]=c;
2620 cnv->UCharErrorBufferLength=1;
2634 if(cnv->sharedData->mbcs.dbcsOnlyState==0) {
2638 state=(uint8_t)(cnv->mode); /* restore the previous state */
2644 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2676 UBool isDBCSOnly=(UBool)(cnv->sharedData->mbcs.dbcsOnlyState!=0);
2690 cnv->preToULength=(int8_t)(bytesFromThisBuffer-backOutDistance);
2692 uprv_memcpy(cnv->preToU, bytes+i, -cnv->preToULength);
2701 byteIndex=_extToU(cnv, cnv->sharedData,
2717 cnv->toUnicodeStatus=offset;
2718 cnv->mode=state;
2719 cnv->toULength=byteIndex;
2734 UConverter *cnv;
2742 cnv=pArgs->converter;
2745 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2746 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2748 stateTable=cnv->sharedData->mbcs.stateTable;
2770 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2775 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2819 UConverter *cnv;
2833 cnv=pArgs->converter;
2835 if(cnv->preToULength>0) {
2840 if(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SURROGATES) {
2847 } else if(cnv->sharedData->mbcs.countStates==1) {
2855 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
2856 stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable;
2858 stateTable=cnv->sharedData->mbcs.stateTable;
2860 unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits;
2863 offset=cnv->toUnicodeStatus;
2870 if((state=(uint8_t)(cnv->mode))==0) {
2871 state=cnv->sharedData->mbcs.dbcsOnlyState;
2895 cnv->mode=state;
2916 if(UCNV_TO_U_USE_FALLBACK(cnv) && (c=ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
2929 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
2933 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
2942 (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv))
2955 if(cnv->sharedData->mbcs.dbcsOnlyState!=0) {
2957 state=(uint8_t)(cnv->mode); /* restore the previous state */
2963 if(UCNV_TO_U_USE_FALLBACK(cnv)) {
2988 cnv->toUnicodeStatus=0;
2989 cnv->mode=state;
2999 cnv->toUBytes;
3000 cnv->toULength=(int8_t)(source-lastSource);
3013 UBool isDBCSOnly=(UBool)(cnv->sharedData->mbcs.dbcsOnlyState!=0);
3014 uint8_t *bytes=cnv->toUBytes;
3017 cnv->toULength=1;
3026 cnv->toULength=i;
3037 cnv->toUnicodeStatus=0;
3038 cnv->mode=state;
3177 } else if(UCNV_TO_U_USE_FALLBACK(cnv)) {
3191 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
3194 } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
3258 UConverter *cnv;
3278 cnv=pArgs->converter;
3279 unicodeMask=cnv->sharedData->mbcs.unicodeMask;
3288 table=cnv->sharedData->mbcs.fromUnicodeTable;
3289 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
3290 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3291 bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3293 bytes=cnv->sharedData->mbcs.fromUnicodeBytes;
3295 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
3298 c=cnv->fromUChar32;
3398 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
3409 c=_extFromU(cnv, cnv->sharedData,
3455 cnv->charErrorBuffer[0]=(char)value;
3456 cnv->charErrorBufferLength=1;
3478 cnv->fromUChar32=c;
3490 UConverter *cnv;
3507 cnv=pArgs->converter;
3514 table=cnv->sharedData->mbcs.fromUnicodeTable;
3515 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3516 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3518 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
3521 if(cnv->useFallback) {
3528 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
3531 c=cnv->fromUChar32;
3615 c=_extFromU(cnv, cnv->sharedData,
3644 cnv->fromUChar32=c;
3666 UConverter *cnv;
3683 cnv=pArgs->converter;
3690 table=cnv->sharedData->mbcs.fromUnicodeTable;
3691 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3692 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3694 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
3696 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
3698 if(cnv->useFallback) {
3707 c=cnv->fromUChar32;
3860 c=_extFromU(cnv, cnv->sharedData,
3912 cnv->fromUChar32=c;
3923 UConverter *cnv;
3945 cnv=pArgs->converter;
3947 if(cnv->preFromUFirstCP>=0) {
3952 ucnv_extContinueMatchFromU(cnv, pArgs, -1, pErrorCode);
3954 if(U_FAILURE(*pErrorCode) || cnv->preFromULength<0) {
3960 outputType=cnv->sharedData->mbcs.outputType;
3961 unicodeMask=cnv->sharedData->mbcs.unicodeMask;
3969 } else if(outputType==MBCS_OUTPUT_2 && cnv->sharedData->mbcs.utf8Friendly) {
3981 table=cnv->sharedData->mbcs.fromUnicodeTable;
3982 if(cnv->sharedData->mbcs.utf8Friendly) {
3983 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
3987 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
3988 bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
3990 bytes=cnv->sharedData->mbcs.fromUnicodeBytes;
3992 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
3995 c=cnv->fromUChar32;
3998 prevLength=cnv->fromUnicodeStatus;
4014 si_value_length = getSISOBytes(SI, cnv->options, si_value);
4015 so_value_length = getSISOBytes(SO, cnv->options, so_value);
4097 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4247 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4328 cnv->fromUnicodeStatus=prevLength; /* save the old state */
4448 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
4459 c=_extFromU(cnv, cnv->sharedData,
4466 prevLength=cnv->fromUnicodeStatus; /* restore SISO state */
4537 charErrorBuffer=(uint8_t *)cnv->charErrorBuffer;
4550 cnv->charErrorBufferLength=(int8_t)length;
4616 cnv->charErrorBuffer[0]=(uint8_t)si_value[1];
4617 cnv->charErrorBufferLength=1;
4629 cnv->charErrorBuffer[0]=(uint8_t)si_value[0];
4631 cnv->charErrorBuffer[1]=(uint8_t)si_value[1];
4633 cnv->charErrorBufferLength=si_value_length;
4640 cnv->fromUChar32=c;
4641 cnv->fromUnicodeStatus=prevLength;
4860 UConverter *utf8, *cnv;
4879 cnv=pFromUArgs->converter;
4885 table=cnv->sharedData->mbcs.fromUnicodeTable;
4886 sbcsIndex=cnv->sharedData->mbcs.sbcsIndex;
4887 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
4888 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
4890 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
4892 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
4894 if(cnv->useFallback) {
4901 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
4950 * (utf8, source, target, limits but not cnv, table, minValue, etc.).
5103 c=_extFromU(cnv, cnv->sharedData,
5112 cnv->fromUChar32=c;
5114 } else if(cnv->preFromUFirstCP>=0) {
5163 UConverter *utf8, *cnv;
5183 cnv=pFromUArgs->converter;
5189 table=cnv->sharedData->mbcs.fromUnicodeTable;
5190 mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
5191 if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
5192 results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
5194 results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes;
5196 asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips;
5198 if(cnv->useFallback) {
5205 hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY);
5377 (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0))
5396 cnv->charErrorBuffer[0]=(char)value;
5397 cnv->charErrorBufferLength=1;
5416 c=_extFromU(cnv, cnv->sharedData,
5425 cnv->fromUChar32=c;
5427 } else if(cnv->preFromUFirstCP>=0) {
5476 ucnv_MBCSGetStarters(const UConverter* cnv,
5482 state0=cnv->sharedData->mbcs.stateTable[cnv->sharedData->mbcs.dbcsOnlyState];
5502 UConverter *cnv=pArgs->converter;
5508 if( cnv->subChar1!=0 &&
5509 (cnv->sharedData->mbcs.extIndexes!=NULL ?
5510 cnv->useSubChar1 :
5511 (cnv->invalidUCharBuffer[0]<=0xff))
5514 subchar=(char *)&cnv->subChar1;
5518 subchar=(char *)cnv->subChars;
5519 length=cnv->subCharLen;
5523 cnv->useSubChar1=FALSE;
5525 if (cnv->sharedData->mbcs.outputType == MBCS_OUTPUT_2_SISO) {
5531 if(cnv->fromUnicodeStatus==2) {
5533 cnv->fromUnicodeStatus=1;
5539 if(cnv->fromUnicodeStatus<=1) {
5541 cnv->fromUnicodeStatus=2;