Compare commits
1 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0568035f1 |
16
configure.py
16
configure.py
@@ -985,21 +985,21 @@ config.libs = [
|
||||
Object(NonMatching, "clib/zconvert.c"),
|
||||
Object(NonMatching, "clib/zi81key.c"),
|
||||
Object(NonMatching, "clib/zi8alpha.c"),
|
||||
Object(NonMatching, "clib/zi8alts.c"),
|
||||
Object(Matching, "clib/zi8alts.c"),
|
||||
Object(NonMatching, "clib/zi8cgetc.c"),
|
||||
Object(NonMatching, "clib/zi8cinfo.c"),
|
||||
Object(Matching, "clib/zi8copy.c"),
|
||||
Object(NonMatching, "clib/zi8dawg.c"),
|
||||
Object(NonMatching, "clib/zi8getc.c"),
|
||||
Object(Matching, "clib/zi8getc.c"),
|
||||
Object(NonMatching, "clib/zi8getc2.c"),
|
||||
Object(NonMatching, "clib/zi8getSW.c"),
|
||||
Object(NonMatching, "clib/zi8initd.c"),
|
||||
Object(NonMatching, "clib/zi8is.c"),
|
||||
Object(Matching, "clib/zi8getSW.c"),
|
||||
Object(Matching, "clib/zi8initd.c"),
|
||||
Object(Matching, "clib/zi8is.c"),
|
||||
Object(NonMatching, "clib/zi8match.c"),
|
||||
Object(NonMatching, "clib/zi8misc.c"),
|
||||
Object(Matching, "clib/zi8misc.c"),
|
||||
Object(NonMatching, "clib/zi8pud2.c"),
|
||||
Object(NonMatching, "clib/Zi8punct.c"),
|
||||
Object(NonMatching, "clib/zi8space.c"),
|
||||
Object(Matching, "clib/Zi8punct.c"),
|
||||
Object(Matching, "clib/zi8space.c"),
|
||||
Object(NonMatching, "clib/zi8uwd.c"),
|
||||
Object(Matching, "clib/zi8ver.c"),
|
||||
Object(Matching, "clib/zi8ZHuwd.c"),
|
||||
|
||||
@@ -160,11 +160,12 @@ typedef struct _ziGetParam {
|
||||
ziWChar* candidates; // 0x18
|
||||
ziU8 maxCandidates; // 0x1C
|
||||
ziWChar firstCandidate; // 0x1E
|
||||
ziU8 wordCandidates; // 0x1F
|
||||
ziU8 unk_0x20; // 0x20
|
||||
|
||||
ziU8 count; // 0x20
|
||||
ziU8 letters; // 0x21
|
||||
ziU8* scratch; // 0x22
|
||||
ziU8 count; // 0x22
|
||||
ziU8* scratch; // 0x24
|
||||
ziU32 unk_0x28; // 0x28
|
||||
} ziGetParam;
|
||||
|
||||
typedef struct _ziLanguageEntry {
|
||||
@@ -172,20 +173,195 @@ typedef struct _ziLanguageEntry {
|
||||
ziU8* tableData; // 0x04
|
||||
} ziLanguageEntry;
|
||||
|
||||
typedef struct _zi8DawgRec {
|
||||
ziU8* node;
|
||||
ziU32 attr;
|
||||
ziU16 key;
|
||||
ziU8 unk_0x0A[2];
|
||||
ziU8* back;
|
||||
} zi8DawgRec;
|
||||
|
||||
typedef struct _zi8DawgCtx {
|
||||
ziU8 lang; // 0x00
|
||||
ziU8 key; // 0x01
|
||||
ziU16 cnt; // 0x02
|
||||
ziU16 cap; // 0x04
|
||||
ziU8 unk_0x06[2];
|
||||
ziU8* p08; // 0x08
|
||||
ziU8* p0C; // 0x0C
|
||||
ziU8* table; // 0x10
|
||||
ziU8* p14; // 0x14
|
||||
zi8DawgRec recs[0x32]; // 0x18
|
||||
ziU32 unk_0x338; // 0x338
|
||||
} zi8DawgCtx;
|
||||
|
||||
typedef struct _ziUwdNode {
|
||||
struct _ziUwdNode* next;
|
||||
ziU8* word;
|
||||
} ziUwdNode;
|
||||
|
||||
struct __zi8_work_data_s {
|
||||
ziU8 unk_0x00;
|
||||
ziU8 unk_0x01;
|
||||
ziU8 unk_0x02[2];
|
||||
ziLanguageEntry* langEntries; // 0x04
|
||||
ziU32 unk_0x08;
|
||||
ziU8 unk_0x08;
|
||||
ziU8 unk_0x09;
|
||||
ziU8 unk_0x0A;
|
||||
ziU8 unk_0x0B;
|
||||
ziU32 unk_0x0C;
|
||||
ziU32 unk_0x10;
|
||||
ziU32 unk_0x14;
|
||||
ziU16 unk_0x14;
|
||||
ziU8 unk_0x16;
|
||||
ziU8 unk_0x17;
|
||||
ziU8 unk_0x18;
|
||||
ziU8 unk_0x1C[0x108];
|
||||
ziU8 unk_0x19;
|
||||
ziU16 unk_0x1A;
|
||||
ziU8 unk_0x1C[3];
|
||||
ziU8 unk_0x1F;
|
||||
ziU16 unk_0x20[0x40];
|
||||
ziU16 unk_0xA0[0x42];
|
||||
ziU16* unk_0x124[1];
|
||||
ziU8* unk_0x128;
|
||||
ziU8 unk_0x12C;
|
||||
ziU8 unk_0x12D;
|
||||
ziU8 unk_0x12E;
|
||||
ziU8 unk_0x12F;
|
||||
ziPtr unk_0x130[2];
|
||||
ziU8 unk_0x138;
|
||||
ziU8 unk_0x139[3];
|
||||
ziU32 unk_0x13C;
|
||||
ziU8 unk_0x140;
|
||||
ziU8 unk_0x141[0x43];
|
||||
ziU8 unk_0x184[0x43];
|
||||
ziU8 uwdCount; // 0x1C7
|
||||
ziUwdNode uwdNodes[0x20]; // 0x1C8
|
||||
ziUwdNode* uwdList; // 0x2C8
|
||||
ziU32 pudTable[0x10]; // 0x2CC
|
||||
ziU8 pudCount; // 0x30C
|
||||
ziU8 unk_0x30D[3];
|
||||
ziU32 unk_0x310;
|
||||
ziU32 unk_0x314;
|
||||
ziU32 unk_0x318;
|
||||
ziU8 pdRemoveOpt; // 0x31C
|
||||
ziU8 unk_0x31D;
|
||||
ziU8 unk_0x31E;
|
||||
ziU8 unk_0x31F;
|
||||
ziU8 (*oemMatch)(ziU16 idx, ziWChar* buf, ziU8 len, ziPtr data); //0x320
|
||||
ziU16 oemLen; //0x324
|
||||
ziU8 unk_0x326[2];
|
||||
ziU32 oemIdx; //0x328
|
||||
ziPtr oemData; //0x32C
|
||||
ziU8 unk_0x330[8];
|
||||
ziU32 unk_0x338;
|
||||
ziU8 unk_0x33C[0x1FC];
|
||||
ziU8 unk_0x538;
|
||||
ziU8 unk_0x539;
|
||||
ziU8 unk_0x53A[0x40];
|
||||
ziWChar unk_0x57A[0x641];
|
||||
ziPtr unk_0x11FC;
|
||||
ziPtr userKeys[0x83]; // 0x1200
|
||||
ziU8 unk_0x140C[4];
|
||||
ziU32 unk_0x1410;
|
||||
ziU8 unk_0x1414[4];
|
||||
ziU8 unk_0x1418;
|
||||
ziU8 unk_0x1419;
|
||||
ziU16 unk_0x141A;
|
||||
ziU8 unk_0x141C;
|
||||
ziU8 unk_0x141D;
|
||||
ziU8 unk_0x141E;
|
||||
ziU8 unk_0x141F;
|
||||
ziU8 unk_0x1420[4];
|
||||
zi8DawgCtx dawgCtx; // 0x1424
|
||||
ziU8 unk_0x1760[4]; // 0x1760
|
||||
ziU8* unk_0x1764; // 0x1764
|
||||
ziU8 unk_0x1768;
|
||||
ziU8 unk_0x1769[0x81];
|
||||
ziU16 unk_0x17EA;
|
||||
ziU8 unk_0x17EC;
|
||||
ziU8 unk_0x17ED[3];
|
||||
ziU8* unk_0x17F0;
|
||||
ziWChar unk_0x17F4[0x40]; // 0x17F4..0x1874
|
||||
ziU16 unk_0x1874;
|
||||
ziU8 unk_0x1876;
|
||||
ziU8 unk_0x1877;
|
||||
ziU8 unk_0x1878;
|
||||
ziU8 unk_0x1879;
|
||||
ziWChar unk_0x187A[0x41];
|
||||
ziU8 unk_0x18FC;
|
||||
ziU8 unk_0x18FD;
|
||||
ziWChar unk_0x18FE[0x41];
|
||||
ziU8 unk_0x1980;
|
||||
ziU8 unk_0x1981;
|
||||
ziU8 unk_0x1982;
|
||||
ziU8 unk_0x1983;
|
||||
ziU8 unk_0x1984;
|
||||
ziU8 unk_0x1985;
|
||||
ziU8 unk_0x1986;
|
||||
ziU8 unk_0x1987;
|
||||
ziWChar unk_0x1988[0x41];
|
||||
ziU8 unk_0x1A0A;
|
||||
ziU8 unk_0x1A0B[0x85];
|
||||
ziWChar unk_0x1A90;
|
||||
ziWChar unk_0x1A92[0x41];
|
||||
ziU8 unk_0x1B14;
|
||||
ziU8 unk_0x1B15[3];
|
||||
ziU16* unk_0x1B18;
|
||||
ziU16 unk_0x1B1C;
|
||||
ziU16 unk_0x1B1E;
|
||||
ziU16 unk_0x1B20;
|
||||
ziU16 unk_0x1B22;
|
||||
ziU8 unk_0x1B24;
|
||||
ziU8 unk_0x1B25[3];
|
||||
union {
|
||||
ziU32 word;
|
||||
struct {
|
||||
ziU32 msb : 1;
|
||||
} bits;
|
||||
} unk_0x1B28;
|
||||
union {
|
||||
ziU32 word;
|
||||
struct {
|
||||
ziU32 msb : 1;
|
||||
} bits;
|
||||
} unk_0x1B2C;
|
||||
ziU8 unk_0x1B30;
|
||||
ziU8 unk_0x1B31;
|
||||
ziU16 unk_0x1B32;
|
||||
ziU16 unk_0x1B34;
|
||||
ziU16 unk_0x1B36;
|
||||
ziU16 unk_0x1B38;
|
||||
ziU8 unk_0x1B3A;
|
||||
ziU8 unk_0x1B3B;
|
||||
ziU8 unk_0x1B3C;
|
||||
ziU8 unk_0x1B3D;
|
||||
ziU8 unk_0x1B3E;
|
||||
ziU8 unk_0x1B3F;
|
||||
ziU16 unk_0x1B40;
|
||||
ziU8 unk_0x1B42[2];
|
||||
};
|
||||
|
||||
typedef struct ziMatchParam {
|
||||
ziU8 count; // 0x00
|
||||
ziU8 arr1[0xC]; // 0x01
|
||||
ziU8 arrD[0xC]; // 0x0D
|
||||
ziU8 arr19[4]; // 0x19
|
||||
ziU8 arr1D[4]; // 0x1D
|
||||
ziU8 pad_0x21; // 0x21
|
||||
ziU16 field22; // 0x22
|
||||
ziU8 length; // 0x24
|
||||
ziU8 nCand; // 0x25
|
||||
ziWChar phon[0x10]; // 0x26
|
||||
ziWChar phon2[0x10]; // 0x46
|
||||
ziWChar first; // 0x66
|
||||
ziWChar first2; // 0x68
|
||||
ziWChar comp; // 0x6A
|
||||
ziU8 nSeg; // 0x6C
|
||||
ziU8 segs1[0xC0]; // 0x6D
|
||||
ziU8 segsD[0xC0]; // 0x12D
|
||||
ziU8 pad_0x1ED; // 0x1ED
|
||||
} ziMatchParam;
|
||||
|
||||
#define ZI_WORK ((struct __zi8_work_data_s*)__zi8_work_data)
|
||||
#define ZI_NEED_WORK , ziPtr __zi8_work_data
|
||||
|
||||
|
||||
49
libs/RVLMiddleware/eZiText/src/clib/Zi8punct.c
Normal file
49
libs/RVLMiddleware/eZiText/src/clib/Zi8punct.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
const ziWChar Zi8PunctTable[40] = {
|
||||
0xFF0C, 0x3002, 0x3001, 0xFF1A, 0xFF1F, 0xFF01, 0x3005, 0x2026,
|
||||
0x2015, 0xFF1B, 0xFF0E, 0x30FB, 0x201C, 0x201D, 0xFF08, 0xFF09,
|
||||
0x300C, 0x300D, 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15,
|
||||
0xFF16, 0xFF17, 0xFF18, 0xFF19, 0xFF0F, 0xFF05, 0xFFE5, 0xFF04,
|
||||
0xFFE1, 0x20AC, 0x203B, 0xFF20, 0x0000,
|
||||
};
|
||||
|
||||
ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
|
||||
ziS32 limit = ((ziU16*)__zi8_work_data)[8] - 1;
|
||||
ziS32 count = 0;
|
||||
ziU8 i = 0;
|
||||
ziU16 fc = param->firstCandidate;
|
||||
ziU16 j = 0;
|
||||
|
||||
for (;;) {
|
||||
if (Zi8PunctTable[j] == 0) {
|
||||
break;
|
||||
}
|
||||
if (fc == 0) {
|
||||
count++;
|
||||
if (ZI_WORK->unk_0x00 == 0) {
|
||||
param->candidates[i++] = Zi8PunctTable[j];
|
||||
if ((param->context & 0x10) != 0) {
|
||||
param->candidates[i++] = 0x20;
|
||||
if ((ziU8)i >= limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (count >= param->maxCandidates) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (count >= (ziS32)ZI_WORK->unk_0x0C) {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fc--;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if (ZI_WORK->unk_0x00 == 0) {
|
||||
param->letters = count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
108
libs/RVLMiddleware/eZiText/src/clib/zi8alts.c
Normal file
108
libs/RVLMiddleware/eZiText/src/clib/zi8alts.c
Normal file
@@ -0,0 +1,108 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
ziU16 Zi8MatchAltSound(ziU8* elements, ziU16 count, ziU8* table, ziU16 ch,
|
||||
ziU32 mask, ziU16 target, ziU8 flags ZI_NEED_WORK) {
|
||||
ziU8 hi;
|
||||
ziU8 lo;
|
||||
ziS32 i;
|
||||
ziS32 j;
|
||||
ziS32 mid;
|
||||
ziU16 off;
|
||||
ziU16 w;
|
||||
|
||||
hi = (ziU8)((ziU16)ch >> 8);
|
||||
lo = (ziU8)ch;
|
||||
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;
|
||||
}
|
||||
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
|
||||
goto up;
|
||||
}
|
||||
goto search;
|
||||
up:
|
||||
i = j;
|
||||
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;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (i >= count) {
|
||||
goto down_start;
|
||||
}
|
||||
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
|
||||
goto body;
|
||||
}
|
||||
down_start:
|
||||
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;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
goto up;
|
||||
}
|
||||
if ((((ziU16)(elements + j * 4)[1] << 8) | (ziU16)(elements + j * 4)[0]) > ch) {
|
||||
return 0;
|
||||
}
|
||||
mid = (j + i) / 2;
|
||||
if (mid == j) {
|
||||
return 0;
|
||||
}
|
||||
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
|
||||
i = mid;
|
||||
goto hi_check;
|
||||
}
|
||||
j = mid;
|
||||
goto search;
|
||||
hi_check:
|
||||
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
|
||||
j = i;
|
||||
goto up;
|
||||
}
|
||||
if ((((ziU16)(elements + i * 4)[1] << 8) | (ziU16)(elements + i * 4)[0]) < ch) {
|
||||
return 0;
|
||||
}
|
||||
mid = (j + i) / 2;
|
||||
if (mid == j) {
|
||||
return 0;
|
||||
}
|
||||
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
|
||||
i = mid;
|
||||
goto hi_check;
|
||||
}
|
||||
j = mid;
|
||||
goto search;
|
||||
}
|
||||
212
libs/RVLMiddleware/eZiText/src/clib/zi8getSW.c
Normal file
212
libs/RVLMiddleware/eZiText/src/clib/zi8getSW.c
Normal file
@@ -0,0 +1,212 @@
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
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,
|
||||
ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK);
|
||||
|
||||
typedef struct _ziSwParam {
|
||||
ziU8 flag;
|
||||
ziU8 unk_0x01[0xB];
|
||||
ziS32 count;
|
||||
ziU16 cap;
|
||||
ziU8 unk_0x12[2];
|
||||
} 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;
|
||||
|
||||
firstCand = param->firstCandidate;
|
||||
count = 0;
|
||||
u28 = 0;
|
||||
pNext = 0;
|
||||
flag14 = 1;
|
||||
flag13 = 1;
|
||||
flag12 = 0;
|
||||
flag11 = 0;
|
||||
sylCnt = 0;
|
||||
err = 0x64;
|
||||
|
||||
if (param->currentWord != 0 && param->wordCharCount != 0 &&
|
||||
param->currentWord[param->wordCharCount - 1] != 0x20) {
|
||||
flag11 = 1;
|
||||
}
|
||||
|
||||
if (param->elementCount == 0 || (param->elementCount == 1 && flag11 == 0)) {
|
||||
count = Zi8AlphaGetCandidates(param, sw, ZI_WORK);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sw->flag != 0 || (param->getOptions & 0xFD) != 0x81) {
|
||||
out = buf;
|
||||
rem = 0x40;
|
||||
} else {
|
||||
out = (ziWChar*)param->candidates;
|
||||
rem = sw->cap - 1;
|
||||
}
|
||||
if ((param->getOptions & 0xFD) == 0x80) {
|
||||
u28 = (ziU8*)param->candidates;
|
||||
rem = sw->cap - 1;
|
||||
}
|
||||
|
||||
if (rem <= param->elementCount) {
|
||||
err = 0x168;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((Zi8GetTableCount(param->language, 0x1F, ZI_WORK) & 8) != 0) {
|
||||
flag14 = 0;
|
||||
}
|
||||
|
||||
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
|
||||
buf[0] = 0x2D;
|
||||
} else {
|
||||
Zi8getKeyLayout(param->language, param->elements[0], buf, 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;
|
||||
} else {
|
||||
cur = 1;
|
||||
}
|
||||
|
||||
if (cur == param->elementCount) goto L5dc;
|
||||
if (firstCand != 0) {
|
||||
firstCand--;
|
||||
goto L5dc;
|
||||
}
|
||||
if (sw->flag != 0) {
|
||||
if (++count >= sw->count) 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;
|
||||
} 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->flag != 0) {
|
||||
if (++count >= sw->count) goto end;
|
||||
goto L560;
|
||||
}
|
||||
if (u28 != 0) {
|
||||
for (i = 0; i < cur; i++) {
|
||||
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
|
||||
}
|
||||
u28[i++] = 0;
|
||||
u28[i] = 0;
|
||||
u28 += i;
|
||||
} else {
|
||||
i = cur;
|
||||
out[i++] = 0;
|
||||
out[i] = 0;
|
||||
out += i;
|
||||
}
|
||||
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;
|
||||
}
|
||||
while (buf2[i] != 0) {
|
||||
buf2[i] = buf2[i + 1];
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
Zi8getKeyLayout(param->language, param->elements[0], buf2, 1, ZI_WORK);
|
||||
}
|
||||
cur = 1;
|
||||
pNext = buf2;
|
||||
goto L560;
|
||||
|
||||
end:
|
||||
if (sw->flag != 0) {
|
||||
param->letters = 0;
|
||||
} else {
|
||||
param->letters = (ziU8)count;
|
||||
}
|
||||
Zi8LogError(err, ZI_WORK);
|
||||
return count;
|
||||
}
|
||||
15
libs/RVLMiddleware/eZiText/src/clib/zi8getc.c
Normal file
15
libs/RVLMiddleware/eZiText/src/clib/zi8getc.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <zi8clib/zi8getc.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
|
||||
|
||||
ziU8 Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK) {
|
||||
ZI_WORK->unk_0x1B3A = 0;
|
||||
ZI_WORK->unk_0x1B3C = 0;
|
||||
ZI_WORK->unk_0x1B3B = 0;
|
||||
ZI_WORK->unk_0x1B3D = 0;
|
||||
ZI_WORK->unk_0x1B36 = 0;
|
||||
ZI_WORK->unk_0x1B32 = 0;
|
||||
ZI_WORK->unk_0x1B34 = 0;
|
||||
return _Zi8GetCandidates(getParam, ZI_WORK);
|
||||
}
|
||||
75
libs/RVLMiddleware/eZiText/src/clib/zi8initd.c
Normal file
75
libs/RVLMiddleware/eZiText/src/clib/zi8initd.c
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
|
||||
extern void Zi8SetLatinSearchOrder(ziU32 a, ziU8 b ZI_NEED_WORK);
|
||||
extern void ZADP_Zi8SetPDremoveOpt(ziU8 a ZI_NEED_WORK);
|
||||
extern ziU16 Zi8GetFormatVersion(ziU8 a ZI_NEED_WORK);
|
||||
extern void Zi8ZHsetZYfuzzyPairs(ziU32* a ZI_NEED_WORK);
|
||||
extern void Zi8ZHsetPYfuzzyPairs(ziU32* a ZI_NEED_WORK);
|
||||
extern void Zi8SetParentalControls(ziU8 a ZI_NEED_WORK);
|
||||
|
||||
ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
|
||||
ziU32 zyFuzzy;
|
||||
ziU32 pyFuzzy;
|
||||
ziU32* pzyFuzzy;
|
||||
ziU32* ppyFuzzy;
|
||||
|
||||
Zi8Memset(__zi8_work_data, 0, 0x1B44);
|
||||
ZI_WORK->unk_0x08 = 1;
|
||||
ZI_WORK->unk_0x09 = 1;
|
||||
ZI_WORK->unk_0x0A = 0xFF;
|
||||
ZI_WORK->unk_0x10 = 0x64;
|
||||
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
|
||||
ZI_WORK->unk_0x1A = 0x20;
|
||||
ZI_WORK->unk_0x1C[2] = 0;
|
||||
ZI_WORK->unk_0x1B30 = 0;
|
||||
ZI_WORK->unk_0x1B3A = 0;
|
||||
ZI_WORK->unk_0x1B36 = 0;
|
||||
ZI_WORK->unk_0x1B32 = 0;
|
||||
ZI_WORK->unk_0x1B34 = 0;
|
||||
ZI_WORK->unk_0x1B3B = 0;
|
||||
ZI_WORK->unk_0x1B3C = 0;
|
||||
ZI_WORK->unk_0x1B40 = 0;
|
||||
ZI_WORK->unk_0x1B38 = 0;
|
||||
ZI_WORK->langEntries = langEntries;
|
||||
if (ZI_WORK->langEntries == ZI8_NULL) {
|
||||
Zi8LogError(0x578, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
if (ZI_WORK->langEntries->language == 0) {
|
||||
Zi8LogError(0x582, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
ZI_WORK->unk_0x1874 = 0x2D;
|
||||
ZI_WORK->unk_0x538 = 0;
|
||||
ZI_WORK->unk_0x1C[3] = 0;
|
||||
ZI_WORK->unk_0x141A = 0x100;
|
||||
Zi8SetLatinSearchOrder(0, 0, ZI_WORK);
|
||||
ZADP_Zi8SetPDremoveOpt(1, ZI_WORK);
|
||||
ZI_WORK->unk_0x17 = 5;
|
||||
ZI_WORK->unk_0x16 = Zi8GetFormatVersion(1, ZI_WORK) & 2;
|
||||
ZI_WORK->unk_0x1B28.bits.msb = 1;
|
||||
ZI_WORK->unk_0x1B2C.bits.msb = 1;
|
||||
zyFuzzy = ZI_WORK->unk_0x1B2C.word;
|
||||
pzyFuzzy = &zyFuzzy;
|
||||
Zi8ZHsetZYfuzzyPairs(pzyFuzzy, ZI_WORK);
|
||||
pyFuzzy = ZI_WORK->unk_0x1B28.word;
|
||||
ppyFuzzy = &pyFuzzy;
|
||||
Zi8ZHsetPYfuzzyPairs(ppyFuzzy, ZI_WORK);
|
||||
Zi8SetParentalControls(2, ZI_WORK);
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziU8 Zi8IsZicorpSignature(ziU16* p, ziU16 len) {
|
||||
if ((ziU16)len > 6 && p[0] == 0x7A && p[1] == 0x69 && p[2] == 0x63 &&
|
||||
p[3] == 0x6F && p[4] == 0x72 && p[5] == 0x70) {
|
||||
return 1;
|
||||
}
|
||||
if ((ziU16)len > 6 && p[0] == 0x39 && p[1] == 0x34 && p[2] == 0x32 &&
|
||||
p[3] == 0x36 && p[4] == 0x37 && p[5] == 0x37) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
138
libs/RVLMiddleware/eZiText/src/clib/zi8is.c
Normal file
138
libs/RVLMiddleware/eZiText/src/clib/zi8is.c
Normal file
@@ -0,0 +1,138 @@
|
||||
#include <zi8clib/zi8is.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
extern ziU8 Zi8LangSupported(ziU8 lang ZI_NEED_WORK);
|
||||
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
|
||||
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
|
||||
|
||||
ziU8 Zi8GetZHCharSet(ziPtr workData) {
|
||||
ziU8 charSet = 0;
|
||||
ziU8 bak;
|
||||
ziU16 v0;
|
||||
ziU16 v1;
|
||||
ziU16 v2;
|
||||
ziU32 addr;
|
||||
ziU8* p;
|
||||
ziWChar candBuf[0x10];
|
||||
ziGetParam getParam;
|
||||
|
||||
Zi8LogError(0x64, workData);
|
||||
if (Zi8LangSupported(1, workData) == 0) {
|
||||
Zi8ReplaceLastError(0x26C, workData);
|
||||
return 0;
|
||||
}
|
||||
if (Zi8GetTableCount(1, 10, workData) != 0) {
|
||||
bak = ((struct __zi8_work_data_s*)workData)->unk_0x18;
|
||||
((struct __zi8_work_data_s*)workData)->unk_0x18 = 1;
|
||||
addr = Zi8GetTableAddress(1, 10, workData);
|
||||
p = (ziU8*)addr;
|
||||
v0 = (ziU16)((ziU16)p[0] | ((ziU16)p[1] << 8));
|
||||
((struct __zi8_work_data_s*)workData)->unk_0x18 = 0;
|
||||
addr = Zi8GetTableAddress(1, 10, workData);
|
||||
p = (ziU8*)addr;
|
||||
v1 = (ziU16)((ziU16)p[2] | ((ziU16)p[3] << 8));
|
||||
v2 = (ziU16)((ziU16)p[4] | ((ziU16)p[5] << 8));
|
||||
((struct __zi8_work_data_s*)workData)->unk_0x18 = bak;
|
||||
if (v0 != 0) {
|
||||
if (v0 > 0x4E20) {
|
||||
charSet |= 8;
|
||||
} else {
|
||||
charSet |= 1;
|
||||
}
|
||||
}
|
||||
if (v1 != 0) {
|
||||
if (v1 > 0x2710) {
|
||||
charSet |= 2;
|
||||
} else {
|
||||
charSet |= 0x10;
|
||||
}
|
||||
}
|
||||
if (v2 != 0) {
|
||||
charSet |= 4;
|
||||
}
|
||||
return charSet;
|
||||
}
|
||||
|
||||
Zi8Memset(&getParam, 0, 0x2C);
|
||||
getParam.language = 1;
|
||||
getParam.context = 1;
|
||||
getParam.getOptions = 0;
|
||||
getParam.candidates = candBuf;
|
||||
getParam.maxCandidates = 1;
|
||||
getParam.subLanguage = 1;
|
||||
retry:
|
||||
getParam.getMode = 0;
|
||||
if (_Zi8GetCandidates(&getParam, workData) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
goto next;
|
||||
}
|
||||
getParam.getMode = 1;
|
||||
if (_Zi8GetCandidates(&getParam, workData) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
goto next;
|
||||
}
|
||||
getParam.getMode = 2;
|
||||
if (_Zi8GetCandidates(&getParam, workData) != 0) {
|
||||
charSet |= getParam.subLanguage;
|
||||
}
|
||||
next:
|
||||
if (getParam.subLanguage == 1) {
|
||||
getParam.subLanguage = 4;
|
||||
goto retry;
|
||||
}
|
||||
if (getParam.subLanguage == 4) {
|
||||
getParam.subLanguage = 2;
|
||||
goto retry;
|
||||
}
|
||||
return charSet;
|
||||
}
|
||||
|
||||
ziBool Zi8IsComponent(ziWChar ch ZI_NEED_WORK) {
|
||||
if (ch >= 0xEF10 && ch < 0xF305) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziBool Zi8IsCharacter(ziWChar ch ZI_NEED_WORK) {
|
||||
ziU16 count;
|
||||
ziU8 hi;
|
||||
ziU8 lo;
|
||||
|
||||
ziU32 addr;
|
||||
ziU8* table;
|
||||
ziU16 i;
|
||||
|
||||
if (ch >= 0x3105 && ch <= 0x3129) {
|
||||
return 1;
|
||||
}
|
||||
switch (ch) {
|
||||
case 0x2C7:
|
||||
case 0x2C9:
|
||||
case 0x2CA:
|
||||
case 0x2CB:
|
||||
case 0x2D9:
|
||||
return 1;
|
||||
}
|
||||
switch (ch) {
|
||||
case 0x3002:
|
||||
case 0xFF01:
|
||||
case 0xFF0C:
|
||||
case 0xFF1F:
|
||||
return 1;
|
||||
}
|
||||
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
|
||||
lo = (ziU8)ch;
|
||||
count = Zi8GetTableCount(1, 0, ZI_WORK);
|
||||
addr = Zi8GetTableAddress(1, 0, ZI_WORK);
|
||||
table = (ziU8*)addr;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (table[6] == hi && table[7] == lo) {
|
||||
return 1;
|
||||
}
|
||||
table += 0xC;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
144
libs/RVLMiddleware/eZiText/src/clib/zi8misc.c
Normal file
144
libs/RVLMiddleware/eZiText/src/clib/zi8misc.c
Normal file
@@ -0,0 +1,144 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
|
||||
typedef struct { ziU8 b[0xC]; } ziE12;
|
||||
|
||||
#define WORKP ((struct __zi8_work_data_s*)__zi8_work_data)
|
||||
|
||||
ziU16 Zi8Uni2Ptr(ziU16 ch, ziE12* buf ZI_NEED_WORK) {
|
||||
ziU8 hi;
|
||||
ziU8 lo;
|
||||
ziU16 count;
|
||||
ziU32 table;
|
||||
ziU32 table2;
|
||||
ziU16 i;
|
||||
ziU8* e;
|
||||
ziU8* p;
|
||||
|
||||
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
|
||||
lo = (ziU8)ch;
|
||||
count = Zi8GetTableCount(1, 0, __zi8_work_data);
|
||||
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
|
||||
table2 = Zi8GetTableAddress(1, 1, __zi8_work_data);
|
||||
if (buf == ZI8_NULL) {
|
||||
for (i = 0; i < 0x40; i++) {
|
||||
if (ch == WORKP->unk_0x20[i]) {
|
||||
i = WORKP->unk_0xA0[i];
|
||||
e = (ziU8*)table + i * 0xC;
|
||||
if (i >= count) {
|
||||
break;
|
||||
}
|
||||
if (hi != e[6] || lo != e[7]) {
|
||||
break;
|
||||
}
|
||||
p = (ziU8*)(table2 +
|
||||
(((e[9] & 0xF) << 16) |
|
||||
(e[0xB] | (e[0xA] << 8))));
|
||||
if (WORKP->unk_0x16 != 0) {
|
||||
switch (p[0] & 7) {
|
||||
case 2:
|
||||
p += 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
p += 3;
|
||||
break;
|
||||
case 5:
|
||||
p += 4;
|
||||
break;
|
||||
default:
|
||||
p += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((p[0] & 0x80) == 0) {
|
||||
break;
|
||||
}
|
||||
if (buf != ZI8_NULL) {
|
||||
*buf = *(ziE12*)e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
e = (ziU8*)table;
|
||||
if (WORKP->unk_0x1B18 != ZI8_NULL && WORKP->unk_0x1B24 == WORKP->unk_0x18) {
|
||||
if ((ziU16)ch >= WORKP->unk_0x1B1C && (ziU16)ch <= WORKP->unk_0x1B1E) {
|
||||
i = (ziU16)(ch - WORKP->unk_0x1B1C);
|
||||
goto map;
|
||||
}
|
||||
if ((ziU16)ch >= WORKP->unk_0x1B20 && (ziU16)ch <= WORKP->unk_0x1B22) {
|
||||
i = (ziU16)(WORKP->unk_0x1B1E + (ch - WORKP->unk_0x1B20) -
|
||||
WORKP->unk_0x1B1C + 1);
|
||||
goto map;
|
||||
}
|
||||
return 0xFFFF;
|
||||
map:
|
||||
i = WORKP->unk_0x1B18[i];
|
||||
if (i != 0xFFFF) {
|
||||
e = (ziU8*)table + i * 0xC;
|
||||
if (hi == e[6] && lo == e[7]) {
|
||||
if (buf != ZI8_NULL) {
|
||||
*buf = *(ziE12*)e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0xFFFF;
|
||||
}
|
||||
i = 0;
|
||||
while (i < count) {
|
||||
if (lo == e[7] && hi == e[6]) {
|
||||
if (buf != ZI8_NULL) {
|
||||
*buf = *(ziE12*)e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
e += 0xC;
|
||||
i++;
|
||||
}
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
ziU16 Zi8Uni2Ord(ziU16 ch ZI_NEED_WORK) {
|
||||
return Zi8Uni2Ptr(ch, ZI8_NULL, __zi8_work_data);
|
||||
}
|
||||
|
||||
ziU16 Zi8Ord2Uni(ziU16 ord ZI_NEED_WORK) {
|
||||
ziU8* p;
|
||||
|
||||
if ((ziU16)ord >= Zi8GetTableCount(1, 0, __zi8_work_data)) {
|
||||
Zi8LogError(0x132, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
p = (ziU8*)Zi8GetTableAddress(1, 0, __zi8_work_data);
|
||||
p += ord * 0xC;
|
||||
Zi8LogError(0x64, __zi8_work_data);
|
||||
return (ziU16)(((ziU16)p[6] << 8) + p[7]);
|
||||
}
|
||||
|
||||
ziU16 Zi8Ord2Ord(ziU16 ord ZI_NEED_WORK) {
|
||||
ziU32 table;
|
||||
ziU16 count;
|
||||
ziU8* p;
|
||||
|
||||
count = Zi8GetTableCount(1, 0, __zi8_work_data);
|
||||
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
|
||||
if (ord == 0 || (ziU16)ord >= count) {
|
||||
Zi8LogError(0x132, __zi8_work_data);
|
||||
return ord;
|
||||
}
|
||||
p = (ziU8*)table + (ord - 1) * 0xC;
|
||||
while (ord != 0) {
|
||||
if (p[6] != p[0x12] || p[7] != p[0x13]) {
|
||||
break;
|
||||
}
|
||||
p -= 0xC;
|
||||
ord--;
|
||||
}
|
||||
Zi8LogError(0x64, __zi8_work_data);
|
||||
return ord;
|
||||
}
|
||||
99
libs/RVLMiddleware/eZiText/src/clib/zi8space.c
Normal file
99
libs/RVLMiddleware/eZiText/src/clib/zi8space.c
Normal file
@@ -0,0 +1,99 @@
|
||||
#include <zi8clib/zi8space.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
extern ziU8 Zi8GetPyPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b, ziU8* c,
|
||||
ziU16* d, ziU16* e ZI_NEED_WORK);
|
||||
extern ziU8 Zi8GetBpmfPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b,
|
||||
ziU16* d, ziU16* e ZI_NEED_WORK);
|
||||
|
||||
ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
|
||||
ziU16 maxLen ZI_NEED_WORK) {
|
||||
ziWChar candBuf[0x10];
|
||||
ziWChar pyBuf[0x10];
|
||||
ziU16 m;
|
||||
ziU16 vE;
|
||||
ziU16 vC;
|
||||
ziU8 n;
|
||||
ziU8 flag;
|
||||
ziU8 v9;
|
||||
ziU8 isPy;
|
||||
int i;
|
||||
int k;
|
||||
ziWChar* psrc;
|
||||
ziWChar* pdst;
|
||||
|
||||
psrc = src;
|
||||
n = count;
|
||||
pdst = dst;
|
||||
m = maxLen;
|
||||
|
||||
if (n == 0) {
|
||||
Zi8LogError(0x137, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((psrc[0] >= 0xF361 && psrc[0] <= 0xF37A) ||
|
||||
(psrc[0] >= 0xF341 && psrc[0] <= 0xF35A)) {
|
||||
isPy = 1;
|
||||
} else if (psrc[0] >= 0xF305 && psrc[0] <= 0xF329) {
|
||||
isPy = 0;
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
i = 2;
|
||||
while (i <= n) {
|
||||
if (isPy) {
|
||||
flag = Zi8GetPyPhonetic(psrc, i, candBuf, pyBuf, &v9, &vE, &vC, ZI_WORK);
|
||||
if (i == v9) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if ((psrc[i - 1] == 0xF360 && psrc[i - 2] != 0xF360) ||
|
||||
Zi8GetBpmfPhonetic(psrc, i, candBuf, pyBuf, &vE, &vC, ZI_WORK) !=
|
||||
0) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (i-- >= m - 1) {
|
||||
goto fail;
|
||||
}
|
||||
m -= i + 1;
|
||||
for (k = 0; k < i; k++) {
|
||||
pdst[k] = psrc[k];
|
||||
}
|
||||
if (pdst[k - 1] != 0xF360 &&
|
||||
(pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) {
|
||||
pdst[k++] = ZI_WORK->unk_0x1A;
|
||||
}
|
||||
psrc += i;
|
||||
n -= i;
|
||||
pdst += k;
|
||||
i = 2;
|
||||
}
|
||||
|
||||
if (i-- > m) {
|
||||
goto fail;
|
||||
}
|
||||
for (k = 0; k < i; k++) {
|
||||
pdst[k] = psrc[k];
|
||||
}
|
||||
pdst[k] = 0;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
if ((ziU8)count >= (ziU16)maxLen) {
|
||||
count = (ziU8)(maxLen - 1);
|
||||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
dst[i] = src[i];
|
||||
}
|
||||
dst[i] = 0;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user