cleanup: eZiText (gotos, comma conditions) #1357

Merged
coah80 merged 1 commits from agent/w0929/cleanup2-w1-land into main 2026-10-09 18:02:35 +00:00
7 changed files with 659 additions and 539 deletions

View File

@@ -213,6 +213,7 @@ Zi8UInt Zi8SpellingZY(ziU16 *output,Zi8UInt key,ziU8 includeTone)
initialIndex = (ziU16)(((key & 0xffff) >> 9) & 0x3f);
finalIndex = (ziU16)(((key & 0xffff) >> 3) & 0x3f);
tone = (ziU16)(key & 7);
/* MWCC needs the stored initial character as the branch value. */
if ((output[0] = zi8ZYinitialSpelling[initialIndex]) != 0) {
length = 1;
}
@@ -250,7 +251,7 @@ Zi8UInt Zi8SpellingPY(ziU16 *output,Zi8UInt key,ziU8 includeTone)
Zi8UInt length = 0;
ziU16 initialIndex = (ziU16)(((key & 0xffff) >> 9) & 0x3f);
ziU16 finalIndex = (ziU16)(((key & 0xffff) >> 3) & 0x3f);
volatile ziU16 tone = (ziU16)(key & 7);
ziU16 tone = (ziU16)(key & 7);
output[0] = zi8PYinitialSpelling[initialIndex][0];
output[1] = zi8PYinitialSpelling[initialIndex][1];
@@ -363,7 +364,6 @@ ziU8 MatchAltSound1Key(ziU16 *spelling,Zi8UInt spellingLength,Zi8UInt requireFul
goto BINARY_SEARCH;
START_PROCESS:
recordIndex = searchIndex;
PROCESS:
do {
if (((records[recordIndex].flags & 0xeU) == 0) ||
((modifierFlags & records[recordIndex].flags) != 0)) {
@@ -402,7 +402,6 @@ BACKWARD_PROCESS:
}
}
}
goto BACKWARD_TEST;
BACKWARD_TEST:
recordIndex = recordIndex - 1;
if ((((int)recordIndex < 0) || (keyHigh != records[recordIndex].keyHigh)) ||
@@ -458,30 +457,25 @@ static int ZiIsSupportedPhonetic(ziU8 language,ziPtr work)
return 1;
}
switch (language) {
case 0x79:
case 0x7a:
case 0x7d:
goto LAB_group_b;
case 0x77:
case 0x78:
case 0x7c:
goto LAB_group_a;
if ((Zi8LangSupported(0x77,work) != 0) || (Zi8LangSupported(0x78,work) != 0) ||
(Zi8LangSupported(0x7c,work) != 0)) {
return 1;
}
case 0x79:
case 0x7a:
case 0x7d:
if ((Zi8LangSupported(0x79,work) == 0) && (Zi8LangSupported(0x7a,work) == 0) &&
(Zi8LangSupported(0x7d,work) == 0)) {
break;
}
return 1;
default:
goto LAB_return_false;
break;
}
LAB_group_a:
if ((Zi8LangSupported(0x77,work) != 0) || (Zi8LangSupported(0x78,work) != 0) ||
(Zi8LangSupported(0x7c,work) != 0)) {
return 1;
}
LAB_group_b:
if ((Zi8LangSupported(0x79,work) == 0) && (Zi8LangSupported(0x7a,work) == 0) &&
(Zi8LangSupported(0x7d,work) == 0)) {
goto LAB_return_false;
}
return 1;
LAB_return_false:
return 0;
return 0;
}
ziU32 Zi8Get1KeyPressSpelling(ziGetParam *params,Zi8OneKeyOptions *options,Zi8OneKeyWork *work)
@@ -938,6 +932,7 @@ ziU32 Zi8Get1KeyPressSpelling(ziGetParam *params,Zi8OneKeyOptions *options,Zi8On
for (;;) {
if (tableCount == 0) break;
spellingEntry = (ziU8 *)Zi8GetTableAddress(1,0xc,work);
/* MWCC needs the spelling-entry advance in the loop body. */
for (tableIndex = 0; tableIndex < tableCount; tableIndex++) {
if ((*spellingEntry & languageMask) != 0) {
if (usePinyin) entryLength = *spellingEntry & 0xf;
@@ -1557,7 +1552,7 @@ finishPhrases:
for (index = 0; index < 4; index++) {
if (keyValues[index] != (keyMasks[index] & phraseTable[index])) break;
}
if (index < 4) goto nextSortedOrdinal;
if (index < 4) continue;
}
entryFlags = false;
if (work->phoneticFilter != 0) {
@@ -1574,17 +1569,17 @@ finishPhrases:
elementIndex = MatchAltSound1Key(spelling,inputLimit,matchFull,(Zi8AltSoundRecord *)alternateTable,phoneticMask,phoneticTable,ordinal,
tone,includeTone,languageMask,work);
}
if (elementIndex == 0) goto nextSortedOrdinal;
if (elementIndex == 0) continue;
if (!emitWords) {
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextSortedOrdinal;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) continue;
ordinal = Zi8Ord2Uni(ordinal,work);
for (index = 0; index < candidateCount; index++) {
if (ordinal == output[index]) break;
}
if (index < candidateCount) goto nextSortedOrdinal;
if (index < candidateCount) continue;
} else {
ordinal = Zi8Ord2Uni(ordinal,work);
if (Zi8IsDupWordW(&ordinal,1,work) != 0) goto nextSortedOrdinal;
if (Zi8IsDupWordW(&ordinal,1,work) != 0) continue;
}
if (remaining == 0) {
totalCandidates++;
@@ -1600,12 +1595,11 @@ finishPhrases:
remaining--;
}
}
nextSortedOrdinal:
;
}
}
if ((options->countOnly == '\0') && (ziU8)Zi8GetZHuwdPtr(&userEntriesAddress,&userCount,work) != 0)
{
/* MWCC needs both user-entry cursor advances in the loop body. */
for (phraseOrdinal = 0; phraseOrdinal < userCount;) {
if ((params->elementCount == '\0') || ((((ziU8*)userEntriesAddress)[1] & 0x80) != 0)) {
userOrdinal = (ziU16)(((ziU8*)userEntriesAddress)[1] & 0x7f) << 8 | (ziU16)((ziU8*)userEntriesAddress)[2];
@@ -1657,6 +1651,7 @@ nextUserOrdinal:
}
phraseTable = syllableTable;
previousCharacter = 0;
/* MWCC needs both ordinal cursor advances in the loop body. */
for (ordinal = 0; ordinal < ordinalCount;) {
if (((*phraseTable & languageMask) != 0) &&
((characterSetTable == 0 || ((characterSet & characterSetTable[(Zi8UInt)ordinal]) != 0)))) {
@@ -1784,23 +1779,22 @@ ziBool Zi8ZHCheckSpelling(ziWChar *input,ziWChar *spelling,ziU8 inputLength,ziPt
switch (spelling[index]) {
case 0xf331:
toneMask = 1;
goto validateTone;
break;
case 0xf332:
toneMask = 2;
goto validateTone;
break;
case 0xf333:
toneMask = 4;
goto validateTone;
break;
case 0xf334:
toneMask = 8;
goto validateTone;
break;
case 0xf335:
toneMask = 0x10;
goto validateTone;
break;
default:
goto nextInputCharacter;
continue;
}
validateTone:
if (toneTable != 0) {
while( true ) {
syllableLength = (index - syllableStart) + 1;
@@ -1842,8 +1836,6 @@ validateTone:
}
input[index] = spelling[index];
syllableStart = index + 1;
nextInputCharacter:
;
}
for (index = 0; input[index] != 0; index = index + 1) {
if ((input[index] >= 0x61) && (input[index] <= 0x7a)) {

View File

@@ -287,6 +287,7 @@ static ziBool ZiIsLetterHyphen(ziWChar character ZI_NEED_WORK) {
void Zi8ChangeWordCase(ziWChar* word, ziU8 language, ZiAlphaWork* work) {
enum { LOWER_CASE, UPPER_CASE } upper = LOWER_CASE;
/* MWCC needs the explicit work cast in the case-mode test below. */
if (work->caseMode == 3) {
Zi8ChangeCharCase(1, word++, language, work);
} else if (((ZiAlphaWork*)work)->caseMode == 1) {
@@ -566,10 +567,12 @@ int Zi8AlphaGetCandidates(ziGetParam* parameters, ziPtr optionData, ziPtr workDa
switch ((int)((ZiAlphaWork*)workData)->dictionaryKinds[index]) {
case 1:
case 9:
goto foundHighlightedDictionary;
break;
default:
continue;
}
break;
}
foundHighlightedDictionary:
if (firstCandidate == 0 && ((ZiAlphaWork*)workData)->highlightedWord[elementIndex - 1] != 0) {
if (((ZiAlphaWork*)workData)->requiredLength < parameters->elementCount)
((ZiAlphaWork*)workData)->reuseHighlightedWord = 0;
@@ -698,7 +701,6 @@ preparePrefix:
prefixVowelRestriction = ZI8_FALSE;
}
}
goto prepareDictionaryOrder;
prepareDictionaryOrder:
((ZiAlphaWork*)workData)->dictionaryOrder[0] = 0;
if ((Zi8GetTableCount(language,0x1f,workData) & 0x20) != 0) {
@@ -770,11 +772,11 @@ prepareDictionaries:
if (dictionaryIndex != ((ZiAlphaWork*)workData)->dictionaryCount) {
dictionaryKind = ((ZiAlphaWork*)workData)->dictionaryKinds[dictionaryIndex];
if (dictionaryKind == 12) {
if (languagePassCount != 2) goto finishDictionaryPass;
if (languagePassCount != 2) continue;
goto selectDictionary;
}
} else {
if (((ZiAlphaOptions*)optionData)->lookupMode != 0) goto finishDictionaryPass;
if (((ZiAlphaOptions*)optionData)->lookupMode != 0) continue;
dictionaryKind = 10;
}
selectDictionary:
@@ -785,7 +787,7 @@ selectDictionary:
case 3:
case 4:
case 10:
goto finishDictionaryPass;
continue;
}
}
{
@@ -803,7 +805,7 @@ selectDictionary:
((parameters->currentWord == 0 ||
((parameters->wordCharCount == 0 ||
(parameters->currentWord[parameters->wordCharCount - 1] == 0x20))))))))
goto finishDictionaryPass;
continue;
if ((candidateCount == 0) &&
((((!punctuationCandidate && (parameters->firstCandidate == firstCandidate)) &&
((parameters->currentWord == 0 ||
@@ -829,10 +831,10 @@ selectDictionary:
punctuationCandidate = ZI8_FALSE;
break;
case 4:
if (((ZiAlphaOptions*)optionData)->minWordLength > elementCount) goto finishDictionaryPass;
if (((ZiAlphaOptions*)optionData)->minWordLength > elementCount) continue;
break;
case 3:
if (((ZiAlphaOptions*)optionData)->minWordLength > elementCount || elementCount == 1) goto finishDictionaryPass;
if (((ZiAlphaOptions*)optionData)->minWordLength > elementCount || elementCount == 1) continue;
break;
case 9:
if (elementCount == 1 && *elements >= 0xEFF1 && *elements <= 0xF010) {
@@ -841,7 +843,7 @@ selectDictionary:
}
default:
if (elementCount == 1 && prefixCount == 0 && *elements >= 0xEFF1 &&
*elements <= 0xF010 && !contextEnabled) goto finishDictionaryPass;
*elements <= 0xF010 && !contextEnabled) continue;
dictionaryExact = 0;
if (languagePassCount == 2) {
for (index = dictionaryIndex + 1; index < ((ZiAlphaWork*)workData)->dictionaryCount; index++) {
@@ -943,7 +945,7 @@ selectDictionary:
}
if (wordLength != 0) goto filterVowelCandidate;
dictionaryStatus[dictionaryKind] = 1;
if (elements[apostropheIndex] >= 0xEFF1) goto retryDictionary;
if (elements[apostropheIndex] >= 0xEFF1) continue;
goto finishDictionaryPass;
}
filterVowelCandidate:
@@ -974,7 +976,7 @@ filterVowelCandidate:
if (wordLength == 0) {
wordLength = 0;
dictionaryStatus[dictionaryKind] = 1;
goto retryDictionary;
continue;
}
}
if (wordLength != 0) {
@@ -1015,6 +1017,7 @@ filterVowelCandidate:
}
break;
case 10:
/* MWCC needs the stored punctuation character as the branch value. */
if ((*wordCursor = *punctuationCursor) != 0) {
punctuationCursor++;
wordLength = 1;
@@ -1078,7 +1081,7 @@ filterVowelCandidate:
punctuationCursor = &punctuationBuffer[0];
dictionaryKind = 0xb;
retryPunctuation = ZI8_TRUE;
goto retryDictionary;
continue;
}
}
if ((((((dictionaryExact == 0) || (!currentVowelRestriction)) || (prefixCount != 0)) ||
@@ -1109,18 +1112,17 @@ prepareRememberedPunctuation:
}
else if (((ZiAlphaOptions*)optionData)->minWordLength <= wordLength) {
if (prefixVowelRestriction) {
if (*wordCursor >= 0x30 && *wordCursor <= 0x39) goto retryDictionary;
if (*wordCursor >= 0x30 && *wordCursor <= 0x39) continue;
if (language == 0x2f) {
if (Zi8ITspecialExclusion(wordCursor,prefixCount,wordLength) != 0) goto retryDictionary;
if (Zi8ITspecialExclusion(wordCursor,prefixCount,wordLength) != 0) continue;
} else if (language == 0x58) {
if (Zi8_814659E8(wordCursor,prefixCount,wordLength) != 0) goto retryDictionary;
if (Zi8_814659E8(wordCursor,prefixCount,wordLength) != 0) continue;
} else if (Zi8IsVowel(language,*wordCursor) == 0) {
wordLength = 0;
goto retryDictionary;
continue;
}
}
{
prepareCandidate:
if (((elementCount == 1) && (dictionaryKind != 10)) &&
((*wordCursor >= 0xeff1 && *wordCursor <= 0xf010))) {
punctuationCandidate = ZI8_TRUE;
@@ -1163,7 +1165,6 @@ prepareCandidate:
case 5:
case 1:
case 9:
checkKeyLayout:
keyLayoutCursor = keyLayout;
candidateCharacterCount = wordLength + prefixCount;
for (index = 0; (int)index < (int)(unsigned int)keyLayoutCount; index = index + 1) {

View File

@@ -948,183 +948,181 @@ pud_search:
((struct __zi8_work_data_s*)work)->pudCount = ((struct __zi8_work_data_s*)work)->zhPudCount;
}
pud_start:
if (((options->countOnly && getOptions != 5) || !wordLength || getMode == 5 ||
if (!(((options->countOnly && getOptions != 5) || !wordLength || getMode == 5 ||
(request->elementCount && Zi8IsComponent(elements[0], work)) ||
!Zi8IsCharacter(request->currentWord[0], work)) &&
(getMode != 2 || request->elementCount <= 1) &&
(getMode != 0 || match.nSeg <= 1) &&
((getMode != 1 && getMode != 2) || match.nCand <= 1)) goto pud_restore;
matchMode = 0;
goto pud_next;
pud_candidate:
matchMode = 1;
currentSpelling[index] = 0;
if (!request->elementCount || (getMode == 0 && request->elementCount == 1 && elements[0] == 0xEF00)) {
character = currentSpelling[wordLength];
switch (character) {
case 0xFF0C: case 0xFF01: case 0x3002: case 0xFF1F:
candidateStatus = 1;
candidateOrdinal = 0xFFFF;
goto pud_accept;
}
}
if (getMode == 2 && index >= request->elementCount + wordLength) {
rangeIndex = 0;
rangeCount = wordLength;
while (rangeIndex < request->elementCount) {
if (!((currentSpelling[rangeCount] == 0x2C9 && elements[rangeIndex] == 0xF331) ||
(currentSpelling[rangeCount] == 0x2CA && elements[rangeIndex] == 0xF332) ||
(currentSpelling[rangeCount] == 0x2C7 && elements[rangeIndex] == 0xF333) ||
(currentSpelling[rangeCount] == 0x2CB && elements[rangeIndex] == 0xF334) ||
(currentSpelling[rangeCount] == 0x2D9 && elements[rangeIndex] == 0xF335) ||
currentSpelling[rangeCount] == elements[rangeIndex] - 0xC200)) break;
++rangeCount;
++rangeIndex;
}
if (rangeIndex == request->elementCount) {
if (!(request->context & 0x10)) request->completion = request->elementCount;
candidateStatus = 1;
((getMode != 1 && getMode != 2) || match.nCand <= 1))) {
matchMode = 0;
while ((index = Zi8MatchPUDdata_ZHS(request->currentWord, wordLength, 1, currentSpelling, 32,
candidateWord, 64, 0, matchMode, work)) != 0) {
matchMode = 1;
currentSpelling[index] = 0;
if (!request->elementCount || (getMode == 0 && request->elementCount == 1 && elements[0] == 0xEF00)) {
character = currentSpelling[wordLength];
switch (character) {
case 0xFF0C: case 0xFF01: case 0x3002: case 0xFF1F:
candidateStatus = 1;
candidateOrdinal = 0xFFFF;
goto pud_accept;
}
}
if (getMode == 2 && index >= request->elementCount + wordLength) {
rangeIndex = 0;
rangeCount = wordLength;
while (rangeIndex < request->elementCount) {
if (!((currentSpelling[rangeCount] == 0x2C9 && elements[rangeIndex] == 0xF331) ||
(currentSpelling[rangeCount] == 0x2CA && elements[rangeIndex] == 0xF332) ||
(currentSpelling[rangeCount] == 0x2C7 && elements[rangeIndex] == 0xF333) ||
(currentSpelling[rangeCount] == 0x2CB && elements[rangeIndex] == 0xF334) ||
(currentSpelling[rangeCount] == 0x2D9 && elements[rangeIndex] == 0xF335) ||
currentSpelling[rangeCount] == elements[rangeIndex] - 0xC200)) break;
++rangeCount;
++rangeIndex;
}
if (rangeIndex == request->elementCount) {
if (!(request->context & 0x10)) request->completion = request->elementCount;
candidateStatus = 1;
character = currentSpelling[wordLength];
candidateOrdinal = 0xFFFF;
goto pud_accept;
}
if (match.nCand == 1) continue;
}
if ((getMode == 1 || getMode == 2) && match.nCand > 1) {
if (match.nCand > index - wordLength) continue;
for (index = 1; index < match.nCand; ++index) {
character = currentSpelling[wordLength + index];
candidateOrdinal = Zi8Uni2Ord(character, work);
if (candidateOrdinal == 0xFFFF) break;
record = records + candidateOrdinal * 12;
candidateStatus = (match.phon[index] & (ziU16)Zi8GetPCode(phoneticTable, record)) == match.phon2[index];
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, candidateOrdinal,
match.phon[index], match.phon2[index], charset, work)) candidateStatus = 1;
if (!candidateStatus) break;
}
if (index < match.nCand) continue;
}
if (getMode == 0 && match.nSeg > 1) {
if (match.nSeg > index - wordLength) continue;
for (index = 1; index < match.nSeg; ++index) {
character = currentSpelling[wordLength + index];
candidateOrdinal = Zi8Uni2Ord(character, work);
if (candidateOrdinal == 0xFFFF) break;
record = records + candidateOrdinal * 12;
if (match.segmentValues[index][0] != (record[0] & match.segmentMasks[index][0]) ||
match.segmentValues[index][1] != (record[1] & match.segmentMasks[index][1]) ||
match.segmentValues[index][2] != (record[2] & match.segmentMasks[index][2]) ||
match.segmentValues[index][3] != (record[3] & match.segmentMasks[index][3])) break;
}
if (index < match.nSeg) continue;
}
character = currentSpelling[wordLength];
candidateOrdinal = 0xFFFF;
goto pud_accept;
}
if (match.nCand == 1) goto pud_next;
}
if ((getMode == 1 || getMode == 2) && match.nCand > 1) {
if (match.nCand > index - wordLength) goto pud_next;
for (index = 1; index < match.nCand; ++index) {
character = currentSpelling[wordLength + index];
candidateOrdinal = Zi8Uni2Ord(character, work);
if (candidateOrdinal == 0xFFFF) break;
if (candidateOrdinal == 0xFFFF) continue;
record = records + candidateOrdinal * 12;
candidateStatus = (match.phon[index] & (ziU16)Zi8GetPCode(phoneticTable, record)) == match.phon2[index];
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, candidateOrdinal,
match.phon[index], match.phon2[index], charset, work)) candidateStatus = 1;
if (!candidateStatus) break;
}
if (index < match.nCand) goto pud_next;
}
if (getMode == 0 && match.nSeg > 1) {
if (match.nSeg > index - wordLength) goto pud_next;
for (index = 1; index < match.nSeg; ++index) {
character = currentSpelling[wordLength + index];
candidateOrdinal = Zi8Uni2Ord(character, work);
if (candidateOrdinal == 0xFFFF) break;
record = records + candidateOrdinal * 12;
if (match.segmentValues[index][0] != (record[0] & match.segmentMasks[index][0]) ||
match.segmentValues[index][1] != (record[1] & match.segmentMasks[index][1]) ||
match.segmentValues[index][2] != (record[2] & match.segmentMasks[index][2]) ||
match.segmentValues[index][3] != (record[3] & match.segmentMasks[index][3])) break;
}
if (index < match.nSeg) goto pud_next;
}
character = currentSpelling[wordLength];
candidateOrdinal = Zi8Uni2Ord(character, work);
if (candidateOrdinal == 0xFFFF) goto pud_next;
record = records + candidateOrdinal * 12;
candidateStatus = 0;
switch (getMode) {
case 7: case 8:
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
if ((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])) {
candidateStatus = 1;
break;
}
if (getMode == 7) break;
case 9:
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
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]) candidateStatus = 1;
break;
case 0:
if (match.recordValues[0] == (record[0] & match.recordMasks[0]) &&
(match.count || (match.recordValues[3] == (record[3] & match.recordMasks[3]) &&
match.recordValues[2] == (record[2] & match.recordMasks[2]) &&
match.recordValues[1] == (record[1] & match.recordMasks[1]))) &&
(ziU8)Zi8SecMatchChar(record, componentTable, &match, 0, work)) candidateStatus = 1;
break;
case 1: case 2:
candidateStatus = (match.phon[0] & (ziU16)Zi8GetPCode(phoneticTable, record)) == match.phon2[0];
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, candidateOrdinal,
match.phon[0], match.phon2[0], charset, work)) candidateStatus = 1;
break;
}
if (!candidateStatus) goto pud_next;
candidateStatus = 0;
switch (getMode) {
case 7: case 8:
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
if ((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])) {
candidateStatus = 1;
break;
}
if (getMode == 7) break;
case 9:
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
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]) candidateStatus = 1;
break;
case 0:
if (match.recordValues[0] == (record[0] & match.recordMasks[0]) &&
(match.count || (match.recordValues[3] == (record[3] & match.recordMasks[3]) &&
match.recordValues[2] == (record[2] & match.recordMasks[2]) &&
match.recordValues[1] == (record[1] & match.recordMasks[1]))) &&
(ziU8)Zi8SecMatchChar(record, componentTable, &match, 0, work)) candidateStatus = 1;
break;
case 1: case 2:
candidateStatus = (match.phon[0] & (ziU16)Zi8GetPCode(phoneticTable, record)) == match.phon2[0];
if (!candidateStatus && (record[0] & 0x80) && !requireFull &&
Zi8MatchAltSound(alternateTable, alternateCount, phoneticTable, candidateOrdinal,
match.phon[0], match.phon2[0], charset, work)) candidateStatus = 1;
break;
}
if (!candidateStatus) continue;
pud_accept:
if (!emitWords) {
if (character == previousOrdinal) goto pud_next;
previousOrdinal = character;
if (candidateOrdinal == 0xFFFF) goto pud_charset;
if (trackDuplicates) {
if ((ziU8)Zi8SetFindCand(request->scratch, candidateOrdinal, work)) goto pud_next;
} else if (Zi8IsDupWChar(candidateOrdinal, work)) goto pud_next;
} else {
emittedWords = 0;
for (index = wordLength; currentSpelling[index];) {
++index;
++emittedWords;
}
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;
currentSpelling[wordLength + emittedWords] = 0;
if (Zi8IsDupWordW(currentSpelling + wordLength, emittedWords, work)) goto pud_next;
}
pud_charset:
if (charsetTable && wordSearchPhase) {
index = wordLength;
while (currentSpelling[index]) {
rangeIndex = Zi8Uni2Ord(currentSpelling[index], work);
if (rangeIndex == 0xFFFF) break;
charsetEntry = charsetTable + rangeIndex;
if (!(charsetEntry[0] & charsetFilter)) break;
++index;
}
if (currentSpelling[index]) goto pud_next;
}
if (skipCount) --skipCount;
else {
if (!candidateWord[0] || ZiMatchZHSpelling(currentSpelling, candidateWord, request->elements,
request->elementCount, wordLength, work)) {
++totalResults;
if (getOptions == 5) {
if (totalResults >= options->maxResults) goto engine_finish;
if (!emitWords) {
if (character == previousOrdinal) continue;
previousOrdinal = character;
if (candidateOrdinal != 0xFFFF) {
if (trackDuplicates) {
if ((ziU8)Zi8SetFindCand(request->scratch, candidateOrdinal, work)) continue;
} else if (Zi8IsDupWChar(candidateOrdinal, work)) continue;
}
} else {
if (emitWords) {
++emittedCount;
for (index = wordLength; currentSpelling[index]; ++index) {
output[outputIndex++] = currentSpelling[index];
emittedWords = 0;
for (index = wordLength; currentSpelling[index];) {
++index;
++emittedWords;
}
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;
currentSpelling[wordLength + emittedWords] = 0;
if (Zi8IsDupWordW(currentSpelling + wordLength, emittedWords, work)) continue;
}
if (charsetTable && wordSearchPhase) {
index = wordLength;
while (currentSpelling[index]) {
rangeIndex = Zi8Uni2Ord(currentSpelling[index], work);
if (rangeIndex == 0xFFFF) break;
charsetEntry = charsetTable + rangeIndex;
if (!(charsetEntry[0] & charsetFilter)) break;
++index;
}
if (currentSpelling[index]) continue;
}
if (skipCount) --skipCount;
else {
if (!candidateWord[0] || ZiMatchZHSpelling(currentSpelling, candidateWord, request->elements,
request->elementCount, wordLength, work)) {
++totalResults;
if (getOptions == 5) {
if (totalResults >= options->maxResults) goto engine_finish;
} else {
if (emitWords) {
++emittedCount;
for (index = wordLength; currentSpelling[index]; ++index) {
output[outputIndex++] = currentSpelling[index];
}
output[outputIndex++] = ' ';
if (outputIndex > outputLimit) {
request->letters = emittedCount;
request->count = emittedCount;
goto engine_finish;
}
} else output[emittedCount++] = character;
if (emittedCount >= request->maxCandidates) {
request->letters = emittedCount;
request->count = emittedCount;
goto engine_finish;
}
}
output[outputIndex++] = ' ';
if (outputIndex > outputLimit) {
request->letters = emittedCount;
request->count = emittedCount;
goto engine_finish;
}
} else output[emittedCount++] = character;
if (emittedCount >= request->maxCandidates) {
request->letters = emittedCount;
request->count = emittedCount;
goto engine_finish;
}
}
}
}
pud_next:
if ((index = Zi8MatchPUDdata_ZHS(request->currentWord, wordLength, 1, currentSpelling, 32,
candidateWord, 64, 0, matchMode, work)) != 0) goto pud_candidate;
pud_restore:
if (wordSearchPhase == 1) {
((struct __zi8_work_data_s*)work)->pudCount = savedPudCount;
wordSearchPhase = 0;
@@ -1486,13 +1484,13 @@ character_range_start:
remainingOrdinals = candidateCount;
while (1) {
if (match.count) {
if (!candidateCount--) goto character_range_done;
if (!candidateCount--) break;
if (match.prefixValues[0] != (record[0] & match.prefixMasks[0])) goto character_range_next;
if ((ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work) == 2) goto character_range_accept;
} else {
if (!Zi8ExactMatchNextChar(record, match.prefixMasks[0], match.prefixValues[0], match.prefixMasks[1], match.prefixValues[1],
match.prefixMasks[2], match.prefixValues[2], match.prefixMasks[3], match.prefixValues[3],
&candidateCount, &record, &candidateOrdinal, work)) goto character_range_done;
&candidateCount, &record, &candidateOrdinal, work)) break;
if ((!match.componentIndex && match.length < 8) ||
(ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work) == 2) goto character_range_accept;
}
@@ -1536,7 +1534,6 @@ character_range_accept:
if (emittedCount >= request->maxCandidates) goto engine_finish;
record += 12;
}
character_range_done:
if (phase != 0xFF) goto character_range_start;
}
if (!options->countOnly && phoneticRetry && ordinalCount && getMode != 5) {
@@ -1587,7 +1584,6 @@ character_range_done:
} else if (totalResults >= options->maxResults) goto engine_finish;
} else --skipCount;
}
ordinal_done:
exactPhrase = 1;
++tableIndex;
}
@@ -1658,7 +1654,6 @@ phonetic_ordinal_search:
phoneticInput = 1;
}
}
tone_candidates:
if (getMode == 2 && getOptions != 6 && !request->elementCount && request->wordCharCount &&
request->currentWord[request->wordCharCount - 1] >= 0x3105 &&
request->currentWord[request->wordCharCount - 1] <= 0x3129) {
@@ -2125,9 +2120,9 @@ frequency_record_next:
++emittedCount;
output[outputIndex++] = alternateCharacter;
output[outputIndex++] = ' ';
if (outputIndex > outputLimit) goto frequency_candidates_done;
if (outputIndex > outputLimit) break;
} else output[emittedCount++] = alternateCharacter;
if (emittedCount >= request->maxCandidates) goto frequency_candidates_done;
if (emittedCount >= request->maxCandidates) break;
} else --skipCount;
alternateCharacter = 0;
firstPhoneticPass = 1;
@@ -2163,7 +2158,6 @@ frequency_record_next:
exactPhrase = 1;
}
}
frequency_candidates_done:
if (phoneticRetry) {
if (!emitWords && emittedCount < request->maxCandidates && getMode != 5) {
for (duplicateIndex = 0; duplicateIndex < emittedCount; ++duplicateIndex) {
@@ -2196,7 +2190,6 @@ frequency_candidates_done:
phonetic_filtered_done:
filteringMode = 1;
}
phonetic_main:
if (Zi8GetFormatVersion(1, work) >= 4) rangeCount = Zi8GetTableCount(1, 23, work);
else rangeCount = 0;
if (rangeCount && match.nCand == 2 && emitWords) {
@@ -2319,7 +2312,6 @@ phonetic_component_done:
ordinals_filtered_done:
filteringMode = 1;
}
phonetic_ordinals:
record = records;
candidateCount = recordCount;
phoneticGroups = 0;
@@ -2493,7 +2485,7 @@ filtered_search:
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])) goto filtered_accept;
match.prefixValues[3] == (match.prefixMasks[3] & phraseEntry[3])) break;
if (getMode == 7) goto filtered_next;
case 9:
phraseEntry = phraseTable + ((record[9] & 15) << 16 | (record[11] | record[10] << 8));
@@ -2531,7 +2523,6 @@ filtered_search:
break;
}
}
filtered_accept:
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
if (charsetTable) {
@@ -2677,6 +2668,7 @@ static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
}
groupCandidates = candidateGroups + groupOffset * 2;
candidateIndex = 0;
/* 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)) {
@@ -2709,43 +2701,43 @@ static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
}
if (remainingSkip) {
--remainingSkip;
goto next_group_candidate;
}
++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) {
} 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(0xB54, work);
Zi8ReplaceLastError(0xB55, work);
return 0;
}
} else {
output[emittedCount++] = character;
}
if (emittedCount >= request->maxCandidates) {
} else if (totalResults >= options->maxResults) {
*skipCount = remainingSkip;
*resultCount = totalResults;
*candidateCount = emittedCount;
*outputCount = emittedCharacters;
Zi8ReplaceLastError(0xB55, work);
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:
++candidateIndex;
@@ -2868,8 +2860,8 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
ziU8 elementIndex;
ziU8 count;
ziWChar spacedElements[256];
struct { ziWChar separator; } savedState;
savedState.separator = ZI_WORK->separator;
ziWChar savedSeparator;
savedSeparator = ZI_WORK->separator;
if (elementCount <= 1 || !charCount) {
return elementCount;
}
@@ -2884,13 +2876,13 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
}
ZI_WORK->separator = 0xF360;
Zi8ZHaddSpace(elements, elementCount, spacedElements, 256, __zi8_work_data);
ZI_WORK->separator = savedState.separator;
ZI_WORK->separator = savedSeparator;
spacedIndex = elementIndex = count = 0;
while (charCount && elementIndex < elementCount) {
for (; charCount && elementIndex < elementCount; ++spacedIndex) {
if (spacedElements[spacedIndex] == 0xF360) {
--charCount;
if (elements[elementIndex] != 0xF360) {
goto next_spaced_element;
continue;
}
} else if (spacedElements[spacedIndex] >= 0xF331 && spacedElements[spacedIndex] <= 0xF335) {
--charCount;
@@ -2902,8 +2894,6 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
}
++elementIndex;
++count;
next_spaced_element:
++spacedIndex;
}
return count;
}

View File

@@ -64,6 +64,7 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU8 count, ziU8 language,
key = Zi8GetTableSize(language, keyTable, ZI_WORK);
if (key != 0 && ZI_WORK->userKeys[language] == 0) {
index = 0;
/* MWCC needs the key-count branch in the loop test block. */
goto check_keys;
next_key:
{
@@ -99,7 +100,7 @@ check_keys:
searching = 1;
current = &records[context->cnt - 1];
while (searching && context->cnt != 0 && current->node != (ziU8*)context->endNode) {
if (capacity < context->cnt) goto finish_graph;
if (capacity < context->cnt) break;
current->attr = ZiDAWGgetCHARattribute(context, current->node, ZI_WORK);
if (context->cnt <= count) {
if (context->keyCodes == 0) {
@@ -134,17 +135,17 @@ check_keys:
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) goto next_sibling;
context->cnt++;
if (ZI_WORK->maxCnt < context->cnt) ZI_WORK->maxCnt = context->cnt;
goto update_current;
if (records[context->cnt].node != (ziU8*)0) {
context->cnt++;
if (ZI_WORK->maxCnt < context->cnt) ZI_WORK->maxCnt = context->cnt;
} else {
next_sibling:
while (context->cnt != 0) {
records[context->cnt - 1].node = ZiDAWGGetSibling(records[context->cnt - 1].node);
if (records[context->cnt - 1].node != (ziU8*)0) break;
context->cnt--;
while (context->cnt != 0) {
records[context->cnt - 1].node = ZiDAWGGetSibling(records[context->cnt - 1].node);
if (records[context->cnt - 1].node != (ziU8*)0) break;
context->cnt--;
}
}
update_current:
current = &records[context->cnt - 1];
}
finish_graph:

View File

@@ -4,7 +4,7 @@ extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU8 Zi8getKeyLayout(ziU8 lang, ziU16 key, ziWChar* layout, ziU8 mode ZI_NEED_WORK);
extern ziChar Zi8ConvertWC2UC(ziWChar ch, ziU8 language ZI_NEED_WORK);
extern ziU32 Zi8AlphaGetCandidates(ziGetParam* param, ziPtr sw ZI_NEED_WORK);
extern ziU8 Zi8SyllablesROMdata(ziWChar* keys, ziU8 count, ziU8 lang, ziWChar* out,
extern ziU8 Zi8SyllablesROMdata(ziWChar* keys, ziU8 keyCount, ziU8 lang, ziWChar* output,
ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK);
typedef struct _ziSwParam {
@@ -20,197 +20,191 @@ typedef struct _ziSwParam {
} ziSwParam;
ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
ziWChar buf[0x40];
ziWChar buf2[0x32];
ziS32 rem;
ziS32 cur;
ziS32 firstCand;
ziS32 count;
ziWChar* pNext;
ziU16 err;
ziU8 flag14;
ziU8 flag13;
ziU8 flag12;
ziU8 flag11;
ziU8 sylCnt;
ziWChar* out;
ziU8* u28;
ziS32 i;
ziWChar syllableBuffer[0x40];
ziWChar keyLayout[0x32];
ziS32 remainingCapacity;
ziS32 syllableLength;
ziS32 remainingSkip;
ziS32 candidateCount;
ziWChar* nextCharacter;
ziU16 error;
ziU8 allowHyphen;
ziU8 needKeyFallback;
ziU8 nextMatch;
ziU8 reverseOrder;
ziU8 matchedLength;
ziWChar* output;
ziU8* encodedOutput;
ziS32 index;
firstCand = param->firstCandidate;
count = 0;
u28 = 0;
pNext = 0;
flag14 = 1;
flag13 = 1;
flag12 = 0;
flag11 = 0;
sylCnt = 0;
err = 0x64;
remainingSkip = param->firstCandidate;
candidateCount = 0;
encodedOutput = 0;
nextCharacter = 0;
allowHyphen = 1;
needKeyFallback = 1;
nextMatch = 0;
reverseOrder = 0;
matchedLength = 0;
error = 0x64;
if (param->currentWord != 0 && param->wordCharCount != 0 &&
param->currentWord[param->wordCharCount - 1] != 0x20) {
flag11 = 1;
reverseOrder = 1;
}
if (param->elementCount == 0 || (param->elementCount == 1 && flag11 == 0)) {
count = Zi8AlphaGetCandidates(param, sw, ZI_WORK);
if (param->elementCount == 0 || (param->elementCount == 1 && reverseOrder == 0)) {
candidateCount = Zi8AlphaGetCandidates(param, sw, ZI_WORK);
goto end;
}
if (sw->countOnly != 0 || (param->getOptions & 0xFD) != 0x81) {
out = buf;
rem = 0x40;
output = syllableBuffer;
remainingCapacity = 0x40;
} else {
out = param->candidates;
rem = sw->capacity - 1;
output = param->candidates;
remainingCapacity = sw->capacity - 1;
}
if ((param->getOptions & 0xFD) == 0x80) {
u28 = (ziU8*)param->candidates;
rem = sw->capacity - 1;
encodedOutput = (ziU8*)param->candidates;
remainingCapacity = sw->capacity - 1;
}
if (rem <= param->elementCount) {
err = 0x168;
if (remainingCapacity <= param->elementCount) {
error = 0x168;
goto end;
}
if ((Zi8GetTableCount(param->language, 0x1F, ZI_WORK) & 8) != 0) {
flag14 = 0;
allowHyphen = 0;
}
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf[0] = 0x2D;
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && allowHyphen != 0) {
syllableBuffer[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf, 1, ZI_WORK);
Zi8getKeyLayout(param->language, param->elements[0], syllableBuffer, 1, ZI_WORK);
}
out[0] = buf[0];
Zi8SyllablesROMdata(param->elements, param->elementCount, param->language, out,
(ziU16)rem, 0, &sylCnt, flag11, ZI_WORK);
if (sylCnt != 0) {
cur = sylCnt;
output[0] = syllableBuffer[0];
Zi8SyllablesROMdata(param->elements, param->elementCount, param->language, output,
(ziU16)remainingCapacity, 0, &matchedLength, reverseOrder, ZI_WORK);
if (matchedLength != 0) {
syllableLength = matchedLength;
} else {
cur = 1;
syllableLength = 1;
}
if (cur == param->elementCount) goto L5dc;
if (firstCand != 0) {
firstCand--;
goto L5dc;
}
if (sw->countOnly != 0) {
if (++count >= sw->maxCount) goto end;
goto L5dc;
}
for (i = cur; i < param->elementCount; i += sylCnt) {
if (param->elements[i] == 0xEFF1 && param->elementCount - i > 1 && flag14 != 0) {
buf2[0] = 0x2D;
if (syllableLength != param->elementCount) {
if (remainingSkip != 0) {
remainingSkip--;
} else if (sw->countOnly != 0) {
if (++candidateCount >= sw->maxCount) goto end;
} else {
Zi8getKeyLayout(param->language, param->elements[i], buf2, 1, ZI_WORK);
}
out[i] = buf2[0];
Zi8SyllablesROMdata(param->elements + i, param->elementCount - i, param->language,
out + i, (ziU16)rem, 0, &sylCnt, 1, ZI_WORK);
if (sylCnt == 0) {
sylCnt = 1;
}
}
if (u28 != 0) {
for (i = 0; i < param->elementCount; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
out[i++] = 0;
out[i] = 0;
out += i;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem > param->elementCount) goto L5dc;
goto end;
L5dc:
while (cur >= 1) {
flag12 = 0;
goto rom;
found:
flag12 = 1;
if (cur == 1) {
flag13 = 0;
}
L464:
if (out[0] >= 0xEFF1 && out[0] <= 0xF010) {
goto dec;
}
L464b:
if (firstCand != 0) {
firstCand--;
goto L560;
}
if (sw->countOnly != 0) {
if (++count >= sw->maxCount) goto end;
goto L560;
}
if (u28 != 0) {
for (i = 0; i < cur; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
for (index = syllableLength; index < param->elementCount; index += matchedLength) {
if (param->elements[index] == 0xEFF1 && param->elementCount - index > 1 && allowHyphen != 0) {
keyLayout[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[index], keyLayout, 1, ZI_WORK);
}
output[index] = keyLayout[0];
Zi8SyllablesROMdata(param->elements + index, param->elementCount - index, param->language,
output + index, (ziU16)remainingCapacity, 0, &matchedLength, 1, ZI_WORK);
if (matchedLength == 0) {
matchedLength = 1;
}
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
i = cur;
out[i++] = 0;
out[i] = 0;
out += i;
if (encodedOutput != 0) {
for (index = 0; index < param->elementCount; index++) {
encodedOutput[index] = Zi8ConvertWC2UC(output[index], param->language, ZI_WORK);
}
encodedOutput[index++] = 0;
encodedOutput[index] = 0;
encodedOutput += index;
} else {
output[index++] = 0;
output[index] = 0;
output += index;
}
remainingCapacity -= index;
if (++candidateCount >= param->maxCandidates) goto end;
/* MWCC needs the forward capacity branch before the common exit. */
if (remainingCapacity > param->elementCount) goto search_syllables;
goto end;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem <= cur) goto end;
L560:
if (pNext != 0) {
if (*pNext == 0) goto end;
out[0] = *pNext++;
goto L464b;
}
rom:
if (Zi8SyllablesROMdata(param->elements, (ziU8)cur, param->language, out,
(ziU16)rem, flag12, 0, flag11, ZI_WORK) != 0) {
goto found;
}
dec:
cur--;
}
if (flag13 == 0) goto end;
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf2[0] = 0x2D;
buf2[1] = 0;
Zi8getKeyLayout(param->language, param->elements[0], &buf2[1], 1, ZI_WORK);
for (i = 1; buf2[i] != 0; i++) {
if (buf2[i] == 0x2D) break;
search_syllables:
for (; syllableLength >= 1; syllableLength--) {
nextMatch = 0;
goto match_syllable;
syllable_found:
nextMatch = 1;
if (syllableLength == 1) {
needKeyFallback = 0;
}
while (buf2[i] != 0) {
buf2[i] = buf2[i + 1];
i++;
if (output[0] >= 0xEFF1 && output[0] <= 0xF010) {
continue;
}
emit_syllable:
if (remainingSkip != 0) {
remainingSkip--;
} else if (sw->countOnly != 0) {
if (++candidateCount >= sw->maxCount) goto end;
} else {
if (encodedOutput != 0) {
for (index = 0; index < syllableLength; index++) {
encodedOutput[index] = Zi8ConvertWC2UC(output[index], param->language, ZI_WORK);
}
encodedOutput[index++] = 0;
encodedOutput[index] = 0;
encodedOutput += index;
} else {
index = syllableLength;
output[index++] = 0;
output[index] = 0;
output += index;
}
remainingCapacity -= index;
if (++candidateCount >= param->maxCandidates) goto end;
if (remainingCapacity <= syllableLength) goto end;
}
next_syllable:
if (nextCharacter != 0) {
if (*nextCharacter == 0) goto end;
output[0] = *nextCharacter++;
goto emit_syllable;
}
match_syllable:
if (Zi8SyllablesROMdata(param->elements, (ziU8)syllableLength, param->language, output,
(ziU16)remainingCapacity, nextMatch, 0, reverseOrder, ZI_WORK) != 0) {
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;
}
while (keyLayout[index] != 0) {
keyLayout[index] = keyLayout[index + 1];
index++;
}
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf2, 1, ZI_WORK);
Zi8getKeyLayout(param->language, param->elements[0], keyLayout, 1, ZI_WORK);
}
cur = 1;
pNext = buf2;
goto L560;
syllableLength = 1;
nextCharacter = keyLayout;
goto next_syllable;
end:
if (sw->countOnly != 0) {
param->letters = 0;
} else {
param->letters = (ziU8)count;
param->letters = (ziU8)candidateCount;
}
Zi8LogError(err, ZI_WORK);
return count;
Zi8LogError(error, ZI_WORK);
return candidateCount;
}

View File

@@ -318,11 +318,11 @@ ziBool Zi8MatchPhonetic(ziU8* pCodeTable, ziU8* dictionary, ziPtr soundTable, zi
altMode = 1;
}
while (remaining-- != 0) {
if ((node[0] & flag) != 0) goto decode_node;
if ((node[0] & flag) == 0) {
next_node:
node += 0xC;
continue;
decode_node:
node += 0xC;
continue;
}
code = Zi8GetPCode(pCodeTable, node);
if ((*values != (code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
if (*count != 0) {
@@ -370,6 +370,7 @@ match_code:
*count = remaining;
return 1;
}
/* MWCC needs the group-end branch before the backward group jump. */
next_group:
{
nextCode = *sound++;
@@ -520,23 +521,23 @@ pinyin_initial:
final[outputIndex] &= 0xfdff;
}
value = *current;
if (value != 0x68 && value != 0xF368) goto scan_final;
if (outputIndex == 0) {
*resultCount += 1;
if (value == 0x68 || value == 0xF368) {
if (outputIndex == 0) {
*resultCount += 1;
}
final[outputIndex] += 0x200;
*bestInitial = initial[0];
*bestFinal = final[0];
count--;
if (count == 0) {
break;
}
current += 1;
}
final[outputIndex] += 0x200;
*bestInitial = initial[0];
*bestFinal = final[0];
count--;
if (count == 0) {
break;
}
current += 1;
}
} else if ((*current == 0xF369) || (*current == 0x69)) {
goto invalid_pinyin;
}
scan_final:
partial = 0;
for (index = 0; index < 4; index++) {
pinyin[index] = 0;
@@ -548,41 +549,41 @@ scan_final:
if (index != 0) {
partial = 1;
}
goto finish_final;
break;
}
if ((value >= 0xF331) && (value < 0xF336)) {
if (index != 0) {
partial = 1;
}
goto finish_final;
break;
}
if ((value < 0x61) || (value > 0x7A)) {
if (value < 0xF361) {
goto finish_final;
break;
}
value -= 0xF361;
if (value > 0x19) {
if (outputIndex == 0) {
*resultCount += 1;
}
goto finish_final;
break;
}
} else {
value -= 0x61;
}
pinyin[index] = (ziU8)value + 1;
if (!Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal)) goto try_final_extension;
if (outputIndex == 0) {
*resultCount += 1;
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal)) {
if (outputIndex == 0) {
*resultCount += 1;
}
current++;
index++;
count--;
if (count == 0) {
break;
}
continue;
}
current++;
index++;
count--;
if (count == 0) {
goto finish_final;
}
continue;
try_final_extension:
if (index < 3) {
pinyin[index + 1] = 0xFF;
@@ -608,13 +609,15 @@ try_final_extension:
}
}
finish_final:
if ((index > 3) && (count != 0) && (((value = *current) == 0x27) || (value == 0xF360) || (value == 0x20))) {
if (outputIndex == 0) {
*resultCount += 1;
if (index > 3 && count != 0) {
value = *current;
if (value == 0x27 || value == 0xF360 || value == 0x20) {
if (outputIndex == 0) {
*resultCount += 1;
}
current++;
count--;
}
current++;
count--;
}
if (index > 3) {
partial = 1;
@@ -681,23 +684,29 @@ finish_final:
if (outputIndex == 0) {
*resultCount = *resultCount + 1;
}
} else if ((value >= 0xF331) && ((value -= 0xF331) <= 4)) {
value++;
initial[outputIndex] |= 7;
final[outputIndex] |= value;
*bestInitial = initial[0];
*bestFinal = final[0];
count--;
current++;
if (outputIndex == 0) {
*resultCount = *resultCount + 1;
}
if ((count != 0) && (((value = *current) == 0x27) || (value == 0xF360) || (value == 0x20))) {
} else if (value >= 0xF331) {
value -= 0xF331;
if (value <= 4) {
value++;
initial[outputIndex] |= 7;
final[outputIndex] |= value;
*bestInitial = initial[0];
*bestFinal = final[0];
count--;
current++;
if (outputIndex == 0) {
*resultCount = *resultCount + 1;
}
if (count != 0) {
value = *current;
if (value == 0x27 || value == 0xF360 || value == 0x20) {
count--;
current++;
if (outputIndex == 0) {
*resultCount = *resultCount + 1;
}
}
}
}
}
}
@@ -714,26 +723,20 @@ ziBool Zi8GetPyFinal(ziU8* pinyin, ziU8* initial, ziU8* final) {
ziU8 index = 0;
ziU8 row;
row = 0;
goto check_row;
scan_row:
while (index < 4) {
if (pinyin[index] != Zi8PinyinFinals[row][index]) {
break;
while (row < 0x36) {
while (index < 4) {
if (pinyin[index] != Zi8PinyinFinals[row][index]) {
break;
}
index++;
}
index++;
}
if (index < 4) {
goto next_row;
}
*initial = Zi8PinyinFinals[row][4];
*final = Zi8PinyinFinals[row][5];
return 1;
next_row:
row++;
index = 0;
check_row:
if (row < 0x36) {
goto scan_row;
if (index >= 4) {
*initial = Zi8PinyinFinals[row][4];
*final = Zi8PinyinFinals[row][5];
return 1;
}
row++;
index = 0;
}
return 0;
}
@@ -787,52 +790,43 @@ ziU8 Zi8GetBpmfPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final,
value = *text - 0xF305;
switch ((ziS32)value) {
case 0x22:
goto bpmf_value_22;
case 0x23:
goto bpmf_value_23;
case 0x24:
goto bpmf_value_24;
default:
goto set_bpmf_initial;
}
bpmf_value_22:
*final |= 0x80;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
goto after_bpmf_initial;
bpmf_value_23:
*final |= 0x100;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
goto after_bpmf_initial;
bpmf_value_24:
*final |= 0x180;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
goto after_bpmf_initial;
set_bpmf_initial:
if ((*text < 0xF331) || (*text > 0xF335)) {
*final |= 0x80;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
break;
case 0x23:
*final |= 0x100;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
break;
case 0x24:
*final |= 0x180;
*initial |= 0x180;
resultCount++;
if (--count == 0) {
*bestInitial = *initial | 0x78;
*bestFinal = *final | 0x38;
return resultCount;
}
text++;
break;
default:
if ((*text < 0xF331) || (*text > 0xF335)) {
*initial |= 0x180;
}
}
after_bpmf_initial:
value = *text - 0xF305;
if ((value > 0x14) && (value < 0x22)) {

View File

@@ -0,0 +1,148 @@
# cleanup2-w1 attempts
Worktree `/mnt/drive2/projects/wii-ipl-workers/data-d2`, branch `agent/w1009/cleanup2-w1`, baseline `85d653b0`.
Full build before edits passed. All six units have 100% code, data and linking; completion checker returned `DECOMPLETE_OK`. DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
Use one function per experiment. Keep changes only when every allocated section, relocation and function extent equals the baseline object. Rebuild reverted source before continuing. Temporary candidate source, objects and build output are in `/tmp/cleanup2-w1-work/`.
The October 4 data-layout notes show that statement order can move extabindex and switch-table relocations under `-opt off -inline off`. Compare the entire object, including those sections. Earlier partial matching logs are historical and do not override the exact baseline.
## Trials
- zi8dawg / Zi8MatchROMdata0-structured-key-loop: reverted; changed .text; relocations differ.
- zi81key / Zi8Get1KeyPressCandidates-sorted-ordinal-continue: reverted; changed ; relocations differ.
- zi81key / Zi8Get1KeyPressCandidates-user-ordinal-continue: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi81key / Zi8Get1KeyPressCandidates-ordinal-continue: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi81key / Zi8Get1KeyPressSpelling-entry-continue: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8cgetc / Zi8NewMatchPhonetic-group-candidate-continue: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8cgetc / Zi8GetElementCount-spaced-element-continue: reverted; changed ; relocations differ.
- zi8match / Zi8GetPyFinal-structured-row-loop: reverted; changed .text, extab, extabindex; relocations differ; function extents differ.
- zi8match / Zi8GetBpmfPhonetic-structured-initial-switch: reverted; changed ; relocations differ.
The initial comparator included generated local symbol names such as `@1362`. Removing labels renumbers them without changing relocation targets. The corrected comparator resolves every defined relocation symbol to its section and offset, and keeps names for external symbols. Rerun the three byte-identical candidates below with this correction.
- zi81key / Zi8Get1KeyPressCandidates-sorted-ordinal-continue-resolved-relocations: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / Zi8GetElementCount-spaced-element-continue-resolved-relocations: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetBpmfPhonetic-structured-initial-switch-resolved-relocations: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyFinal-while-with-row-advance: kept; allocated sections, relocations and function extents identical.
- zi81key / Zi8ZHCheckSpelling-tone-switch-break-continue: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8AlphaGetCandidates-dictionary-retry-continue: reverted; changed .text.
- zi8alpha / Zi8AlphaGetCandidates-retryDictionary-same-loop-continue: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8AlphaGetCandidates-finishDictionaryPass-same-loop-continue: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyFinal-structured-row-match: kept; allocated sections, relocations and function extents identical.
- zi81key / Zi8SpellingPY-remove-local-volatile: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / Zi8GetElementCount-flatten-separator-state: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyFinal-positive-row-match: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8AlphaGetCandidates-highlighted-dictionary-break: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8dawg / Zi8MatchROMdata0-child-or-sibling-branch: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-character-range-break: kept; allocated sections, relocations and function extents identical.
- zi8getSW / Zi8GetSyllablesCandidates-syllable-length-loop: kept; allocated sections, relocations and function extents identical.
- zi8dawg / Zi8MatchROMdata0-capacity-break: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyPhonetic-final-scan-break: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-frequency-candidate-break: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-structured-pud-candidate-loop: kept; allocated sections, relocations and function extents identical.
- zi81key / ZiIsSupportedPhonetic-structured-language-switch: kept; allocated sections, relocations and function extents identical.
- zi81key / Zi8SpellingZY-separate-initial-store: reverted; changed .text.
- zi8alpha / Zi8AlphaGetCandidates-separate-punctuation-store: reverted; changed .text.
- zi8cgetc / zi8InternalGetZH-pud-candidate-continue: kept; allocated sections, relocations and function extents identical.
- zi8getSW / Zi8GetSyllablesCandidates-invert-capacity-exit: reverted; changed .text.
- zi8getSW / Zi8GetSyllablesCandidates-structured-initial-candidate: kept; allocated sections, relocations and function extents identical.
- zi81key / MatchAltSound1Key-remove-fallthrough-goto: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8AlphaGetCandidates-remove-fallthrough-goto: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8MatchPhonetic-structured-node-filter: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyPhonetic-structured-final-match: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyPhonetic-structured-h-initial: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / Zi8NewMatchPhonetic-structured-candidate-skip: kept; allocated sections, relocations and function extents identical.
- zi81key / Zi8Get1KeyPressCandidates-user-ordinal-compound-advances: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi81key / Zi8Get1KeyPressCandidates-ordinal-compound-advances: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8getSW / Zi8GetSyllablesCandidates-structured-syllable-output: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-structured-pud-search-guard: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-structured-pud-ordinal-guard: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / Zi8GetChineseCandidates-direct-engine-returns: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8alpha / Zi8IsVowel-direct-returns: reverted; changed .text; relocations differ; function extents differ.
- zi8alpha / Zi8AlphaGetCandidates-highlighted-switch-loop-exit: kept; allocated sections, relocations and function extents identical.
- zi8getSW / Zi8GetSyllablesCandidates-name-search-state: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8MatchPhonetic-structured-phonetic-group-loop: reverted; changed .text.
- zi8match / Zi8GetPyPhonetic-separate-delimiter-load: kept; allocated sections, relocations and function extents identical.
- zi81key / MatchAltSound1Key-structured-backward-scan: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi81key / MatchAltSound1Key-backward-key-loop: reverted; changed .text.
- The preceding structured-backward-scan draft was invalid because its initial jump sat inside the loop. It failed the object check and was restored. The backward-key-loop trial above tests the complete, equivalent bounded scan.
- zi8match / Zi8GetPyPhonetic-separate-tone-adjustment: kept; allocated sections, relocations and function extents identical.
- zi8match / Zi8GetPyPhonetic-separate-post-tone-delimiter-load: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / zi8InternalGetZH-filtered-switch-match-break: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / remove-unused-labels: kept; allocated sections, relocations and function extents identical.
- zi81key / remove-unused-labels: reverted; compiler failed.
- zi8alpha / remove-unused-labels: kept; allocated sections, relocations and function extents identical.
- zi8cgetc / format-pud-loop-and-document-cursor-constraint: kept; allocated sections, relocations and function extents identical.
- zi8match / format-structured-scans-and-document-group-constraint: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8ChangeWordCase-remove-redundant-work-cast: reverted; changed .text.
- zi81key / document-retained-store-and-cursor-constraints: kept; allocated sections, relocations and function extents identical.
- zi8alpha / document-retained-punctuation-store: kept; allocated sections, relocations and function extents identical.
- zi8dawg / document-retained-key-count-test: kept; allocated sections, relocations and function extents identical.
- zi81key / MatchAltSound1Key-remove-exact-unused-process-label: kept; allocated sections, relocations and function extents identical.
- zi8alpha / Zi8ChangeWordCase-document-retained-field-cast: kept; allocated sections, relocations and function extents identical.
- zi8getSW / document-retained-capacity-branch: kept; allocated sections, relocations and function extents identical.
- zi8dawg / Zi8SyllablesROMdata-return-matched-syllable-length: reverted; changed .text, extabindex; relocations differ; function extents differ.
- zi8alpha / place-retained-cast-note-before-case-branch: kept; allocated sections, relocations and function extents identical.
- zi8getSW / name-syllable-input-key-count: kept; allocated sections, relocations and function extents identical.
## Retained source and final review
The corrected comparator proves every retained change preserves all allocated bytes, relocation destinations and function extents. Failed candidates were rebuilt from the last exact source before the next trial. No compiler pragmas or comma conditions were present in the assigned files. Shared exit paths remain.
- zi8cgetc: PUD search uses a guarded while loop with candidate rejections expressed as continue; character and frequency ranges use break. The filtered switch uses break. The separator state is a scalar. Group-candidate cursor advances remain in the body because moving them into a for header changed code and extabindex. The shared engine-return path remains because direct returns changed code.
- zi81key: removed local volatile, flattened the language switch, used continue for sorted ordinals and break/continue for the tone switch. Kept spelling, user and ordinal cursor tails after both assignment and compound-advance header forms changed code. Separating the initial-character store changed code. The bounded backward-key scan changed code.
- zi8alpha: dictionary retries and pass exits use continue only when the destination is the same enclosing loop. The remaining retry jumps escape nested loops. The highlighted dictionary scan exits its switch and loop with break. Shared vowel returns remain because direct returns changed code. The punctuation store and explicit case-mode cast remain because separate stores and removing the cast changed code.
- zi8match: Pinyin final scanning uses break, a while loop and structured match branches; delimiter loads and tone subtraction are separate statements. BPMF initial cases live in their switch. The group-end jump remains because a do/while group loop changed code.
- zi8dawg: capacity uses break and child/sibling handling uses if/else. The key-count test remains at the shared loop test because hoisting it changed code. An explicit byte return from Zi8SyllablesROMdata added code and changed extabindex, so its existing ABI form remains.
- zi8getSW: initial-candidate and syllable-output branches use if/else, and syllable lengths use a for loop with continue. Search flags, cursors, buffers and numeric labels have descriptive names. The forward capacity branch remains because reversing it changed code.
Deleted unused labels in the affected functions. The first PROCESS-label deletion used an unanchored replacement and also damaged START_PROCESS, so it failed compilation and was restored. The corrected exact-label deletion passes. No inline assembly, new volatile, headers, configuration changes or external actions.
| File | Gotos before | Gotos after | Removed |
| --- | ---: | ---: | ---: |
| zi8cgetc.c | 222 | 199 | 23 |
| zi81key.c | 68 | 52 | 16 |
| zi8alpha.c | 50 | 34 | 16 |
| zi8match.c | 36 | 18 | 18 |
| zi8dawg.c | 23 | 20 | 3 |
| zi8getSW.c | 21 | 15 | 6 |
Removed 82 gotos in total, one volatile qualifier, the one-field separator aggregate, and eight unused labels. Source review and git diff --check passed.
- zi8cgetc / align-pud-word-output-else: kept; allocated sections, relocations and function extents identical.
## Source commits
- zi8cgetc.c: `5c435e80c5b5cd89257186b7c48bb639a6a7949c`
- zi81key.c: `a9f06a6eced58c96a9ce0a81b8f8cf419e55216c`
- zi8alpha.c: `7659885f90830ca4d2c0c2a2a014e7c54949f174`
- zi8match.c: `f1d971bf6a4916c564509b4c7971e1b149b4cc95`
- zi8dawg.c: `a16e82d114dd6b7f0ec64367020b8e81d10c1e0b`
- zi8getSW.c: `e51b7fd004422d1e39e7ab8ef6228836bf0dfd5c`
Pool checks against all six original objects passed, each with zero narrow-string entries. The whole-object comparisons also cover the non-string data.
## Final validation
`gate.py` ran once with all six units and `--quick`, as required by the cleanup brief. Full build passed. Every owned section, all 46 functions, all code/data and linking measures are 100%. Regressions, added forbidden patterns and added readability warnings are all zero.
- zi81key: functions 9/9, code 21460/21460, data 1388/1388, fully linked.
- zi8alpha: functions 12/12, code 21664/21664, data 564/564, fully linked.
- zi8cgetc: functions 8/8, code 47816/47816, data 536/536, fully linked.
- zi8dawg: functions 6/6, code 4868/4868, data 120/120, fully linked.
- zi8getSW: functions 1/1, code 1852/1852, data 20/20, fully linked.
- zi8match: functions 10/10, code 8256/8256, data 728/728, fully linked.
Fresh ctxdiff on all 18 touched functions returned equal instruction counts and `diffs 0`. The report was regenerated after the gate.
```
GATE PASS
regressions vs baseline: 0
forbidden patterns added: 0
readability warnings added: 0
DECOMPLETE_OK
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
```
Full gate output: `/tmp/cleanup2-w1-work/gate.log`. No source edits followed the gate.