Compare commits
1 Commits
main
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15d5910636 |
@@ -355,13 +355,11 @@ ziU8 MatchAltSound1Key(ziU16 *spelling,Zi8UInt spellingLength,Zi8UInt requireFul
|
||||
if ((keyHigh == records[recordIndex].keyHigh) &&
|
||||
(keyLow == records[recordIndex].keyLow)) {
|
||||
searchIndex = recordIndex;
|
||||
goto START_PROCESS;
|
||||
} else {
|
||||
if (keyHigh != records[searchIndex].keyHigh || keyLow != records[searchIndex].keyLow) {
|
||||
goto BINARY_SEARCH;
|
||||
}
|
||||
}
|
||||
if ((keyHigh == records[searchIndex].keyHigh) &&
|
||||
(keyLow == records[searchIndex].keyLow)) {
|
||||
goto START_PROCESS;
|
||||
}
|
||||
goto BINARY_SEARCH;
|
||||
START_PROCESS:
|
||||
recordIndex = searchIndex;
|
||||
do {
|
||||
@@ -1488,40 +1486,41 @@ ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8
|
||||
elementIndex = MatchAltSound1Key(spelling,inputLimit,matchFull,(Zi8AltSoundRecord *)alternateTable,phoneticMask,phoneticTable,
|
||||
phraseCharacter,tone,includeTone,languageMask,work);
|
||||
}
|
||||
if (elementIndex == 0) goto nextPhrase;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,phraseCharacter,work) != 0) goto nextPhrase;
|
||||
for (index = 0; index < candidateCount; index++) {
|
||||
if (firstOrdinal == output[index]) goto nextPhrase;
|
||||
}
|
||||
} else {
|
||||
wordLength = 0;
|
||||
do {
|
||||
phraseCharacter = ((ziU16)entryCursor[1] << 8) | *entryCursor;
|
||||
entryCursor += 2;
|
||||
output[outputIndex + wordLength++] = Zi8Ord2Uni(phraseCharacter & 0x7fff,work);
|
||||
} while ((phraseCharacter & 0x8000) == 0);
|
||||
if (prefixSearch != 0 || params->elementCount != 0) wordLength = 1;
|
||||
if (Zi8IsDupWordW(output + outputIndex,wordLength,work) != 0) goto nextPhrase;
|
||||
output[outputIndex + wordLength] = 0;
|
||||
}
|
||||
if (optionsMask == 5) {
|
||||
if (++totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
} else if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
if (emitWords) {
|
||||
outputIndex += wordLength;
|
||||
output[outputIndex++] = 0x20;
|
||||
if (elementIndex != 0) {
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,phraseCharacter,work) != 0) goto nextPhrase;
|
||||
for (index = 0; index < candidateCount; index++) {
|
||||
if (firstOrdinal == output[index]) goto nextPhrase;
|
||||
}
|
||||
} else {
|
||||
output[outputIndex++] = firstOrdinal;
|
||||
wordLength = 0;
|
||||
do {
|
||||
phraseCharacter = ((ziU16)entryCursor[1] << 8) | *entryCursor;
|
||||
entryCursor += 2;
|
||||
output[outputIndex + wordLength++] = Zi8Ord2Uni(phraseCharacter & 0x7fff,work);
|
||||
} while ((phraseCharacter & 0x8000) == 0);
|
||||
if (prefixSearch != 0 || params->elementCount != 0) wordLength = 1;
|
||||
if (Zi8IsDupWordW(output + outputIndex,wordLength,work) != 0) goto nextPhrase;
|
||||
output[outputIndex + wordLength] = 0;
|
||||
}
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) {
|
||||
params->count = candidateCount;
|
||||
goto finishCandidates;
|
||||
if (optionsMask == 5) {
|
||||
if (++totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
} else if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
if (emitWords) {
|
||||
outputIndex += wordLength;
|
||||
output[outputIndex++] = 0x20;
|
||||
} else {
|
||||
output[outputIndex++] = firstOrdinal;
|
||||
}
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) {
|
||||
params->count = candidateCount;
|
||||
goto finishCandidates;
|
||||
}
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
nextPhrase:
|
||||
@@ -1621,26 +1620,27 @@ finishPhrases:
|
||||
elementIndex = MatchAltSound1Key(spelling,inputLimit,matchFull,(Zi8AltSoundRecord *)alternateTable,phoneticMask,phoneticTable,userOrdinal,
|
||||
tone,includeTone,languageMask,work);
|
||||
}
|
||||
if (elementIndex == 0) goto nextUserOrdinal;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,userOrdinal,work) != 0) goto nextUserOrdinal;
|
||||
userCharacter = Zi8Ord2Uni(userOrdinal,work);
|
||||
for (duplicateIndex = 0; duplicateIndex < candidateCount; duplicateIndex++) {
|
||||
if (userCharacter == output[duplicateIndex]) break;
|
||||
if (elementIndex != 0) {
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,userOrdinal,work) != 0) goto nextUserOrdinal;
|
||||
userCharacter = Zi8Ord2Uni(userOrdinal,work);
|
||||
for (duplicateIndex = 0; duplicateIndex < candidateCount; duplicateIndex++) {
|
||||
if (userCharacter == output[duplicateIndex]) break;
|
||||
}
|
||||
if (duplicateIndex < candidateCount) goto nextUserOrdinal;
|
||||
} else {
|
||||
userCharacter = Zi8Ord2Uni(userOrdinal,work);
|
||||
if (Zi8IsDupWordW(&userCharacter,1,work) != 0) goto nextUserOrdinal;
|
||||
}
|
||||
if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
output[outputIndex++] = userCharacter;
|
||||
if (emitWords) output[outputIndex++] = 0x20;
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) goto finishCandidates;
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
if (duplicateIndex < candidateCount) goto nextUserOrdinal;
|
||||
} else {
|
||||
userCharacter = Zi8Ord2Uni(userOrdinal,work);
|
||||
if (Zi8IsDupWordW(&userCharacter,1,work) != 0) goto nextUserOrdinal;
|
||||
}
|
||||
if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
output[outputIndex++] = userCharacter;
|
||||
if (emitWords) output[outputIndex++] = 0x20;
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) goto finishCandidates;
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1675,31 +1675,33 @@ nextUserOrdinal:
|
||||
elementIndex = MatchAltSound1Key(spelling,inputLimit,matchFull,(Zi8AltSoundRecord *)alternateTable,phoneticMask,phoneticTable,ordinal,
|
||||
tone,includeTone,languageMask,work);
|
||||
}
|
||||
if (elementIndex == 0) goto nextOrdinal;
|
||||
unicodeCharacter = ((ziU16)phraseTable[6] << 8) + (ziU16)phraseTable[7];
|
||||
if (unicodeCharacter == previousCharacter) goto nextOrdinal;
|
||||
previousCharacter = unicodeCharacter;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextOrdinal;
|
||||
for (index = 0; index < candidateCount; index++) {
|
||||
if (unicodeCharacter == output[index]) break;
|
||||
if (elementIndex != 0) {
|
||||
unicodeCharacter = ((ziU16)phraseTable[6] << 8) + (ziU16)phraseTable[7];
|
||||
if (unicodeCharacter != previousCharacter) {
|
||||
previousCharacter = unicodeCharacter;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextOrdinal;
|
||||
for (index = 0; index < candidateCount; index++) {
|
||||
if (unicodeCharacter == output[index]) break;
|
||||
}
|
||||
if (index < candidateCount) goto nextOrdinal;
|
||||
} else {
|
||||
if (Zi8IsDupWordW(&unicodeCharacter,1,work) != 0) goto nextOrdinal;
|
||||
}
|
||||
if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
if (options->countOnly == 0) {
|
||||
candidateCount++;
|
||||
output[outputIndex++] = unicodeCharacter;
|
||||
if (emitWords) output[outputIndex++] = 0x20;
|
||||
} else {
|
||||
if (totalCandidates >= options->maxCount) break;
|
||||
}
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) break;
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
if (index < candidateCount) goto nextOrdinal;
|
||||
} else {
|
||||
if (Zi8IsDupWordW(&unicodeCharacter,1,work) != 0) goto nextOrdinal;
|
||||
}
|
||||
if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
if (options->countOnly == 0) {
|
||||
candidateCount++;
|
||||
output[outputIndex++] = unicodeCharacter;
|
||||
if (emitWords) output[outputIndex++] = 0x20;
|
||||
} else {
|
||||
if (totalCandidates >= options->maxCount) break;
|
||||
}
|
||||
if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) break;
|
||||
} else {
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
nextOrdinal:
|
||||
|
||||
@@ -231,7 +231,7 @@ ziBool Zi8IsVowel(ziU8 language, ziWChar character) {
|
||||
if (language == 47) return ZI8_FALSE;
|
||||
switch (character) {
|
||||
case 0xFF: case 0x152: case 0x153: case 0x178:
|
||||
goto vowel;
|
||||
break;
|
||||
default:
|
||||
return ZI8_FALSE;
|
||||
}
|
||||
@@ -461,10 +461,14 @@ int Zi8AlphaGetCandidates(ziGetParam* parameters, ziPtr optionData, ziPtr workDa
|
||||
if (((Zi8GetTableCount(parameters->language,0x1f,workData) & 0x80) != 0) && (parameters->subLanguage == 0x80)) {
|
||||
contextEnabled = ZI8_TRUE;
|
||||
}
|
||||
if (!(((((ZiAlphaOptions*)optionData)->lookupMode == '\0') && (parameters->subLanguage != 7)) &&
|
||||
((parameters->subLanguage != language &&
|
||||
((((parameters->subLanguage != 0 && (parameters->subLanguage != 1)) && (parameters->subLanguage != 2)) &&
|
||||
((parameters->subLanguage != 0x80 && ((Zi8LangSupported(parameters->subLanguage,workData)) != '\0'))))))))) {
|
||||
if (((ZiAlphaOptions*)optionData)->lookupMode != '\0' ||
|
||||
parameters->subLanguage == 7 ||
|
||||
parameters->subLanguage == language ||
|
||||
parameters->subLanguage == 0 ||
|
||||
parameters->subLanguage == 1 ||
|
||||
parameters->subLanguage == 2 ||
|
||||
parameters->subLanguage == 0x80 ||
|
||||
(Zi8LangSupported(parameters->subLanguage,workData)) == '\0') {
|
||||
languagePassCount = 0;
|
||||
if (((ZiAlphaWork*)workData)->language != parameters->language) {
|
||||
((ZiAlphaWork*)workData)->language = 0;
|
||||
@@ -943,12 +947,12 @@ selectDictionary:
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
if (wordLength != 0) goto filterVowelCandidate;
|
||||
dictionaryStatus[dictionaryKind] = 1;
|
||||
if (elements[apostropheIndex] >= 0xEFF1) continue;
|
||||
goto finishDictionaryPass;
|
||||
}
|
||||
filterVowelCandidate:
|
||||
if (wordLength == 0) {
|
||||
dictionaryStatus[dictionaryKind] = 1;
|
||||
if (elements[apostropheIndex] >= 0xEFF1) continue;
|
||||
goto finishDictionaryPass;
|
||||
}
|
||||
}
|
||||
if ((wordLength != 0) && (prefixVowelRestriction)) {
|
||||
if ((*wordCursor >= 0x30) && (*wordCursor <= 0x39)) {
|
||||
wordLength = 0;
|
||||
@@ -1099,11 +1103,10 @@ filterVowelCandidate:
|
||||
case 7:
|
||||
case 8:
|
||||
case 12:
|
||||
goto prepareRememberedPunctuation;
|
||||
break;
|
||||
default:
|
||||
goto finishDictionaryPass;
|
||||
}
|
||||
prepareRememberedPunctuation:
|
||||
if (Zi8getKeyLayout(language,0xeff1,&punctuationBuffer[0],1,workData) == 0) {
|
||||
punctuationBuffer[0] = 0;
|
||||
}
|
||||
@@ -1556,20 +1559,27 @@ checkPrefixPunctuation:
|
||||
goto preparePrefix;
|
||||
}
|
||||
}
|
||||
if (!completionAllowed && ((ZiAlphaWork*)workData)->suffixMode == 0 && ((ZiAlphaWork*)workData)->prefixCount != 0 &&
|
||||
elementCount > 2 && ((ZiAlphaWork*)workData)->prefixCount == elementCount - 1 &&
|
||||
Zi8IsAlphaPunct(parameters->elements[((ZiAlphaWork*)workData)->prefixCount - 1]) != 0) goto checkPrefixFields;
|
||||
if (!completionAllowed && ((ZiAlphaWork*)workData)->suffixMode == 0 && parameters->elementCount > 1 &&
|
||||
Zi8IsAlphaPunct(parameters->elements[parameters->elementCount - 1]) == 0) goto finishCandidates;
|
||||
checkPrefixFields:
|
||||
if (completionAllowed ||
|
||||
((ZiAlphaWork*)workData)->suffixMode != 0 ||
|
||||
((ZiAlphaWork*)workData)->prefixCount == 0 ||
|
||||
elementCount <= 2 ||
|
||||
((ZiAlphaWork*)workData)->prefixCount != elementCount - 1 ||
|
||||
Zi8IsAlphaPunct(parameters->elements[((ZiAlphaWork*)workData)->prefixCount - 1]) == 0) {
|
||||
if (!completionAllowed && ((ZiAlphaWork*)workData)->suffixMode == 0 && parameters->elementCount > 1 &&
|
||||
Zi8IsAlphaPunct(parameters->elements[parameters->elementCount - 1]) == 0) goto finishCandidates;
|
||||
}
|
||||
prefixMode = ((ZiAlphaWork*)workData)->suffixMode;
|
||||
prefixLength = ((ZiAlphaWork*)workData)->prefixCount;
|
||||
if (prefixMode != 0 || prefixLength == 0 || elementCount <= 2 ||
|
||||
prefixLength != elementCount - 1 || parameters->elements[parameters->elementCount - 1] == 0xEFF1) goto finishCandidates;
|
||||
((ZiAlphaWork*)workData)->suffixMode = 1;
|
||||
((ZiAlphaWork*)workData)->prefixElementCount = parameters->elementCount;
|
||||
prefixPrepared = ZI8_TRUE;
|
||||
goto preparePrefix;
|
||||
if (prefixMode == 0 &&
|
||||
prefixLength != 0 &&
|
||||
elementCount > 2 &&
|
||||
prefixLength == elementCount - 1 &&
|
||||
parameters->elements[parameters->elementCount - 1] != 0xEFF1) {
|
||||
((ZiAlphaWork*)workData)->suffixMode = 1;
|
||||
((ZiAlphaWork*)workData)->prefixElementCount = parameters->elementCount;
|
||||
prefixPrepared = ZI8_TRUE;
|
||||
goto preparePrefix;
|
||||
}
|
||||
|
||||
finishCandidates:
|
||||
((ZiAlphaWork*)workData)->usePrefixAsElements = 0;
|
||||
|
||||
@@ -1,105 +1,95 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
ziU16 Zi8MatchAltSound(ziU8* elements, ziU16 count, ziU8* table, ziU16 ch,
|
||||
ziU16 Zi8MatchAltSound(ziU8* elements, ziU16 count, ziU8* table, ziU16 ordinal,
|
||||
ziU32 mask, ziU16 target, ziU8 flags ZI_NEED_WORK) {
|
||||
ziU8 hi;
|
||||
ziU8 lo;
|
||||
ziS32 i;
|
||||
ziS32 j;
|
||||
ziS32 mid;
|
||||
ziU16 off;
|
||||
ziU16 w;
|
||||
ziU8 ordinalHigh;
|
||||
ziU8 ordinalLow;
|
||||
ziS32 recordIndex;
|
||||
ziS32 searchIndex;
|
||||
ziS32 midpoint;
|
||||
ziU16 phoneticOffset;
|
||||
ziU16 phoneticCode;
|
||||
|
||||
hi = (ziU8)(ch >> 8);
|
||||
lo = (ziU8)ch;
|
||||
ordinalHigh = (ziU8)(ordinal >> 8);
|
||||
ordinalLow = (ziU8)ordinal;
|
||||
flags = (ziU8)(flags >> 3);
|
||||
if (count == 0) {
|
||||
return 0;
|
||||
}
|
||||
j = 0;
|
||||
i = count - 1;
|
||||
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
|
||||
j = i;
|
||||
goto up;
|
||||
searchIndex = 0;
|
||||
recordIndex = count - 1;
|
||||
if ((elements + recordIndex * 4)[1] == ordinalHigh && (elements + recordIndex * 4)[0] == ordinalLow) {
|
||||
searchIndex = recordIndex;
|
||||
} else {
|
||||
if ((elements + searchIndex * 4)[1] != ordinalHigh || (elements + searchIndex * 4)[0] != ordinalLow) {
|
||||
goto search;
|
||||
}
|
||||
}
|
||||
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
|
||||
goto up;
|
||||
}
|
||||
goto search;
|
||||
up:
|
||||
i = j;
|
||||
recordIndex = searchIndex;
|
||||
do {
|
||||
if (((elements + i * 4)[3] & 0xE) == 0 ||
|
||||
((elements + i * 4)[3] & flags) != 0) {
|
||||
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
|
||||
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
|
||||
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
|
||||
(table[off] | ((ziU16)table[off + 1] << 8)));
|
||||
if (target == (w & (ziU16)mask)) {
|
||||
return w;
|
||||
if (((elements + recordIndex * 4)[3] & 0xE) == 0 ||
|
||||
((elements + recordIndex * 4)[3] & flags) != 0) {
|
||||
phoneticOffset = (ziU16)(((ziU16)(elements + recordIndex * 4)[2] |
|
||||
(((ziU16)(elements + recordIndex * 4)[3] & 1) << 8)) << 1);
|
||||
phoneticCode = (ziU16)((((ziU16)(elements + recordIndex * 4)[3] & 0xF0) >> 4) |
|
||||
(table[phoneticOffset] | ((ziU16)table[phoneticOffset + 1] << 8)));
|
||||
if (target == (phoneticCode & (ziU16)mask)) {
|
||||
return phoneticCode;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (i >= count) {
|
||||
recordIndex++;
|
||||
if (recordIndex >= count) {
|
||||
break;
|
||||
}
|
||||
} while ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo);
|
||||
i = j;
|
||||
goto dec;
|
||||
down_body:
|
||||
if (((elements + i * 4)[3] & 0xE) == 0 ||
|
||||
((elements + i * 4)[3] & flags) != 0) {
|
||||
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
|
||||
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
|
||||
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
|
||||
(table[off] | ((ziU16)table[off + 1] << 8)));
|
||||
if (target == (w & (ziU16)mask)) {
|
||||
return w;
|
||||
} while ((elements + recordIndex * 4)[1] == ordinalHigh && (elements + recordIndex * 4)[0] == ordinalLow);
|
||||
recordIndex = searchIndex;
|
||||
while (--recordIndex >= 0 && (elements + recordIndex * 4)[1] == ordinalHigh && (elements + recordIndex * 4)[0] == ordinalLow) {
|
||||
if (((elements + recordIndex * 4)[3] & 0xE) == 0 ||
|
||||
((elements + recordIndex * 4)[3] & flags) != 0) {
|
||||
phoneticOffset = (ziU16)(((ziU16)(elements + recordIndex * 4)[2] |
|
||||
(((ziU16)(elements + recordIndex * 4)[3] & 1) << 8)) << 1);
|
||||
phoneticCode = (ziU16)((((ziU16)(elements + recordIndex * 4)[3] & 0xF0) >> 4) |
|
||||
(table[phoneticOffset] | ((ziU16)table[phoneticOffset + 1] << 8)));
|
||||
if (target == (phoneticCode & (ziU16)mask)) {
|
||||
return phoneticCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
dec:
|
||||
i--;
|
||||
if (i < 0) {
|
||||
goto fail;
|
||||
}
|
||||
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
|
||||
goto down_body;
|
||||
}
|
||||
fail:
|
||||
return 0;
|
||||
search:
|
||||
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
|
||||
if ((elements + searchIndex * 4)[1] == ordinalHigh && (elements + searchIndex * 4)[0] == ordinalLow) {
|
||||
goto up;
|
||||
}
|
||||
if ((((ziU16)(elements + j * 4)[1] << 8) | (ziU16)(elements + j * 4)[0]) > ch) {
|
||||
if ((((ziU16)(elements + searchIndex * 4)[1] << 8) | (ziU16)(elements + searchIndex * 4)[0]) > ordinal) {
|
||||
return 0;
|
||||
}
|
||||
mid = (j + i) / 2;
|
||||
if (mid == j) {
|
||||
midpoint = (searchIndex + recordIndex) / 2;
|
||||
if (midpoint == searchIndex) {
|
||||
return 0;
|
||||
}
|
||||
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
|
||||
i = mid;
|
||||
goto hi_check;
|
||||
if ((((ziU16)(elements + midpoint * 4)[1] << 8) | (ziU16)(elements + midpoint * 4)[0]) >= ordinal) {
|
||||
recordIndex = midpoint;
|
||||
} else {
|
||||
searchIndex = midpoint;
|
||||
goto search;
|
||||
}
|
||||
j = mid;
|
||||
goto search;
|
||||
hi_check:
|
||||
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
|
||||
j = i;
|
||||
if ((elements + recordIndex * 4)[1] == ordinalHigh && (elements + recordIndex * 4)[0] == ordinalLow) {
|
||||
searchIndex = recordIndex;
|
||||
goto up;
|
||||
}
|
||||
if ((((ziU16)(elements + i * 4)[1] << 8) | (ziU16)(elements + i * 4)[0]) < ch) {
|
||||
if ((((ziU16)(elements + recordIndex * 4)[1] << 8) | (ziU16)(elements + recordIndex * 4)[0]) < ordinal) {
|
||||
return 0;
|
||||
}
|
||||
mid = (j + i) / 2;
|
||||
if (mid == j) {
|
||||
midpoint = (searchIndex + recordIndex) / 2;
|
||||
if (midpoint == searchIndex) {
|
||||
return 0;
|
||||
}
|
||||
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
|
||||
i = mid;
|
||||
if ((((ziU16)(elements + midpoint * 4)[1] << 8) | (ziU16)(elements + midpoint * 4)[0]) >= ordinal) {
|
||||
recordIndex = midpoint;
|
||||
goto hi_check;
|
||||
}
|
||||
j = mid;
|
||||
searchIndex = midpoint;
|
||||
goto search;
|
||||
}
|
||||
|
||||
@@ -1254,61 +1254,63 @@ context_word_lookup:
|
||||
break;
|
||||
}
|
||||
} else isFirstCandidate = Zi8Ord2Uni(character, work);
|
||||
if (!emitWords && isFirstCandidate == previousOrdinal) goto context_phrase_next;
|
||||
previousOrdinal = isFirstCandidate;
|
||||
if (!candidateStatus) goto context_phrase_next;
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = isFirstCandidate;
|
||||
if (charsetTable) {
|
||||
index = 0;
|
||||
while (1) {
|
||||
isFirstCandidate = (ziU16)frequencyTable[index * 2 + 1] << 8 | frequencyTable[index * 2];
|
||||
charsetEntry = charsetTable + (isFirstCandidate & 0x7FFF);
|
||||
if (!(charsetEntry[0] & charsetFilter)) { isFirstCandidate = 0; break; }
|
||||
if (isFirstCandidate & 0x8000) break;
|
||||
++index;
|
||||
}
|
||||
if (!(isFirstCandidate & 0x8000)) goto context_phrase_next;
|
||||
}
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, character, work)) goto context_phrase_next;
|
||||
} else if (Zi8IsDupWChar(character, work)) goto context_phrase_next;
|
||||
} else {
|
||||
emittedWords = 0;
|
||||
do {
|
||||
character = (ziU16)frequencyTable[1] << 8 | frequencyTable[0];
|
||||
frequencyTable += 2;
|
||||
output[outputIndex + emittedWords++] = Zi8Ord2Uni(character & 0x7FFF, work);
|
||||
} while (!(character & 0x8000));
|
||||
if (request->elementCount) {
|
||||
if ((getMode == 1 || getMode == 2) && match.nCand) emittedWords = match.nCand;
|
||||
else if (getMode == 0 && match.nSeg > 1) emittedWords = match.nSeg;
|
||||
else emittedWords = 1;
|
||||
} else if (prefixSearch) emittedWords = 1;
|
||||
if (Zi8IsDupWordW(output + outputIndex, emittedWords, work)) goto context_phrase_next;
|
||||
}
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (getOptions == 5) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
outputIndex += emittedWords;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) {
|
||||
request->letters = emittedCount;
|
||||
request->count = emittedCount;
|
||||
goto engine_finish;
|
||||
if (emitWords || isFirstCandidate != previousOrdinal) {
|
||||
previousOrdinal = isFirstCandidate;
|
||||
if (candidateStatus) {
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = isFirstCandidate;
|
||||
if (charsetTable) {
|
||||
index = 0;
|
||||
while (1) {
|
||||
isFirstCandidate = (ziU16)frequencyTable[index * 2 + 1] << 8 | frequencyTable[index * 2];
|
||||
charsetEntry = charsetTable + (isFirstCandidate & 0x7FFF);
|
||||
if (!(charsetEntry[0] & charsetFilter)) { isFirstCandidate = 0; break; }
|
||||
if (isFirstCandidate & 0x8000) break;
|
||||
++index;
|
||||
}
|
||||
if (!(isFirstCandidate & 0x8000)) goto context_phrase_next;
|
||||
}
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, character, work)) goto context_phrase_next;
|
||||
} else if (Zi8IsDupWChar(character, work)) goto context_phrase_next;
|
||||
} else {
|
||||
emittedWords = 0;
|
||||
do {
|
||||
character = (ziU16)frequencyTable[1] << 8 | frequencyTable[0];
|
||||
frequencyTable += 2;
|
||||
output[outputIndex + emittedWords++] = Zi8Ord2Uni(character & 0x7FFF, work);
|
||||
} while (!(character & 0x8000));
|
||||
if (request->elementCount) {
|
||||
if ((getMode == 1 || getMode == 2) && match.nCand) emittedWords = match.nCand;
|
||||
else if (getMode == 0 && match.nSeg > 1) emittedWords = match.nSeg;
|
||||
else emittedWords = 1;
|
||||
} else if (prefixSearch) emittedWords = 1;
|
||||
if (Zi8IsDupWordW(output + outputIndex, emittedWords, work)) goto context_phrase_next;
|
||||
}
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (getOptions == 5) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
outputIndex += emittedWords;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) {
|
||||
request->letters = emittedCount;
|
||||
request->count = emittedCount;
|
||||
goto engine_finish;
|
||||
}
|
||||
} else output[emittedCount++] = previousOrdinal;
|
||||
if (emittedCount >= request->maxCandidates) {
|
||||
request->letters = emittedCount;
|
||||
request->count = emittedCount;
|
||||
goto engine_finish;
|
||||
}
|
||||
}
|
||||
} else output[emittedCount++] = previousOrdinal;
|
||||
if (emittedCount >= request->maxCandidates) {
|
||||
request->letters = emittedCount;
|
||||
request->count = emittedCount;
|
||||
goto engine_finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1365,7 +1367,7 @@ prediction_next:
|
||||
++rangeIndex;
|
||||
phoneticGroups += 2;
|
||||
}
|
||||
goto numeric_setup;
|
||||
break;
|
||||
}
|
||||
++rangeIndex;
|
||||
phoneticGroups += 10;
|
||||
@@ -1797,29 +1799,30 @@ user_character_search:
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!candidateStatus) goto user_character_next;
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + candidateOrdinal;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto user_character_next;
|
||||
}
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, candidateOrdinal, work)) goto user_character_next;
|
||||
} else if (Zi8IsDupWChar(candidateOrdinal, work)) goto user_character_next;
|
||||
} else if (Zi8IsDupWordW(&character, 1, work)) goto user_character_next;
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
++totalResults;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
if (candidateStatus) {
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + candidateOrdinal;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto user_character_next;
|
||||
}
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, candidateOrdinal, work)) goto user_character_next;
|
||||
} else if (Zi8IsDupWChar(candidateOrdinal, work)) goto user_character_next;
|
||||
} else if (Zi8IsDupWordW(&character, 1, work)) goto user_character_next;
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
++totalResults;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
}
|
||||
}
|
||||
user_character_next:
|
||||
++userIndex;
|
||||
@@ -1831,55 +1834,58 @@ user_character_next:
|
||||
record = records;
|
||||
ordinalIndex = 0;
|
||||
while (ordinalIndex < recordCount) {
|
||||
if (!(record[0] & charset)) goto global_character_next;
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + ordinalIndex;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto global_character_next;
|
||||
}
|
||||
character = ((ziU16)record[6] << 8) + record[7];
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (character == previousOrdinal) goto global_character_next;
|
||||
previousOrdinal = character;
|
||||
candidateStatus = 0;
|
||||
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
|
||||
if (getMode != 7) {
|
||||
index = phraseEntry[0] & 7;
|
||||
if ((phraseEntry[0] & phraseMasks[index].bytes[0]) == phraseValues[index].bytes[0] &&
|
||||
(phraseEntry[1] & phraseMasks[index].bytes[1]) == phraseValues[index].bytes[1] &&
|
||||
(phraseEntry[2] & phraseMasks[index].bytes[2]) == phraseValues[index].bytes[2] &&
|
||||
(phraseEntry[3] & phraseMasks[index].bytes[3]) == phraseValues[index].bytes[3]) {
|
||||
if ((resultFallback && index == match.length) || (!resultFallback && index > match.length)) {
|
||||
candidateStatus = 1;
|
||||
} else if (getMode == 9) goto global_character_next;
|
||||
} else if (getMode == 9) goto global_character_next;
|
||||
}
|
||||
if (!candidateStatus && !((phraseEntry[0] & 7) >= match.length &&
|
||||
match.prefixValues[0] == (match.prefixMasks[0] & phraseEntry[0]) &&
|
||||
match.prefixValues[1] == (match.prefixMasks[1] & phraseEntry[1]) &&
|
||||
match.prefixValues[2] == (match.prefixMasks[2] & phraseEntry[2]) &&
|
||||
match.prefixValues[3] == (match.prefixMasks[3] & phraseEntry[3]) &&
|
||||
((resultFallback && (phraseEntry[0] & 7) == match.length) || (!resultFallback && (phraseEntry[0] & 7) > match.length)))) goto global_character_next;
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, ordinalIndex, work)) goto global_character_next;
|
||||
} else if (Zi8IsDupWChar(ordinalIndex, work)) goto global_character_next;
|
||||
} else if (Zi8IsDupWordW(&character, 1, work)) goto global_character_next;
|
||||
if (record[0] & charset) {
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + ordinalIndex;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto global_character_next;
|
||||
}
|
||||
character = ((ziU16)record[6] << 8) + record[7];
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (character != previousOrdinal) {
|
||||
previousOrdinal = character;
|
||||
candidateStatus = 0;
|
||||
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
|
||||
if (getMode != 7) {
|
||||
index = phraseEntry[0] & 7;
|
||||
if ((phraseEntry[0] & phraseMasks[index].bytes[0]) == phraseValues[index].bytes[0] &&
|
||||
(phraseEntry[1] & phraseMasks[index].bytes[1]) == phraseValues[index].bytes[1] &&
|
||||
(phraseEntry[2] & phraseMasks[index].bytes[2]) == phraseValues[index].bytes[2] &&
|
||||
(phraseEntry[3] & phraseMasks[index].bytes[3]) == phraseValues[index].bytes[3]) {
|
||||
if ((resultFallback && index == match.length) || (!resultFallback && index > match.length)) {
|
||||
candidateStatus = 1;
|
||||
} else if (getMode == 9) goto global_character_next;
|
||||
} else if (getMode == 9) goto global_character_next;
|
||||
}
|
||||
if (candidateStatus || (phraseEntry[0] & 7) >= match.length &&
|
||||
match.prefixValues[0] == (match.prefixMasks[0] & phraseEntry[0]) &&
|
||||
match.prefixValues[1] == (match.prefixMasks[1] & phraseEntry[1]) &&
|
||||
match.prefixValues[2] == (match.prefixMasks[2] & phraseEntry[2]) &&
|
||||
match.prefixValues[3] == (match.prefixMasks[3] & phraseEntry[3]) &&
|
||||
((resultFallback && (phraseEntry[0] & 7) == match.length) || (!resultFallback && (phraseEntry[0] & 7) > match.length))) {
|
||||
if (!emitWords) {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, ordinalIndex, work)) goto global_character_next;
|
||||
} else if (Zi8IsDupWChar(ordinalIndex, work)) goto global_character_next;
|
||||
} else if (Zi8IsDupWordW(&character, 1, work)) goto global_character_next;
|
||||
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (options->countOnly) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (options->countOnly) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
global_character_next:
|
||||
@@ -1988,49 +1994,52 @@ component_retry:
|
||||
duplicateIndex = 1;
|
||||
component_phrase_word:
|
||||
relatedRecord = records + (candidateOrdinal & 0x7FFF) * 12;
|
||||
if (duplicateIndex < match.nSeg &&
|
||||
(match.segmentValues[duplicateIndex][0] != (relatedRecord[0] & match.segmentMasks[duplicateIndex][0]) ||
|
||||
match.segmentValues[duplicateIndex][1] != (relatedRecord[1] & match.segmentMasks[duplicateIndex][1]) ||
|
||||
match.segmentValues[duplicateIndex][2] != (relatedRecord[2] & match.segmentMasks[duplicateIndex][2]) ||
|
||||
match.segmentValues[duplicateIndex][3] != (relatedRecord[3] & match.segmentMasks[duplicateIndex][3]))) goto component_phrase_next;
|
||||
currentSpelling[duplicateIndex] = ((ziU16)relatedRecord[6] << 8) + relatedRecord[7];
|
||||
if (++duplicateIndex >= match.nSeg) {
|
||||
if (switchedPhonetic) {
|
||||
if (!(candidateOrdinal & 0x8000)) goto component_phrase_next;
|
||||
goto component_phrase_charset;
|
||||
if (duplicateIndex >= match.nSeg ||
|
||||
match.segmentValues[duplicateIndex][0] == (relatedRecord[0] & match.segmentMasks[duplicateIndex][0]) &&
|
||||
match.segmentValues[duplicateIndex][1] == (relatedRecord[1] & match.segmentMasks[duplicateIndex][1]) &&
|
||||
match.segmentValues[duplicateIndex][2] == (relatedRecord[2] & match.segmentMasks[duplicateIndex][2]) &&
|
||||
match.segmentValues[duplicateIndex][3] == (relatedRecord[3] & match.segmentMasks[duplicateIndex][3])) {
|
||||
currentSpelling[duplicateIndex] = ((ziU16)relatedRecord[6] << 8) + relatedRecord[7];
|
||||
if (++duplicateIndex >= match.nSeg) {
|
||||
if (switchedPhonetic) {
|
||||
if (!(candidateOrdinal & 0x8000)) goto component_phrase_next;
|
||||
goto component_phrase_charset;
|
||||
}
|
||||
if (duplicateIndex == match.nSeg && (candidateOrdinal & 0x8000)) goto component_phrase_next;
|
||||
if (prefixSearch) goto component_phrase_charset;
|
||||
} else if (candidateOrdinal & 0x8000) goto component_phrase_next;
|
||||
if (!(candidateOrdinal & 0x8000)) {
|
||||
candidateOrdinal = (ziU16)phoneticGroups[1] << 8 | phoneticGroups[0];
|
||||
phoneticGroups += 2;
|
||||
goto component_phrase_word;
|
||||
}
|
||||
if (duplicateIndex == match.nSeg && (candidateOrdinal & 0x8000)) goto component_phrase_next;
|
||||
if (prefixSearch) goto component_phrase_charset;
|
||||
} else if (candidateOrdinal & 0x8000) goto component_phrase_next;
|
||||
if (candidateOrdinal & 0x8000) goto component_phrase_charset;
|
||||
candidateOrdinal = (ziU16)phoneticGroups[1] << 8 | phoneticGroups[0];
|
||||
phoneticGroups += 2;
|
||||
goto component_phrase_word;
|
||||
component_phrase_charset:
|
||||
if (charsetTable) {
|
||||
index = 0;
|
||||
while (1) {
|
||||
isFirstCandidate = (ziU16)frequencyTable[index * 2 + 1] << 8 | frequencyTable[index * 2];
|
||||
charsetEntry = charsetTable + (isFirstCandidate & 0x7FFF);
|
||||
if (!(charsetEntry[0] & charsetFilter)) { isFirstCandidate = 0; break; }
|
||||
if (isFirstCandidate & 0x8000) break;
|
||||
++index;
|
||||
if (charsetTable) {
|
||||
index = 0;
|
||||
while (1) {
|
||||
isFirstCandidate = (ziU16)frequencyTable[index * 2 + 1] << 8 | frequencyTable[index * 2];
|
||||
charsetEntry = charsetTable + (isFirstCandidate & 0x7FFF);
|
||||
if (!(charsetEntry[0] & charsetFilter)) { isFirstCandidate = 0; break; }
|
||||
if (isFirstCandidate & 0x8000) break;
|
||||
++index;
|
||||
}
|
||||
if (!(isFirstCandidate & 0x8000)) goto component_phrase_next;
|
||||
}
|
||||
if (!(isFirstCandidate & 0x8000)) goto component_phrase_next;
|
||||
}
|
||||
if (Zi8IsDupWordW(currentSpelling, duplicateIndex, work)) goto component_phrase_next;
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (options->countOnly) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
currentSpelling[duplicateIndex++] = ' ';
|
||||
if (outputIndex + duplicateIndex >= outputLimit) goto engine_finish;
|
||||
Zi8Memcpy(output + outputIndex, currentSpelling, duplicateIndex * 2);
|
||||
outputIndex += duplicateIndex;
|
||||
if (++emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
if (!Zi8IsDupWordW(currentSpelling, duplicateIndex, work)) {
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (options->countOnly) {
|
||||
if (totalResults >= options->maxResults) goto engine_finish;
|
||||
} else {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
currentSpelling[duplicateIndex++] = ' ';
|
||||
if (outputIndex + duplicateIndex >= outputLimit) goto engine_finish;
|
||||
Zi8Memcpy(output + outputIndex, currentSpelling, duplicateIndex * 2);
|
||||
outputIndex += duplicateIndex;
|
||||
if (++emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
component_phrase_next:
|
||||
@@ -2070,28 +2079,28 @@ frequency_range_retry:
|
||||
frequency_accept:
|
||||
ordinalIndex = firstOrdinal + (remainingOrdinals - candidateCount - 1);
|
||||
if (charsetTable) charsetEntry = charsetTable + ordinalIndex;
|
||||
if (charsetTable && !(charsetEntry[0] & charsetFilter)) goto frequency_record_next;
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
if (emitWords) {
|
||||
if (!Zi8IsDupWordW(&candidateOrdinal, 1, work)) {
|
||||
exactPhrase = 0;
|
||||
recordFrequency = (record[4] & 0xFC) >> 2;
|
||||
}
|
||||
} else {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, ordinalIndex, work)) {
|
||||
if (!charsetTable || charsetEntry[0] & charsetFilter) {
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
if (emitWords) {
|
||||
if (!Zi8IsDupWordW(&candidateOrdinal, 1, work)) {
|
||||
exactPhrase = 0;
|
||||
recordFrequency = (record[4] & 0xFC) >> 2;
|
||||
}
|
||||
} else {
|
||||
if (trackDuplicates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, ordinalIndex, work)) {
|
||||
record += 12;
|
||||
continue;
|
||||
}
|
||||
} else if (Zi8IsDupWChar(ordinalIndex, work)) {
|
||||
record += 12;
|
||||
continue;
|
||||
}
|
||||
} else if (Zi8IsDupWChar(ordinalIndex, work)) {
|
||||
record += 12;
|
||||
continue;
|
||||
exactPhrase = 0;
|
||||
recordFrequency = (record[4] & 0xFC) >> 2;
|
||||
}
|
||||
exactPhrase = 0;
|
||||
recordFrequency = (record[4] & 0xFC) >> 2;
|
||||
}
|
||||
frequency_record_next:
|
||||
record += 12;
|
||||
}
|
||||
}
|
||||
@@ -2241,50 +2250,51 @@ phonetic_filtered_done:
|
||||
index = rangeIndex;
|
||||
while (index < rangeCount) {
|
||||
alternateEntry = alternateCursor;
|
||||
if (!(((alternateEntry[0] & 0x80) && (charset & 0x10)) ||
|
||||
((alternateEntry[2] & 0x80) && (charset & 0x60)))) goto phonetic_pair_next;
|
||||
character = (ziU16)(alternateEntry[0] & 0x7F) << 8 | alternateEntry[1];
|
||||
relatedOrdinal = (ziU16)(alternateEntry[2] & 0x7F) << 8 | alternateEntry[3];
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + character;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto phonetic_pair_next;
|
||||
charsetEntry = charsetTable + relatedOrdinal;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto phonetic_pair_next;
|
||||
} else {
|
||||
record = records + character * 12;
|
||||
if (!(record[0] & charset)) goto phonetic_pair_next;
|
||||
record = records + relatedOrdinal * 12;
|
||||
if (!(record[0] & charset)) goto phonetic_pair_next;
|
||||
}
|
||||
if (isFirstCandidate || phoneticGroupWildcard) {
|
||||
record = records + character * 12;
|
||||
candidateStatus = (Zi8GetPCode(phoneticTable, record) & match.phon[0]) == match.phon2[0];
|
||||
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
|
||||
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, character,
|
||||
match.phon[0], match.phon2[0], charset, work)) candidateStatus = 1;
|
||||
if (!candidateStatus) goto phonetic_pair_next;
|
||||
record = records + relatedOrdinal * 12;
|
||||
candidateStatus = (Zi8GetPCode(phoneticTable, record) & match.phon[1]) == match.phon2[1];
|
||||
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
|
||||
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, relatedOrdinal,
|
||||
match.phon[1], match.phon2[1], charset, work)) candidateStatus = 1;
|
||||
if (!candidateStatus) goto phonetic_pair_next;
|
||||
}
|
||||
output[outputIndex] = Zi8Ord2Uni(character, work);
|
||||
output[outputIndex + 1] = Zi8Ord2Uni(relatedOrdinal, work);
|
||||
output[outputIndex + 2] = ' ';
|
||||
if (!Zi8IsDupWordW(output + outputIndex, 2, work)) {
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (!options->countOnly) {
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = output[outputIndex];
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
outputIndex += 3;
|
||||
++emittedCount;
|
||||
if (emittedCount >= request->maxCandidates || outputIndex > outputLimit) goto engine_finish;
|
||||
} else if (totalResults >= options->maxResults) goto engine_finish;
|
||||
if (((alternateEntry[0] & 0x80) && (charset & 0x10)) ||
|
||||
((alternateEntry[2] & 0x80) && (charset & 0x60))) {
|
||||
character = (ziU16)(alternateEntry[0] & 0x7F) << 8 | alternateEntry[1];
|
||||
relatedOrdinal = (ziU16)(alternateEntry[2] & 0x7F) << 8 | alternateEntry[3];
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + character;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto phonetic_pair_next;
|
||||
charsetEntry = charsetTable + relatedOrdinal;
|
||||
if (!(charsetEntry[0] & charsetFilter)) goto phonetic_pair_next;
|
||||
} else {
|
||||
record = records + character * 12;
|
||||
if (!(record[0] & charset)) goto phonetic_pair_next;
|
||||
record = records + relatedOrdinal * 12;
|
||||
if (!(record[0] & charset)) goto phonetic_pair_next;
|
||||
}
|
||||
if (isFirstCandidate || phoneticGroupWildcard) {
|
||||
record = records + character * 12;
|
||||
candidateStatus = (Zi8GetPCode(phoneticTable, record) & match.phon[0]) == match.phon2[0];
|
||||
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
|
||||
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, character,
|
||||
match.phon[0], match.phon2[0], charset, work)) candidateStatus = 1;
|
||||
if (!candidateStatus) goto phonetic_pair_next;
|
||||
record = records + relatedOrdinal * 12;
|
||||
candidateStatus = (Zi8GetPCode(phoneticTable, record) & match.phon[1]) == match.phon2[1];
|
||||
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
|
||||
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, relatedOrdinal,
|
||||
match.phon[1], match.phon2[1], charset, work)) candidateStatus = 1;
|
||||
if (!candidateStatus) goto phonetic_pair_next;
|
||||
}
|
||||
output[outputIndex] = Zi8Ord2Uni(character, work);
|
||||
output[outputIndex + 1] = Zi8Ord2Uni(relatedOrdinal, work);
|
||||
output[outputIndex + 2] = ' ';
|
||||
if (!Zi8IsDupWordW(output + outputIndex, 2, work)) {
|
||||
if (skipCount) --skipCount;
|
||||
else {
|
||||
++totalResults;
|
||||
if (!options->countOnly) {
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = output[outputIndex];
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
outputIndex += 3;
|
||||
++emittedCount;
|
||||
if (emittedCount >= request->maxCandidates || outputIndex > outputLimit) goto engine_finish;
|
||||
} else if (totalResults >= options->maxResults) goto engine_finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
phonetic_pair_next:
|
||||
@@ -2584,7 +2594,6 @@ filtered_next:
|
||||
case 5: goto cangjie_filtered_done;
|
||||
}
|
||||
goto engine_finish;
|
||||
|
||||
}
|
||||
|
||||
static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
|
||||
@@ -2671,72 +2680,69 @@ static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
|
||||
/* MWCC needs both candidate cursor advances in the loop body. */
|
||||
while (candidateIndex < groupSize) {
|
||||
character = groupCandidates[0] | (ziU16)groupCandidates[1] << 8;
|
||||
if (!(charset & records[character].flags)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + character;
|
||||
if (!(*charsetEntry & charsetFilter)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
}
|
||||
if (!wordMode) {
|
||||
if (useFoundCandidates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, character, work)) {
|
||||
if (charset & records[character].flags) {
|
||||
if (charsetTable) {
|
||||
charsetEntry = charsetTable + character;
|
||||
if (!(*charsetEntry & charsetFilter)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
} else if (Zi8IsDupWChar(character, work)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
}
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
character = Zi8Ord2Uni(character, work);
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (character == previousCharacter) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
previousCharacter = character;
|
||||
if (wordMode && Zi8IsDupWordW(&character, 1, work)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
if (remainingSkip) {
|
||||
--remainingSkip;
|
||||
} else {
|
||||
++totalResults;
|
||||
if (!options->countOnly) {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) {
|
||||
((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
}
|
||||
if (wordMode) {
|
||||
++emittedCount;
|
||||
output[emittedCharacters++] = character;
|
||||
output[emittedCharacters++] = 0x20;
|
||||
if (emittedCharacters > capacity) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB54, work);
|
||||
return 0;
|
||||
if (!wordMode) {
|
||||
if (useFoundCandidates) {
|
||||
if ((ziU8)Zi8SetFindCand(request->scratch, character, work)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
} else {
|
||||
output[emittedCount++] = character;
|
||||
} else if (Zi8IsDupWChar(character, work)) {
|
||||
goto next_group_candidate;
|
||||
}
|
||||
if (emittedCount >= request->maxCandidates) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB55, work);
|
||||
return 0;
|
||||
}
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
character = Zi8Ord2Uni(character, work);
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = character;
|
||||
if (character != previousCharacter) {
|
||||
previousCharacter = character;
|
||||
if (!wordMode || !(Zi8IsDupWordW(&character, 1, work))) {
|
||||
if (remainingSkip) {
|
||||
--remainingSkip;
|
||||
} else {
|
||||
++totalResults;
|
||||
if (!options->countOnly) {
|
||||
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) {
|
||||
((ZiChineseWork*)work)->duplicateIndex = 0;
|
||||
}
|
||||
if (wordMode) {
|
||||
++emittedCount;
|
||||
output[emittedCharacters++] = character;
|
||||
output[emittedCharacters++] = 0x20;
|
||||
if (emittedCharacters > capacity) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB54, work);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
output[emittedCount++] = character;
|
||||
}
|
||||
if (emittedCount >= request->maxCandidates) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB55, work);
|
||||
return 0;
|
||||
}
|
||||
} else if (totalResults >= options->maxResults) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB56, work);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (totalResults >= options->maxResults) {
|
||||
*skipCount = remainingSkip;
|
||||
*resultCount = totalResults;
|
||||
*candidateCount = emittedCount;
|
||||
*outputCount = emittedCharacters;
|
||||
Zi8ReplaceLastError(0xB56, work);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
next_group_candidate:
|
||||
|
||||
@@ -643,7 +643,7 @@ ziU32 Zi8GetSInfo(ziU8* strokes, ziU8* extraStrokes, ziWChar* outputBuffer, ziU8
|
||||
{
|
||||
int strokeIndex;
|
||||
int outputCount;
|
||||
volatile int extraCount;
|
||||
int extraCount;
|
||||
|
||||
outputCount = 0;
|
||||
Zi8LogError(100, work);
|
||||
@@ -652,17 +652,14 @@ ziU32 Zi8GetSInfo(ziU8* strokes, ziU8* extraStrokes, ziWChar* outputBuffer, ziU8
|
||||
return 0;
|
||||
}
|
||||
for (strokeIndex = 0; strokeIndex < 4; strokeIndex++) {
|
||||
if (strokeIndex == 0) {
|
||||
goto lowStroke;
|
||||
}
|
||||
outputBuffer[(ziU8)outputCount] = zi8StrokeCode((strokes[strokeIndex] & 0xf0) >> 4, work);
|
||||
if (outputBuffer[(ziU8)outputCount++] != 0) {
|
||||
goto lowStroke;
|
||||
}
|
||||
if (strokeIndex != 0) {
|
||||
outputBuffer[(ziU8)outputCount] = zi8StrokeCode((strokes[strokeIndex] & 0xf0) >> 4, work);
|
||||
if (outputBuffer[(ziU8)outputCount++] == 0) {
|
||||
badStroke:
|
||||
outputBuffer[(ziU8)--outputCount] = 0;
|
||||
return outputCount;
|
||||
lowStroke:
|
||||
outputBuffer[(ziU8)--outputCount] = 0;
|
||||
return outputCount;
|
||||
}
|
||||
}
|
||||
outputBuffer[(ziU8)outputCount] = zi8StrokeCode(strokes[strokeIndex] & 0xf, work);
|
||||
if (outputBuffer[(ziU8)outputCount++] == 0) {
|
||||
goto badStroke;
|
||||
@@ -939,7 +936,6 @@ ziU32 ZiCharInfo2(ziWChar ch, ziWChar* charInfoBuffer, ziU8 maxInfoBufSize, ziU3
|
||||
}
|
||||
Zi8LogError(100,work);
|
||||
return count;
|
||||
|
||||
}
|
||||
index++;
|
||||
tablePtr = tablePtr + 4;
|
||||
|
||||
@@ -124,15 +124,16 @@ check_keys:
|
||||
}
|
||||
if (context->cnt < count) goto descend;
|
||||
}
|
||||
if (context->cnt < search[1]) goto descend;
|
||||
if (search[0] != 0 && context->cnt > search[1]) goto next_sibling;
|
||||
if (acceptPrefix != 0 || ZiDAWGgetEOWattribute(current->node)) {
|
||||
for (index = 0; index < context->cnt; index++) output[index] = (ziU16)records[index].attr;
|
||||
result = context->cnt;
|
||||
searching = 0;
|
||||
if (acceptPrefix != 0) goto next_sibling;
|
||||
if (context->cnt >= search[1]) {
|
||||
if (search[0] != 0 && context->cnt > search[1]) goto next_sibling;
|
||||
if (acceptPrefix != 0 || ZiDAWGgetEOWattribute(current->node)) {
|
||||
for (index = 0; index < context->cnt; index++) output[index] = (ziU16)records[index].attr;
|
||||
result = context->cnt;
|
||||
searching = 0;
|
||||
if (acceptPrefix != 0) goto next_sibling;
|
||||
}
|
||||
if (search[0] != 0 && context->cnt >= search[1]) goto next_sibling;
|
||||
}
|
||||
if (search[0] != 0 && context->cnt >= search[1]) goto next_sibling;
|
||||
descend:
|
||||
records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node);
|
||||
if (records[context->cnt].node != (ziU8*)0) {
|
||||
@@ -148,6 +149,7 @@ next_sibling:
|
||||
}
|
||||
current = &records[context->cnt - 1];
|
||||
}
|
||||
|
||||
finish_graph:
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -179,25 +179,25 @@ match_syllable:
|
||||
goto syllable_found;
|
||||
}
|
||||
}
|
||||
if (needKeyFallback == 0) goto end;
|
||||
|
||||
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && allowHyphen != 0) {
|
||||
keyLayout[0] = 0x2D;
|
||||
keyLayout[1] = 0;
|
||||
Zi8getKeyLayout(param->language, param->elements[0], &keyLayout[1], 1, ZI_WORK);
|
||||
for (index = 1; keyLayout[index] != 0; index++) {
|
||||
if (keyLayout[index] == 0x2D) break;
|
||||
if (needKeyFallback != 0) {
|
||||
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && allowHyphen != 0) {
|
||||
keyLayout[0] = 0x2D;
|
||||
keyLayout[1] = 0;
|
||||
Zi8getKeyLayout(param->language, param->elements[0], &keyLayout[1], 1, ZI_WORK);
|
||||
for (index = 1; keyLayout[index] != 0; index++) {
|
||||
if (keyLayout[index] == 0x2D) break;
|
||||
}
|
||||
while (keyLayout[index] != 0) {
|
||||
keyLayout[index] = keyLayout[index + 1];
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
Zi8getKeyLayout(param->language, param->elements[0], keyLayout, 1, ZI_WORK);
|
||||
}
|
||||
while (keyLayout[index] != 0) {
|
||||
keyLayout[index] = keyLayout[index + 1];
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
Zi8getKeyLayout(param->language, param->elements[0], keyLayout, 1, ZI_WORK);
|
||||
syllableLength = 1;
|
||||
nextCharacter = keyLayout;
|
||||
goto next_syllable;
|
||||
}
|
||||
syllableLength = 1;
|
||||
nextCharacter = keyLayout;
|
||||
goto next_syllable;
|
||||
|
||||
end:
|
||||
if (sw->countOnly != 0) {
|
||||
|
||||
@@ -66,18 +66,17 @@ retry:
|
||||
getParam.getMode = 0;
|
||||
if (_Zi8GetCandidates(&getParam, __zi8_work_data) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
goto next;
|
||||
} else {
|
||||
getParam.getMode = 1;
|
||||
if (_Zi8GetCandidates(&getParam, __zi8_work_data) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
} else {
|
||||
getParam.getMode = 2;
|
||||
if (_Zi8GetCandidates(&getParam, __zi8_work_data) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
}
|
||||
}
|
||||
}
|
||||
getParam.getMode = 1;
|
||||
if (_Zi8GetCandidates(&getParam, __zi8_work_data) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
goto next;
|
||||
}
|
||||
getParam.getMode = 2;
|
||||
if (_Zi8GetCandidates(&getParam, __zi8_work_data) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
}
|
||||
next:
|
||||
if (getParam.subLanguage == 1) {
|
||||
getParam.subLanguage = 4;
|
||||
goto retry;
|
||||
|
||||
@@ -393,15 +393,14 @@ next_group:
|
||||
do {
|
||||
dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
|
||||
sound += 2;
|
||||
if (hasString) {
|
||||
goto phonetic_skip;
|
||||
}
|
||||
code = Zi8GetPCode(pCodeTable, dictionary + (dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
|
||||
if (((code & masks[partIndex]) != values[partIndex]) && (altMode == 0) && (dictionary[(dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
|
||||
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, dictionaryIndex & 0x7FFF, masks[partIndex], values[partIndex], flag, ZI_WORK);
|
||||
}
|
||||
if ((code & masks[partIndex]) == values[partIndex]) {
|
||||
goto phonetic_matched;
|
||||
if (!hasString) {
|
||||
code = Zi8GetPCode(pCodeTable, dictionary + (dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
|
||||
if (((code & masks[partIndex]) != values[partIndex]) && (altMode == 0) && (dictionary[(dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
|
||||
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, dictionaryIndex & 0x7FFF, masks[partIndex], values[partIndex], flag, ZI_WORK);
|
||||
}
|
||||
if ((code & masks[partIndex]) == values[partIndex]) {
|
||||
goto phonetic_matched;
|
||||
}
|
||||
}
|
||||
phonetic_skip:
|
||||
if ((dictionaryIndex & 0x8000) == 0) {
|
||||
@@ -480,17 +479,14 @@ ziU8 Zi8GetPyPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final, z
|
||||
initial[outputIndex] = 0;
|
||||
final[outputIndex] = 0;
|
||||
value = *current;
|
||||
if (value < 0x61) {
|
||||
goto check_pinyin_extension;
|
||||
if (value >= 0x61) {
|
||||
if (value <= 0x7A) {
|
||||
goto pinyin_ascii;
|
||||
}
|
||||
}
|
||||
if (value <= 0x7A) {
|
||||
goto pinyin_ascii;
|
||||
if (value >= 0xF361) {
|
||||
if (value <= 0xF37A) goto pinyin_extension;
|
||||
}
|
||||
check_pinyin_extension:
|
||||
if (value < 0xF361) {
|
||||
goto invalid_pinyin;
|
||||
}
|
||||
if (value <= 0xF37A) goto pinyin_extension;
|
||||
invalid_pinyin:
|
||||
*bestInitial = *bestFinal = initial[0] = final[0] = 0xFFFF;
|
||||
return 1;
|
||||
@@ -716,7 +712,6 @@ pinyin_initial:
|
||||
*resultCount -= 1;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
ziBool Zi8GetPyFinal(ziU8* pinyin, ziU8* initial, ziU8* final) {
|
||||
|
||||
@@ -66,15 +66,14 @@ ziU16 Zi8Uni2Ptr(ziU16 ch, ziE12* buf ZI_NEED_WORK) {
|
||||
if (ZI_WORK->unicodeMap != ZI8_NULL && ZI_WORK->unicodeMapSubLang == ZI_WORK->subLanguage) {
|
||||
if (ch >= ZI_WORK->unicodeRange1Min && ch <= ZI_WORK->unicodeRange1Max) {
|
||||
i = (ziU16)(ch - ZI_WORK->unicodeRange1Min);
|
||||
goto map;
|
||||
} else {
|
||||
if (ch >= ZI_WORK->unicodeRange2Min && ch <= ZI_WORK->unicodeRange2Max) {
|
||||
i = (ziU16)(ZI_WORK->unicodeRange1Max + (ch - ZI_WORK->unicodeRange2Min) -
|
||||
ZI_WORK->unicodeRange1Min + 1);
|
||||
} else {
|
||||
return 0xFFFF;
|
||||
}
|
||||
}
|
||||
if (ch >= ZI_WORK->unicodeRange2Min && ch <= ZI_WORK->unicodeRange2Max) {
|
||||
i = (ziU16)(ZI_WORK->unicodeRange1Max + (ch - ZI_WORK->unicodeRange2Min) -
|
||||
ZI_WORK->unicodeRange1Min + 1);
|
||||
goto map;
|
||||
}
|
||||
return 0xFFFF;
|
||||
map:
|
||||
i = ZI_WORK->unicodeMap[i];
|
||||
if (i != 0xFFFF) {
|
||||
e = (ziU8*)table + i * 0xC;
|
||||
|
||||
@@ -76,16 +76,14 @@ ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
|
||||
i = 2;
|
||||
}
|
||||
|
||||
if (i-- > m) {
|
||||
goto fail;
|
||||
if (i-- <= m) {
|
||||
for (k = 0; k < i; k++) {
|
||||
pdst[k] = psrc[k];
|
||||
}
|
||||
pdst[k] = 0;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
for (k = 0; k < i; k++) {
|
||||
pdst[k] = psrc[k];
|
||||
}
|
||||
pdst[k] = 0;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
if (count >= maxLen) {
|
||||
count = (ziU8)(maxLen - 1);
|
||||
|
||||
@@ -103,7 +103,7 @@ ziU8 Zi8MatchUWDdata(ziWChar* pattern, ziU8 length, ziWChar* currentWord, ziU16
|
||||
ziU32 size;
|
||||
int headerSize;
|
||||
int entryLanguage;
|
||||
volatile int entryLength;
|
||||
int entryLength;
|
||||
int previousOffset;
|
||||
int visited = 0;
|
||||
int fallback = 0;
|
||||
|
||||
@@ -301,133 +301,131 @@ ziU32 Zi8GetKOcandidates(ziGetParam* param, ZiKoreanCandidateOptions* options ZI
|
||||
param->candidates[0] = 0;
|
||||
}
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
if (param->wordCharCount == 0) goto scan_key_table;
|
||||
{
|
||||
if (((keyIndex = Zi8_8148302C(param->currentWord[0], keyTable, ZI_WORK)) != 0xFFFF) &&
|
||||
((keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, keyBytes[4])] & 8) != 0)) {
|
||||
wordOffset = keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, childLow)] |
|
||||
((keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, keyBytes[4])] & 3) << 16 |
|
||||
keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, childHigh)] << 8);
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
wordNode = wordTable + wordOffset;
|
||||
if (param->wordCharCount != 0) {
|
||||
{
|
||||
if (((keyIndex = Zi8_8148302C(param->currentWord[0], keyTable, ZI_WORK)) != 0xFFFF) &&
|
||||
((keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, keyBytes[4])] & 8) != 0)) {
|
||||
wordOffset = keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, childLow)] |
|
||||
((keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, keyBytes[4])] & 3) << 16 |
|
||||
keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, childHigh)] << 8);
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
wordNode = wordTable + wordOffset;
|
||||
match_word:
|
||||
while (remainingLetters != 0) {
|
||||
keyIndex = Zi8_8148302C(param->currentWord[wordIndex], keyTable, ZI_WORK);
|
||||
if (keyIndex == (((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1])) {
|
||||
--remainingLetters;
|
||||
++wordIndex;
|
||||
if ((*wordNode & 0x40) != 0) {
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
break;
|
||||
}
|
||||
wordNode += 2;
|
||||
} else {
|
||||
wordIndex = 1;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (remainingLetters == 0) {
|
||||
keyIndex = ((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1];
|
||||
character = (ziU16)((ziU16)keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, characterHigh)] << 8 |
|
||||
keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, characterLow)]);
|
||||
if (param->wordCharCount == 1) {
|
||||
if (keyIndex == previousIndex) {
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
while (remainingLetters != 0) {
|
||||
keyIndex = Zi8_8148302C(param->currentWord[wordIndex], keyTable, ZI_WORK);
|
||||
if (keyIndex == (((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1])) {
|
||||
--remainingLetters;
|
||||
++wordIndex;
|
||||
if ((*wordNode & 0x40) != 0) {
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
break;
|
||||
}
|
||||
wordNode += 2;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
} else {
|
||||
wordIndex = 1;
|
||||
goto next_word;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
break;
|
||||
}
|
||||
previousIndex = keyIndex;
|
||||
if (param->elementCount == 0) {
|
||||
if (remainingCandidates != 0) {
|
||||
--remainingCandidates;
|
||||
} else {
|
||||
if (options->countOnly != 0) {
|
||||
if (++prefixCount < (ziS32)options->maxCount) {
|
||||
goto skip_word;
|
||||
}
|
||||
return options->maxCount;
|
||||
}
|
||||
if (remainingLetters == 0) {
|
||||
keyIndex = ((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1];
|
||||
character = (ziU16)((ziU16)keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, characterHigh)] << 8 |
|
||||
keyTable[(keyIndex << 3) + keyIndex + offsetof(ZiKoreanKeyEntry, characterLow)]);
|
||||
if (param->wordCharCount == 1) {
|
||||
if (keyIndex == previousIndex) {
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
}
|
||||
wordNode += 2;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
goto next_word;
|
||||
}
|
||||
previousIndex = keyIndex;
|
||||
if (param->elementCount == 0) {
|
||||
if (remainingCandidates != 0) {
|
||||
--remainingCandidates;
|
||||
} else {
|
||||
if (options->countOnly != 0) {
|
||||
if (++prefixCount < (ziS32)options->maxCount) {
|
||||
goto skip_word;
|
||||
}
|
||||
return options->maxCount;
|
||||
}
|
||||
param->candidates[candidateCount++] = character;
|
||||
++param->count;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
return param->letters;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
param->candidates[candidateCount++] = character;
|
||||
++param->count;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
return param->letters;
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
if (candidateCount < param->maxCandidates) goto skip_word;
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
candidateCount = 0;
|
||||
} else {
|
||||
return candidateCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
param->candidates[candidateCount++] = character;
|
||||
++param->count;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
if (candidateCount < param->maxCandidates) goto skip_word;
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
candidateCount = 0;
|
||||
} else {
|
||||
return candidateCount;
|
||||
for (candidateIndex = 0; candidateIndex < candidateCount; candidateIndex++) {
|
||||
if (character == param->candidates[candidateIndex]) break;
|
||||
}
|
||||
if ((candidateIndex == candidateCount) &&
|
||||
(Zi8_814833F0(param, character, ZI_WORK) == 0)) {
|
||||
param->candidates[candidateCount++] = character;
|
||||
++param->count;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
if (candidateCount >= param->maxCandidates) {
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
candidateCount = 0;
|
||||
} else {
|
||||
return candidateCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (candidateIndex = 0; candidateIndex < candidateCount; candidateIndex++) {
|
||||
if (character == param->candidates[candidateIndex]) break;
|
||||
}
|
||||
if ((candidateIndex == candidateCount) &&
|
||||
(Zi8_814833F0(param, character, ZI_WORK) == 0)) {
|
||||
param->candidates[candidateCount++] = character;
|
||||
++param->count;
|
||||
if (++param->letters < param->maxCandidates) {
|
||||
goto skip_word;
|
||||
}
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
if (candidateCount < param->maxCandidates) goto skip_word;
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
candidateCount = 0;
|
||||
} else {
|
||||
return candidateCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
skip_word:
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
}
|
||||
wordNode += 2;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
next_word:
|
||||
if ((*wordNode & 0x80) == 0) {
|
||||
goto match_word;
|
||||
}
|
||||
}
|
||||
skip_word:
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
}
|
||||
resultCount = prefixCount;
|
||||
if (candidateCount != 0) {
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
resultCount = prefixCount;
|
||||
}
|
||||
wordNode += 2;
|
||||
remainingLetters = param->wordCharCount - 1;
|
||||
wordIndex = 1;
|
||||
next_word:
|
||||
if ((*wordNode & 0x80) != 0) {
|
||||
goto search_table;
|
||||
}
|
||||
goto match_word;
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
}
|
||||
}
|
||||
search_table:
|
||||
resultCount = prefixCount;
|
||||
if (candidateCount != 0) {
|
||||
Zi8_814834AC(param, &remainingCandidates, &candidateCount, &inserted, ZI_WORK);
|
||||
if (options->countOnly != 0) {
|
||||
if ((prefixCount += candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
resultCount = prefixCount;
|
||||
}
|
||||
param->count = candidateCount;
|
||||
param->letters = candidateCount;
|
||||
}
|
||||
scan_key_table:
|
||||
if (param->elementCount > 9) {
|
||||
param->letters = 0;
|
||||
return 0;
|
||||
|
||||
@@ -68,17 +68,12 @@ ziBool Zi8getKeyLayout(ziU8 language, ziWChar key, ziWChar* chars, ziU8 mode, zi
|
||||
chars[keyIndex] = 0;
|
||||
return 1;
|
||||
} else {
|
||||
if (mode == 1) {
|
||||
goto table_1e;
|
||||
if (mode != 1) {
|
||||
if ((tableCount = Zi8GetTableCount(language, 0x1d, __zi8_work_data)) != 0) {
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1d, __zi8_work_data);
|
||||
goto tables_ready;
|
||||
}
|
||||
}
|
||||
if ((tableCount = Zi8GetTableCount(language, 0x1d, __zi8_work_data)) == 0) {
|
||||
goto table_1e;
|
||||
}
|
||||
{
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1d, __zi8_work_data);
|
||||
goto tables_ready;
|
||||
}
|
||||
table_1e:
|
||||
if ((tableCount = Zi8GetTableCount(language, 0x1e, __zi8_work_data)) != 0) {
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1e, __zi8_work_data);
|
||||
}
|
||||
|
||||
@@ -53,26 +53,28 @@ posEntry:
|
||||
if ((ziS32)position < length) {
|
||||
if (complete) word[length] = 1; else word[length] = 0;
|
||||
if (++index >= ZI_WORK->oemLen) goto oemFailed;
|
||||
} else {
|
||||
if (fallback) {
|
||||
index = 0;
|
||||
*word = *pattern;
|
||||
return 1;
|
||||
}
|
||||
ZI_WORK->oemIdx = ++index;
|
||||
while (word[position] != 0) position++;
|
||||
return position;
|
||||
}
|
||||
matchRetry:
|
||||
if (index < ZI_WORK->oemLen) {
|
||||
if (ZI_WORK->oemMatch(index, word, capacity, ZI_WORK->oemData)) {
|
||||
goto posEntry;
|
||||
}
|
||||
}
|
||||
oemFailed:
|
||||
if (length == 1 && complete && !continuation) {
|
||||
complete = 0;
|
||||
fallback = 1;
|
||||
index = 0;
|
||||
goto matchRetry;
|
||||
}
|
||||
if (fallback) {
|
||||
index = 0;
|
||||
*word = *pattern;
|
||||
return 1;
|
||||
}
|
||||
ZI_WORK->oemIdx = ++index;
|
||||
while (word[position] != 0) position++;
|
||||
return position;
|
||||
matchRetry:
|
||||
if (index >= ZI_WORK->oemLen) goto oemFailed;
|
||||
if (!ZI_WORK->oemMatch(index, word, capacity, ZI_WORK->oemData)) goto oemFailed;
|
||||
goto posEntry;
|
||||
oemFailed:
|
||||
if (length != 1 || !complete || continuation) goto tail0;
|
||||
complete = 0;
|
||||
fallback = 1;
|
||||
index = 0;
|
||||
goto matchRetry;
|
||||
tail0:
|
||||
return 0;
|
||||
}
|
||||
|
||||
290
tools/decomp-assist/clean3-c2.attempts.md
Normal file
290
tools/decomp-assist/clean3-c2.attempts.md
Normal file
@@ -0,0 +1,290 @@
|
||||
# clean3-c2 attempts
|
||||
|
||||
Worktree `/mnt/drive2/projects/wii-ipl-workers/clean3-c2`, branch `agent/w1009/clean3-c2`, baseline `8a67b68cf`.
|
||||
|
||||
Scope: eZiText sources and their module headers. Each cleanup must preserve allocated section bytes, sizes and alignments, normalized relocation destinations, and function extents. Rebuild rejected source before the next trial. Commit cleaned files separately and gate all changed units together at the end.
|
||||
|
||||
Baseline DOL SHA1 is `26116613f624061ba99c8d1a299aaa6efa85670d`. Live report has 12563/12563 exact functions and 100% code, data and linking. Global fuzzy is 99.999886; exact-unit gates take priority over that rounded global value.
|
||||
|
||||
Read clean3-head.md, cleanup-common.md, AGENTS.md and prior cleanup2-w1 and cleanup-c6 evidence. The cleanup2-w3 and cleanup2-x9 eZiText mentions only describe out-of-scope files; they contain no further eZiText trials. Applied unslop and writing-for-agents to this log.
|
||||
|
||||
Skip previously rejected direct engine returns, spelling/punctuation store separation, candidate advances moved to for headers, backward alternate-sound scan rewrites, phonetic-group loop rewrites, and scalar removal of the PUD workspace carrier. New trials target remaining forward guards and exits, preserving existing cursor statements and common cleanup exits.
|
||||
|
||||
No function-scoped optimizer pragmas or use-site volatile casts occur in this module. The two volatile locals are checked separately. Temporary snapshots and compiler output live under `/tmp/clean3-c2-baseline`.
|
||||
|
||||
## Trials
|
||||
- KEEP `zi8cinfo` remove volatile extraCount: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8uwd` remove volatile entryLength: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cinfo` Zi8GetSInfo guarded high stroke: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alts` Zi8MatchAltSound bounded backward scan: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard context_phrase_next at line 1257: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard user_character_next at line 1801: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard global_character_next at line 1836: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard component_phrase_next at line 1994: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard component_phrase_charset at line 2008: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard frequency_record_next at line 2078: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard phonetic_pair_next at line 2249: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard next_group_candidate at line 2680: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` forward guard START_PROCESS at line 360: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` forward guard finishCandidates at line 1434: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` forward guard checkPrefixFields at line 1559: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8dawg` forward guard finish_graph at line 33: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8dawg` forward guard descend at line 127: compile failed.
|
||||
- KEEP `zi8match` forward guard phonetic_skip at line 396: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8match` forward guard check_pinyin_extension at line 482: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8match` forward guard invalid_pinyin at line 487: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8getSW` forward guard end at line 182: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zkokeyp` forward guard scan_key_table at line 304: compile failed.
|
||||
- KEEP `zi8alts` forward guard up at line 25: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` forward guard oemFailed at line 67: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` forward guard tail0 at line 72: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify inverted negated guards: allocated sections, resolved relocations and function extents identical.
|
||||
- Trial generator correction: the first descend and scan_key_table drafts inverted the greater-than character in a pointer arrow. Both failed compilation and were restored. The corrected generator leaves pointer arrows intact; retest those equivalent guards.
|
||||
- KEEP `zi8dawg` forward guard descend at line 127: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zkokeyp` forward guard scan_key_table at line 304: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8space` forward guard fail at line 79: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zmtkey` forward guard table_1e at line 71: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard context_phrase_next at line 1259: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard global_character_next at line 1846: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard global_character_next at line 1861: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard component_phrase_next at line 2031: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard next_group_candidate at line 2707: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` forward guard next_group_candidate at line 2709: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` forward guard nextPhrase at line 1490: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` forward guard nextUserOrdinal at line 1625: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` forward guard nextOrdinal at line 1681: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` forward guard nextOrdinal at line 1683: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` forward guard filterVowelCandidate at line 946: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` forward guard finishCandidates at line 1568: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8getSW` forward guard search_syllables at line 130: .text.
|
||||
- KEEP `zkokeyp` forward guard skip_word at line 388: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zkokeyp` forward guard skip_word at line 392: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zkokeyp` forward guard search_table at line 415: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` forward guard oemFailed at line 68: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zmtkey` forward guard table_1e at line 72: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` numeric_setup loop break: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` vowel loop break: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` prepareRememberedPunctuation loop break: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `ziswordw` found loop break: .text.
|
||||
- REVERT `zi8cgetc` phonetic_record_next structured else branch: compile failed.
|
||||
- KEEP `zi81key` START_PROCESS structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8dawg` descend structured else branch: compile failed.
|
||||
- KEEP `zi8getSW` end structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alts` up structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alts` hi_check structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` matchRetry structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8is` next structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8misc` map structured else branch: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !*spelling || spelling == end: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidate || !spellingLength: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidate[index] || candidate[index] != spelling[index]: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8ZHaddSpace(spelling, spellingLength, spacedSpelling, 64, __zi8_work_data): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8ZHaddSpace(candidate, candidateLength, spacedCandidate, 64, __zi8_work_data): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !ZiPartialMatch(spellingCursor, spacedSpelling + 64, : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !((struct __zi8_work_data_s*)work)->cangjieEnabled || request->elementCount > 6: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !index || index + 1 != request->elementCount: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !(request->context & 0x10) && (elements[request->elementCount - 1] == 0xF: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !ordinalCount && getMode == 0 && request->elementCount == 1 && elements[0] == 0xEF00: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !Zi8IsCharacter(character, work) || (!emitWords && character == previousOrdinal): .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && Zi8MatchAlt: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && : .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !(((options->countOnly && getOptions != 5) || !wordLength || getMode == 5 || : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !request->elementCount || (getMode == 0 && request->elementCount == 1 && elements[0] : .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !((currentSpelling[rangeCount] == 0x2C9 && elements[rangeIndex] == 0xF331) || : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && Zi8: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && Zi8Matc: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateWord[0] || ZiMatchZHSpelling(currentSpelling, candidateWord, request->eleme: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && !filteringMode && : .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !(!emitWords && isFirstCandidate == previousOrdinal): allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !request->elementCount && !options->countOnly && request->wordCharCount && Zi: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !options->countOnly && !ordinalCount && match.nCand <= 1 && match.nSeg <= 1 && : .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !request->elementCount && (getMode == 7 || getMode == 8 || getMode == 9): .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !options->countOnly && ordinalCount && (getMode == 7 || getMode == 8 || getMode == 9): .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && !((phraseEntry[0] & 7) >= match.length && match.p: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8ExactMatchNextChar(record, match.prefixMasks[0], match.prefixValues[0], match.pre: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !options->countOnly && phoneticRetry && ordinalCount && getMode != 5: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !Zi8PriMatchNextChar(record, match.recordMasks[0], match.recordValues[0], match.recor: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !options->countOnly && !phoneticRetry && ordinalCount && getMode != 7 && getM: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8MatchPhonetic(phoneticTable, records, alternateTable, alternateCount, : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && Zi8: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !(!candidateStatus && !((phraseEntry[0] & 7) >= match.length && : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !filteringMode || match.nSeg <= 1: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8PriMatchNextChar(record, match.recordMasks[0], match.recordValues[0], match.recor: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !emitWords || request->getMode != 16 || match.nSeg <= 1: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !(ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !(duplicateIndex < match.nSeg && (match.segmentValues[duplicateIn: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8PriMatchNextChar(record, match.recordMasks[0], match.recordValues[0], match.recor: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !(ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !(charsetTable && !(charsetEntry[0] & charsetFilter)): allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !charsetTable || charsetEntry[0] & charsetFilter: .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8IsDupWordW(&candidateOrdinal, 1, work): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8PriMatchNextComp(componentCursor, match.recordMasks[0], match.recordValues[0], ma: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !emitWords && emittedCount < request->maxCandidates && getMode != 5: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !frequencyEntry[1] || !frequencyEntry[2]: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !frequencyEntry[3] || !frequencyEntry[4]: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && : .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !candidateStatus && (record[0] & 0x80) && !requireFull && : .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8IsDupWordW(output + outputIndex, 2, work): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !(ziU8)Zi8NewMatchPhonetic(request, (ZiChineseRecord*)records, alternateTable, altern: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8MatchPhonetic(phoneticTable, records, alternateTable, alternateCount, : allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !emitWords || match.nCand <= 1: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !switchedPhonetic || emittedCount >= request->maxCandidates: .text.
|
||||
- REVERT `zi8cgetc` simplify predicate !totalResults && !request->firstCandidate && getMode == 1 && match.nCand > 1 && : .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !(wordMode && Zi8IsDupWordW(&character, 1, work)): allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8cgetc` simplify predicate !wordMode || !(Zi8IsDupWordW(&character, 1, work)): .text.
|
||||
- KEEP `zi8cgetc` simplify predicate !Zi8MatchPhonetic(phonetics, (ziU8*)records, indexTable, indexCount, : allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` simplify predicate !((keyHigh == records[searchIndex].keyHigh) && (keyLow == records[searchI: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8alpha` simplify predicate !work->suffixMode || !work->suffixLocked: .text.
|
||||
- REVERT `zi8alpha` simplify predicate !work->requiredLength || length == work->requiredLength: .text.
|
||||
- REVERT `zi8alpha` simplify predicate !work->suffixLocked && work->highlightedLanguage > 1: .text.
|
||||
- KEEP `zi8alpha` simplify predicate !Zi8IsVowel(47, *ending): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` simplify predicate !Zi8IsVowel(88, *ending): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` simplify predicate !(((((ZiAlphaOptions*)optionData)->lookupMode == '\0') && (parameters->subLanguage !=: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` simplify predicate !((((ZiAlphaOptions*)optionData)->lookupMode != '\0') || ((!completionAllowed && (!cu: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8alpha` simplify predicate !primaryMatched && !secondaryMatched: .text.
|
||||
- KEEP `zi8alpha` simplify predicate !(!completionAllowed && ((ZiAlphaWork*)workData)->suffixMode == 0 && ((ZiAlphaWork*)w: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8alpha` simplify predicate !completionAllowed && ((ZiAlphaWork*)workData)->suffixMode == 0 && parameters->elemen: .text.
|
||||
- KEEP `zi8alpha` simplify predicate !(prefixMode != 0 || prefixLength == 0 || elementCount <= 2 || prefixLength: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8dawg` simplify predicate !(count == 1 && mode != 0 && graphTable == 0xe): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8match` simplify predicate !(hasString): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alts` simplify predicate !((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo): allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zoemdata` simplify predicate !ZI_WORK->ignoreCase || language == ZI8_LANG_ZH: .text.
|
||||
- REVERT `zoemdata` simplify predicate !Zi8ChangeCharCase(1, &folded, language, __zi8_work_data) || folded != word[position]: .text.
|
||||
- KEEP `zoemdata` simplify predicate !(!ZI_WORK->oemMatch(index, word, capacity, ZI_WORK->oemData)): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` simplify predicate !(length != 1 || !complete || continuation): allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zmtkey` simplify predicate !Zi8MapKeyCode(key, &key, __zi8_work_data): allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zmtkey` simplify predicate !Zi8MapKeyCode(key, &key, __zi8_work_data) || (key >= numKeys): .text.
|
||||
- KEEP `zi81key` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cinfo` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8dawg` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8match` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8getSW` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8is` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8misc` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zmtkey` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zoemdata` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alts` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zkokeyp` format structured guards and remove extra call parentheses: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cinfo` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8dawg` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8getSW` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zkokeyp` preserve existing indentation outside changed scopes: allocated sections, resolved relocations and function extents identical.
|
||||
|
||||
Predicate trial review: only whole-condition negations were valid simplification candidates. Drafts that negated an initial operand of a compound condition changed code and were rejected. Redundant parentheses added around single calls were removed in the final format pass. The branch generator also rejected two drafts whose final goto belonged to an unbraced nested if; these were restored, and later trials required a standalone goto statement.
|
||||
- REVERT `zi8cgetc` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- REVERT `zi81key` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- REVERT `zi8alpha` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- REVERT `zi8match` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- REVERT `zi8cinfo` remove unused labels: .text, extab, extabindex, resolved relocations, function extents.
|
||||
- KEEP `zi8alts` remove unused labels: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zi8misc` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- REVERT `ziswordw` remove unused labels: .text, extabindex, resolved relocations, function extents.
|
||||
- KEEP `zmtkey` collapse redundant nested scope: allocated sections, resolved relocations and function extents identical.
|
||||
- Unused-label draft correction: the first label sweep also selected switch default labels. All seven byte-changing drafts were restored. The corrected sweep excludes default and retains every switch arm.
|
||||
- KEEP `zi8alts` name ordinal and phonetic search locals: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8is` Zi8GetZHCharSet nested candidate alternatives: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8misc` Zi8Uni2Ptr structured range fallback: allocated sections, resolved relocations and function extents identical.
|
||||
- REVERT `zoemdata` Zi8MatchOEMdata structured retry and fallback loops: .text, extabindex, resolved relocations, function extents.
|
||||
- KEEP `zi8cgetc` retain readable original PUD and tone predicates: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` final indentation and condition line breaks: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8cgetc` final indentation and condition line breaks: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zmtkey` final indentation and condition line breaks: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi81key` align alternate-sound search branch: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8dawg` retain common exit instead of a broad nested guard: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8alpha` retain common exit instead of a broad nested guard: allocated sections, resolved relocations and function extents identical.
|
||||
- KEEP `zi8getSW` retain common alpha exit instead of nesting the search: allocated sections, resolved relocations and function extents identical.
|
||||
|
||||
## Final source review
|
||||
|
||||
Retained common exits in zi8dawg, zi8alpha and zi8getSW rather than nesting most of those functions for a single removed goto. All three restorations preserve the baseline objects. Retained the original PUD eligibility and tone predicates because the expanded inversions were harder to read.
|
||||
|
||||
All 30 clib objects compare identical to baseline in allocated bytes, sizes, alignments, resolved relocation destinations and function extents. Removed 54 gotos and both volatile locals. Added no optimizer pragma, asm, carrier, cast workaround, or code comment. No headers changed.
|
||||
|
||||
| File | Gotos before | Gotos after |
|
||||
| --- | --- | --- |
|
||||
| zi81key.c | 52 | 46 |
|
||||
| zi8alpha.c | 34 | 29 |
|
||||
| zi8alts.c | 12 | 6 |
|
||||
| zi8cgetc.c | 199 | 184 |
|
||||
| zi8cinfo.c | 12 | 10 |
|
||||
| zi8dawg.c | 20 | 19 |
|
||||
| zi8getSW.c | 15 | 14 |
|
||||
| zi8is.c | 4 | 2 |
|
||||
| zi8match.c | 18 | 15 |
|
||||
| zi8misc.c | 2 | 0 |
|
||||
| zi8space.c | 3 | 2 |
|
||||
| zi8uwd.c | 7 | 7 |
|
||||
| zkokeyp.c | 12 | 8 |
|
||||
| zmtkey.c | 3 | 1 |
|
||||
| zoemdata.c | 10 | 6 |
|
||||
|
||||
Remaining jumps serve shared error/success exits, candidate cursor advances, binary-search transitions, or phonetic/dictionary state transitions. Keep the prior compiler constraints and PUD carrier as documented in cleanup2-w1 and cleanup-c6. The new equivalent OEM retry-loop trial changed text, function extents and extabindex, so its existing retry transitions remain.
|
||||
|
||||
## Retained cleanup by file
|
||||
|
||||
- zi81key.c: Guard phrase/user/ordinal matches and duplicate characters. Keep binary-search transitions, candidate cursor advances and the stored-initial-character condition.
|
||||
- zi8alpha.c: Use switch breaks and positive vowel/prefix guards. Simplify the language-eligibility predicate. Keep shared candidate exit, dictionary transitions and punctuation-store constraint.
|
||||
- zi8alts.c: Use a bounded backward scan and structured binary-search alternatives; name ordinal, cursor and phonetic locals. Keep the two binary-search transitions and shared match entry.
|
||||
- zi8cgetc.c: Use positive candidate, duplicate, charset and phonetic guards; break the prediction range. Keep shared engine exit and dictionary/phonetic state transitions with their original cursor statements.
|
||||
- zi8cinfo.c: Remove volatile extraCount; guard high-stroke decoding. Keep the common badStroke error path.
|
||||
- zi8dawg.c: Guard terminal candidate checks before child traversal. Keep shared finish_graph and sibling/child state transitions.
|
||||
- zi8getSW.c: Guard the single-key fallback. Keep the common exit and syllable retry/output transitions, including the required forward capacity branch.
|
||||
- zi8is.c: Use nested alternatives for the three candidate modes. Keep the sublanguage retry transition.
|
||||
- zi8match.c: Guard phonetic lookup and both pinyin ranges. Keep phonetic group transitions and common invalid-pinyin handling.
|
||||
- zi8misc.c: Select the two Unicode ranges through structured alternatives; remove both map jumps.
|
||||
- zi8space.c: Guard the successful output copy. Keep the shared fallback-copy path.
|
||||
- zi8uwd.c: Remove volatile entryLength. Keep UWD retry/error paths.
|
||||
- zkokeyp.c: Guard context-word lookup, capacity handling and sibling continuation. Keep matching-word retry and required cursor advances.
|
||||
- zmtkey.c: Guard the preferred key table; remove an extra nested scope. Keep the common table-ready join.
|
||||
- zoemdata.c: Guard callback retry and one-character fallback through structured alternatives. Keep OEM retry transitions; the nested-loop alternative changed bytes.
|
||||
|
||||
## Final validation
|
||||
|
||||
Ran gate.py once with --quick over all 30 clib units, including reverted-trial units. Full 43U build passed. GATE PASS; zero regressions, added forbidden patterns and added readability warnings. Gate output: `/tmp/clean3-c2-gate.log`.
|
||||
|
||||
Fresh report: every one of the 30 units has 100% code, data, functions, sections and linking. All 30 compiled objects also equal the initial baseline with normalized relocations. Focused pools for all 15 changed units are identical; ctxdiff for all 19 edited functions gives diffs 0 with equal instruction counts. Focused output: `/tmp/clean3-c2-focused.log`.
|
||||
|
||||
Completion checker: DECOMPLETE_OK. Assembly checker: ASM INVENTORY PASS, 162 ORIGINAL functions, 0 PLACEHOLDER. DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`. Whitespace check passed. No source changes followed validation.
|
||||
|
||||
| Changed unit | Exact functions before and after | Code bytes | Data bytes |
|
||||
| --- | --- | --- | --- |
|
||||
| zi81key | 9/9 | 21460/21460 | 1388/1388 |
|
||||
| zi8alpha | 12/12 | 21664/21664 | 564/564 |
|
||||
| zi8alts | 1/1 | 1200/1200 | 20/20 |
|
||||
| zi8cgetc | 8/8 | 47816/47816 | 536/536 |
|
||||
| zi8cinfo | 10/10 | 10948/10948 | 1848/1848 |
|
||||
| zi8dawg | 6/6 | 4868/4868 | 120/120 |
|
||||
| zi8getSW | 1/1 | 1852/1852 | 20/20 |
|
||||
| zi8is | 3/3 | 1136/1136 | 40/40 |
|
||||
| zi8match | 10/10 | 8256/8256 | 728/728 |
|
||||
| zi8misc | 4/4 | 1636/1636 | 80/80 |
|
||||
| zi8space | 1/1 | 776/776 | 20/20 |
|
||||
| zi8uwd | 4/4 | 2656/2656 | 80/80 |
|
||||
| zkokeyp | 7/7 | 5200/5200 | 180/180 |
|
||||
| zmtkey | 4/4 | 2216/2216 | 60/60 |
|
||||
| zoemdata | 3/3 | 976/976 | 60/60 |
|
||||
|
||||
## Source commits
|
||||
|
||||
- `957a39055` libs/RVLMiddleware/eZiText/src/clib/zi81key.c
|
||||
- `12bdc2a7e` libs/RVLMiddleware/eZiText/src/clib/zi8alpha.c
|
||||
- `838370954` libs/RVLMiddleware/eZiText/src/clib/zi8alts.c
|
||||
- `0eb24cad5` libs/RVLMiddleware/eZiText/src/clib/zi8cgetc.c
|
||||
- `8152d3da6` libs/RVLMiddleware/eZiText/src/clib/zi8cinfo.c
|
||||
- `9482de173` libs/RVLMiddleware/eZiText/src/clib/zi8dawg.c
|
||||
- `fc8f41798` libs/RVLMiddleware/eZiText/src/clib/zi8getSW.c
|
||||
- `a6a23be5d` libs/RVLMiddleware/eZiText/src/clib/zi8is.c
|
||||
- `48605c7b0` libs/RVLMiddleware/eZiText/src/clib/zi8match.c
|
||||
- `037dad697` libs/RVLMiddleware/eZiText/src/clib/zi8misc.c
|
||||
- `d3300f748` libs/RVLMiddleware/eZiText/src/clib/zi8space.c
|
||||
- `4152a2f2c` libs/RVLMiddleware/eZiText/src/clib/zi8uwd.c
|
||||
- `3eff13e83` libs/RVLMiddleware/eZiText/src/clib/zkokeyp.c
|
||||
- `3cddf9998` libs/RVLMiddleware/eZiText/src/clib/zmtkey.c
|
||||
- `330dd0bd7` libs/RVLMiddleware/eZiText/src/clib/zoemdata.c
|
||||
|
||||
Each source file was committed separately. No push, PR, merge, rebase, cross-worktree edit or subagent occurred.
|
||||
Reference in New Issue
Block a user