Lines Matching refs:extData
73 CnvExtData *extData; in CnvExtOpen() local
75 extData=(CnvExtData *)uprv_malloc(sizeof(CnvExtData)); in CnvExtOpen()
76 if(extData==NULL) { in CnvExtOpen()
80 uprv_memset(extData, 0, sizeof(CnvExtData)); in CnvExtOpen()
82 extData->ucm=ucm; /* aliased, not owned */ in CnvExtOpen()
84 extData->newConverter.close=CnvExtClose; in CnvExtOpen()
85 extData->newConverter.isValid=CnvExtIsValid; in CnvExtOpen()
86 extData->newConverter.addTable=CnvExtAddTable; in CnvExtOpen()
87 extData->newConverter.write=CnvExtWrite; in CnvExtOpen()
88 return &extData->newConverter; in CnvExtOpen()
93 CnvExtData *extData=(CnvExtData *)cnvData; in CnvExtClose() local
94 if(extData!=NULL) { in CnvExtClose()
95 utm_close(extData->toUTable); in CnvExtClose()
96 utm_close(extData->toUUChars); in CnvExtClose()
97 utm_close(extData->fromUTableUChars); in CnvExtClose()
98 utm_close(extData->fromUTableValues); in CnvExtClose()
99 utm_close(extData->fromUBytes); in CnvExtClose()
100 uprv_free(extData); in CnvExtClose()
114 CnvExtData *extData=(CnvExtData *)cnvData; in CnvExtWrite() local
125 length=(int32_t)uprv_strlen(extData->ucm->baseName)+1; in CnvExtWrite()
128 extData->ucm->baseName[length++]=0; in CnvExtWrite()
140 udata_writeBlock(pData, extData->ucm->baseName, length); in CnvExtWrite()
150 indexes[UCNV_EXT_TO_U_LENGTH]=length=utm_countItems(extData->toUTable); in CnvExtWrite()
154 indexes[UCNV_EXT_TO_U_UCHARS_LENGTH]=length=utm_countItems(extData->toUUChars); in CnvExtWrite()
158 length=utm_countItems(extData->fromUTableUChars); in CnvExtWrite()
163 *((UChar *)utm_alloc(extData->fromUTableUChars))=0; in CnvExtWrite()
164 *((uint32_t *)utm_alloc(extData->fromUTableValues))=0; in CnvExtWrite()
174 length=utm_countItems(extData->fromUBytes); in CnvExtWrite()
179 *((uint8_t *)utm_alloc(extData->fromUBytes))=0; in CnvExtWrite()
186 indexes[UCNV_EXT_FROM_U_STAGE_1_LENGTH]=length=extData->stage1Top; in CnvExtWrite()
187 indexes[UCNV_EXT_FROM_U_STAGE_12_LENGTH]=length+=extData->stage2Top; in CnvExtWrite()
191 length=extData->stage3Top; in CnvExtWrite()
196 extData->stage3[extData->stage3Top++]=0; in CnvExtWrite()
203 indexes[UCNV_EXT_FROM_U_STAGE_3B_LENGTH]=length=extData->stage3bTop; in CnvExtWrite()
210 (extData->maxInBytes<<16)| in CnvExtWrite()
211 (extData->maxOutBytes<<8)| in CnvExtWrite()
212 extData->maxBytesPerUChar; in CnvExtWrite()
214 (extData->maxInUChars<<16)| in CnvExtWrite()
215 (extData->maxOutUChars<<8)| in CnvExtWrite()
216 extData->maxUCharsPerByte; in CnvExtWrite()
218 indexes[UCNV_EXT_FLAGS]=extData->ucm->ext->unicodeMask; in CnvExtWrite()
222 udata_writeBlock(pData, utm_getStart(extData->toUTable), indexes[UCNV_EXT_TO_U_LENGTH]*4); in CnvExtWrite()
223 … udata_writeBlock(pData, utm_getStart(extData->toUUChars), indexes[UCNV_EXT_TO_U_UCHARS_LENGTH]*2); in CnvExtWrite()
225 …udata_writeBlock(pData, utm_getStart(extData->fromUTableUChars), indexes[UCNV_EXT_FROM_U_LENGTH]*2… in CnvExtWrite()
226 …udata_writeBlock(pData, utm_getStart(extData->fromUTableValues), indexes[UCNV_EXT_FROM_U_LENGTH]*4… in CnvExtWrite()
227 … udata_writeBlock(pData, utm_getStart(extData->fromUBytes), indexes[UCNV_EXT_FROM_U_BYTES_LENGTH]); in CnvExtWrite()
229 udata_writeBlock(pData, extData->stage1, extData->stage1Top*2); in CnvExtWrite()
230 udata_writeBlock(pData, extData->stage2, extData->stage2Top*2); in CnvExtWrite()
231 udata_writeBlock(pData, extData->stage3, extData->stage3Top*2); in CnvExtWrite()
232 udata_writeBlock(pData, extData->stage3b, extData->stage3bTop*4); in CnvExtWrite()
238 length=extData->stage1Top; in CnvExtWrite()
242 if(extData->stage1[i]!=length) { in CnvExtWrite()
243 printf("stage1[%04x]=%04x\n", i, extData->stage1[i]); in CnvExtWrite()
248 length=extData->stage2Top; in CnvExtWrite()
252 if(extData->stage2[i]!=0) { in CnvExtWrite()
253 printf("stage12[%04x]=%04x\n", j, extData->stage2[i]); in CnvExtWrite()
257 length=extData->stage3Top; in CnvExtWrite()
261 if(extData->stage3[i]!=0) { in CnvExtWrite()
262 printf("stage3[%04x]=%04x\n", i, extData->stage3[i]); in CnvExtWrite()
266 length=extData->stage3bTop; in CnvExtWrite()
270 if(extData->stage3b[i]!=0) { in CnvExtWrite()
271 printf("stage3b[%04x]=%08x\n", i, extData->stage3b[i]); in CnvExtWrite()
326 getToUnicodeValue(CnvExtData *extData, UCMTable *table, UCMapping *m) { in getToUnicodeValue() argument
351 ((uint32_t)utm_countItems(extData->toUUChars)); in getToUnicodeValue()
352 u=utm_allocN(extData->toUUChars, u16Length); in getToUnicodeValue()
366 if(m->bLen>extData->maxInBytes) { in getToUnicodeValue()
367 extData->maxInBytes=m->bLen; in getToUnicodeValue()
369 if(u16Length>extData->maxOutUChars) { in getToUnicodeValue()
370 extData->maxOutUChars=u16Length; in getToUnicodeValue()
374 if(ratio>extData->maxUCharsPerByte) { in getToUnicodeValue()
375 extData->maxUCharsPerByte=ratio; in getToUnicodeValue()
409 generateToUTable(CnvExtData *extData, UCMTable *table, in generateToUTable() argument
463 section=(uint32_t *)utm_allocN(extData->toUTable, 1+count); in generateToUTable()
522 defaultValue=getToUnicodeValue(extData, table, m); in generateToUTable()
530 section[j]|=(uint32_t)utm_countItems(extData->toUTable); in generateToUTable()
533 if(!generateToUTable(extData, table, subStart, subLimit, unitIndex+1, defaultValue)) { in generateToUTable()
547 makeToUTable(CnvExtData *extData, UCMTable *table) { in makeToUTable() argument
552 extData->toUTable=utm_open("cnv extension toUTable", 0x10000, UCNV_EXT_TO_U_MIN_CODE_POINT, 4); in makeToUTable()
553 extData->toUUChars=utm_open("cnv extension toUUChars", 0x10000, UCNV_EXT_TO_U_INDEX_MASK+1, 2); in makeToUTable()
555 return generateToUTable(extData, table, 0, toUCount, 0, 0); in makeToUTable()
633 getFromUBytesValue(CnvExtData *extData, UCMTable *table, UCMapping *m) { in getFromUBytesValue() argument
664 value=(uint32_t)utm_countItems(extData->fromUBytes); in getFromUBytesValue()
665 resultBytes=utm_allocN(extData->fromUBytes, m->bLen); in getFromUBytesValue()
684 if(u16Length>extData->maxInUChars) { in getFromUBytesValue()
685 extData->maxInUChars=u16Length; in getFromUBytesValue()
687 if(m->bLen>extData->maxOutBytes) { in getFromUBytesValue()
688 extData->maxOutBytes=m->bLen; in getFromUBytesValue()
692 if(ratio>extData->maxBytesPerUChar) { in getFromUBytesValue()
693 extData->maxBytesPerUChar=ratio; in getFromUBytesValue()
708 generateFromUTable(CnvExtData *extData, UCMTable *table, in generateFromUTable() argument
747 sectionUChars=(UChar *)utm_allocN(extData->fromUTableUChars, 1+count); in generateFromUTable()
748 sectionValues=(uint32_t *)utm_allocN(extData->fromUTableValues, 1+count); in generateFromUTable()
795 defaultValue=getFromUBytesValue(extData, table, m); in generateFromUTable()
803 sectionValues[j]=(uint32_t)utm_countItems(extData->fromUTableValues); in generateFromUTable()
806 if(!generateFromUTable(extData, table, subStart, subLimit, unitIndex+1, defaultValue)) { in generateFromUTable()
820 addFromUTrieEntry(CnvExtData *extData, UChar32 c, uint32_t value) { in addFromUTrieEntry() argument
833 if(i1>=extData->stage1Top) { in addFromUTrieEntry()
834 extData->stage1Top=i1+1; in addFromUTrieEntry()
839 if(extData->stage1[i1]==0) { in addFromUTrieEntry()
841 newBlock=extData->stage2Top; in addFromUTrieEntry()
843 while(min<newBlock && extData->stage2[newBlock-1]==0) { in addFromUTrieEntry()
847 extData->stage1[i1]=(uint16_t)newBlock; in addFromUTrieEntry()
848 extData->stage2Top=newBlock+MBCS_STAGE_2_BLOCK_SIZE; in addFromUTrieEntry()
849 if(extData->stage2Top>UPRV_LENGTHOF(extData->stage2)) { in addFromUTrieEntry()
855 i2=extData->stage1[i1]+nextOffset; in addFromUTrieEntry()
858 if(extData->stage2[i2]==0) { in addFromUTrieEntry()
860 newBlock=extData->stage3Top; in addFromUTrieEntry()
862 while(min<newBlock && extData->stage3[newBlock-1]==0) { in addFromUTrieEntry()
868 extData->stage2[i2]=(uint16_t)(newBlock>>UCNV_EXT_STAGE_2_LEFT_SHIFT); in addFromUTrieEntry()
870 extData->stage3Top=newBlock+MBCS_STAGE_3_BLOCK_SIZE; in addFromUTrieEntry()
871 if(extData->stage3Top>UPRV_LENGTHOF(extData->stage3)) { in addFromUTrieEntry()
877 i3=((int32_t)extData->stage2[i2]<<UCNV_EXT_STAGE_2_LEFT_SHIFT)+nextOffset; in addFromUTrieEntry()
885 extData->stage3[i3]=1; in addFromUTrieEntry()
898 min<i3 && extData->stage3[min]==1; in addFromUTrieEntry()
903 if(extData->stage3Sub1Block!=0) { in addFromUTrieEntry()
905 extData->stage2[i2]=extData->stage3Sub1Block; in addFromUTrieEntry()
906 extData->stage3Top-=MBCS_STAGE_3_BLOCK_SIZE; in addFromUTrieEntry()
907 uprv_memset(extData->stage3+extData->stage3Top, 0, MBCS_STAGE_3_BLOCK_SIZE*2); in addFromUTrieEntry()
910 extData->stage3Sub1Block=extData->stage2[i2]; in addFromUTrieEntry()
915 if((i3b=extData->stage3bTop++)>=UPRV_LENGTHOF(extData->stage3b)) { in addFromUTrieEntry()
921 extData->stage3[i3]=(uint16_t)i3b; in addFromUTrieEntry()
922 extData->stage3b[i3b]=value; in addFromUTrieEntry()
927 generateFromUTrie(CnvExtData *extData, UCMTable *table, int32_t mapLength) { in generateFromUTrie() argument
983 value=getFromUBytesValue(extData, table, m); in generateFromUTrie()
988 addFromUTrieEntry(extData, c, value); in generateFromUTrie()
991 addFromUTrieEntry(extData, c, (uint32_t)utm_countItems(extData->fromUTableValues)); in generateFromUTrie()
994 if(!generateFromUTable(extData, table, subStart, subLimit, 2, value)) { in generateFromUTrie()
1008 makeFromUTable(CnvExtData *extData, UCMTable *table) { in makeFromUTable() argument
1014 …extData->fromUTableUChars=utm_open("cnv extension fromUTableUChars", 0x10000, UCNV_EXT_FROM_U_DATA… in makeFromUTable()
1015 …extData->fromUTableValues=utm_open("cnv extension fromUTableValues", 0x10000, UCNV_EXT_FROM_U_DATA… in makeFromUTable()
1016 … extData->fromUBytes=utm_open("cnv extension fromUBytes", 0x10000, UCNV_EXT_FROM_U_DATA_MASK+1, 1); in makeFromUTable()
1019 extData->stage2Top=MBCS_STAGE_2_FIRST_ASSIGNED; in makeFromUTable()
1020 extData->stage3Top=MBCS_STAGE_3_FIRST_ASSIGNED; in makeFromUTable()
1027 extData->stage3b[1]=UCNV_EXT_FROM_U_SUBCHAR1; in makeFromUTable()
1028 extData->stage3bTop=2; in makeFromUTable()
1031 utm_alloc(extData->fromUTableUChars); in makeFromUTable()
1032 utm_alloc(extData->fromUTableValues); in makeFromUTable()
1034 if(!generateFromUTrie(extData, table, fromUCount)) { in makeFromUTable()
1042 stage1=extData->stage1; in makeFromUTable()
1043 stage1Top=extData->stage1Top; in makeFromUTable()
1055 CnvExtData *extData; in CnvExtAddTable() local
1064 extData=(CnvExtData *)cnvData; in CnvExtAddTable()
1074 makeToUTable(extData, table) && in CnvExtAddTable()
1075 makeFromUTable(extData, table); in CnvExtAddTable()