Import sj3-patches-20040916
Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
parent
381c676eda
commit
a76f53bc03
78 changed files with 3433 additions and 3852 deletions
252
kanakan/adddic.c
252
kanakan/adddic.c
|
|
@ -31,49 +31,34 @@
|
|||
* $SonyRCSfile: adddic.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:26 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Uchar *srchdict(), *skipkstr(), *get_idxptr();
|
||||
Int sstrncmp(), study(), cmpstr();
|
||||
Int cvtknj();
|
||||
Int srchkana(), srchgram(), getkanji();
|
||||
Int sstrlen(), srchkanji();
|
||||
Uint addel_arg();
|
||||
Void memset(), mvmemi(), mkclidx(), mkidxtbl();
|
||||
Void mvmemd(), set_size(), delclsub();
|
||||
TypeDicSeg srchidx();
|
||||
TypeIdxOfs count_uidx();
|
||||
static u_int checkdict(u_char* kanji, TypeGram grm);
|
||||
static int cal_nextym(u_char* ptr);
|
||||
static int usr_freelen(void);
|
||||
static void sprt_seg(TypeDicSeg seg, TypeDicOfs ofs);
|
||||
static void apnd_uidx(TypeDicSeg seg, u_char* yomi, int len);
|
||||
|
||||
|
||||
|
||||
Void chg_uidx();
|
||||
Static Void sprt_seg(), apnd_uidx();
|
||||
|
||||
Static Int cal_nextym(), usr_freelen();
|
||||
Static Uint checkdict();
|
||||
|
||||
|
||||
|
||||
Uint adddic(yomi, kanji, hinsi)
|
||||
Uchar *yomi;
|
||||
Uchar *kanji;
|
||||
TypeGram hinsi;
|
||||
u_int
|
||||
adddic(u_char* yomi, u_char* kanji, TypeGram hinsi)
|
||||
{
|
||||
Uint err;
|
||||
Uchar yptr[MaxWdYomiLen+1];
|
||||
Uchar kptr[MaxWdKanjiLen+1];
|
||||
Int klen;
|
||||
u_int err;
|
||||
u_char yptr[MaxWdYomiLen+1];
|
||||
u_char kptr[MaxWdKanjiLen+1];
|
||||
int klen;
|
||||
TypeDicSeg segnum;
|
||||
Int saml;
|
||||
int saml;
|
||||
TypeDicOfs dstofs;
|
||||
TypeDicOfs douofs;
|
||||
TypeDicOfs hnsofs;
|
||||
|
|
@ -83,56 +68,46 @@ TypeGram hinsi;
|
|||
TypeDicOfs oldsiz;
|
||||
TypeDicOfs fresiz;
|
||||
TypeIdxOfs freidx;
|
||||
Uchar *douptr;
|
||||
Uchar *dstptr;
|
||||
u_char *douptr;
|
||||
u_char *dstptr;
|
||||
TypeDicOfs pos;
|
||||
Uchar *p1;
|
||||
Int i;
|
||||
Int nlen, plen;
|
||||
Int size;
|
||||
u_char *p1;
|
||||
int i;
|
||||
int nlen, plen;
|
||||
int size;
|
||||
STDYIN *stdy;
|
||||
STDYOUT stdydat;
|
||||
|
||||
|
||||
if (err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr)))
|
||||
if ((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) != 0)
|
||||
return err;
|
||||
|
||||
|
||||
inputyomi = yomi;
|
||||
cnvstart = ystart = yptr;
|
||||
cnvlen = sstrlen(yptr);
|
||||
cnvlen = strlen(yptr);
|
||||
|
||||
|
||||
if (err = checkdict(kanji, hinsi)) return err;
|
||||
if ((err = checkdict(kanji, hinsi)) != 0)
|
||||
return err;
|
||||
|
||||
|
||||
if (!curdict -> maxunit) return AD_NotUserDict;
|
||||
|
||||
|
||||
klen = cvtknj(yomi, kanji, kptr);
|
||||
|
||||
|
||||
newsiz = DouonBlkSizeNumber + cnvlen + (klen !=0 ? klen+1 : 0) + 2;
|
||||
|
||||
|
||||
if (newsiz > MaxDouonBlk) return AD_OvflwDouBlk;
|
||||
if (newsiz > curdict->seglen) return AD_OvflwDouBlk;
|
||||
|
||||
|
||||
segnum = srchidx((TypeDicSeg)DicSegBase, cnvlen);
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
(*curdict->getdic)(curdict, segnum);
|
||||
i = srchkana(&p1, &saml);
|
||||
dstofs = douofs = p1 - dicbuf;
|
||||
hnsofs = knjofs = 0;
|
||||
if (i) {
|
||||
|
||||
i = srchgram(p1, &p1, hinsi);
|
||||
dstofs = hnsofs = p1 - dicbuf;
|
||||
if (i) {
|
||||
|
||||
srchkanji(&p1, kptr, klen);
|
||||
if (*p1 != HinsiBlkTerm) return AD_ArExist;
|
||||
dstofs = knjofs = p1 - dicbuf;
|
||||
|
|
@ -141,13 +116,11 @@ TypeGram hinsi;
|
|||
|
||||
p1 = dicbuf + douofs;
|
||||
|
||||
|
||||
if (!hnsofs) {
|
||||
oldsiz = 0;
|
||||
nlen = cnvlen - saml;
|
||||
newsiz = DouonBlkSizeNumber + nlen;
|
||||
|
||||
|
||||
nxtask = cal_nextym(p1);
|
||||
}
|
||||
else {
|
||||
|
|
@ -155,64 +128,48 @@ TypeGram hinsi;
|
|||
nxtask = 0;
|
||||
}
|
||||
if (!knjofs) newsiz += 2;
|
||||
|
||||
|
||||
newsiz += (klen != 0 ? klen+1 : 0);
|
||||
|
||||
|
||||
fresiz = usr_freelen();
|
||||
|
||||
|
||||
if ((unsigned int) (newsiz - oldsiz - nxtask) <=
|
||||
(unsigned int) fresiz) break;
|
||||
|
||||
|
||||
if (segend(p1) && (segnum + 1 < curdict->segunit)) {
|
||||
|
||||
segnum++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (curdict->segunit >= curdict->maxunit)
|
||||
return AD_OvflwUsrDic;
|
||||
|
||||
|
||||
freidx = count_uidx();
|
||||
|
||||
|
||||
if ((unsigned int) (douofs + newsiz) <= curdict->seglen) {
|
||||
|
||||
if (hnsofs) p1 = getntag(p1);
|
||||
pos = p1 - dicbuf;
|
||||
|
||||
|
||||
nlen = getnlen(p1);
|
||||
if ((unsigned int) freidx < getplen(p1) + nlen + 1)
|
||||
return AD_OvflwIndex;
|
||||
|
||||
|
||||
if ((*curdict->putdic)(curdict, curdict->segunit))
|
||||
return AD_OvflwUsrDic;
|
||||
|
||||
|
||||
sprt_seg(segnum, pos);
|
||||
|
||||
|
||||
nxtask = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (segend(p1)) {
|
||||
|
||||
if ((unsigned int) freidx < cnvlen + 1) return AD_OvflwIndex;
|
||||
|
||||
|
||||
if ((*curdict->putdic)(curdict, curdict->segunit))
|
||||
return AD_OvflwUsrDic;
|
||||
curdict->segunit++;
|
||||
|
||||
|
||||
(*curdict->getdic)(curdict, curdict->segunit - 1);
|
||||
memset(dicbuf, DicSegTerm, (Int)curdict->seglen);
|
||||
dicbuf[0] = 0;
|
||||
|
|
@ -220,13 +177,10 @@ TypeGram hinsi;
|
|||
(*curdict->rszdic)(curdict, curdict->segunit);
|
||||
mkidxtbl(curdict);
|
||||
|
||||
|
||||
segnum++;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
nlen = getnlen(p1);
|
||||
if ((unsigned int) freidx < getplen(p1) + nlen + 1)
|
||||
return AD_OvflwIndex;
|
||||
|
|
@ -234,21 +188,17 @@ TypeGram hinsi;
|
|||
if ((*curdict->putdic)(curdict, curdict->segunit))
|
||||
return AD_OvflwUsrDic;
|
||||
|
||||
|
||||
sprt_seg(segnum, douofs);
|
||||
|
||||
|
||||
segnum++;
|
||||
}
|
||||
}
|
||||
|
||||
douptr = dicbuf + douofs;
|
||||
|
||||
|
||||
if (nxtask) {
|
||||
Uchar *tp;
|
||||
u_char *tp;
|
||||
|
||||
|
||||
size = getsize(douptr) - nxtask;
|
||||
plen = getplen(douptr) + nxtask;
|
||||
nlen = getnlen(douptr) - nxtask;
|
||||
|
|
@ -258,27 +208,21 @@ TypeGram hinsi;
|
|||
*(douptr + 1) = size;
|
||||
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
|
||||
|
||||
|
||||
p1 = douptr + DouonBlkSizeNumber;
|
||||
tp = p1 + nxtask;
|
||||
mvmemi(tp, p1, dicbuf + curdict->seglen - tp);
|
||||
}
|
||||
|
||||
|
||||
dstptr = dicbuf + dstofs;
|
||||
size = newsiz - oldsiz;
|
||||
p1 = dicbuf + curdict->seglen;
|
||||
mvmemd(p1 - size, p1, p1 - dstptr - size);
|
||||
|
||||
|
||||
if (!hnsofs) {
|
||||
|
||||
if (douofs == segtop() - dicbuf) {
|
||||
|
||||
chg_uidx(segnum, yptr, cnvlen);
|
||||
}
|
||||
|
||||
|
||||
*dstptr = 0;
|
||||
nlen = cnvlen - saml;
|
||||
if (nlen & 0x10) *dstptr |= NokoriYomiTop;
|
||||
|
|
@ -287,7 +231,6 @@ TypeGram hinsi;
|
|||
*dstptr++ = size;
|
||||
*dstptr++ = ((nlen&0x0f)|((saml&0x0f)<<4));
|
||||
|
||||
|
||||
while (saml < cnvlen) *dstptr++ = yptr[saml++];
|
||||
}
|
||||
|
||||
|
|
@ -301,22 +244,17 @@ TypeGram hinsi;
|
|||
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
|
||||
}
|
||||
|
||||
|
||||
if (!knjofs) *dstptr++ = hinsi;
|
||||
|
||||
|
||||
stdydat.stdy1.offset = dstptr - dicbuf;
|
||||
for (saml = 0 ; saml < klen ; ) *dstptr++ = kptr[saml++];
|
||||
if (klen > 0) *dstptr++ = KanjiStrEnd;
|
||||
|
||||
|
||||
if (!knjofs) *dstptr++ = HinsiBlkTerm;
|
||||
|
||||
|
||||
(*curdict->putdic)(curdict, segnum);
|
||||
|
||||
if (StudyExist()) {
|
||||
|
||||
size -= nxtask;
|
||||
for (i = StudyCount, stdy = StudyDict ; i-- ; stdy++) {
|
||||
if (stdy -> dicid != curdict->dicid) continue;
|
||||
|
|
@ -324,9 +262,8 @@ TypeGram hinsi;
|
|||
if (stdy -> offset >= dstofs) stdy -> offset += size;
|
||||
}
|
||||
|
||||
|
||||
for (p1 = ClStudyDict ; !iseocl(p1) ; p1 = ClNextTag(p1)) {
|
||||
err = sstrncmp(yptr, (Uchar TFar *)ClYomiPos(p1),
|
||||
err = strncmp(yptr, (u_char*)ClYomiPos(p1),
|
||||
(Int)ClYomiLen(p1));
|
||||
if (err == MATCH) {
|
||||
delclsub(p1);
|
||||
|
|
@ -339,7 +276,6 @@ TypeGram hinsi;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
stdydat.stdy1.seg = segnum;
|
||||
stdydat.stdy1.dicid = curdict->dicid;
|
||||
stdydat.stdy1.styno = 0;
|
||||
|
|
@ -357,19 +293,16 @@ TypeGram hinsi;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Int checksub(kanji, grm)
|
||||
Uchar *kanji;
|
||||
TypeGram grm;
|
||||
static int
|
||||
checksub(u_char* kanji, TypeGram grm)
|
||||
{
|
||||
Reg1 Uchar *tagp;
|
||||
Reg2 Uchar *ptr;
|
||||
Reg3 Uchar *endp;
|
||||
Int flg, nlen;
|
||||
Int dounum;
|
||||
Uchar buf[MaxWdKanjiLen + 1];
|
||||
u_char *tagp;
|
||||
u_char *ptr;
|
||||
u_char *endp;
|
||||
int flg, nlen;
|
||||
int dounum;
|
||||
u_char buf[MaxWdKanjiLen + 1];
|
||||
|
||||
|
||||
dicinl = cnvlen;
|
||||
dicsaml = 0;
|
||||
prevseg = (TypeDicSeg)-1;
|
||||
|
|
@ -378,64 +311,42 @@ TypeGram grm;
|
|||
if (cnvlen == getnlen(tagp) + getplen(tagp))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
dounum = 0;
|
||||
|
||||
|
||||
nlen = getnlen(tagp);
|
||||
ptr = tagp + DouonBlkSizeNumber + nlen;
|
||||
|
||||
|
||||
endp = tagp + getsize(tagp);
|
||||
|
||||
|
||||
while (ptr < endp) {
|
||||
|
||||
|
||||
flg = (grm == *ptr++);
|
||||
while (*ptr != HinsiBlkTerm) {
|
||||
|
||||
|
||||
if (flg) {
|
||||
|
||||
|
||||
buf[getkanji(inputyomi, cnvlen, ptr, buf)] = 0;
|
||||
|
||||
|
||||
if (cmpstr(kanji, buf)) return -1;
|
||||
}
|
||||
|
||||
|
||||
dounum++;
|
||||
ptr = skipkstr(ptr);
|
||||
}
|
||||
|
||||
|
||||
ptr++;
|
||||
}
|
||||
|
||||
|
||||
return dounum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Uint checkdict(kanji, grm)
|
||||
Uchar *kanji;
|
||||
TypeGram grm;
|
||||
static u_int
|
||||
checkdict(u_char* kanji, TypeGram grm)
|
||||
{
|
||||
Reg1 DICTL *dp;
|
||||
Reg2 Int dounum = 0;
|
||||
Reg3 Int tmp;
|
||||
DICTL *dp;
|
||||
int dounum = 0;
|
||||
int tmp;
|
||||
DICT *tmpdict;
|
||||
|
||||
tmpdict = curdict;
|
||||
for (dp = dictlist ; dp ; dp = dp -> next) {
|
||||
|
||||
curdict = dp -> dict;
|
||||
|
||||
|
||||
if ((tmp = checksub(kanji, grm)) < 0) {
|
||||
curdict = tmpdict;
|
||||
return AD_ArExist;
|
||||
|
|
@ -445,32 +356,24 @@ TypeGram grm;
|
|||
}
|
||||
curdict = tmpdict;
|
||||
|
||||
|
||||
if (MaxKouhoNumber <= dounum) return AD_OvflwDouNum;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int cal_nextym(ptr)
|
||||
Reg1 Uchar *ptr;
|
||||
static int
|
||||
cal_nextym(u_char* ptr)
|
||||
{
|
||||
Reg2 Int count = 0;
|
||||
Reg3 Uchar *src;
|
||||
Reg4 Int len;
|
||||
|
||||
int count = 0;
|
||||
u_char *src;
|
||||
int len;
|
||||
|
||||
if (!segend(ptr)) {
|
||||
|
||||
|
||||
src = cnvstart + getplen(ptr);
|
||||
|
||||
|
||||
len = getnlen(ptr);
|
||||
ptr += DouonBlkSizeNumber;
|
||||
|
||||
|
||||
while (len--) {
|
||||
if (*ptr++ == *src++)
|
||||
count++;
|
||||
|
|
@ -479,39 +382,34 @@ Reg1 Uchar *ptr;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int usr_freelen()
|
||||
static int
|
||||
usr_freelen(void)
|
||||
{
|
||||
Reg1 Uchar *ptr;
|
||||
u_char* ptr;
|
||||
|
||||
|
||||
ptr = segtop();
|
||||
while (!segend(ptr)) ptr += getsize(ptr);
|
||||
|
||||
|
||||
return(curdict->seglen - (ptr - dicbuf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void sprt_seg(seg, ofs)
|
||||
TypeDicSeg seg;
|
||||
TypeDicOfs ofs;
|
||||
static void
|
||||
sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
|
||||
{
|
||||
Reg3 TypeDicSeg s;
|
||||
Uchar *pos;
|
||||
Reg1 Uchar *p;
|
||||
Reg2 Uchar *q;
|
||||
Int i;
|
||||
Int j;
|
||||
Int ylen, nlen;
|
||||
TypeDicSeg s;
|
||||
u_char *pos;
|
||||
u_char *p;
|
||||
u_char *q;
|
||||
int i;
|
||||
int j;
|
||||
int ylen, nlen;
|
||||
TypeDicID dicid;
|
||||
Uchar yomi[MaxWdYomiLen];
|
||||
u_char yomi[MaxWdYomiLen];
|
||||
STDYIN *stdy;
|
||||
|
||||
for (s = curdict->segunit - 1 ; s >= seg ; s--) {
|
||||
|
|
@ -521,13 +419,10 @@ TypeDicOfs ofs;
|
|||
curdict->segunit++;
|
||||
(*curdict->rszdic)(curdict, curdict->segunit);
|
||||
|
||||
|
||||
(*curdict->getdic)(curdict, seg + 1);
|
||||
|
||||
|
||||
pos = dicbuf + ofs;
|
||||
|
||||
|
||||
for (p = segtop() ; (p <= pos) && !segend(p) ; p = q) {
|
||||
q = getntag(p);
|
||||
i = getplen(p);
|
||||
|
|
@ -537,34 +432,26 @@ TypeDicOfs ofs;
|
|||
while (j-- > 0) yomi[i++] = *p++;
|
||||
}
|
||||
|
||||
|
||||
nlen = getnlen(pos);
|
||||
ylen = (i = getplen(pos)) + (j = nlen);
|
||||
|
||||
|
||||
apnd_uidx(seg, yomi, ylen);
|
||||
|
||||
|
||||
set_size(segtop(), getsize(pos) + i, 0, ylen);
|
||||
|
||||
|
||||
mvmemi(yomi, (p = segtop() + DouonBlkSizeNumber), ylen);
|
||||
|
||||
|
||||
q = pos + DouonBlkSizeNumber + j;
|
||||
i = dicbuf + curdict->seglen - q;
|
||||
mvmemi(q, p += ylen, i);
|
||||
j = q - p;
|
||||
|
||||
|
||||
p += i;
|
||||
memset(p, DicSegTerm, (dicbuf + curdict->seglen - p));
|
||||
|
||||
|
||||
(*curdict->putdic)(curdict, seg + 1);
|
||||
|
||||
if (StudyExist()) {
|
||||
|
||||
dicid = curdict -> dicid;
|
||||
for (i = StudyCount, stdy = StudyDict ; i-- > 0 ; stdy++) {
|
||||
if (stdy -> dicid != dicid)
|
||||
|
|
@ -580,37 +467,28 @@ TypeDicOfs ofs;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
(*curdict->getdic)(curdict, seg);
|
||||
memset(dicbuf + ofs, DicSegTerm, (Int)(curdict->seglen - ofs));
|
||||
(*curdict->putdic)(curdict, seg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void apnd_uidx(seg, yomi, len)
|
||||
TypeDicSeg seg;
|
||||
Uchar *yomi;
|
||||
Int len;
|
||||
static void
|
||||
apnd_uidx(TypeDicSeg seg, u_char* yomi, int len)
|
||||
{
|
||||
Reg1 Uchar *p;
|
||||
Reg1 Uchar *q;
|
||||
u_char *p;
|
||||
u_char *q;
|
||||
|
||||
|
||||
p = get_idxptr(seg);
|
||||
while (*p++) ;
|
||||
|
||||
|
||||
q = idxbuf + curdict->idxlen;
|
||||
mvmemd(q - (len + 1), q, (Int)(q - (len + 1) - p));
|
||||
|
||||
|
||||
while (len--) *p++ = *yomi++;
|
||||
*p = 0;
|
||||
|
||||
|
||||
(*curdict->putidx)(curdict, 0);
|
||||
|
||||
|
||||
mkidxtbl(curdict);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,30 +31,26 @@
|
|||
* $SonyRCSfile: addelcmn.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:27 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Uchar *get_idxptr();
|
||||
Int sj2cd_str(), yomicmp(), codesize();
|
||||
Int sstrlen(), sstrcmp();
|
||||
Int sj2cd_str();
|
||||
Void mvmemi(), mvmemd(), mkidxtbl();
|
||||
|
||||
|
||||
|
||||
Void set_size(p, size, plen, nlen)
|
||||
Reg1 Uchar *p;
|
||||
Int size;
|
||||
Int plen;
|
||||
Int nlen;
|
||||
void
|
||||
set_size (Uchar *p, Int size, Int plen, Int nlen)
|
||||
{
|
||||
*p = (Uchar)(size >> 8);
|
||||
if (nlen & 0x10) *p |= NokoriYomiTop;
|
||||
|
|
@ -65,21 +61,17 @@ Int nlen;
|
|||
|
||||
|
||||
|
||||
Static Int isvyomi(yp)
|
||||
Reg1 Uchar *yp;
|
||||
static Int
|
||||
isvyomi (Uchar *yp)
|
||||
{
|
||||
Reg2 Int len;
|
||||
Int len;
|
||||
|
||||
if (!*yp) return FALSE;
|
||||
|
||||
|
||||
if (!(Chrtbl[*yp] & DICTOP)) return FALSE;
|
||||
|
||||
for (len = 0 ; *yp ; yp++) {
|
||||
|
||||
if (!(Chrtbl[*yp]) || (*yp >= Y_KUTEN)) return FALSE;
|
||||
|
||||
|
||||
if (++len > MaxWdYomiLen) return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -88,30 +80,28 @@ Reg1 Uchar *yp;
|
|||
|
||||
|
||||
|
||||
Static Int isvknj(kanji)
|
||||
Reg1 Uchar *kanji;
|
||||
static Int
|
||||
isvknj(Uchar *kanji)
|
||||
{
|
||||
Reg2 Int len;
|
||||
Int len;
|
||||
|
||||
if (!*kanji) return FALSE;
|
||||
|
||||
|
||||
for (len = 0 ; *kanji ; ) {
|
||||
if (*kanji == SS3) {
|
||||
kanji += 3;
|
||||
len += 2;
|
||||
} else
|
||||
|
||||
|
||||
if (isknj1(*kanji)) {
|
||||
kanji += 2;
|
||||
len += 2;
|
||||
}
|
||||
|
||||
else {
|
||||
kanji++;
|
||||
len += 2;
|
||||
}
|
||||
|
||||
|
||||
if (len > MaxWdKanjiLen) return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -120,10 +110,10 @@ Reg1 Uchar *kanji;
|
|||
|
||||
|
||||
|
||||
Static Int isgrm(gram)
|
||||
TypeGram gram;
|
||||
static Int
|
||||
isgrm (TypeGram gram)
|
||||
{
|
||||
Reg1 Int grm = gram;
|
||||
Int grm = gram;
|
||||
|
||||
if (MEISI_1 <= grm && grm <= D_MEISI_6) return TRUE;
|
||||
if (MYOUJI <= grm && grm <= JOSUUSI2) return TRUE;
|
||||
|
|
@ -142,49 +132,33 @@ TypeGram gram;
|
|||
|
||||
|
||||
|
||||
Uint addel_arg(yp, kp, grm, nyp, len)
|
||||
Uchar *yp;
|
||||
Uchar *kp;
|
||||
TypeGram grm;
|
||||
Uchar *nyp;
|
||||
Int len;
|
||||
Uint
|
||||
addel_arg (Uchar *yp, Uchar *kp, TypeGram grm, Uchar *nyp, Int len)
|
||||
{
|
||||
Reg1 Ushort err = 0;
|
||||
Ushort err = 0;
|
||||
|
||||
|
||||
if (!sj2cd_str(yp, nyp, len)) err |= AD_BadYomi;
|
||||
|
||||
|
||||
if (!isvyomi(nyp)) err |= AD_BadYomi;
|
||||
|
||||
|
||||
if (!isvknj(kp)) err |= AD_BadKanji;
|
||||
|
||||
|
||||
if (!isgrm(grm)) err |= AD_BadHinsi;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void yomi2kata(src, dst)
|
||||
Reg2 Uchar *src;
|
||||
Reg1 Uchar *dst;
|
||||
static void
|
||||
yomi2kata (Uchar *src, Uchar *dst)
|
||||
{
|
||||
Reg3 Int first;
|
||||
Reg4 Int second;
|
||||
Int first;
|
||||
Int second;
|
||||
|
||||
while (first = *src++) {
|
||||
while ((first = *src++) != 0) {
|
||||
second = *src++;
|
||||
|
||||
|
||||
if (first != 0xa4) {
|
||||
*dst++ = first;
|
||||
*dst++ = second;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
*dst++ = 0xa5;
|
||||
*dst++ = second;
|
||||
|
|
@ -196,86 +170,64 @@ Reg1 Uchar *dst;
|
|||
|
||||
|
||||
|
||||
Static Int top_strcmp(src, dst)
|
||||
Reg1 Uchar *src;
|
||||
Reg3 Uchar *dst;
|
||||
static Int
|
||||
top_strcmp (Uchar *src, Uchar *dst)
|
||||
{
|
||||
Reg2 Int i;
|
||||
|
||||
|
||||
Int i;
|
||||
for (i = 0 ; *src && (*src == *dst) ; src++, dst++) i++;
|
||||
|
||||
|
||||
i /= 2;
|
||||
|
||||
|
||||
return (i > MaxYomiAskNumber) ? MaxYomiAskNumber : i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int last_strcmp(src, dst)
|
||||
Uchar *src;
|
||||
Uchar *dst;
|
||||
static Int
|
||||
last_strcmp (Uchar *src, Uchar *dst)
|
||||
{
|
||||
Int slen;
|
||||
Reg1 Int dlen;
|
||||
Int dlen;
|
||||
|
||||
|
||||
slen = sstrlen(src);
|
||||
dlen = sstrlen(dst);
|
||||
slen = strlen(src);
|
||||
dlen = strlen(dst);
|
||||
|
||||
|
||||
if (dlen > MaxYomiAskNumber * 2) return 0;
|
||||
|
||||
|
||||
if (sstrcmp(src + (slen - dlen), dst)) return 0;
|
||||
if (strcmp(src + (slen - dlen), dst)) return 0;
|
||||
|
||||
|
||||
return (dlen / 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int cvtknj(yomi, knj, dst)
|
||||
Uchar *yomi;
|
||||
Uchar *knj;
|
||||
Reg1 Uchar *dst;
|
||||
Int
|
||||
cvtknj (Uchar *yomi, Uchar *knj, Uchar *dst)
|
||||
{
|
||||
Uchar kana[MaxWdYomiLen * 2 + 1];
|
||||
Reg2 Int len;
|
||||
Int len;
|
||||
Uchar *keep;
|
||||
|
||||
keep = dst;
|
||||
yomi2kata(yomi, kana);
|
||||
|
||||
|
||||
if (len = top_strcmp(yomi, knj)) {
|
||||
if ((len = top_strcmp(yomi, knj)) != 0) {
|
||||
*dst = (Uchar)(ZenHiraAssyuku | (len - 1));
|
||||
}
|
||||
|
||||
else if (len = top_strcmp(kana, knj)) {
|
||||
else if ((len = top_strcmp(kana, knj)) != 0) {
|
||||
*dst = (Uchar)(ZenKataAssyuku | (len - 1));
|
||||
}
|
||||
|
||||
|
||||
if (len) {
|
||||
|
||||
knj += len * 2;
|
||||
dst++;
|
||||
|
||||
}
|
||||
|
||||
if (*knj) {
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
if (len = last_strcmp(yomi, knj)) {
|
||||
if ((len = last_strcmp(yomi, knj)) != 0) {
|
||||
*dst++ = (Uchar)(ZenHiraAssyuku | (len - 1));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
else if (len = last_strcmp(kana, knj)) {
|
||||
else if ((len = last_strcmp(kana, knj)) != 0) {
|
||||
*dst++ = (Uchar)(ZenKataAssyuku | (len - 1));
|
||||
break;
|
||||
}
|
||||
|
|
@ -287,62 +239,48 @@ Reg1 Uchar *dst;
|
|||
knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
*dst++ = *knj++;
|
||||
|
||||
} else if (*knj & 0x80) {
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
}
|
||||
|
||||
else {
|
||||
*dst++ = (Uchar)LeadingHankaku;
|
||||
*dst++ = *knj++;
|
||||
}
|
||||
|
||||
|
||||
if (!*knj) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*dst = 0;
|
||||
|
||||
|
||||
return (dst - keep);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int srchkana(ptr, saml)
|
||||
Uchar **ptr;
|
||||
Int *saml;
|
||||
Int
|
||||
srchkana (Uchar **ptr, Int *saml)
|
||||
{
|
||||
Uchar *p;
|
||||
Int cmp;
|
||||
Int cnt = 0;
|
||||
Uchar same;
|
||||
Reg1 Int flg = 0;
|
||||
Int flg = 0;
|
||||
|
||||
|
||||
same = 0;
|
||||
|
||||
|
||||
p = segtop();
|
||||
|
||||
|
||||
while (!segend(p)) {
|
||||
|
||||
|
||||
if (flg == 0) {
|
||||
|
||||
|
||||
cmp = yomicmp(cnvstart, p, &same);
|
||||
|
||||
|
||||
if (cmp == OVER) break;
|
||||
|
||||
|
||||
if (cmp == MATCH && *(cnvstart + same) == 0) {
|
||||
*ptr = p;
|
||||
*saml = same;
|
||||
|
|
@ -350,15 +288,12 @@ Int *saml;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
p = getntag(p);
|
||||
cnt++;
|
||||
}
|
||||
|
||||
|
||||
if (flg != 0) return cnt;
|
||||
|
||||
|
||||
*ptr = p;
|
||||
*saml = same;
|
||||
return 0;
|
||||
|
|
@ -366,30 +301,23 @@ Int *saml;
|
|||
|
||||
|
||||
|
||||
Int srchgram(ptr, dst, hinsi)
|
||||
Reg1 Uchar *ptr;
|
||||
Uchar **dst;
|
||||
TypeGram hinsi;
|
||||
Int
|
||||
srchgram (Uchar *ptr, Uchar **dst, TypeGram hinsi)
|
||||
{
|
||||
Uchar *endp;
|
||||
Int cnt = 0, nlen;
|
||||
Int flg = FALSE;
|
||||
|
||||
|
||||
endp = getntag(ptr);
|
||||
|
||||
|
||||
nlen = getnlen(ptr);
|
||||
|
||||
ptr += DouonBlkSizeNumber + nlen;
|
||||
while (ptr < endp) {
|
||||
|
||||
if (*ptr == hinsi) {
|
||||
*dst = ptr;
|
||||
flg = TRUE;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
ptr += codesize(*ptr);
|
||||
} while (*ptr != HinsiBlkTerm);
|
||||
|
|
@ -397,43 +325,34 @@ TypeGram hinsi;
|
|||
cnt++;
|
||||
}
|
||||
|
||||
|
||||
if (flg) return cnt;
|
||||
|
||||
|
||||
*dst = ptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int srchkanji(dst, knj, klen)
|
||||
Uchar **dst;
|
||||
Uchar *knj;
|
||||
Int klen;
|
||||
Int
|
||||
srchkanji (Uchar **dst, Uchar *knj, Int klen)
|
||||
{
|
||||
Reg1 Uchar *ptr;
|
||||
Uchar *ptr;
|
||||
Uchar *p, *q;
|
||||
Int len;
|
||||
Int flg = FALSE;
|
||||
Int cnt = 0;
|
||||
|
||||
|
||||
ptr = *dst + 1;
|
||||
|
||||
|
||||
while (*ptr != HinsiBlkTerm) {
|
||||
|
||||
for (p = ptr, q = knj, len = klen ; len ; len--)
|
||||
if (*p++ != *q++) break;
|
||||
|
||||
|
||||
if (!len) {
|
||||
*dst = ptr;
|
||||
flg = TRUE;
|
||||
}
|
||||
|
||||
|
||||
while (!(*ptr == KanjiStrEnd)) {
|
||||
ptr += codesize(*ptr);
|
||||
}
|
||||
|
|
@ -441,62 +360,49 @@ Int klen;
|
|||
cnt++;
|
||||
}
|
||||
|
||||
|
||||
if (!flg) *dst = ptr;
|
||||
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TypeIdxOfs count_uidx()
|
||||
TypeIdxOfs
|
||||
count_uidx (void)
|
||||
{
|
||||
Uchar *p;
|
||||
|
||||
|
||||
p = get_idxptr(curdict->segunit - 1);
|
||||
while (*p++) ;
|
||||
|
||||
|
||||
return (curdict->idxlen - (p - idxbuf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void chg_uidx(seg, yomi, len)
|
||||
TypeDicSeg seg;
|
||||
Uchar *yomi;
|
||||
Int len;
|
||||
void
|
||||
chg_uidx (TypeDicSeg seg, Uchar *yomi, Int len)
|
||||
{
|
||||
Uchar *p, *q;
|
||||
Int olen;
|
||||
|
||||
|
||||
p = get_idxptr(seg);
|
||||
|
||||
|
||||
olen = sstrlen(p);
|
||||
olen = strlen(p);
|
||||
|
||||
q = idxbuf + curdict->idxlen;
|
||||
|
||||
|
||||
if (len > olen) {
|
||||
|
||||
mvmemd(q - (len-olen), q, (Int)(q - (len-olen) - p));
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
mvmemi(p + (olen-len), p, (Int)(q - (p + (olen-len))));
|
||||
}
|
||||
|
||||
|
||||
while (len--) *p++ = *yomi++;
|
||||
|
||||
|
||||
(*curdict->putidx)(curdict, 0);
|
||||
|
||||
|
||||
mkidxtbl(curdict);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,16 +31,20 @@
|
|||
* $SonyRCSfile: alloc.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:28 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_const.h"
|
||||
#include "sj_var.h"
|
||||
#include "sj_struct.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
#define JREC_NUM 128
|
||||
#define CLREC_NUM 128
|
||||
|
|
@ -48,10 +52,11 @@
|
|||
static JREC *jrec = NULL;
|
||||
static CLREC *clrec = NULL;
|
||||
|
||||
JREC *alloc_jrec()
|
||||
JREC*
|
||||
alloc_jrec(void)
|
||||
{
|
||||
register JREC *p;
|
||||
register int i;
|
||||
JREC *p;
|
||||
int i;
|
||||
|
||||
if (jrec == NULL) {
|
||||
jrec = (JREC *)malloc(sizeof(JREC) * JREC_NUM);
|
||||
|
|
@ -66,8 +71,8 @@ JREC *alloc_jrec()
|
|||
return p;
|
||||
}
|
||||
|
||||
Void free_jrec(p)
|
||||
JREC *p;
|
||||
void
|
||||
free_jrec(JREC *p)
|
||||
{
|
||||
if (p != NULL) {
|
||||
p -> jsort = jrec;
|
||||
|
|
@ -75,10 +80,11 @@ JREC *p;
|
|||
}
|
||||
}
|
||||
|
||||
CLREC *alloc_clrec()
|
||||
CLREC*
|
||||
alloc_clrec(void)
|
||||
{
|
||||
register CLREC *p;
|
||||
register int i;
|
||||
CLREC *p;
|
||||
int i;
|
||||
|
||||
if (clrec == NULL) {
|
||||
clrec = (CLREC *)malloc(sizeof(CLREC) * CLREC_NUM);
|
||||
|
|
@ -93,8 +99,8 @@ CLREC *alloc_clrec()
|
|||
return p;
|
||||
}
|
||||
|
||||
Void free_clrec(p)
|
||||
CLREC *p;
|
||||
void
|
||||
free_clrec(CLREC* p)
|
||||
{
|
||||
if (p != NULL) {
|
||||
p -> clsort = clrec;
|
||||
|
|
|
|||
|
|
@ -31,19 +31,19 @@
|
|||
* $SonyRCSfile: charsize.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:29 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
codesize(code)
|
||||
u_char code;
|
||||
int
|
||||
codesize(u_char code)
|
||||
{
|
||||
switch (code & KanjiModeMask) {
|
||||
case ZenHiraAssyuku:
|
||||
|
|
|
|||
150
kanakan/cl2knj.c
150
kanakan/cl2knj.c
|
|
@ -31,47 +31,38 @@
|
|||
* $SonyRCSfile: cl2knj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:31 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Int sj2cd_chr(), hzstrlen(), sstrlen();
|
||||
Void sstrncpy(), mkjiritu(), mkbunsetu(), wakachi();
|
||||
Void mkkouho(), getrank(), cvtclknj(), freework();
|
||||
Void memset();
|
||||
Int sj2cd_chr();
|
||||
void cvtclknj(), freework();
|
||||
|
||||
|
||||
|
||||
Static CLREC *nextrecblk(), *prevrecblk();
|
||||
Static Void initkbuf();
|
||||
static CLREC* nextrecblk(void);
|
||||
static CLREC* prevrecblk(void);
|
||||
static void initkbuf(u_char* kouho);
|
||||
|
||||
|
||||
|
||||
Int cl2knj(yomi, len, kouho)
|
||||
Uchar *yomi;
|
||||
Reg4 Int len;
|
||||
Uchar *kouho;
|
||||
int
|
||||
cl2knj(u_char* yomi, int len, u_char* kouho)
|
||||
{
|
||||
Reg1 Uchar *ptr1;
|
||||
Reg2 Uchar *ptr2;
|
||||
Reg3 Int i;
|
||||
u_char *ptr1;
|
||||
u_char *ptr2;
|
||||
int i;
|
||||
|
||||
|
||||
khcount = nkhcount = 0;
|
||||
|
||||
|
||||
initkbuf(kouho);
|
||||
|
||||
|
||||
if (len > MaxClInputLen * 2) len = MaxClInputLen * 2;
|
||||
|
||||
|
||||
ptr1 = yomi; ptr2 = hyomi;
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
if (isknj1(*ptr1)) {
|
||||
|
|
@ -81,79 +72,53 @@ Uchar *kouho;
|
|||
}
|
||||
*ptr2 = 0;
|
||||
|
||||
|
||||
sstrncpy(yomi, orgyomi, (Int)(ptr1 - yomi));
|
||||
strlcpy(yomi, orgyomi, (int)(ptr1 - yomi));
|
||||
|
||||
|
||||
if (!hyomi[0]) return 0;
|
||||
|
||||
|
||||
freework();
|
||||
|
||||
|
||||
inputyomi = orgyomi;
|
||||
cnvstart = ystart = hyomi;
|
||||
cnvlen = sstrlen(hyomi);
|
||||
cnvlen = strlen(hyomi);
|
||||
|
||||
|
||||
mkjiritu(0);
|
||||
|
||||
|
||||
mkbunsetu();
|
||||
|
||||
|
||||
if (!maxclptr) wakachi();
|
||||
|
||||
|
||||
jrt1st = maxjptr;
|
||||
clt1st = maxclptr;
|
||||
|
||||
|
||||
mkkouho();
|
||||
|
||||
|
||||
getrank();
|
||||
|
||||
|
||||
selectid = 1;
|
||||
|
||||
|
||||
cvtclknj();
|
||||
|
||||
|
||||
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
|
||||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int nextcl(kouho, mode)
|
||||
Uchar *kouho;
|
||||
Int mode;
|
||||
|
||||
int
|
||||
nextcl(u_char* kouho, int mode)
|
||||
{
|
||||
CLREC *clptr;
|
||||
|
||||
|
||||
initkbuf(kouho);
|
||||
|
||||
|
||||
if (!khcount) return 0;
|
||||
|
||||
|
||||
|
||||
if (!mode && (selectid < khcount))
|
||||
if (!mode && (selectid < khcount)) {
|
||||
selectid++;
|
||||
|
||||
|
||||
}
|
||||
else if((mode < 2) && (clptr = nextrecblk())) {
|
||||
selectid = 1;
|
||||
clt1st = clptr;
|
||||
mkkouho();
|
||||
getrank();
|
||||
}
|
||||
|
||||
|
||||
|
||||
else {
|
||||
cvtclknj();
|
||||
return 0;
|
||||
|
|
@ -161,62 +126,44 @@ Int mode;
|
|||
|
||||
cvtclknj();
|
||||
|
||||
|
||||
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
|
||||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Static CLREC *nextrecblk()
|
||||
static CLREC*
|
||||
nextrecblk(void)
|
||||
{
|
||||
Reg1 CLREC *clptr;
|
||||
Reg2 Int keeplen;
|
||||
CLREC *clptr;
|
||||
int keeplen;
|
||||
|
||||
|
||||
keeplen = clt1st -> cllen;
|
||||
|
||||
|
||||
clptr = clt1st -> clsort;
|
||||
|
||||
|
||||
while (clptr && (Int)clptr -> cllen == keeplen)
|
||||
while (clptr && (int)clptr -> cllen == keeplen)
|
||||
clptr = clptr -> clsort;
|
||||
|
||||
|
||||
return clptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Int prevcl(kouho, mode)
|
||||
Uchar *kouho;
|
||||
Int mode;
|
||||
|
||||
int
|
||||
prevcl(u_char* kouho, int mode)
|
||||
{
|
||||
CLREC *clptr;
|
||||
|
||||
|
||||
initkbuf(kouho);
|
||||
|
||||
|
||||
if (!khcount) return 0;
|
||||
|
||||
|
||||
if (!mode && (selectid > 1))
|
||||
if (!mode && (selectid > 1)) {
|
||||
selectid--;
|
||||
|
||||
|
||||
}
|
||||
else if ((mode < 2) && (clptr = prevrecblk())) {
|
||||
clt1st = clptr;
|
||||
mkkouho();
|
||||
getrank();
|
||||
selectid = khcount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else {
|
||||
cvtclknj();
|
||||
return 0;
|
||||
|
|
@ -224,56 +171,45 @@ Int mode;
|
|||
|
||||
cvtclknj();
|
||||
|
||||
|
||||
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
|
||||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static CLREC *prevrecblk()
|
||||
static CLREC*
|
||||
prevrecblk(void)
|
||||
{
|
||||
Reg1 CLREC *clptr;
|
||||
CLREC *clptr;
|
||||
CLREC *keepptr;
|
||||
Reg2 Int keeplen;
|
||||
Int cllen;
|
||||
int keeplen;
|
||||
int cllen;
|
||||
|
||||
|
||||
clptr = maxclptr;
|
||||
|
||||
|
||||
|
||||
if ((cllen = clt1st -> cllen) == clptr -> cllen)
|
||||
return NULL;
|
||||
|
||||
|
||||
while ((Int)clptr -> cllen > cllen) {
|
||||
|
||||
while ((int)clptr -> cllen > cllen) {
|
||||
keeplen = clptr -> cllen;
|
||||
|
||||
|
||||
keepptr = clptr;
|
||||
|
||||
|
||||
while ((Int)clptr -> cllen == keeplen)
|
||||
while ((int)clptr -> cllen == keeplen)
|
||||
clptr = clptr -> clsort;
|
||||
}
|
||||
|
||||
|
||||
return keepptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void initkbuf(kouho)
|
||||
Uchar *kouho;
|
||||
static void
|
||||
initkbuf(u_char* kouho)
|
||||
{
|
||||
kanjitmp = kouho;
|
||||
memset(kanjitmp, 0, sizeof(STDYOUT) + 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int selectnum()
|
||||
int
|
||||
selectnum(void)
|
||||
{
|
||||
return selectid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,97 +31,74 @@
|
|||
* $SonyRCSfile: clstudy.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:32 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
int sj2cd_str();
|
||||
void mvmemd(), mvmemi();
|
||||
|
||||
Int sj2cd_str(), sstrlen();
|
||||
Void memcpy(), memset(), mvmemd(), mvmemi();
|
||||
static u_char* delcldata(u_char* ycode);
|
||||
static int delclold(void);
|
||||
static u_char* srchclpos(u_char* ycode);
|
||||
|
||||
|
||||
|
||||
Static Uchar *delcldata(), *srchclpos();
|
||||
Void delclsub(), mkclidx();
|
||||
Static Int delclold();
|
||||
|
||||
|
||||
|
||||
Int clstudy(yomi1, yomi2, stdy)
|
||||
Uchar *yomi1;
|
||||
Uchar *yomi2;
|
||||
STDYOUT *stdy;
|
||||
int
|
||||
clstudy(u_char* yomi1, u_char* yomi2, STDYOUT *stdy)
|
||||
{
|
||||
Uchar ytmp[CLSTDY_TMPLEN];
|
||||
Uchar *dst, *ptr;
|
||||
Int ret;
|
||||
Int len1, len2;
|
||||
Int alen, blen;
|
||||
Int i;
|
||||
u_char ytmp[CLSTDY_TMPLEN];
|
||||
u_char *dst, *ptr;
|
||||
int ret;
|
||||
int len1, len2;
|
||||
int alen, blen;
|
||||
int i;
|
||||
|
||||
if (!StudyExist()) return ClstudyNoDict;
|
||||
|
||||
|
||||
if (!yomi1 || !*yomi1) return ClstudyParaErr;
|
||||
|
||||
|
||||
if (!yomi2 || !*yomi2) {
|
||||
|
||||
|
||||
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
|
||||
return ClstudyYomiErr;
|
||||
|
||||
|
||||
(Void)delcldata(ytmp);
|
||||
|
||||
ret = ClstudyNormEnd;
|
||||
}
|
||||
|
||||
|
||||
else if (!stdy)
|
||||
else if (!stdy) {
|
||||
return ClstudyParaErr;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
|
||||
return ClstudyYomiErr;
|
||||
len1 = sstrlen(ytmp);
|
||||
len1 = strlen(ytmp);
|
||||
|
||||
|
||||
if (!sj2cd_str(yomi2, ytmp + len1, CLSTDY_TMPLEN - len1))
|
||||
return ClstudyYomiErr;
|
||||
|
||||
len2 = len1 + stdy -> len;
|
||||
|
||||
|
||||
ytmp[len2] = 0;
|
||||
|
||||
|
||||
alen = len2 + CL_HDLEN;
|
||||
|
||||
|
||||
if (alen + 1 >= ClStudyLen) return ClstudyNoArea;
|
||||
|
||||
|
||||
blen = ClStudyTail - delcldata(ytmp) - 1;
|
||||
|
||||
|
||||
while (blen < alen) {
|
||||
|
||||
if (!(i = delclold())) break;
|
||||
blen += i;
|
||||
}
|
||||
|
||||
|
||||
if (blen >= alen) {
|
||||
|
||||
dst = srchclpos(ytmp);
|
||||
|
||||
|
||||
ptr = ClStudyTail - alen;
|
||||
mvmemd(ptr, ClStudyTail, (ptr - dst));
|
||||
ClYomiLen(dst) = (Uchar)len2;
|
||||
|
|
@ -132,40 +109,32 @@ STDYOUT *stdy;
|
|||
|
||||
ret = ClstudyNormEnd;
|
||||
}
|
||||
|
||||
else
|
||||
else {
|
||||
ret = ClstudyNoArea;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mkclidx();
|
||||
|
||||
|
||||
putcldic();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Uchar *delcldata(ycode)
|
||||
Uchar *ycode;
|
||||
static u_char*
|
||||
delcldata(u_char* ycode)
|
||||
{
|
||||
Reg1 Uchar *tagptr;
|
||||
Reg2 Uchar *ptr1;
|
||||
Reg3 Uchar *ptr2;
|
||||
Int len1;
|
||||
u_char *tagptr;
|
||||
u_char *ptr1;
|
||||
u_char *ptr2;
|
||||
int len1;
|
||||
|
||||
|
||||
tagptr = ClStudyDict;
|
||||
while (!iseocl(tagptr)) {
|
||||
|
||||
ptr1 = ycode;
|
||||
ptr2 = ClYomiPos(tagptr);
|
||||
len1 = ClYomiLen(tagptr);
|
||||
|
||||
|
||||
while (*ptr1 && len1) {
|
||||
if (*ptr1 != *ptr2) break;
|
||||
ptr1++;
|
||||
|
|
@ -173,134 +142,98 @@ Uchar *ycode;
|
|||
len1--;
|
||||
}
|
||||
|
||||
|
||||
if (!*ptr1 || !len1) {
|
||||
|
||||
delclsub(tagptr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
tagptr = ClNextTag(tagptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return tagptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void delclsub(target)
|
||||
Uchar *target;
|
||||
void
|
||||
delclsub(u_char* target)
|
||||
{
|
||||
Reg1 Uchar *src;
|
||||
Int num;
|
||||
Int tmp;
|
||||
Int len;
|
||||
u_char *src;
|
||||
int num;
|
||||
int tmp;
|
||||
int len;
|
||||
|
||||
|
||||
num = ClGetNum(target);
|
||||
|
||||
|
||||
len = ClBlkLen(target);
|
||||
|
||||
|
||||
src = target + len;
|
||||
|
||||
|
||||
mvmemi(src, target, (ClStudyTail - src));
|
||||
|
||||
|
||||
memset(ClStudyTail - len, 0, len);
|
||||
|
||||
|
||||
|
||||
src = ClStudyDict;
|
||||
while (!iseocl(src)) {
|
||||
|
||||
tmp = ClGetNum(src);
|
||||
|
||||
|
||||
if (tmp > num) {
|
||||
|
||||
tmp -= 1;
|
||||
ClSetNum(src, tmp);
|
||||
}
|
||||
|
||||
|
||||
src = ClNextTag(src);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int delclold()
|
||||
static int
|
||||
delclold(void)
|
||||
{
|
||||
Reg1 Uchar *tagptr;
|
||||
Reg2 Uchar *target;
|
||||
Int num;
|
||||
Int tmp;
|
||||
u_char *tagptr;
|
||||
u_char *target;
|
||||
int num;
|
||||
int tmp;
|
||||
|
||||
|
||||
target = NULL;
|
||||
num = 0;
|
||||
|
||||
|
||||
tagptr = ClStudyDict;
|
||||
while (!iseocl(tagptr)) {
|
||||
|
||||
|
||||
tmp = ClGetNum(tagptr);
|
||||
|
||||
|
||||
if (tmp >= num) {
|
||||
|
||||
num = tmp;
|
||||
target = tagptr;
|
||||
}
|
||||
|
||||
|
||||
tagptr = ClNextTag(tagptr);
|
||||
}
|
||||
|
||||
|
||||
if (target) {
|
||||
|
||||
num = ClBlkLen(tagptr);
|
||||
|
||||
|
||||
delclsub(target);
|
||||
}
|
||||
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Uchar *srchclpos(ycode)
|
||||
Uchar *ycode;
|
||||
static u_char*
|
||||
srchclpos(u_char* ycode)
|
||||
{
|
||||
Reg1 Uchar *tagptr;
|
||||
Reg3 Uchar *target;
|
||||
Reg2 Uchar *ptr1;
|
||||
Reg4 Uchar *ptr2;
|
||||
Reg5 Int len;
|
||||
Int tmp;
|
||||
u_char *tagptr;
|
||||
u_char *target;
|
||||
u_char *ptr1;
|
||||
u_char *ptr2;
|
||||
int len;
|
||||
int tmp;
|
||||
|
||||
|
||||
target = NULL;
|
||||
tagptr = ClStudyDict;
|
||||
while (!iseocl(tagptr)) {
|
||||
|
||||
tmp = ClGetNum(tagptr);
|
||||
|
||||
|
||||
tmp++;
|
||||
ClSetNum(tagptr, tmp);
|
||||
|
||||
|
||||
ptr1 = ycode;
|
||||
ptr2 = ClYomiPos(tagptr);
|
||||
len = ClYomiLen(tagptr);
|
||||
|
|
@ -311,36 +244,28 @@ Uchar *ycode;
|
|||
len--;
|
||||
}
|
||||
|
||||
|
||||
if (!target) {
|
||||
|
||||
if (!len)
|
||||
;
|
||||
|
||||
|
||||
else if (!*ptr1)
|
||||
target = tagptr;
|
||||
|
||||
|
||||
else if (*ptr1 < *ptr2)
|
||||
target = tagptr;
|
||||
}
|
||||
|
||||
|
||||
tagptr = ClNextTag(tagptr);
|
||||
}
|
||||
|
||||
|
||||
return target ? target : tagptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void mkclidx()
|
||||
void
|
||||
mkclidx(void)
|
||||
{
|
||||
Reg1 Uchar *ptr;
|
||||
Reg2 Int num;
|
||||
Int st, ed;
|
||||
u_char *ptr;
|
||||
int num;
|
||||
int st, ed;
|
||||
|
||||
if (!StudyExist()) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,33 +31,26 @@
|
|||
* $SonyRCSfile: cvtdict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:40 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Int getkanji(), seldict();
|
||||
Uchar TFar *getstb();
|
||||
Void get_askknj();
|
||||
|
||||
|
||||
|
||||
Void cvtdict(krec, clrec, flg)
|
||||
KHREC *krec;
|
||||
CLREC *clrec;
|
||||
Int flg;
|
||||
void
|
||||
cvtdict(KHREC *krec, CLREC *clrec, int flg)
|
||||
{
|
||||
TypeDicOfs ofs;
|
||||
Uchar *yptr;
|
||||
Int jlen;
|
||||
Int stblen;
|
||||
Int sttlen;
|
||||
Uchar TFar *fptr;
|
||||
Uchar *fptr;
|
||||
Int cllen;
|
||||
JREC *jrec;
|
||||
Int i, j;
|
||||
|
|
@ -73,7 +66,7 @@ Int flg;
|
|||
jlen = jrec -> jlen;
|
||||
|
||||
|
||||
if (i = jrec -> sttofs) {
|
||||
if ((i = jrec -> sttofs) != 0) {
|
||||
|
||||
if (i == SETTOU_KIGOU) {
|
||||
sttlen = 1;
|
||||
|
|
@ -166,8 +159,8 @@ Int flg;
|
|||
|
||||
|
||||
|
||||
Void cvtminasi(len)
|
||||
Int len;
|
||||
void
|
||||
cvtminasi(Int len)
|
||||
{
|
||||
Uchar *ptr;
|
||||
|
||||
|
|
@ -193,8 +186,8 @@ Int len;
|
|||
|
||||
|
||||
|
||||
Void cvtwakachi(clrec)
|
||||
CLREC *clrec;
|
||||
void
|
||||
cvtwakachi(CLREC *clrec)
|
||||
{
|
||||
Int jlen;
|
||||
Uchar *ym;
|
||||
|
|
|
|||
|
|
@ -31,28 +31,24 @@
|
|||
* $SonyRCSfile: cvtkanji.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:41 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
Void mkknjmax();
|
||||
Void mvmemi(), free_clall();
|
||||
Void free_jall();
|
||||
|
||||
|
||||
|
||||
Int hzstrlen(), ph_khtbl();
|
||||
Void cvtdict(), cvtminasi();
|
||||
Void cvtwakachi(), setstyrec(), cvtkouho(), mkknjmax();
|
||||
Void ph_setkouho(), mvmemi(), free_clall();
|
||||
Void free_jall(), memcpy(), cvtphknj();
|
||||
Uchar TFar *getstb();
|
||||
STDYIN *srchstdy();
|
||||
|
||||
|
||||
|
||||
Void cvtphknj(num)
|
||||
Int num;
|
||||
void
|
||||
cvtphknj (void)
|
||||
{
|
||||
Int i, j;
|
||||
CLREC *clrec;
|
||||
|
|
@ -119,8 +115,8 @@ not_enough_memory:
|
|||
|
||||
|
||||
|
||||
Void cvtkouho(krec)
|
||||
KHREC *krec;
|
||||
void
|
||||
cvtkouho (KHREC *krec)
|
||||
{
|
||||
CLREC *clrec;
|
||||
|
||||
|
|
@ -161,13 +157,13 @@ KHREC *krec;
|
|||
|
||||
|
||||
|
||||
Void setstyrec(krec)
|
||||
KHREC *krec;
|
||||
void
|
||||
setstyrec (KHREC *krec)
|
||||
{
|
||||
JREC *jrec;
|
||||
KHREC *kptr;
|
||||
Int ii;
|
||||
Uchar TFar *fptr;
|
||||
Uchar *fptr;
|
||||
STDYOUT stdy;
|
||||
|
||||
jrec = krec -> clrec -> jnode;
|
||||
|
|
@ -201,11 +197,11 @@ KHREC *krec;
|
|||
stdy.ka_fg = krec -> ka_fg;
|
||||
|
||||
|
||||
if (jrec -> stbofs && (fptr = getstb(jrec -> hinsi)))
|
||||
if (jrec -> stbofs && (fptr = getstb(jrec -> hinsi)) != NULL)
|
||||
stdy.len -= StbYomiLen(fptr + jrec -> stbofs - 1);
|
||||
|
||||
|
||||
if (fptr = Settou_ptr(jrec -> sttofs))
|
||||
if ((fptr = Settou_ptr(jrec -> sttofs)) != NULL)
|
||||
stdy.sttlen = SttYomiLen(fptr);
|
||||
else
|
||||
stdy.sttlen = 0;
|
||||
|
|
@ -214,3 +210,4 @@ KHREC *krec;
|
|||
memcpy((Uchar *)&stdy, kanjitmp, sizeof(STDYOUT));
|
||||
kanjitmp += sizeof(STDYOUT);
|
||||
}
|
||||
|
||||
|
|
|
|||
168
kanakan/deldic.c
168
kanakan/deldic.c
|
|
@ -31,217 +31,165 @@
|
|||
* $SonyRCSfile: deldic.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:42 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Uchar *skipkstr(), *get_idxptr();
|
||||
Int sstrlen(), srchkana(), srchgram();
|
||||
Int srchkanji(), cvtknj();
|
||||
Uint addel_arg();
|
||||
Void mvmemi(), memset(), set_size(), chg_uidx();
|
||||
Void mkidxtbl();
|
||||
TypeDicSeg srchidx();
|
||||
TypeIdxOfs count_uidx();
|
||||
void mvmemi();
|
||||
void mkidxtbl();
|
||||
|
||||
|
||||
|
||||
Static Int del_douon(), del_segment();
|
||||
Static Void del_uidx(), del_stdy();
|
||||
static int del_douon(TypeDicSeg seg, u_char* ptr, TypeDicOfs ofs);
|
||||
static int del_segment(TypeDicSeg seg);
|
||||
static void del_uidx(TypeDicSeg seg);
|
||||
static void del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size);
|
||||
|
||||
|
||||
|
||||
Uint deldic(yomi, kanji, hinsi)
|
||||
Uchar *yomi;
|
||||
Uchar *kanji;
|
||||
TypeGram hinsi;
|
||||
u_int
|
||||
deldic(u_char* yomi, u_char* kanji, TypeGram hinsi)
|
||||
{
|
||||
Uchar yptr[MaxWdYomiLen + 1];
|
||||
Uchar kptr[MaxWdKanjiLen + 1];
|
||||
Ushort err;
|
||||
Int knjlen;
|
||||
u_char yptr[MaxWdYomiLen + 1];
|
||||
u_char kptr[MaxWdKanjiLen + 1];
|
||||
u_short err;
|
||||
int knjlen;
|
||||
TypeDicSeg useg;
|
||||
TypeDicOfs ofs;
|
||||
Uchar *p1, *p2, *p3;
|
||||
Int dblknum;
|
||||
Int hblknum;
|
||||
Int kblknum;
|
||||
Int samlen;
|
||||
Uchar *stp, *edp;
|
||||
Int size, len;
|
||||
u_char *p1, *p2, *p3;
|
||||
int dblknum;
|
||||
int hblknum;
|
||||
int kblknum;
|
||||
int samlen;
|
||||
u_char *stp, *edp;
|
||||
int size, len;
|
||||
|
||||
|
||||
if (err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr)))
|
||||
if ((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) != 0)
|
||||
return err;
|
||||
|
||||
|
||||
if (!curdict -> maxunit) return AD_NotUserDict;
|
||||
if ((curdict -> maxunit) == 0) return AD_NotUserDict;
|
||||
|
||||
|
||||
knjlen = cvtknj(yomi, kanji, kptr);
|
||||
|
||||
|
||||
cnvstart = yptr;
|
||||
cnvlen = sstrlen(yptr);
|
||||
cnvlen = strlen(yptr);
|
||||
|
||||
|
||||
useg = srchidx((TypeDicSeg)DicSegBase, cnvlen);
|
||||
(*curdict->getdic)(curdict, useg);
|
||||
|
||||
|
||||
if (!(dblknum = srchkana(&p1, &samlen))) return AD_NoMidasi;
|
||||
if ((dblknum = srchkana(&p1, &samlen)) == 0) return AD_NoMidasi;
|
||||
|
||||
|
||||
if (!(hblknum = srchgram(p1, &p2, hinsi))) return AD_NoHinsi;
|
||||
if ((hblknum = srchgram(p1, &p2, hinsi)) == 0) return AD_NoHinsi;
|
||||
|
||||
|
||||
p3 = p2;
|
||||
kblknum = srchkanji(&p3, kptr, knjlen);
|
||||
if (*p3 == HinsiBlkTerm) return AD_NoKanji;
|
||||
ofs = p3 - dicbuf;
|
||||
|
||||
|
||||
edp = skipkstr(p3);
|
||||
|
||||
|
||||
if (kblknum == 1) {
|
||||
|
||||
if (hblknum == 1) {
|
||||
|
||||
if (dblknum == 1) {
|
||||
return del_segment(useg);
|
||||
}
|
||||
|
||||
else {
|
||||
return del_douon(useg, p1, ofs);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
stp = p2;
|
||||
edp++;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
stp = p3;
|
||||
}
|
||||
|
||||
|
||||
size = edp - stp;
|
||||
|
||||
|
||||
len = dicbuf + (curdict->seglen) - edp;
|
||||
mvmemi(edp, stp, len);
|
||||
|
||||
|
||||
edp += len;
|
||||
memset(edp, DicSegTerm, dicbuf + curdict->seglen - edp);
|
||||
|
||||
|
||||
set_size(p1, (Int)(getsize(p1) - size),
|
||||
(Int)getplen(p1), (Int)getnlen(p1));
|
||||
set_size(p1, (int)(getsize(p1) - size),
|
||||
(int)getplen(p1), (int)getnlen(p1));
|
||||
|
||||
|
||||
(*curdict->putdic)(curdict, useg);
|
||||
|
||||
|
||||
del_stdy(useg, ofs, size);
|
||||
|
||||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int del_douon(seg, ptr, ofs)
|
||||
TypeDicSeg seg;
|
||||
Uchar *ptr;
|
||||
TypeDicOfs ofs;
|
||||
static int
|
||||
del_douon(TypeDicSeg seg, u_char* ptr, TypeDicOfs ofs)
|
||||
{
|
||||
Uchar *nxt, *p1, *p2;
|
||||
Int size;
|
||||
Int nlen, plen, len;
|
||||
u_char *nxt, *p1, *p2;
|
||||
int size;
|
||||
int nlen, plen, len;
|
||||
|
||||
|
||||
nxt = getntag(ptr);
|
||||
|
||||
|
||||
if (segend(nxt)) {
|
||||
|
||||
size = nxt - ptr;
|
||||
|
||||
|
||||
memset(ptr, DicSegTerm, dicbuf + curdict->seglen - nxt);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
size = getsize(nxt);
|
||||
nlen = getnlen(nxt);
|
||||
plen = getplen(nxt);
|
||||
|
||||
|
||||
if (ptr == segtop()) {
|
||||
|
||||
if (nlen + plen > (unsigned int) count_uidx()
|
||||
+ sstrlen(get_idxptr(seg)))
|
||||
+ strlen(get_idxptr(seg)))
|
||||
return AD_OvflwIndex;
|
||||
}
|
||||
|
||||
|
||||
len = ((len = getplen(ptr)) < plen) ? plen - len : 0;
|
||||
|
||||
|
||||
set_size(ptr, size + len, plen - len, nlen + len);
|
||||
|
||||
|
||||
p1 = nxt + DouonBlkSizeNumber;
|
||||
p2 = ptr + DouonBlkSizeNumber + len;
|
||||
|
||||
|
||||
mvmemi(p1, p2, dicbuf + curdict->seglen - p1);
|
||||
|
||||
|
||||
size = p1 - p2;
|
||||
memset(dicbuf + curdict->seglen - size, DicSegTerm, size);
|
||||
|
||||
|
||||
if (ptr == segtop()) {
|
||||
|
||||
chg_uidx(seg, ptr + DouonBlkSizeNumber, nlen + len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(*curdict->putdic)(curdict, seg);
|
||||
|
||||
|
||||
del_stdy(seg, ofs, size);
|
||||
|
||||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int del_segment(seg)
|
||||
TypeDicSeg seg;
|
||||
static int
|
||||
del_segment(TypeDicSeg seg)
|
||||
{
|
||||
Int i;
|
||||
int i;
|
||||
STDYIN *styp;
|
||||
TypeDicID dicid;
|
||||
TypeStyNum stdynum;
|
||||
TypeDicSeg sg;
|
||||
|
||||
|
||||
if (curdict->segunit > 1) {
|
||||
|
||||
for (sg = seg + 1 ; sg < curdict->segunit ; sg++) {
|
||||
(*curdict->getdic)(curdict, sg);
|
||||
(*curdict->putdic)(curdict, sg - 1);
|
||||
|
|
@ -249,19 +197,16 @@ TypeDicSeg seg;
|
|||
curdict->segunit--;
|
||||
}
|
||||
else {
|
||||
memset(dicbuf, DicSegTerm, (Int)curdict->seglen);
|
||||
memset(dicbuf, DicSegTerm, (int)curdict->seglen);
|
||||
dicbuf[0] = 0;
|
||||
(*curdict->putdic)(curdict, DicSegBase);
|
||||
}
|
||||
|
||||
|
||||
(*curdict->rszdic)(curdict, curdict->segunit);
|
||||
|
||||
|
||||
del_uidx(seg);
|
||||
|
||||
if (StudyExist()) {
|
||||
|
||||
dicid = curdict->dicid;
|
||||
for (i = 0, styp = StudyDict ; i < StudyCount ; ) {
|
||||
if (styp -> dicid != dicid)
|
||||
|
|
@ -271,10 +216,9 @@ TypeDicSeg seg;
|
|||
else if (styp -> seg < seg)
|
||||
;
|
||||
else {
|
||||
|
||||
stdynum = styp -> styno;
|
||||
StudyCount--;
|
||||
mvmemi((Uchar *)(styp + 1), (Uchar *)styp,
|
||||
mvmemi((u_char*)(styp + 1), (u_char*)styp,
|
||||
sizeof(*styp) * (StudyCount - i));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -285,7 +229,6 @@ TypeDicSeg seg;
|
|||
for (i = 0, styp = StudyDict ; i < StudyCount ; i++, styp++)
|
||||
if (styp -> styno > stdynum) styp -> styno -= 1;
|
||||
|
||||
|
||||
putstydic();
|
||||
}
|
||||
|
||||
|
|
@ -293,40 +236,31 @@ TypeDicSeg seg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Void del_uidx(seg)
|
||||
TypeDicSeg seg;
|
||||
static void
|
||||
del_uidx(TypeDicSeg seg)
|
||||
{
|
||||
Uchar *p, *q;
|
||||
Int len;
|
||||
u_char *p, *q;
|
||||
int len;
|
||||
|
||||
|
||||
p = get_idxptr(seg);
|
||||
for (q = p ; *q++; )
|
||||
;
|
||||
|
||||
|
||||
mvmemi(q, p, idxbuf + curdict->idxlen - q);
|
||||
|
||||
|
||||
len = q - p;
|
||||
memset(idxbuf + curdict->idxlen - len, 0, len);
|
||||
|
||||
|
||||
(*curdict->putidx)(curdict, 0);
|
||||
|
||||
|
||||
mkidxtbl(curdict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void del_stdy(seg, ofs, size)
|
||||
TypeDicSeg seg;
|
||||
TypeDicOfs ofs;
|
||||
Int size;
|
||||
static void
|
||||
del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size)
|
||||
{
|
||||
Int i;
|
||||
int i;
|
||||
TypeStyNum stdynum;
|
||||
STDYIN *stdy;
|
||||
TypeDicID dicid;
|
||||
|
|
@ -344,10 +278,9 @@ Int size;
|
|||
stdy -> offset -= size;
|
||||
|
||||
else if (stdy -> offset == ofs) {
|
||||
|
||||
stdynum = stdy -> styno;
|
||||
StudyCount--;
|
||||
mvmemi((Uchar *)(stdy + 1), (Uchar *)stdy,
|
||||
mvmemi((u_char*)(stdy + 1), (u_char*)stdy,
|
||||
sizeof(*stdy) * (StudyCount - i));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -358,7 +291,6 @@ Int size;
|
|||
for (i = 0, stdy = StudyDict ; i < StudyCount ; i++, stdy++)
|
||||
if (stdy -> styno > stdynum) (stdy -> styno)--;
|
||||
|
||||
|
||||
putstydic();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
255
kanakan/depend.c
255
kanakan/depend.c
|
|
@ -31,18 +31,22 @@
|
|||
* $SonyRCSfile: depend.c,v $
|
||||
* $SonyRevision: 1.4 $
|
||||
* $SonyDate: 1997/10/07 07:39:45 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "Dict.h"
|
||||
#include "sj3err.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
#if defined(__FD_SET) && !defined(FD_SET)
|
||||
|
|
@ -52,22 +56,14 @@
|
|||
|
||||
extern int serv_errno;
|
||||
extern Global *work_base;
|
||||
char *malloc();
|
||||
|
||||
|
||||
|
||||
|
||||
DictFile *dictlink = NULL;
|
||||
|
||||
|
||||
|
||||
StdyFile *stdylink = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
static long get4byte(p)
|
||||
Uchar *p;
|
||||
static long
|
||||
get4byte(u_char* p)
|
||||
{
|
||||
long i;
|
||||
|
||||
|
|
@ -76,9 +72,9 @@ Uchar *p;
|
|||
i = (i << 8) + *++p;
|
||||
return ((i << 8) + *++p);
|
||||
}
|
||||
static void Put4byte(p, n)
|
||||
Uchar *p;
|
||||
long n;
|
||||
|
||||
static void
|
||||
Put4byte(u_char* p, long n)
|
||||
{
|
||||
p += 3;
|
||||
*p-- = n; n >>= 8;
|
||||
|
|
@ -86,15 +82,12 @@ long n;
|
|||
*p-- = n; n >>= 8;
|
||||
*p = n;
|
||||
}
|
||||
|
||||
#define put4byte(p, n) Put4byte((p), (long)(n))
|
||||
|
||||
|
||||
|
||||
static int fgetfile(fp, pos, len, p)
|
||||
FILE *fp;
|
||||
long pos;
|
||||
int len;
|
||||
Uchar *p;
|
||||
static int
|
||||
fgetfile(FILE* fp, long pos, int len, void* p)
|
||||
{
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
|
|
@ -104,11 +97,9 @@ Uchar *p;
|
|||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
static int fputfile(fp, pos, len, p)
|
||||
FILE *fp;
|
||||
long pos;
|
||||
int len;
|
||||
Uchar *p;
|
||||
|
||||
static int
|
||||
fputfile(FILE* fp, long pos, int len, u_char* p)
|
||||
{
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
|
|
@ -118,11 +109,9 @@ Uchar *p;
|
|||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
static int getfile(fd, pos, len, p)
|
||||
int fd;
|
||||
int pos;
|
||||
int len;
|
||||
Uchar *p;
|
||||
|
||||
static int
|
||||
getfile(int fd, off_t pos, int len, void* p)
|
||||
{
|
||||
if (lseek(fd, pos, L_SET) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
|
|
@ -132,11 +121,9 @@ Uchar *p;
|
|||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
static int putfile(fd, pos, len, p)
|
||||
int fd;
|
||||
int pos;
|
||||
int len;
|
||||
Uchar *p;
|
||||
|
||||
static int
|
||||
putfile(int fd, off_t pos, int len, void* p)
|
||||
{
|
||||
if (lseek(fd, pos, L_SET) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
|
|
@ -148,33 +135,29 @@ Uchar *p;
|
|||
}
|
||||
|
||||
|
||||
|
||||
static int check_passwd(buf, passwd)
|
||||
Uchar *buf;
|
||||
char *passwd;
|
||||
static int
|
||||
check_passwd(u_char* buf, char* passwd)
|
||||
{
|
||||
buf += PasswdPos;
|
||||
return (*buf && strncmp(passwd, buf, PasswdLen)) ? FALSE : TRUE;
|
||||
}
|
||||
static void set_passwd(buf, passwd)
|
||||
Uchar *buf;
|
||||
char *passwd;
|
||||
|
||||
static void
|
||||
set_passwd(u_char* buf, char* passwd)
|
||||
{
|
||||
strncpy(buf + PasswdPos, passwd, PasswdLen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int check_dictfile(buf)
|
||||
Uchar *buf;
|
||||
static int
|
||||
check_dictfile(u_char* buf)
|
||||
{
|
||||
return (DictVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static DictFile *search_same_dict(ino)
|
||||
ino_t ino;
|
||||
static DictFile*
|
||||
search_same_dict(ino_t ino)
|
||||
{
|
||||
DictFile *p;
|
||||
|
||||
|
|
@ -185,43 +168,44 @@ ino_t ino;
|
|||
}
|
||||
|
||||
|
||||
|
||||
static Int getofs(dp)
|
||||
register DictFile *dp;
|
||||
static int
|
||||
getofs(DictFile* dp)
|
||||
{
|
||||
idxofs = dp -> ofsptr;
|
||||
return 0;
|
||||
}
|
||||
static Int getidx(dp)
|
||||
register DictFile *dp;
|
||||
|
||||
static int
|
||||
getidx(DictFile* dp)
|
||||
{
|
||||
idxbuf = dp -> buffer + dp -> idxstrt;
|
||||
return 0;
|
||||
}
|
||||
static Int getdic(dp, seg)
|
||||
register DictFile *dp;
|
||||
TypeDicSeg seg;
|
||||
|
||||
static int
|
||||
getdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
if (seg >= dp->dict.segunit) return -1;
|
||||
dicbuf = dp->buffer + dp->segstrt + dp->dict.seglen * seg;
|
||||
return 0;
|
||||
}
|
||||
static Int putidx(dp)
|
||||
register DictFile *dp;
|
||||
|
||||
static int
|
||||
putidx(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
return putfile(dp->fd, dp->idxstrt, dp->dict.idxlen, idxbuf);
|
||||
}
|
||||
static Int putdic(dp, seg)
|
||||
register DictFile *dp;
|
||||
TypeDicSeg seg;
|
||||
|
||||
static int
|
||||
putdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
Uchar *p;
|
||||
u_char *p;
|
||||
long i, j;
|
||||
|
||||
if (seg >= dp->dict.maxunit) return -1;
|
||||
i = dp->segstrt + dp->dict.seglen * (seg + 1);
|
||||
if (i > dp->bufsiz) {
|
||||
if (!(p = (Uchar *)malloc(i))) return -1;
|
||||
if (!(p = (u_char *)malloc(i))) return -1;
|
||||
memcpy(dp->buffer, p, dp->bufsiz);
|
||||
|
||||
if (idxbuf - dp->buffer == dp->idxstrt)
|
||||
|
|
@ -240,16 +224,16 @@ TypeDicSeg seg;
|
|||
|
||||
return putfile(dp->fd, i, dp->dict.seglen, p);
|
||||
}
|
||||
static Int rszdic(dp, seg)
|
||||
register DictFile *dp;
|
||||
TypeDicSeg seg;
|
||||
|
||||
static int
|
||||
rszdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
long i;
|
||||
Uchar *p;
|
||||
u_char *p;
|
||||
|
||||
i = dp->segstrt + dp->dict.seglen * seg;
|
||||
if (dp->bufsiz != i) {
|
||||
if (!(p = (Uchar *)malloc(i))) return -1;
|
||||
if (!(p = (u_char *)malloc(i))) return -1;
|
||||
memcpy(dp->buffer, p, ((i > dp->bufsiz) ? dp->bufsiz : i));
|
||||
|
||||
if (idxbuf - dp->buffer == dp->idxstrt)
|
||||
|
|
@ -268,17 +252,15 @@ TypeDicSeg seg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
DictFile *opendict(name, passwd)
|
||||
char *name;
|
||||
char *passwd;
|
||||
DictFile*
|
||||
opendict(char* name, char* passwd)
|
||||
{
|
||||
FILE *fp;
|
||||
struct stat sbuf;
|
||||
DictFile *dfp;
|
||||
Uchar tmp[HeaderLength];
|
||||
u_char tmp[HeaderLength];
|
||||
int i;
|
||||
Uchar *dp;
|
||||
u_char *dp;
|
||||
|
||||
|
||||
if (stat(name, &sbuf) == ERROR) {
|
||||
|
|
@ -318,9 +300,9 @@ char *passwd;
|
|||
}
|
||||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
|
||||
if ((dp = (Uchar *)malloc((long)sbuf.st_size)) == NULL) {
|
||||
if ((dp = (u_char *)malloc((long)sbuf.st_size)) == NULL) {
|
||||
#else
|
||||
if ((dp = (Uchar *)malloc(sbuf.st_size)) == NULL) {
|
||||
if ((dp = (u_char *)malloc(sbuf.st_size)) == NULL) {
|
||||
#endif
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error1;
|
||||
}
|
||||
|
|
@ -376,9 +358,8 @@ error1: fclose(fp);
|
|||
}
|
||||
|
||||
|
||||
|
||||
int closedict(dfp)
|
||||
DictFile *dfp;
|
||||
int
|
||||
closedict(DictFile* dfp)
|
||||
{
|
||||
DictFile *df;
|
||||
|
||||
|
|
@ -408,38 +389,36 @@ DictFile *dfp;
|
|||
}
|
||||
|
||||
|
||||
static fd_set zero_fd_set = { { 0 } };
|
||||
|
||||
static fd_set zero_fd_set = { 0 };
|
||||
void lock_dict(p, fd)
|
||||
DictFile *p;
|
||||
int fd;
|
||||
void
|
||||
lock_dict(DictFile* p, int fd)
|
||||
{
|
||||
FD_SET(fd, &(p -> lock));
|
||||
}
|
||||
void unlock_dict(p, fd)
|
||||
DictFile *p;
|
||||
int fd;
|
||||
|
||||
void
|
||||
unlock_dict(DictFile* p, int fd)
|
||||
{
|
||||
FD_CLR(fd, &(p -> lock));
|
||||
}
|
||||
int is_dict_locked(p)
|
||||
DictFile *p;
|
||||
|
||||
int
|
||||
is_dict_locked(DictFile* p)
|
||||
{
|
||||
return memcmp(&(p -> lock), &zero_fd_set, sizeof(zero_fd_set));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int check_stdyfile(buf)
|
||||
Uchar *buf;
|
||||
static int
|
||||
check_stdyfile(u_char* buf)
|
||||
{
|
||||
return (StdyVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static StdyFile *search_same_stdy(ino)
|
||||
ino_t ino;
|
||||
static StdyFile*
|
||||
search_same_stdy(ino_t ino)
|
||||
{
|
||||
StdyFile *p;
|
||||
|
||||
|
|
@ -450,18 +429,16 @@ ino_t ino;
|
|||
}
|
||||
|
||||
|
||||
|
||||
StdyFile *openstdy(name, passwd)
|
||||
char *name;
|
||||
char *passwd;
|
||||
StdyFile*
|
||||
openstdy(char* name, char* passwd)
|
||||
{
|
||||
FILE *fp;
|
||||
struct stat sbuf;
|
||||
StdyFile *sfp;
|
||||
Uchar *hd;
|
||||
u_char *hd;
|
||||
STDYIN *sp;
|
||||
Ushort *cip;
|
||||
Uchar *clp;
|
||||
u_char *clp;
|
||||
long stdycnt, stdypos, stdylen, stdymax;
|
||||
long clidxpos, clidxlen;
|
||||
long clstdypos, clstdylen, clstdystep;
|
||||
|
|
@ -482,7 +459,7 @@ char *passwd;
|
|||
}
|
||||
|
||||
|
||||
if ((hd = (Uchar *)malloc(HeaderLength+CommentLength)) == NULL) {
|
||||
if ((hd = (u_char *)malloc(HeaderLength+CommentLength)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory; return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -528,7 +505,7 @@ char *passwd;
|
|||
if ((cip = (Ushort *)malloc(clidxlen)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error3;
|
||||
}
|
||||
if ((clp = (Uchar *)malloc(clstdylen)) == NULL) {
|
||||
if ((clp = (u_char *)malloc(clstdylen)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error4;
|
||||
}
|
||||
|
||||
|
|
@ -569,9 +546,8 @@ error0: free((char *)hd);
|
|||
}
|
||||
|
||||
|
||||
|
||||
int closestdy(sfp)
|
||||
StdyFile *sfp;
|
||||
int
|
||||
closestdy(StdyFile* sfp)
|
||||
{
|
||||
StdyFile *sf;
|
||||
|
||||
|
|
@ -603,11 +579,11 @@ StdyFile *sfp;
|
|||
}
|
||||
|
||||
|
||||
|
||||
int putstydic()
|
||||
int
|
||||
putstydic(void)
|
||||
{
|
||||
int fd;
|
||||
Uchar *hd;
|
||||
u_char *hd;
|
||||
StdyFile *sf;
|
||||
long len;
|
||||
|
||||
|
|
@ -628,10 +604,12 @@ int putstydic()
|
|||
|
||||
return putfile(fd, get4byte(hd + StdyNormPos), len, sf -> stdy.stdydic);
|
||||
}
|
||||
int putcldic()
|
||||
|
||||
int
|
||||
putcldic(void)
|
||||
{
|
||||
int fd;
|
||||
Uchar *hd;
|
||||
u_char *hd;
|
||||
StdyFile *sf;
|
||||
|
||||
sf = (StdyFile *)stdy_base;
|
||||
|
|
@ -646,15 +624,11 @@ int putcldic()
|
|||
}
|
||||
|
||||
|
||||
|
||||
makedict(path, idxlen, seglen, segnum)
|
||||
char *path;
|
||||
int idxlen;
|
||||
int seglen;
|
||||
int segnum;
|
||||
int
|
||||
makedict(char* path, int idxlen, int seglen, int segnum)
|
||||
{
|
||||
FILE *fp;
|
||||
Uchar tmp[HeaderLength + CommentLength];
|
||||
u_char tmp[HeaderLength + CommentLength];
|
||||
long pos = HeaderLength + CommentLength;
|
||||
int ret = ERROR;
|
||||
int i;
|
||||
|
|
@ -708,15 +682,11 @@ error:
|
|||
}
|
||||
|
||||
|
||||
|
||||
makestdy(path, stynum, clstep, cllen)
|
||||
char *path;
|
||||
int stynum;
|
||||
int clstep;
|
||||
int cllen;
|
||||
int
|
||||
makestdy(char* path, int stynum, int clstep, int cllen)
|
||||
{
|
||||
FILE *fp;
|
||||
Uchar tmp[HeaderLength + CommentLength];
|
||||
u_char tmp[HeaderLength + CommentLength];
|
||||
long pos = HeaderLength + CommentLength;
|
||||
int ret = ERROR;
|
||||
int i, j;
|
||||
|
|
@ -792,24 +762,23 @@ error:
|
|||
}
|
||||
|
||||
|
||||
|
||||
void sj_closeall()
|
||||
void
|
||||
sj_closeall(void)
|
||||
{
|
||||
while (dictlink) closedict(dictlink);
|
||||
while (stdylink) closestdy(stdylink);
|
||||
}
|
||||
|
||||
|
||||
|
||||
set_dictpass(dp, pass)
|
||||
DictFile *dp;
|
||||
char *pass;
|
||||
int
|
||||
set_dictpass(DictFile* dp, char* pass)
|
||||
{
|
||||
set_passwd(dp -> buffer, pass);
|
||||
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
|
||||
}
|
||||
set_stdypass(pass)
|
||||
char *pass;
|
||||
|
||||
int
|
||||
set_stdypass(char* pass)
|
||||
{
|
||||
StdyFile *sp;
|
||||
|
||||
|
|
@ -820,22 +789,21 @@ char *pass;
|
|||
|
||||
|
||||
|
||||
static set_comment(buf, comment)
|
||||
Uchar *buf;
|
||||
char *comment;
|
||||
static void
|
||||
set_comment(u_char* buf, char* comment)
|
||||
{
|
||||
strncpy(buf + HeaderLength, comment, CommentLength);
|
||||
}
|
||||
|
||||
set_dictcmnt(dp, cmnt)
|
||||
DictFile *dp;
|
||||
char *cmnt;
|
||||
int
|
||||
set_dictcmnt(DictFile* dp, char* cmnt)
|
||||
{
|
||||
set_comment(dp -> buffer, cmnt);
|
||||
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
|
||||
}
|
||||
set_stdycmnt(cmnt)
|
||||
char *cmnt;
|
||||
|
||||
int
|
||||
set_stdycmnt(char* cmnt)
|
||||
{
|
||||
StdyFile *sp;
|
||||
|
||||
|
|
@ -845,9 +813,8 @@ char *cmnt;
|
|||
}
|
||||
|
||||
|
||||
|
||||
get_stdysize(stynum, clstep, cllen)
|
||||
int *stynum, *clstep, *cllen;
|
||||
void
|
||||
get_stdysize(int* stynum, int* clstep, int* cllen)
|
||||
{
|
||||
*stynum = StudyMax;
|
||||
*clstep = ClStudyStep;
|
||||
|
|
|
|||
|
|
@ -31,38 +31,31 @@
|
|||
* $SonyRCSfile: dict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:45 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
|
||||
Int codesize();
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Void get_askknj()
|
||||
void
|
||||
get_askknj(void)
|
||||
{
|
||||
Reg1 Uchar *p;
|
||||
Reg3 Uchar *q;
|
||||
Reg2 Uchar *r;
|
||||
Int i = 0, csize;
|
||||
Int flg;
|
||||
u_char *p;
|
||||
u_char *q;
|
||||
u_char *r;
|
||||
int i = 0, csize;
|
||||
int flg;
|
||||
|
||||
|
||||
p = q = dicbuf;
|
||||
|
||||
|
||||
q += *p++;
|
||||
|
||||
|
||||
while (p < q) {
|
||||
|
||||
askknj[i] = p;
|
||||
|
||||
|
||||
r = NULL;
|
||||
flg = TRUE;
|
||||
do {
|
||||
|
|
@ -76,15 +69,13 @@ Void get_askknj()
|
|||
} while (flg);
|
||||
|
||||
p++;
|
||||
|
||||
askknj_k[i++] = r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int seldict(id)
|
||||
TypeDicID id;
|
||||
int
|
||||
seldict(TypeDicID id)
|
||||
{
|
||||
DICTL *dp;
|
||||
|
||||
|
|
@ -98,9 +89,8 @@ TypeDicID id;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *get_idxptr(seg)
|
||||
TypeDicSeg seg;
|
||||
u_char*
|
||||
get_idxptr(TypeDicSeg seg)
|
||||
{
|
||||
(*curdict->getofs)(curdict);
|
||||
(*curdict->getidx)(curdict);
|
||||
|
|
|
|||
|
|
@ -31,53 +31,38 @@
|
|||
* $SonyRCSfile: functbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:46 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_func.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Void num_type00(), num_type01(), num_type02(), num_type03();
|
||||
Void num_type04(), num_type05(), num_type06(), num_type07();
|
||||
Void num_type08(), num_type09(), num_type10(), num_type11();
|
||||
Void num_type12(), num_type13(), num_type14();
|
||||
VFunc cvtnum_func[] = {
|
||||
VFuncNT cvtnum_func[] = {
|
||||
num_type00, num_type01, num_type02, num_type03,
|
||||
num_type04, num_type05, num_type06, num_type07,
|
||||
num_type08, num_type09, num_type10, num_type11,
|
||||
num_type12, num_type13, num_type14
|
||||
};
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_hira(), *getkan_kata(), *getkan_knj(), *getkan_ofs();
|
||||
Uchar *getkan_norm(), *getkan_none();
|
||||
UCPFunc getkan_func[] = {
|
||||
UCPFuncGK getkan_func[] = {
|
||||
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
|
||||
getkan_knj, getkan_ofs, getkan_norm, getkan_none,
|
||||
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
|
||||
getkan_knj, getkan_ofs, getkan_norm, getkan_none
|
||||
};
|
||||
|
||||
|
||||
|
||||
Int setj_norm1(), setj_norm2(), setj_knj(), setj_ofs(), setj_atrb();
|
||||
IFunc setjrec_func[] = {
|
||||
IFuncSetj setjrec_func[] = {
|
||||
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
|
||||
setj_knj, setj_ofs, setj_norm2, setj_atrb,
|
||||
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
|
||||
setj_knj, setj_ofs, setj_norm2, setj_atrb
|
||||
};
|
||||
|
||||
|
||||
|
||||
Int hiraknj_atrb(), hiraknj_ofs(), hiraknj_knj(), hiraknj_hask();
|
||||
Int hiraknj_kask(), hiraknj_norm(), hiraknj_hira();
|
||||
IFunc hiraknj_func[] = {
|
||||
IFuncHira hiraknj_func[] = {
|
||||
hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask,
|
||||
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb,
|
||||
hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask,
|
||||
|
|
@ -85,10 +70,7 @@ IFunc hiraknj_func[] = {
|
|||
};
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_1byte(), *makekan_knj(), *makekan_ofs();
|
||||
Uchar *makekan_norm(), *makekan_none();
|
||||
UCPFunc makekan_func[] = {
|
||||
UCPFuncMK makekan_func[] = {
|
||||
makekan_norm, makekan_norm, makekan_1byte, makekan_1byte,
|
||||
makekan_knj, makekan_ofs, makekan_norm, makekan_none,
|
||||
makekan_norm, makekan_norm, makekan_1byte, makekan_1byte,
|
||||
|
|
|
|||
|
|
@ -31,41 +31,30 @@
|
|||
* $SonyRCSfile: getkanji.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:49 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static u_char*
|
||||
code2kanji(u_char* s, u_char* d, u_char* ym, int yl, int flg);
|
||||
|
||||
Static Uchar *code2kanji();
|
||||
Int codesize();
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_none(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_none(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_hira(s, d, ym, yl, flg)
|
||||
Uchar *d;
|
||||
Reg2 Uchar *ym;
|
||||
Uchar *s;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_hira(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
Reg1 Int cnt, csize;
|
||||
int cnt, csize;
|
||||
|
||||
csize = codesize(*s);
|
||||
|
||||
|
|
@ -82,15 +71,11 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_kata(s, d, ym, yl, flg)
|
||||
Reg1 Uchar *d;
|
||||
Reg2 Uchar *ym;
|
||||
Uchar *s;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_kata(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
Reg3 Int cnt, csize;
|
||||
Reg4 Uchar ch;
|
||||
int cnt, csize;
|
||||
u_char ch;
|
||||
|
||||
csize = codesize(*s);
|
||||
|
||||
|
|
@ -123,26 +108,16 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_knj(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_knj(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
|
||||
return code2kanji(askknj[*s & KnjAssyukuMask], d, ym, yl, flg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_ofs(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_ofs(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
|
||||
return code2kanji(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
|
||||
|
|
@ -150,16 +125,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_norm(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_norm(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
Reg2 Int i, csize;
|
||||
Reg2 Uchar c;
|
||||
u_char c;
|
||||
|
||||
if (*s != 0) {
|
||||
c = s[1];
|
||||
|
|
@ -174,15 +143,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *getkan_ascii(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
u_char*
|
||||
getkan_ascii(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
Reg2 Uchar c;
|
||||
u_char c;
|
||||
|
||||
c = s[1];
|
||||
if (c & 0x80)
|
||||
|
|
@ -193,15 +157,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Uchar *code2kanji(s, d, ym, yl, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Int flg;
|
||||
static u_char*
|
||||
code2kanji(u_char* s, u_char* d, u_char* ym, int yl, int flg)
|
||||
{
|
||||
Reg2 Int csize;
|
||||
int csize;
|
||||
|
||||
for ( ; ; ) {
|
||||
csize = codesize(*s);
|
||||
|
|
@ -261,19 +220,13 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Int getkanji(ym, yl, ptr, buf)
|
||||
Uchar *ym;
|
||||
Int yl;
|
||||
Uchar *ptr;
|
||||
Uchar *buf;
|
||||
int
|
||||
getkanji(u_char* ym, int yl, u_char* ptr, u_char* buf)
|
||||
{
|
||||
Uchar *q;
|
||||
|
||||
u_char *q;
|
||||
|
||||
q = code2kanji(ptr, buf, ym, yl, TRUE);
|
||||
|
||||
|
||||
return q - buf;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,112 +31,79 @@
|
|||
* $SonyRCSfile: getrank.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:50 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static void setstynum (void);
|
||||
static void setnspr (KHREC *kptr, STDYIN *sptr);
|
||||
static void regetrank (void);
|
||||
|
||||
|
||||
|
||||
STDYIN *srchstdy();
|
||||
|
||||
|
||||
|
||||
Static Void setstynum(), setnspr(), regetrank();
|
||||
|
||||
|
||||
|
||||
Void getrank()
|
||||
void
|
||||
getrank (void)
|
||||
{
|
||||
|
||||
trank = nrank = 1;
|
||||
|
||||
|
||||
setstynum();
|
||||
|
||||
|
||||
regetrank();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void setstynum()
|
||||
static void
|
||||
setstynum (void)
|
||||
{
|
||||
KHREC *kptr;
|
||||
STDYIN *sptr;
|
||||
Int count;
|
||||
|
||||
|
||||
for (kptr = kouhotbl, count = khcount ; count-- ; kptr++) {
|
||||
|
||||
sptr = srchstdy(kptr -> clrec -> jnode -> jseg, kptr -> offs,
|
||||
kptr -> clrec -> jnode -> dicid);
|
||||
|
||||
|
||||
if (!sptr) continue;
|
||||
|
||||
|
||||
setnspr(kptr, sptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void setnspr(kptr, sptr)
|
||||
KHREC *kptr;
|
||||
STDYIN *sptr;
|
||||
static void
|
||||
setnspr (KHREC *kptr, STDYIN *sptr)
|
||||
{
|
||||
KHREC *ptr;
|
||||
Int keepnm;
|
||||
TypeStyNum styno;
|
||||
|
||||
|
||||
styno = kptr -> styno = sptr -> styno;
|
||||
|
||||
|
||||
keepnm = trank;
|
||||
|
||||
|
||||
for (ptr = kouhotbl ; ptr < kptr ; ptr++) {
|
||||
|
||||
|
||||
if (styno < ptr -> styno) {
|
||||
|
||||
ptr -> rank++;
|
||||
|
||||
|
||||
keepnm--;
|
||||
}
|
||||
|
||||
|
||||
else if (styno == ptr -> styno) {
|
||||
|
||||
|
||||
if (kptr -> sttfg && kptr -> ka_fg) {
|
||||
|
||||
|
||||
if ((sptr -> sttkj == kptr -> sttkj) &&
|
||||
(sptr -> ka_kj == kptr -> ka_kj)) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
}
|
||||
}
|
||||
|
||||
else if (kptr -> sttfg) {
|
||||
|
||||
|
||||
if (sptr -> sttkj == kptr -> sttkj) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
}
|
||||
}
|
||||
|
||||
else if (kptr -> ka_fg) {
|
||||
|
||||
|
||||
if (sptr -> ka_kj == kptr -> ka_kj) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
|
|
@ -145,41 +112,30 @@ STDYIN *sptr;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
kptr -> rank = (Uchar)keepnm;
|
||||
trank++;
|
||||
|
||||
|
||||
if (keepnm <= nrank) nrank++;
|
||||
|
||||
|
||||
if (sptr -> nmflg && (nrank > keepnm)) nrank = keepnm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void regetrank()
|
||||
static void
|
||||
regetrank (void)
|
||||
{
|
||||
KHREC *kptr;
|
||||
Int count;
|
||||
Int tmp;
|
||||
|
||||
|
||||
if (nrank < trank) {
|
||||
|
||||
tmp = nrank;
|
||||
|
||||
|
||||
trank += nkhcount;
|
||||
}
|
||||
|
||||
else {
|
||||
nkhcount = tmp = 0;
|
||||
}
|
||||
|
||||
|
||||
for (count = khcount, kptr = kouhotbl ; count-- ; kptr++) {
|
||||
|
||||
if (!(kptr -> rank)) {
|
||||
if (tmp && kptr -> mode && !(kptr -> offs)) {
|
||||
kptr -> rank = (Uchar)tmp++;
|
||||
|
|
@ -187,8 +143,6 @@ Static Void regetrank()
|
|||
else
|
||||
kptr -> rank = (Uchar)trank++;
|
||||
}
|
||||
|
||||
|
||||
else if ((Short)kptr -> rank >= nrank)
|
||||
kptr -> rank += (Uchar)nkhcount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,20 @@
|
|||
* $SonyRCSfile: hzstrlen.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:52 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_const.h"
|
||||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Int euc_codesize(c)
|
||||
Reg1 Uchar c;
|
||||
Int
|
||||
euc_codesize (Uchar c)
|
||||
{
|
||||
if ((c & KanjiModeMask) == 0x90) {
|
||||
return 1;
|
||||
|
|
@ -56,17 +57,12 @@ Reg1 Uchar c;
|
|||
}
|
||||
}
|
||||
|
||||
Int hzstrlen(ptr, len)
|
||||
Reg1 Uchar *ptr;
|
||||
Reg2 Int len;
|
||||
Int
|
||||
hzstrlen (Uchar *ptr, Int len)
|
||||
{
|
||||
Uchar *head;
|
||||
|
||||
|
||||
head = ptr;
|
||||
|
||||
while (len-- > 0) ptr += euc_codesize(*ptr);
|
||||
|
||||
|
||||
return (ptr - head);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
* from Sony Corporation.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: memcpy.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:56 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
Void memcpy (src, dst, n)
|
||||
Reg1 Uchar *src;
|
||||
Reg2 Uchar *dst;
|
||||
Reg3 Int n;
|
||||
{
|
||||
while (n-- > 0) *dst++ = *src++;
|
||||
}
|
||||
|
||||
Void sstrncpy(src, dst, n)
|
||||
Reg2 Uchar *src;
|
||||
Reg1 Uchar *dst;
|
||||
Reg3 Int n;
|
||||
{
|
||||
while (n-- > 0) *dst++ = *src++;
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
* from Sony Corporation.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: memset.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:59 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
Void memset(p, c, n)
|
||||
Reg1 Uchar *p;
|
||||
Reg3 Uchar c;
|
||||
Reg2 Int n;
|
||||
{
|
||||
while (n-- > 0) *p++ = c;
|
||||
}
|
||||
|
||||
|
|
@ -31,27 +31,30 @@
|
|||
* $SonyRCSfile: mkbunset.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:02 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
CLREC *alloc_clrec();
|
||||
Uchar TFar *getstb();
|
||||
Int terminate(), setconj();
|
||||
Void setclrec(), srchfzk(), memset();
|
||||
Int terminate();
|
||||
Void setclrec(), srchfzk();
|
||||
|
||||
Void mkbunsetu()
|
||||
void
|
||||
mkbunsetu(void)
|
||||
{
|
||||
Reg1 JREC *jrec;
|
||||
JREC *jrec;
|
||||
TypeGram hinsi;
|
||||
Uchar TFar *cnj;
|
||||
u_char *cnj;
|
||||
CREC crec[4];
|
||||
Int count;
|
||||
int count;
|
||||
TypeCnct right;
|
||||
Uchar *next;
|
||||
u_char *next;
|
||||
int i;
|
||||
|
||||
fzkcount = 0;
|
||||
|
|
@ -67,7 +70,7 @@ Void mkbunsetu()
|
|||
else
|
||||
hinsi = jrec -> hinsi;
|
||||
|
||||
if (right = Connadr[hinsi]) {
|
||||
if ((right = Connadr[hinsi]) != '\0') {
|
||||
gobilen = 0;
|
||||
next = cnvstart + jrec->jlen;
|
||||
|
||||
|
|
@ -79,7 +82,7 @@ Void mkbunsetu()
|
|||
srchfzk(jrec, next, right, 0);
|
||||
}
|
||||
|
||||
else if (count = setconj(hinsi, jrec, crec)) {
|
||||
else if ((count = setconj(hinsi, jrec, crec)) != 0) {
|
||||
|
||||
for (i = count ; i-- > 0 ; ) {
|
||||
|
||||
|
|
@ -101,26 +104,26 @@ Void mkbunsetu()
|
|||
}
|
||||
|
||||
|
||||
CLREC *argclrec(len)
|
||||
Int len;
|
||||
CLREC*
|
||||
argclrec(int len)
|
||||
{
|
||||
Reg1 CLREC *ptr;
|
||||
Reg2 CLREC *rec;
|
||||
Reg3 CLREC *child;
|
||||
CLREC *ptr;
|
||||
CLREC *rec;
|
||||
CLREC *child;
|
||||
|
||||
rec = alloc_clrec();
|
||||
|
||||
if (!rec) {
|
||||
if (!maxclptr) return NULL;
|
||||
if (maxclptr == NULL) return NULL;
|
||||
|
||||
ptr = NULL;
|
||||
rec = maxclptr;
|
||||
while (child = rec -> clsort) {
|
||||
while ((child = rec -> clsort) != NULL) {
|
||||
ptr = rec;
|
||||
rec = child;
|
||||
}
|
||||
|
||||
if (len <= (Int) rec -> cllen) return NULL;
|
||||
if (len <= (int) rec -> cllen) return NULL;
|
||||
|
||||
if (ptr)
|
||||
ptr -> clsort = NULL;
|
||||
|
|
@ -129,8 +132,8 @@ Int len;
|
|||
if (rec -> jnode) (rec -> jnode)--;
|
||||
}
|
||||
|
||||
memset((Uchar *)rec, 0, sizeof(*rec));
|
||||
rec -> cllen = rec -> cl2len = (Uchar)len;
|
||||
memset((u_char*)rec, 0, sizeof(*rec));
|
||||
rec -> cllen = rec -> cl2len = (u_char)len;
|
||||
|
||||
if (!maxclptr) {
|
||||
maxclptr = rec;
|
||||
|
|
@ -139,17 +142,17 @@ Int len;
|
|||
|
||||
ptr = maxclptr;
|
||||
|
||||
if (((Int)ptr -> cllen < len) ||
|
||||
(((Int)ptr -> cllen == len) &&
|
||||
if (((int)ptr -> cllen < len) ||
|
||||
(((int)ptr -> cllen == len) &&
|
||||
(ptr -> jnode -> hinsi == TANKANJI))) {
|
||||
rec -> clsort = maxclptr;
|
||||
maxclptr = rec;
|
||||
return rec;
|
||||
}
|
||||
|
||||
while (child = ptr -> clsort) {
|
||||
if ((Int)child -> cllen < len ||
|
||||
((Int)child -> cllen == len &&
|
||||
while ((child = ptr -> clsort) != NULL) {
|
||||
if ((int)child -> cllen < len ||
|
||||
((int)child -> cllen == len &&
|
||||
child->jnode->hinsi == TANKANJI)){
|
||||
ptr -> clsort = rec;
|
||||
rec -> clsort = child;
|
||||
|
|
@ -159,7 +162,6 @@ Int len;
|
|||
ptr = child;
|
||||
}
|
||||
|
||||
|
||||
ptr -> clsort = rec;
|
||||
return rec;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,28 +31,28 @@
|
|||
* $SonyRCSfile: mkjiritu.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:03 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Uchar *srchdict();
|
||||
Uchar TFar *getstb();
|
||||
Int srchhead(), sstrncmp();
|
||||
JREC *alloc_jrec();
|
||||
Void srchnum(), setubi(), setjrec();
|
||||
Void setcrec(), memcpy(), memset();
|
||||
Int srchhead();
|
||||
|
||||
Static Void dic_mu(), dic_cl();
|
||||
static void dic_mu(int mode);
|
||||
static void dic_cl(void);
|
||||
|
||||
Void mkjiritu(mode)
|
||||
Int mode;
|
||||
void
|
||||
mkjiritu(int mode)
|
||||
{
|
||||
Uchar chkind1;
|
||||
Uchar chkind2;
|
||||
u_char chkind1;
|
||||
u_char chkind2;
|
||||
JREC *jrec;
|
||||
Uchar TFar *stb;
|
||||
u_char *stb;
|
||||
|
||||
headcode = headlen = 0;
|
||||
|
||||
|
|
@ -87,15 +87,15 @@ Int mode;
|
|||
}
|
||||
|
||||
for (jrec = maxjptr ; jrec ; jrec = jrec -> jsort) {
|
||||
if (stb = getstb(jrec -> hinsi))
|
||||
if ((stb = getstb(jrec -> hinsi)) != NULL)
|
||||
setubi(jrec, stb);
|
||||
}
|
||||
}
|
||||
|
||||
Static Void dic_mu(mode)
|
||||
Int mode;
|
||||
static void
|
||||
dic_mu(int mode)
|
||||
{
|
||||
Uchar *tagp;
|
||||
u_char *tagp;
|
||||
DICTL *dp;
|
||||
|
||||
for (dp = dictlist ; dp ; dp = dp -> next) {
|
||||
|
|
@ -104,17 +104,16 @@ Int mode;
|
|||
dicsaml = 0;
|
||||
prevseg = -1;
|
||||
|
||||
while (tagp = srchdict(tagp)) setjrec(tagp, mode);
|
||||
while ((tagp = srchdict(tagp)) != NULL) setjrec(tagp, mode);
|
||||
}
|
||||
}
|
||||
|
||||
JREC *argjrec(len, rec)
|
||||
Int len;
|
||||
JREC *rec;
|
||||
JREC*
|
||||
argjrec(int len, JREC* rec)
|
||||
{
|
||||
Reg1 JREC *ptr;
|
||||
Reg2 JREC *jrec;
|
||||
Reg3 JREC *child;
|
||||
JREC *ptr;
|
||||
JREC *jrec;
|
||||
JREC *child;
|
||||
|
||||
jrec = alloc_jrec();
|
||||
|
||||
|
|
@ -123,12 +122,12 @@ JREC *rec;
|
|||
|
||||
ptr = NULL;
|
||||
jrec = maxjptr;
|
||||
while (child = jrec -> jsort) {
|
||||
while ((child = jrec -> jsort) != NULL) {
|
||||
ptr = jrec;
|
||||
jrec = child;
|
||||
}
|
||||
|
||||
if (len <= (Int) jrec -> jlen) return NULL;
|
||||
if (len <= (int) jrec -> jlen) return NULL;
|
||||
|
||||
if (ptr)
|
||||
ptr -> jsort = NULL;
|
||||
|
|
@ -137,10 +136,10 @@ JREC *rec;
|
|||
}
|
||||
|
||||
if (rec)
|
||||
memcpy((Uchar *)rec, (Uchar *)jrec, sizeof(JREC));
|
||||
memcpy((u_char*)rec, (u_char*)jrec, sizeof(JREC));
|
||||
else
|
||||
memset((Uchar *)jrec, 0, sizeof(*jrec));
|
||||
jrec -> jlen = (Uchar)len;
|
||||
memset((u_char*)jrec, 0, sizeof(*jrec));
|
||||
jrec -> jlen = (u_char)len;
|
||||
|
||||
if (!maxjptr) {
|
||||
maxjptr = jrec;
|
||||
|
|
@ -150,14 +149,14 @@ JREC *rec;
|
|||
|
||||
ptr = maxjptr;
|
||||
|
||||
if ((Int)ptr -> jlen < len) {
|
||||
if ((int)ptr -> jlen < len) {
|
||||
jrec -> jsort = maxjptr;
|
||||
maxjptr = jrec;
|
||||
return jrec;
|
||||
}
|
||||
|
||||
while (child = ptr -> jsort) {
|
||||
if ((Int)child -> jlen < len) break;
|
||||
while ((child = ptr -> jsort) != NULL) {
|
||||
if ((int)child -> jlen < len) break;
|
||||
|
||||
ptr = child;
|
||||
}
|
||||
|
|
@ -167,19 +166,20 @@ JREC *rec;
|
|||
return jrec;
|
||||
}
|
||||
|
||||
Static Void dic_cl()
|
||||
static void
|
||||
dic_cl(void)
|
||||
{
|
||||
Uchar *p;
|
||||
Ushort pos;
|
||||
Int len;
|
||||
Int cmp;
|
||||
u_char *p;
|
||||
u_short pos;
|
||||
int len;
|
||||
int cmp;
|
||||
|
||||
if (!StudyExist()) return;
|
||||
|
||||
if ((pos = ClStudyIdx[(Short) *cnvstart / ClStudyStep]) != (Ushort)-1) {
|
||||
if ((pos = ClStudyIdx[(Short) *cnvstart / ClStudyStep]) != (u_short)-1) {
|
||||
|
||||
for (p = ClStudyDict + pos ; !iseocl(p) ; p = ClNextTag(p)) {
|
||||
cmp = sstrncmp(cnvstart, (Uchar TFar *)ClYomiPos(p),
|
||||
cmp = strncmp(cnvstart, (u_char*)ClYomiPos(p),
|
||||
len = ClYomiLen(p));
|
||||
|
||||
if (cmp == MATCH) {
|
||||
|
|
|
|||
|
|
@ -31,36 +31,31 @@
|
|||
* $SonyRCSfile: mkkouho.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:04 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_suuji.h"
|
||||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Uchar *skipkstr();
|
||||
Void setkouho(), setwdnum(), get_askknj();
|
||||
Int seldict(), codesize();
|
||||
static void getkhtbl(CLREC* clrec);
|
||||
static void cl_kanji(JREC* jrec, CLREC* clrec);
|
||||
static u_char* makekan(u_char* s, u_char* d, int flg);
|
||||
static int diffknj(JREC* jrec, u_char* ptr, int num);
|
||||
static void cl_numcmn(JREC* jrec, CLREC* clrec);
|
||||
|
||||
|
||||
|
||||
Static Void getkhtbl(), cl_kanji();
|
||||
Static Int diffknj();
|
||||
Static Void cl_numcmn();
|
||||
Static Uchar *makekan();
|
||||
|
||||
|
||||
|
||||
Void mkkouho()
|
||||
void
|
||||
mkkouho(void)
|
||||
{
|
||||
CLREC *clrec;
|
||||
Int keeplen;
|
||||
int keeplen;
|
||||
|
||||
|
||||
khcount = nkhcount = 0;
|
||||
|
|
@ -79,19 +74,15 @@ Void mkkouho()
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Void getkhtbl(clrec)
|
||||
CLREC *clrec;
|
||||
static void
|
||||
getkhtbl(CLREC* clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
|
||||
|
||||
jrec = clrec -> jnode;
|
||||
|
||||
|
||||
switch (jrec -> class) {
|
||||
case C_DICT:
|
||||
|
||||
cl_kanji(jrec, clrec);
|
||||
break;
|
||||
|
||||
|
|
@ -114,20 +105,17 @@ CLREC *clrec;
|
|||
|
||||
case C_MINASI:
|
||||
case C_WAKACHI:
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void cl_kanji(jrec, clrec)
|
||||
JREC *jrec;
|
||||
CLREC *clrec;
|
||||
static void
|
||||
cl_kanji(JREC* jrec, CLREC* clrec)
|
||||
{
|
||||
Uchar *ptr;
|
||||
Int kcount = khcount;
|
||||
u_char *ptr;
|
||||
int kcount = khcount;
|
||||
|
||||
|
||||
if (seldict(jrec -> dicid)) {
|
||||
|
|
@ -156,21 +144,15 @@ CLREC *clrec;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_none(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_none(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_1byte(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_1byte(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
if ((*s & KanjiModeMask) == ZenHiraAssyuku)
|
||||
*d++ = 0x10 | (*s & KnjAssyukuMask);
|
||||
|
|
@ -182,22 +164,16 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_knj(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_knj(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
|
||||
return makekan(askknj[*s & KnjAssyukuMask], d, flg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_ofs(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_ofs(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
|
||||
return makekan(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
|
||||
|
|
@ -205,14 +181,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_norm(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_norm(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
Reg1 Int i, csize;
|
||||
Reg1 Uchar c;
|
||||
u_char c;
|
||||
|
||||
if (*s != 0) {
|
||||
c = s[1];
|
||||
|
|
@ -229,13 +201,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Uchar *makekan_ascii(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
u_char*
|
||||
makekan_ascii(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
Reg1 Uchar c;
|
||||
u_char c;
|
||||
|
||||
c = s[1];
|
||||
if (c & 0x80)
|
||||
|
|
@ -248,13 +217,10 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Uchar *makekan(s, d, flg)
|
||||
Uchar *s;
|
||||
Uchar *d;
|
||||
Int flg;
|
||||
static u_char*
|
||||
makekan(u_char* s, u_char* d, int flg)
|
||||
{
|
||||
Reg1 Int csize;
|
||||
int csize;
|
||||
|
||||
for ( ; ; ) {
|
||||
csize = codesize(*s);
|
||||
|
|
@ -314,26 +280,19 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
#define PEND 2
|
||||
#define QEND 1
|
||||
Static Int sameknj(p, plen, q, qlen)
|
||||
Reg1 Uchar *p;
|
||||
Uchar plen;
|
||||
Reg2 Uchar *q;
|
||||
Uchar qlen;
|
||||
static int
|
||||
sameknj(u_char* p, int plen, u_char* q, int qlen)
|
||||
{
|
||||
Int i;
|
||||
Int j;
|
||||
Int endf = 0;
|
||||
Int brkf;
|
||||
extern Int euc_codesize();
|
||||
int i;
|
||||
int j;
|
||||
int endf = 0;
|
||||
int brkf;
|
||||
|
||||
do {
|
||||
|
||||
if ((i = euc_codesize(*p)) != euc_codesize(*q)) return FALSE;
|
||||
|
||||
|
||||
brkf = 0;
|
||||
for (j = 0; j < i; j++) {
|
||||
if (p[j] != q[j] ) {
|
||||
|
|
@ -343,37 +302,30 @@ Uchar qlen;
|
|||
}
|
||||
if (brkf) break;
|
||||
|
||||
|
||||
if (p[i] == KanjiStrEnd) endf += PEND;
|
||||
if (q[i] == KanjiStrEnd) endf += QEND;
|
||||
|
||||
|
||||
p += i;
|
||||
q += i;
|
||||
} while (!endf);
|
||||
|
||||
switch (endf) {
|
||||
|
||||
case (PEND | QEND):
|
||||
|
||||
if (plen == qlen) return TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case PEND:
|
||||
i = plen;
|
||||
plen = qlen;
|
||||
qlen = i;
|
||||
p = q;
|
||||
|
||||
|
||||
case QEND:
|
||||
if (p[euc_codesize(*p)] != KanjiStrEnd) break;
|
||||
if ((*p & KanjiModeMask) != 0x10 ) break;
|
||||
if (qlen != plen - (*p & KanjiCodeMask) - 1) break;
|
||||
return TRUE;
|
||||
|
||||
|
||||
default:
|
||||
if (q[euc_codesize(*q)] != KanjiStrEnd) break;
|
||||
if (p[euc_codesize(*p)] != KanjiStrEnd) break;
|
||||
|
|
@ -390,72 +342,52 @@ Uchar qlen;
|
|||
#undef QEND
|
||||
|
||||
|
||||
|
||||
Static Int diffknj(jrec, ptr, num)
|
||||
JREC *jrec;
|
||||
Uchar *ptr;
|
||||
Int num;
|
||||
static int
|
||||
diffknj(JREC* jrec, u_char* ptr, int num)
|
||||
{
|
||||
KHREC *kptr;
|
||||
JREC *jptr;
|
||||
Int i;
|
||||
Uchar kbuf1[MaxWdKanjiLen];
|
||||
Uchar kbuf2[MaxWdKanjiLen];
|
||||
int i;
|
||||
u_char kbuf1[MaxWdKanjiLen];
|
||||
u_char kbuf2[MaxWdKanjiLen];
|
||||
|
||||
|
||||
if (jrec -> hinsi == TANKANJI) return TRUE;
|
||||
|
||||
|
||||
makekan(ptr, kbuf1, TRUE);
|
||||
|
||||
|
||||
for (i = 0, kptr = kouhotbl ; i < num ; i++, kptr++) {
|
||||
|
||||
if ((jptr = kptr -> clrec -> jnode) == jrec)
|
||||
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (jptr -> hinsi == TANKANJI) continue;
|
||||
|
||||
|
||||
if (jptr -> class != jrec -> class) continue;
|
||||
|
||||
|
||||
if (jptr -> dicid != jrec -> dicid) continue;
|
||||
|
||||
|
||||
if (jptr -> jseg != jrec -> jseg) continue;
|
||||
|
||||
|
||||
if (jptr -> sttofs != jrec -> sttofs) continue;
|
||||
|
||||
|
||||
if (jptr -> stbofs != jrec -> stbofs) continue;
|
||||
|
||||
|
||||
makekan(dicbuf + kptr -> offs, kbuf2, TRUE);
|
||||
|
||||
|
||||
if (sameknj(kbuf1, jrec -> jlen, kbuf2, jptr -> jlen))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Static Int chrck_numtbl(flg, cond)
|
||||
Ushort flg;
|
||||
Ushort cond;
|
||||
static int
|
||||
chrck_numtbl(u_short flg, u_short cond)
|
||||
{
|
||||
Ushort must;
|
||||
u_short must;
|
||||
|
||||
if (cond = SelNumCond(cond)) {
|
||||
if (must = (cond & SelNumMust)) {
|
||||
if ((cond = SelNumCond(cond)) != 0) {
|
||||
if ((must = (cond & SelNumMust)) != 0) {
|
||||
if ((flg & must) != must) return FALSE;
|
||||
cond &= ~must;
|
||||
}
|
||||
|
|
@ -466,13 +398,12 @@ Ushort cond;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Int sel_sjmode(jrec)
|
||||
JREC *jrec;
|
||||
int
|
||||
sel_sjmode(JREC* jrec)
|
||||
{
|
||||
Ushort i;
|
||||
Ushort TFar *p;
|
||||
Ushort TFar *q;
|
||||
u_short i;
|
||||
u_short *p;
|
||||
u_short *q;
|
||||
|
||||
switch (jrec -> class) {
|
||||
case C_N_ARABIA:
|
||||
|
|
@ -504,15 +435,13 @@ JREC *jrec;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Void cl_numcmn(jrec, clrec)
|
||||
JREC *jrec;
|
||||
CLREC *clrec;
|
||||
static void
|
||||
cl_numcmn(JREC* jrec, CLREC* clrec)
|
||||
{
|
||||
Uchar *p;
|
||||
Int i;
|
||||
Ushort j;
|
||||
Ushort TFar *tbl;
|
||||
u_char *p;
|
||||
int i;
|
||||
u_short j;
|
||||
u_short *tbl;
|
||||
|
||||
|
||||
p = cnvstart;
|
||||
|
|
@ -556,7 +485,7 @@ CLREC *clrec;
|
|||
if (!chrck_numtbl(jrec -> flags, j)) continue;
|
||||
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)0, (Int)SelNumFunc(j));
|
||||
setkouho(clrec, (TypeDicOfs)0, (int)SelNumFunc(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,32 +31,24 @@
|
|||
* $SonyRCSfile: mknumber.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:05 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "sj_suuji.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Void setwdnum();
|
||||
Int setucnum();
|
||||
|
||||
|
||||
|
||||
Static Int word2char(wd, tbl, keta, flg)
|
||||
Ushort wd;
|
||||
Uchar TFar *tbl;
|
||||
Int keta;
|
||||
Int flg;
|
||||
static int
|
||||
word2char(u_short wd, u_char* tbl, int keta, int flg)
|
||||
{
|
||||
Int mask;
|
||||
Int num;
|
||||
Uchar TFar *src;
|
||||
int mask;
|
||||
int num;
|
||||
u_char* src;
|
||||
|
||||
for (mask = 0x1000 ; mask ; mask >>= 4) {
|
||||
|
||||
|
|
@ -90,16 +82,13 @@ Int flg;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Void words2num(wd, tbl, flgc)
|
||||
Ushort *wd;
|
||||
Uchar TFar *tbl;
|
||||
Int flgc;
|
||||
static void
|
||||
words2num(u_short* wd, u_char* tbl, int flgc)
|
||||
{
|
||||
Int i;
|
||||
Int keta;
|
||||
Int flg;
|
||||
Uchar *kp = kanjitmp;
|
||||
int i;
|
||||
int keta;
|
||||
int flg;
|
||||
u_char *kp = kanjitmp;
|
||||
|
||||
if (flgc) {
|
||||
keta = NumKetaLength - 1;
|
||||
|
|
@ -124,149 +113,122 @@ Int flgc;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void num_type00(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type00(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type01(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type01(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type02(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type02(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type03(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type03(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type04(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type04(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type05(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type05(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type06(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type06(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num3tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type07(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type07(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num3tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void kan_num(wd, tbl1, tbl2)
|
||||
Ushort *wd;
|
||||
Uchar TFar *tbl1;
|
||||
Uchar TFar *tbl2;
|
||||
static void
|
||||
kan_num(u_short* wd, u_char* tbl1, u_char* tbl2)
|
||||
{
|
||||
Int ii;
|
||||
Ushort tmp;
|
||||
Int mask;
|
||||
Int num;
|
||||
Int flg;
|
||||
Uchar TFar *kurai1;
|
||||
Uchar TFar *kurai2;
|
||||
Uchar TFar *src;
|
||||
Uchar *keep = kanjitmp;
|
||||
int ii;
|
||||
u_short tmp;
|
||||
int mask;
|
||||
int num;
|
||||
int flg;
|
||||
u_char* kurai1;
|
||||
u_char* kurai2;
|
||||
u_char* src;
|
||||
u_char* keep = kanjitmp;
|
||||
|
||||
|
||||
kurai2 = Num6tbl - 2;
|
||||
|
|
@ -325,45 +287,36 @@ Uchar TFar *tbl2;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void num_type08(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type08(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
kan_num(num, Num2tbl, Num4tbl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type09(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type09(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Ushort num[NumWordBuf];
|
||||
u_short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (Int)jrec -> numlen, num);
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
kan_num(num, Num3tbl, Num5tbl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type10(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type10(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Int i;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = jrec -> numlen ; i > 0 ; i--) {
|
||||
|
|
@ -379,14 +332,11 @@ JREC *jrec;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void num_type11(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type11(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Int i;
|
||||
Int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
i = j = jrec -> numlen;
|
||||
|
|
@ -412,14 +362,11 @@ JREC *jrec;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void num_type12(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type12(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Int i;
|
||||
Int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
for (i = jrec -> numlen ; i > 0 ; i--) {
|
||||
|
|
@ -433,26 +380,23 @@ JREC *jrec;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Void num_kurai(p, len, tbl)
|
||||
Uchar *p;
|
||||
Int len;
|
||||
Uchar TFar *tbl;
|
||||
static void
|
||||
num_kurai(u_char* p, int len, u_char* tbl)
|
||||
{
|
||||
Int i;
|
||||
Int j;
|
||||
Uchar tmp;
|
||||
int i;
|
||||
int j;
|
||||
u_char tmp;
|
||||
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
tmp = *p++;
|
||||
|
||||
*kanjitmp++ = tbl[j = ((tmp & 0x0f) - _Num0) * 2];
|
||||
*kanjitmp++ = tbl[j + 1];
|
||||
if (j = ((tmp >> 4) & 3)) {
|
||||
if ((j = ((tmp >> 4) & 3)) != 0) {
|
||||
*kanjitmp++ = Num4tbl[j = (3 - j) * 2];
|
||||
*kanjitmp++ = Num4tbl[j + 1];
|
||||
}
|
||||
if (j = ((tmp >> 6) & 3)) {
|
||||
if ((j = ((tmp >> 6) & 3)) != 0) {
|
||||
*kanjitmp++ = Num6tbl[j = (3 - j) * 2];
|
||||
*kanjitmp++ = Num6tbl[j + 1];
|
||||
}
|
||||
|
|
@ -460,34 +404,28 @@ Uchar TFar *tbl;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void num_type13(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type13(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Uchar num[NumKetaLength];
|
||||
Int len;
|
||||
u_char num[NumKetaLength];
|
||||
int len;
|
||||
|
||||
|
||||
len = setucnum(s1, (Int)jrec -> numlen, num);
|
||||
len = setucnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
num_kurai(num, len, Num1tbl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void num_type14(s1, s2, jrec)
|
||||
Uchar *s1;
|
||||
Uchar *s2;
|
||||
JREC *jrec;
|
||||
void
|
||||
num_type14(u_char* s1, u_char* s2, JREC* jrec)
|
||||
{
|
||||
Uchar num[NumKetaLength];
|
||||
Int len;
|
||||
u_char num[NumKetaLength];
|
||||
int len;
|
||||
|
||||
|
||||
len = setucnum(s1, (Int)jrec -> numlen, num);
|
||||
len = setucnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
num_kurai(num, len, Num2tbl);
|
||||
|
|
|
|||
|
|
@ -31,122 +31,100 @@
|
|||
* $SonyRCSfile: peepdic.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1995/07/21 05:22:51 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
Uchar *skiphblk();
|
||||
|
||||
static void add_yomi (void);
|
||||
static void cd2sjh_chr (Uchar ch, Uchar *dst);
|
||||
static Int next_douon (void);
|
||||
static Int next_hinsi (void);
|
||||
static Int next_kanji (void);
|
||||
static Int prev_douon (void);
|
||||
static Int prev_hinsi (void);
|
||||
static Int prev_kanji (void);
|
||||
static void set_buf (Uchar *buf);
|
||||
static void set_idxyomi (void);
|
||||
static void set_kanji (void);
|
||||
|
||||
|
||||
|
||||
Uchar *skipkstr(), *skiphblk(), *get_idxptr();
|
||||
Int getkanji(), codesize();
|
||||
|
||||
|
||||
|
||||
Static Int prev_kanji(), prev_hinsi(), prev_douon();
|
||||
Static Int next_kanji(), next_hinsi(), next_douon();
|
||||
Static Void set_kanji(), set_buf(), add_yomi(), cd2sjh_chr();
|
||||
Static Void set_idxyomi();
|
||||
|
||||
|
||||
|
||||
Int getusr(buf)
|
||||
Uchar *buf;
|
||||
Int
|
||||
getusr (Uchar *buf)
|
||||
{
|
||||
Int nlen;
|
||||
|
||||
|
||||
peepyomi[0] = peepknj[0] = peepgrm = 0;
|
||||
|
||||
|
||||
(*curdict->getdic)(curdict, peepidx = DicSegBase);
|
||||
get_askknj();
|
||||
|
||||
|
||||
peepdptr = segtop();
|
||||
|
||||
|
||||
if (segend(peepdptr)) return 0;
|
||||
|
||||
|
||||
add_yomi();
|
||||
|
||||
|
||||
nlen = getnlen(peepdptr);
|
||||
peephptr = peepdptr + DouonBlkSizeNumber + nlen;
|
||||
|
||||
|
||||
peepgrm = *peephptr;
|
||||
|
||||
|
||||
peepkptr = peephptr + 1;
|
||||
|
||||
|
||||
set_kanji();
|
||||
|
||||
|
||||
set_buf(buf);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int nextusr(buf)
|
||||
Uchar *buf;
|
||||
Int
|
||||
nextusr (Uchar *buf)
|
||||
{
|
||||
|
||||
(*curdict->getdic)(curdict, peepidx);
|
||||
get_askknj();
|
||||
|
||||
|
||||
if (next_kanji()) {
|
||||
|
||||
set_kanji();
|
||||
|
||||
|
||||
set_buf(buf);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int prevusr(buf)
|
||||
Uchar *buf;
|
||||
Int
|
||||
prevusr (Uchar *buf)
|
||||
{
|
||||
|
||||
(*curdict->getdic)(curdict, peepidx);
|
||||
get_askknj();
|
||||
|
||||
|
||||
if (prev_kanji()) {
|
||||
|
||||
set_kanji();
|
||||
|
||||
|
||||
set_buf(buf);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void set_kanji()
|
||||
static void
|
||||
set_kanji (void)
|
||||
{
|
||||
Int len;
|
||||
|
||||
|
|
@ -157,40 +135,36 @@ Static Void set_kanji()
|
|||
|
||||
|
||||
|
||||
Static Void set_buf(buf)
|
||||
Reg2 Uchar *buf;
|
||||
static void
|
||||
set_buf (Uchar *buf)
|
||||
{
|
||||
Reg1 Uchar *p;
|
||||
Reg2 Int i, csize;
|
||||
Uchar *p;
|
||||
Int i, csize;
|
||||
|
||||
|
||||
for (p = peepyomi ; *p ; ) *buf++ = *p++;
|
||||
*buf++ = 0;
|
||||
|
||||
|
||||
for (p = peepknj ; *p ; ) {
|
||||
csize = euc_codesize(*p);
|
||||
for (i = 0; i < csize; i++ ) *buf++ = *p++;
|
||||
}
|
||||
*buf++ = 0;
|
||||
|
||||
|
||||
*buf++ = peepgrm;
|
||||
*buf++ = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int prev_kanji()
|
||||
static Int
|
||||
prev_kanji (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
Uchar *p2;
|
||||
|
||||
|
||||
p1 = peephptr + 1;
|
||||
if (peepkptr <= p1) return prev_hinsi();
|
||||
|
||||
|
||||
p2 = peepkptr;
|
||||
while (p1 < p2) {
|
||||
peepkptr = p1;
|
||||
|
|
@ -202,35 +176,29 @@ Static Int prev_kanji()
|
|||
|
||||
|
||||
|
||||
Static Int prev_hinsi()
|
||||
static Int
|
||||
prev_hinsi (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
Uchar *p2;
|
||||
Int nlen;
|
||||
|
||||
|
||||
nlen = getnlen(peepdptr);
|
||||
p1 = peepdptr + DouonBlkSizeNumber + nlen;
|
||||
|
||||
if (peephptr <= p1) return prev_douon();
|
||||
|
||||
|
||||
p2 = peephptr;
|
||||
while (p1 < p2) {
|
||||
peephptr = p1;
|
||||
p1 = skiphblk(p1);
|
||||
}
|
||||
|
||||
|
||||
peepgrm = *peephptr;
|
||||
|
||||
|
||||
p1 = peephptr + 1;
|
||||
while (*p1 != HinsiBlkTerm) {
|
||||
|
||||
peepkptr = p1;
|
||||
|
||||
|
||||
p1 = skipkstr(p1);
|
||||
}
|
||||
|
||||
|
|
@ -239,184 +207,133 @@ Static Int prev_hinsi()
|
|||
|
||||
|
||||
|
||||
Static Int prev_douon()
|
||||
static Int
|
||||
prev_douon (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
Uchar *p2;
|
||||
Int nlen;
|
||||
|
||||
|
||||
if (peepdptr <= segtop()) {
|
||||
|
||||
if (peepidx <= DicSegBase) return 0;
|
||||
|
||||
|
||||
(*curdict->getdic)(curdict, --peepidx);
|
||||
get_askknj();
|
||||
|
||||
|
||||
set_idxyomi();
|
||||
|
||||
|
||||
p1 = segtop();
|
||||
do {
|
||||
|
||||
peepdptr = p1;
|
||||
|
||||
|
||||
add_yomi();
|
||||
|
||||
|
||||
p1 = getntag(p1);
|
||||
} while (!segend(p1));
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
set_idxyomi();
|
||||
|
||||
|
||||
p1 = segtop();
|
||||
p2 = peepdptr;
|
||||
do {
|
||||
|
||||
peepdptr = p1;
|
||||
|
||||
|
||||
add_yomi();
|
||||
|
||||
|
||||
p1 = getntag(p1);
|
||||
} while (p1 < p2);
|
||||
}
|
||||
|
||||
|
||||
nlen = getnlen(peepdptr);
|
||||
p1 = peepdptr + DouonBlkSizeNumber + nlen;
|
||||
|
||||
|
||||
p2 = getntag(peepdptr);
|
||||
do {
|
||||
peephptr = p1;
|
||||
p1 = skiphblk(p1);
|
||||
} while (p1 < p2);
|
||||
|
||||
|
||||
peepgrm = *peephptr;
|
||||
|
||||
|
||||
p1 = peephptr + 1;
|
||||
do {
|
||||
|
||||
peepkptr = p1;
|
||||
|
||||
|
||||
p1 = skipkstr(p1);
|
||||
} while (*p1 != HinsiBlkTerm);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int next_kanji()
|
||||
static Int
|
||||
next_kanji (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
|
||||
|
||||
p1 = skipkstr(peepkptr);
|
||||
|
||||
|
||||
if (*p1 == HinsiBlkTerm) return next_hinsi();
|
||||
|
||||
|
||||
peepkptr = p1;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int next_hinsi()
|
||||
static Int
|
||||
next_hinsi (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
|
||||
|
||||
p1 = skiphblk(peephptr);
|
||||
|
||||
|
||||
if (p1 >= getntag(peepdptr)) return next_douon();
|
||||
|
||||
|
||||
peephptr = p1;
|
||||
|
||||
|
||||
peepgrm = *p1;
|
||||
|
||||
|
||||
peepkptr = p1 + 1;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Int next_douon()
|
||||
static Int
|
||||
next_douon (void)
|
||||
{
|
||||
Uchar *p1;
|
||||
Int nlen;
|
||||
|
||||
|
||||
p1 = getntag(peepdptr);
|
||||
|
||||
|
||||
if (segend(p1)) {
|
||||
|
||||
if (peepidx + 1 < curdict->segunit) {
|
||||
(*curdict->getdic)(curdict, ++peepidx);
|
||||
get_askknj();
|
||||
peepdptr = segtop();
|
||||
|
||||
|
||||
set_idxyomi();
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
else {
|
||||
peepdptr = p1;
|
||||
}
|
||||
|
||||
|
||||
add_yomi();
|
||||
|
||||
|
||||
nlen = getnlen(peepdptr);
|
||||
peephptr = peepdptr + DouonBlkSizeNumber + nlen;
|
||||
|
||||
|
||||
|
||||
peepgrm = *peephptr;
|
||||
|
||||
|
||||
peepkptr = peephptr + 1;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void set_idxyomi()
|
||||
static void
|
||||
set_idxyomi (void)
|
||||
{
|
||||
Uchar *p1, *p2;
|
||||
|
||||
if (p2 = get_idxptr(peepidx)) {
|
||||
if ((p2 = get_idxptr(peepidx)) != NULL) {
|
||||
p1 = peepyomi;
|
||||
while (*p2) {
|
||||
cd2sjh_chr(*p2++, p1);
|
||||
|
|
@ -428,35 +345,28 @@ Static Void set_idxyomi()
|
|||
|
||||
|
||||
|
||||
Static Void add_yomi()
|
||||
static void
|
||||
add_yomi (void)
|
||||
{
|
||||
Int nlen;
|
||||
Uchar *p1, *p2;
|
||||
|
||||
|
||||
nlen = getnlen(peepdptr);
|
||||
|
||||
|
||||
p1 = peepyomi + getplen(peepdptr) * 2;
|
||||
|
||||
|
||||
p2 = peepdptr + DouonBlkSizeNumber;
|
||||
|
||||
|
||||
while (nlen--) {
|
||||
cd2sjh_chr(*p2++, p1);
|
||||
p1 += 2;
|
||||
}
|
||||
|
||||
|
||||
*p1 = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Void cd2sjh_chr(ch, dst)
|
||||
Uchar ch;
|
||||
Reg1 Uchar *dst;
|
||||
static void
|
||||
cd2sjh_chr (Uchar ch, Uchar *dst)
|
||||
{
|
||||
if (ch == _TYOUON) {
|
||||
*dst++ = 0xa1;
|
||||
|
|
@ -499,3 +409,4 @@ Reg1 Uchar *dst;
|
|||
else {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,19 +31,19 @@
|
|||
* $SonyRCSfile: ph2knj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:09 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
Int sj2cd_chr(), sstrlen();
|
||||
Void mkjiritu(), mkbunsetu(), wakachi(), mk2claus();
|
||||
Int sj2cd_chr();
|
||||
void mk2claus();
|
||||
Void freework();
|
||||
Void selclrec();
|
||||
CLREC *free_clst();
|
||||
|
|
@ -51,23 +51,19 @@ JREC *free_jlst();
|
|||
|
||||
|
||||
|
||||
Int ph2knj(zyomi, kanji, knjlen)
|
||||
Uchar *zyomi;
|
||||
Uchar *kanji;
|
||||
Int knjlen;
|
||||
Int ph2knj
|
||||
(Uchar *zyomi, Uchar *kanji, Int knjlen)
|
||||
{
|
||||
Uchar *ptr;
|
||||
Uchar *dst;
|
||||
Int i;
|
||||
|
||||
|
||||
for (ptr = zyomi, dst = hyomi, i = 0 ; *ptr ; ) {
|
||||
if (i++ >= MaxPhInputLen) { *kanji = 0; return 0; }
|
||||
ptr += sj2cd_chr(ptr, dst++);
|
||||
}
|
||||
*dst = 0;
|
||||
|
||||
|
||||
freework();
|
||||
prevclgrm = 0;
|
||||
prevclrow = 0;
|
||||
|
|
@ -75,47 +71,32 @@ Int knjlen;
|
|||
khcount = 0;
|
||||
nextcllen = 0;
|
||||
|
||||
|
||||
inputyomi = zyomi;
|
||||
cnvstart = ystart = hyomi;
|
||||
cnvlen = sstrlen(hyomi);
|
||||
cnvlen = strlen(hyomi);
|
||||
|
||||
|
||||
kanjipos = kanji;
|
||||
kanjilen = knjlen;
|
||||
|
||||
|
||||
while (cnvlen && kanjilen) {
|
||||
|
||||
if (!clt1st) {
|
||||
|
||||
mkjiritu(DO_CLSTUDY | DO_IKKATU);
|
||||
|
||||
|
||||
mkbunsetu();
|
||||
|
||||
|
||||
if (!maxclptr) wakachi();
|
||||
|
||||
jrt1st = maxjptr;
|
||||
clt1st = maxclptr;
|
||||
}
|
||||
|
||||
|
||||
mk2claus();
|
||||
|
||||
|
||||
selclrec();
|
||||
|
||||
|
||||
prevclgrm = selcl -> jnode -> hinsi;
|
||||
prevclrow = selcl -> right;
|
||||
|
||||
|
||||
clt1st = free_clst(clt1st, (Int)selcl -> cllen);
|
||||
jrt1st = free_jlst(jrt1st);
|
||||
|
||||
|
||||
cnvstart += selcl -> cllen;
|
||||
cnvlen -= selcl -> cllen;
|
||||
|
||||
|
|
@ -135,4 +116,3 @@ Int knjlen;
|
|||
return(inputyomi - zyomi);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,19 +31,18 @@
|
|||
* $SonyRCSfile: ph_khtbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:09 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Uchar *skipkstr();
|
||||
STDYIN *srchstdy();
|
||||
Void ph_setkouho();
|
||||
Int seldict();
|
||||
|
||||
Static Void ph_setsty(clrec)
|
||||
CLREC *clrec;
|
||||
|
||||
static void
|
||||
ph_setsty (CLREC *clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
TypeDicOfs offset;
|
||||
|
|
@ -60,9 +59,7 @@ CLREC *clrec;
|
|||
ptr = dicbuf + jrec->jofsst + 1;
|
||||
|
||||
for ( ; *ptr != HinsiBlkTerm ; ptr = skipkstr(ptr)) {
|
||||
|
||||
offset = ptr - dicbuf;
|
||||
|
||||
sptr = srchstdy(jrec -> jseg, offset, jrec -> dicid);
|
||||
|
||||
if (!khcount){
|
||||
|
|
@ -75,7 +72,6 @@ CLREC *clrec;
|
|||
if (sptr -> styno < kouhotbl[0].styno) {
|
||||
ph_setkouho(clrec, offset, sptr);
|
||||
}
|
||||
|
||||
else if (sptr -> styno == kouhotbl -> styno) {
|
||||
if (!(kouhotbl[0].ka_fg &&
|
||||
sptr -> ka_kj == kouhotbl[0].ka_kj)) {
|
||||
|
|
@ -87,8 +83,8 @@ CLREC *clrec;
|
|||
|
||||
|
||||
|
||||
Int ph_khtbl(clrec)
|
||||
CLREC *clrec;
|
||||
Int
|
||||
ph_khtbl (CLREC *clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
Int flg = FALSE;
|
||||
|
|
|
|||
|
|
@ -31,19 +31,19 @@
|
|||
* $SonyRCSfile: setconj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:16 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_right.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Static Int cnjstrcmp(yptr, cnjp, saml)
|
||||
Uchar *yptr;
|
||||
Uchar TFar *cnjp;
|
||||
Int *saml;
|
||||
static Int
|
||||
cnjstrcmp (Uchar *yptr, Uchar *cnjp, Int *saml)
|
||||
{
|
||||
Int asklen;
|
||||
Int nkrlen;
|
||||
|
|
@ -78,9 +78,8 @@ Int *saml;
|
|||
return MATCH;
|
||||
}
|
||||
|
||||
Static TypeCnct cnvrow(rec, row)
|
||||
JREC *rec;
|
||||
TypeCnct row;
|
||||
static TypeCnct
|
||||
cnvrow (JREC *rec, TypeCnct row)
|
||||
{
|
||||
TypeGram hinsi;
|
||||
Int stt;
|
||||
|
|
@ -112,10 +111,8 @@ TypeCnct row;
|
|||
return row;
|
||||
}
|
||||
|
||||
Int setconj(hinsi, jrec, crec)
|
||||
TypeGram hinsi;
|
||||
JREC *jrec;
|
||||
CREC *crec;
|
||||
Int
|
||||
setconj (TypeGram hinsi, JREC *jrec, CREC *crec)
|
||||
{
|
||||
Uchar *yptr;
|
||||
Int cmp;
|
||||
|
|
@ -123,9 +120,9 @@ CREC *crec;
|
|||
Int saml;
|
||||
Int ofslen;
|
||||
int count = 0;
|
||||
Uchar TFar *cnj;
|
||||
Uchar *cnj;
|
||||
|
||||
if (cnj = Conjadr(hinsi)) {
|
||||
if ((cnj = Conjadr(hinsi)) != NULL) {
|
||||
saml = ofslen = 0;
|
||||
|
||||
yptr = cnvstart + jrec -> jlen;
|
||||
|
|
@ -148,7 +145,7 @@ CREC *crec;
|
|||
|
||||
if (isdpnd(*(yptr + saml))) continue;
|
||||
|
||||
if (right = cnvrow(jrec, (TypeCnct)CnjRight(cnj))) {
|
||||
if ((right = cnvrow(jrec, (TypeCnct)CnjRight(cnj))) != '\0') {
|
||||
crec -> len = (Uchar)(ofslen + saml);
|
||||
crec -> right = right;
|
||||
count++;
|
||||
|
|
|
|||
|
|
@ -31,34 +31,28 @@
|
|||
* $SonyRCSfile: setjrec.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:17 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
JREC *argjrec();
|
||||
Int codesize();
|
||||
|
||||
|
||||
|
||||
Int setj_atrb(p)
|
||||
Uchar *p;
|
||||
int
|
||||
setj_atrb(u_char* p)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int setj_ofs(p)
|
||||
Uchar *p;
|
||||
int
|
||||
setj_ofs(u_char* p)
|
||||
{
|
||||
Int contf = TRUE;
|
||||
int contf = TRUE;
|
||||
|
||||
|
||||
p = dicbuf + ((*p & KanjiCodeMask) << 8) + *(p + 1);
|
||||
|
|
@ -97,11 +91,10 @@ Uchar *p;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Int setj_knj(p)
|
||||
Uchar *p;
|
||||
int
|
||||
setj_knj(u_char* p)
|
||||
{
|
||||
Int contf = TRUE;
|
||||
int contf = TRUE;
|
||||
|
||||
|
||||
p = askknj[*p & KnjAssyukuMask];
|
||||
|
|
@ -140,31 +133,29 @@ Uchar *p;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Int setj_norm1(p)
|
||||
Uchar *p;
|
||||
int
|
||||
setj_norm1(u_char* p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int setj_norm2(p)
|
||||
Uchar *p;
|
||||
int
|
||||
setj_norm2(u_char* p)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Int setj_norm3(p)
|
||||
Uchar *p;
|
||||
|
||||
int
|
||||
setj_norm3(u_char* p)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Static Uchar chkhead(gram)
|
||||
TypeGram gram;
|
||||
static int
|
||||
chkhead(TypeGram gram)
|
||||
{
|
||||
|
||||
if (!headcode) return TRUE;
|
||||
|
|
@ -187,19 +178,17 @@ TypeGram gram;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void setjrec(tagp, mode)
|
||||
Uchar *tagp;
|
||||
Int mode;
|
||||
void
|
||||
setjrec(u_char* tagp, int mode)
|
||||
{
|
||||
TypeGram gram;
|
||||
Uchar *ptr;
|
||||
Uchar *endp;
|
||||
Uchar *tmp;
|
||||
u_char *ptr;
|
||||
u_char *endp;
|
||||
u_char *tmp;
|
||||
JREC *rec;
|
||||
Int plen;
|
||||
Int nlen;
|
||||
Int len;
|
||||
int plen;
|
||||
int nlen;
|
||||
int len;
|
||||
|
||||
|
||||
plen = getplen(tagp);
|
||||
|
|
@ -270,16 +259,13 @@ Int mode;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void setnumrec(tagp, rec, gram)
|
||||
Uchar *tagp;
|
||||
JREC *rec;
|
||||
TypeGram gram;
|
||||
void
|
||||
setnumrec(u_char* tagp, JREC* rec, TypeGram gram)
|
||||
{
|
||||
Uchar *ptr;
|
||||
Uchar *endp;
|
||||
Uchar *tmp;
|
||||
Int plen, nlen, len;
|
||||
u_char *ptr;
|
||||
u_char *endp;
|
||||
u_char *tmp;
|
||||
int plen, nlen, len;
|
||||
JREC *jrec;
|
||||
|
||||
|
||||
|
|
@ -331,7 +317,7 @@ TypeGram gram;
|
|||
if (gram != *ptr) continue;
|
||||
|
||||
|
||||
if (!(jrec = argjrec((Int)(rec -> jlen + len), rec))) continue;
|
||||
if (!(jrec = argjrec((int)(rec -> jlen + len), rec))) continue;
|
||||
|
||||
|
||||
jrec -> jseg = prevseg;
|
||||
|
|
@ -342,9 +328,8 @@ TypeGram gram;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void setcrec(tagp)
|
||||
Uchar *tagp;
|
||||
void
|
||||
setcrec(u_char* tagp)
|
||||
{
|
||||
JREC *rec;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,35 +31,27 @@
|
|||
* $SonyRCSfile: setkouho.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:20 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
static int hiraknj(u_char *p);
|
||||
|
||||
|
||||
|
||||
Int sel_sjmode(), codesize();
|
||||
|
||||
|
||||
|
||||
Static Int hiraknj();
|
||||
|
||||
|
||||
|
||||
Void setkouho(clrec, offs, mode)
|
||||
CLREC *clrec;
|
||||
TypeDicOfs offs;
|
||||
Int mode;
|
||||
void
|
||||
setkouho(CLREC* clrec, TypeDicOfs offs, int mode)
|
||||
{
|
||||
JREC *jrec;
|
||||
KHREC *kptr;
|
||||
Uchar TFar *fptr;
|
||||
Int flg;
|
||||
Int i;
|
||||
u_char TFar *fptr;
|
||||
int flg;
|
||||
int i;
|
||||
|
||||
|
||||
if (khcount >= MaxKouhoNumber) return;
|
||||
|
|
@ -76,7 +68,7 @@ Int mode;
|
|||
kptr -> offs = offs;
|
||||
kptr -> rank = 0;
|
||||
kptr -> styno = 0;
|
||||
kptr -> mode = (Uchar)mode;
|
||||
kptr -> mode = (u_char)mode;
|
||||
|
||||
|
||||
if (jrec -> flags & JFLAG_KA) {
|
||||
|
|
@ -130,7 +122,7 @@ Int mode;
|
|||
kptr -> offs = offs;
|
||||
kptr -> rank = 0;
|
||||
kptr -> styno = 0;
|
||||
kptr -> mode = (Uchar)mode;
|
||||
kptr -> mode = (u_char)mode;
|
||||
|
||||
kptr -> sttfg = 1;
|
||||
kptr -> sttkj = 1;
|
||||
|
|
@ -144,14 +136,11 @@ Int mode;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Void ph_setkouho(clrec, offs, sptr)
|
||||
CLREC *clrec;
|
||||
TypeDicOfs offs;
|
||||
STDYIN *sptr;
|
||||
void
|
||||
ph_setkouho(CLREC* clrec, TypeDicOfs offs, STDYIN* sptr)
|
||||
{
|
||||
JREC *jrec;
|
||||
Uchar TFar *p;
|
||||
u_char TFar *p;
|
||||
|
||||
|
||||
if (sptr) {
|
||||
|
|
@ -174,7 +163,7 @@ STDYIN *sptr;
|
|||
kouhotbl[0].mode = sel_sjmode(jrec = clrec -> jnode);
|
||||
|
||||
|
||||
kouhotbl[0].sttfg = (Uchar)
|
||||
kouhotbl[0].sttfg = (u_char)
|
||||
((p = Settou_ptr(jrec->sttofs)) ? (SttHiraKnj(p)?1:0) : 0);
|
||||
|
||||
|
||||
|
|
@ -197,13 +186,12 @@ STDYIN *sptr;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Static Int hiraknj(p)
|
||||
Reg1 Uchar *p;
|
||||
static int
|
||||
hiraknj(u_char *p)
|
||||
{
|
||||
char flg = TRUE;
|
||||
Int i;
|
||||
Int result;
|
||||
int i;
|
||||
int result;
|
||||
|
||||
do {
|
||||
if (p[codesize(*p)] == KanjiStrEnd) flg = FALSE;
|
||||
|
|
@ -239,72 +227,58 @@ Reg1 Uchar *p;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_atrb(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_atrb(u_char* p, int* len)
|
||||
{
|
||||
*len = 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_ofs(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_ofs(u_char* p, int* len)
|
||||
{
|
||||
*len = 2;
|
||||
return hiraknj(dicbuf + ((*p & KanjiCodeMask) << 8) + *(p + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_knj(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_knj(u_char* p, int* len)
|
||||
{
|
||||
*len = 1;
|
||||
return hiraknj(askknj[*p & KnjAssyukuMask]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_hask(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_hask(u_char* p, int* len)
|
||||
{
|
||||
*len = 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_kask(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_kask(u_char* p, int* len)
|
||||
{
|
||||
*len = 1;
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_norm(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_norm(u_char* p, int* len)
|
||||
{
|
||||
*len = codesize(*p);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Int hiraknj_hira(p, len)
|
||||
Uchar *p;
|
||||
Int *len;
|
||||
int
|
||||
hiraknj_hira(u_char* p, int* len)
|
||||
{
|
||||
Uchar ch;
|
||||
u_char ch;
|
||||
|
||||
*len = codesize(*p);
|
||||
ch = *(p + 1);
|
||||
|
|
|
|||
|
|
@ -31,19 +31,18 @@
|
|||
* $SonyRCSfile: setubi.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:22 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
JREC *argjrec();
|
||||
Void memcpy();
|
||||
Int sstrncmp();
|
||||
|
||||
Uchar TFar *getstb(hinsi)
|
||||
TypeGram hinsi;
|
||||
Uchar*
|
||||
getstb(TypeGram hinsi)
|
||||
{
|
||||
if (hinsi < MEISI_1 || hinsi > TIMEI) return NULL;
|
||||
|
||||
|
|
@ -51,13 +50,12 @@ TypeGram hinsi;
|
|||
}
|
||||
|
||||
|
||||
Void setubi(rec, stbtbl)
|
||||
JREC *rec;
|
||||
Uchar TFar *stbtbl;
|
||||
void
|
||||
setubi(JREC *rec, Uchar *stbtbl)
|
||||
{
|
||||
Uchar TFar *stb;
|
||||
Uchar *stb;
|
||||
Uchar *yptr;
|
||||
Uchar TFar *sptr;
|
||||
Uchar *sptr;
|
||||
Int slen;
|
||||
JREC *new;
|
||||
Int cmp;
|
||||
|
|
@ -71,7 +69,7 @@ Uchar TFar *stbtbl;
|
|||
slen = StbYomiLen(stb);
|
||||
sptr = StbYomiTop(stb);
|
||||
|
||||
cmp = sstrncmp(yptr, sptr, slen);
|
||||
cmp = strncmp(yptr, sptr, slen);
|
||||
|
||||
if (cmp == OVER || cmp == PARTLY) break;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,35 +31,31 @@
|
|||
* $SonyRCSfile: skipkstr.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:25 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_const.h"
|
||||
#include "sj_dict.h"
|
||||
#include "sj_table.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Int codesize();
|
||||
|
||||
Uchar *skipkstr(ptr)
|
||||
Reg1 Uchar *ptr;
|
||||
u_char*
|
||||
skipkstr(u_char* ptr)
|
||||
{
|
||||
Reg2 Int contf = TRUE, csize;
|
||||
int contf = TRUE, csize;
|
||||
|
||||
|
||||
do {
|
||||
csize = codesize(*ptr);
|
||||
|
||||
if (ptr[csize] == KanjiStrEnd) contf = FALSE;
|
||||
|
||||
ptr += csize;
|
||||
} while (contf);
|
||||
|
||||
ptr++;
|
||||
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,24 +31,22 @@
|
|||
* $SonyRCSfile: srchdict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:26 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Uchar *get_idxptr();
|
||||
Int yomicmp(), sstrlen();
|
||||
Void get_askknj();
|
||||
TypeDicSeg srchidx();
|
||||
|
||||
Int yomicmp(ptr1, ptr2, saml)
|
||||
Reg1 Uchar *ptr1;
|
||||
Reg2 Uchar *ptr2;
|
||||
Uchar *saml;
|
||||
int
|
||||
yomicmp(u_char* ptr1, u_char* ptr2, u_char* saml)
|
||||
{
|
||||
Int i, j;
|
||||
Int same;
|
||||
int i, j;
|
||||
int same;
|
||||
|
||||
same = *saml;
|
||||
|
||||
|
|
@ -61,7 +59,7 @@ Uchar *saml;
|
|||
for (i = same ; i ; i--)
|
||||
if (*ptr1++ != *ptr2++) return OVER;
|
||||
|
||||
j = sstrlen(ptr2);
|
||||
j = strlen(ptr2);
|
||||
}
|
||||
|
||||
else if (i > same)
|
||||
|
|
@ -89,12 +87,12 @@ Uchar *saml;
|
|||
}
|
||||
|
||||
|
||||
Uchar *srchdict(tagp)
|
||||
Uchar *tagp;
|
||||
u_char*
|
||||
srchdict(u_char* tagp)
|
||||
{
|
||||
TypeDicSeg segno;
|
||||
Int cmp;
|
||||
Int maxlen;
|
||||
int cmp;
|
||||
int maxlen;
|
||||
|
||||
maxlen = (cnvlen > MaxWdYomiLen) ? MaxWdYomiLen : cnvlen;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,23 +31,25 @@
|
|||
* $SonyRCSfile: srchidx.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:29 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Uchar *get_idxptr();
|
||||
Int sstrlen(), istrcmp();
|
||||
Int istrcmp();
|
||||
|
||||
TypeDicSeg srchidx(low, len)
|
||||
TypeDicSeg low;
|
||||
Int len;
|
||||
TypeDicSeg
|
||||
srchidx(TypeDicSeg low, int len)
|
||||
{
|
||||
TypeDicSeg high;
|
||||
TypeDicSeg mid;
|
||||
Int cmp;
|
||||
Uchar *target;
|
||||
int cmp;
|
||||
u_char *target;
|
||||
|
||||
if ((high = curdict->segunit - 1) < 1) return 0;
|
||||
|
||||
|
|
@ -59,7 +61,7 @@ Int len;
|
|||
|
||||
target = get_idxptr(mid);
|
||||
|
||||
cmp = istrcmp(cnvstart, target, len, sstrlen(target));
|
||||
cmp = istrcmp(cnvstart, target, len, strlen(target));
|
||||
|
||||
if (cmp == OVER) {
|
||||
high = mid - 1;
|
||||
|
|
|
|||
|
|
@ -31,26 +31,27 @@
|
|||
* $SonyRCSfile: srchnum.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:30 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_suuji.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
JREC *argjrec();
|
||||
Uchar *srchdict();
|
||||
Void setnumrec(), memcpy(), memset();
|
||||
|
||||
Static Void srch_kurai1(), srch_kurai2();
|
||||
static void srch_kurai1(u_char* ptr, u_char* cnct);
|
||||
static void srch_kurai2(u_char* ptr, u_char* cnct);
|
||||
|
||||
Static Void srch_josuu_sub(jrec, gram)
|
||||
JREC *jrec;
|
||||
TypeGram gram;
|
||||
static void
|
||||
srch_josuu_sub(JREC *jrec, TypeGram gram)
|
||||
{
|
||||
Uchar *tagp;
|
||||
u_char *tagp;
|
||||
DICTL *dp;
|
||||
|
||||
for (dp = dictlist ; dp ; dp = dp -> next) {
|
||||
|
|
@ -58,16 +59,17 @@ TypeGram gram;
|
|||
dicinl = 1;
|
||||
dicsaml = 0;
|
||||
prevseg = -1;
|
||||
while (tagp = srchdict(tagp)) setnumrec(tagp, jrec, gram);
|
||||
while ((tagp = srchdict(tagp)) != NULL)
|
||||
setnumrec(tagp, jrec, gram);
|
||||
}
|
||||
}
|
||||
|
||||
Static Void srch_josuu(jrec)
|
||||
JREC *jrec;
|
||||
static void
|
||||
srch_josuu(JREC *jrec)
|
||||
{
|
||||
Uchar *kp;
|
||||
Int klen;
|
||||
Int len;
|
||||
u_char *kp;
|
||||
int klen;
|
||||
int len;
|
||||
|
||||
if (headcode && headcode != SETTOU_DAI) return;
|
||||
|
||||
|
|
@ -85,22 +87,20 @@ JREC *jrec;
|
|||
cnvlen = klen;
|
||||
}
|
||||
|
||||
Static Void setnrec_sub(p, flag, stb)
|
||||
Uchar *p;
|
||||
Ushort flag;
|
||||
Int stb;
|
||||
static void
|
||||
setnrec_sub(u_char* p, u_short flag, int stb)
|
||||
{
|
||||
JREC *rec;
|
||||
Int len1;
|
||||
Int len2;
|
||||
int len1;
|
||||
int len2;
|
||||
|
||||
len1 = len2 = p - suuji_yptr;
|
||||
if (headcode) len1 += headlen;
|
||||
if (stb) len2--;
|
||||
|
||||
if ((Int)suuji_len == len2) {
|
||||
if ((int)suuji_len == len2) {
|
||||
if (suuji_wkeep) {
|
||||
memcpy((Uchar *)suuji_wbuf, (Uchar *)suuji_wkeep,
|
||||
memcpy((u_char*)suuji_wbuf, (u_char*)suuji_wkeep,
|
||||
sizeof(suuji_wbuf[0]) * NumWordBuf);
|
||||
}
|
||||
if (suuji_ukeep) {
|
||||
|
|
@ -110,21 +110,20 @@ Int stb;
|
|||
return;
|
||||
}
|
||||
|
||||
if (rec = argjrec(len1, (JREC *)NULL)) {
|
||||
if ((rec = argjrec(len1, (JREC *)NULL)) != NULL) {
|
||||
rec -> class = suuji_class;
|
||||
rec -> hinsi = SUUSI;
|
||||
rec -> sttofs = headcode;
|
||||
rec -> stbofs = (Uchar)stb;
|
||||
rec -> stbofs = (u_char)stb;
|
||||
rec -> flags = flag;
|
||||
rec -> numlen = (Uchar)len2;
|
||||
rec -> numlen = (u_char)len2;
|
||||
|
||||
if (!stb) srch_josuu(rec);
|
||||
}
|
||||
}
|
||||
|
||||
Static Void setnrec(p, flag)
|
||||
Uchar *p;
|
||||
Ushort flag;
|
||||
static void
|
||||
setnrec(u_char* p, u_short flag)
|
||||
{
|
||||
setnrec_sub(p, flag, 0);
|
||||
|
||||
|
|
@ -133,14 +132,11 @@ Ushort flag;
|
|||
}
|
||||
}
|
||||
|
||||
Static Uchar TFar *srchtbl(ch, tbl, rec, n)
|
||||
Uchar ch;
|
||||
Uchar TFar *tbl;
|
||||
Int rec;
|
||||
Int n;
|
||||
static u_char*
|
||||
srchtbl(u_char ch, u_char* tbl, int rec, int n)
|
||||
{
|
||||
Int high, low, mid;
|
||||
Uchar TFar *p;
|
||||
int high, low, mid;
|
||||
u_char *p;
|
||||
|
||||
if (!ch) return NULL;
|
||||
|
||||
|
|
@ -168,19 +164,16 @@ Int n;
|
|||
return p;
|
||||
}
|
||||
|
||||
Static Int isconnect(cnct, num)
|
||||
Uchar TFar *cnct;
|
||||
Int num;
|
||||
static int
|
||||
isconnect(u_char* cnct, int num)
|
||||
{
|
||||
return (cnct[num / 8] & (0x80 >> (num % 8)));
|
||||
}
|
||||
|
||||
Static Int string_cmp(s, l, d)
|
||||
Reg3 Uchar TFar *s;
|
||||
Reg1 Int l;
|
||||
Reg2 Uchar *d;
|
||||
static int
|
||||
string_cmp(u_char* s, int l, u_char* d)
|
||||
{
|
||||
Uchar TFar *p;
|
||||
u_char *p;
|
||||
|
||||
p = s;
|
||||
|
||||
|
|
@ -193,27 +186,27 @@ Reg2 Uchar *d;
|
|||
return (s - p);
|
||||
}
|
||||
|
||||
Static Int check_num(ptr)
|
||||
Uchar *ptr;
|
||||
static int
|
||||
check_num(u_char* ptr)
|
||||
{
|
||||
Int i;
|
||||
Int j;
|
||||
Int k;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int tmp;
|
||||
Int hketa;
|
||||
Int lketa;
|
||||
Int flg = FALSE;
|
||||
Int cnt;
|
||||
Ushort flag;
|
||||
int hketa;
|
||||
int lketa;
|
||||
int flg = FALSE;
|
||||
int cnt;
|
||||
u_short flag;
|
||||
|
||||
memset((Uchar *)suuji_wbuf, 0, sizeof(Ushort) * NumWordBuf);
|
||||
memset((u_char*)suuji_wbuf, 0, sizeof(u_short) * NumWordBuf);
|
||||
flag = 0;
|
||||
|
||||
hketa = lketa = cnt = 0;
|
||||
for (i = suuji_keta ; --i >= 0 ;) {
|
||||
if (hketa >= 4) return FALSE;
|
||||
tmp = suuji_ubuf[i];
|
||||
if (j = ((tmp >> 6) & 3)) {
|
||||
if ((j = ((tmp >> 6) & 3)) != 0) {
|
||||
if (j < hketa) return FALSE;
|
||||
if (j > hketa) {
|
||||
flag |= JFLAG_N01;
|
||||
|
|
@ -282,16 +275,16 @@ Uchar *ptr;
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
Static Void srch_number1(ptr)
|
||||
Uchar *ptr;
|
||||
static void
|
||||
srch_number1(u_char* ptr)
|
||||
{
|
||||
Uchar ch;
|
||||
Uchar mode;
|
||||
Uchar TFar *p;
|
||||
Int l;
|
||||
u_char ch;
|
||||
u_char mode;
|
||||
u_char TFar *p;
|
||||
int l;
|
||||
TypeClass cls;
|
||||
Int len;
|
||||
Uchar *tptr;
|
||||
int len;
|
||||
u_char *tptr;
|
||||
|
||||
if (suuji_keta >= NumKetaLength) return;
|
||||
|
||||
|
|
@ -315,7 +308,7 @@ Uchar *ptr;
|
|||
|
||||
check_num(tptr);
|
||||
srch_number1(tptr);
|
||||
srch_kurai2(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai2(tptr, (u_char*)NULL);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -324,8 +317,8 @@ Uchar *ptr;
|
|||
|
||||
check_num(tptr);
|
||||
srch_number1(tptr);
|
||||
srch_kurai1(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai2(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai1(tptr, (u_char*)NULL);
|
||||
srch_kurai2(tptr, (u_char*)NULL);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -349,7 +342,7 @@ Uchar *ptr;
|
|||
suuji_class = C_N_ARABIA;
|
||||
check_num(tptr);
|
||||
srch_number1(tptr);
|
||||
srch_kurai2(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai2(tptr, (u_char*)NULL);
|
||||
|
||||
suuji_class = C_N_KAZU;
|
||||
}
|
||||
|
|
@ -382,18 +375,17 @@ Uchar *ptr;
|
|||
}
|
||||
}
|
||||
|
||||
Static Void srch_kurai1(ptr, cnct)
|
||||
Uchar *ptr;
|
||||
Uchar TFar *cnct;
|
||||
static void
|
||||
srch_kurai1(u_char* ptr, u_char* cnct)
|
||||
{
|
||||
Uchar ch;
|
||||
Uchar TFar *p;
|
||||
Int l;
|
||||
Int keta;
|
||||
Int mode;
|
||||
u_char ch;
|
||||
u_char *p;
|
||||
int l;
|
||||
int keta;
|
||||
int mode;
|
||||
TypeClass cls;
|
||||
Int len;
|
||||
Uchar *tptr;
|
||||
int len;
|
||||
u_char *tptr;
|
||||
|
||||
if (!(p = srchtbl((ch = *ptr), Kurai1_tbl, Kr1TblRecLen, Kr1TblRecNum)))
|
||||
return;
|
||||
|
|
@ -421,7 +413,7 @@ Uchar TFar *cnct;
|
|||
}
|
||||
|
||||
if (cnct) {
|
||||
if (!isconnect(cnct, (Int)Kr1TblCnct(mode))) continue;
|
||||
if (!isconnect(cnct, (int)Kr1TblCnct(mode))) continue;
|
||||
suuji_ubuf[suuji_keta - 1] |= (keta << 4);
|
||||
}
|
||||
else {
|
||||
|
|
@ -433,7 +425,7 @@ Uchar TFar *cnct;
|
|||
check_num(tptr);
|
||||
|
||||
srch_number1(tptr);
|
||||
srch_kurai1(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai1(tptr, (u_char*)NULL);
|
||||
srch_kurai2(tptr, Kr1TblCnctP(p));
|
||||
|
||||
if (cnct)
|
||||
|
|
@ -443,18 +435,17 @@ Uchar TFar *cnct;
|
|||
}
|
||||
}
|
||||
|
||||
Static Void srch_kurai2(ptr, cnct)
|
||||
Uchar *ptr;
|
||||
Uchar TFar *cnct;
|
||||
static void
|
||||
srch_kurai2(u_char* ptr, u_char* cnct)
|
||||
{
|
||||
Uchar ch;
|
||||
Uchar TFar *p;
|
||||
Int l;
|
||||
Int keta;
|
||||
Int mode;
|
||||
u_char ch;
|
||||
u_char *p;
|
||||
int l;
|
||||
int keta;
|
||||
int mode;
|
||||
TypeClass cls;
|
||||
Int len;
|
||||
Uchar *tptr;
|
||||
int len;
|
||||
u_char *tptr;
|
||||
|
||||
if ((suuji_ubuf[0] & 0x0f) == _Num0) return;
|
||||
|
||||
|
|
@ -484,7 +475,7 @@ Uchar TFar *cnct;
|
|||
}
|
||||
|
||||
if (cnct) {
|
||||
if (!isconnect(cnct, (Int)Kr2TblCnct(mode))) continue;
|
||||
if (!isconnect(cnct, (int)Kr2TblCnct(mode))) continue;
|
||||
suuji_ubuf[suuji_keta - 1] |= (keta << 6);
|
||||
}
|
||||
else {
|
||||
|
|
@ -495,7 +486,7 @@ Uchar TFar *cnct;
|
|||
check_num(tptr);
|
||||
|
||||
srch_number1(tptr);
|
||||
srch_kurai1(tptr, (Uchar TFar *)NULL);
|
||||
srch_kurai1(tptr, (u_char*)NULL);
|
||||
|
||||
if (cnct)
|
||||
suuji_ubuf[suuji_keta - 1] &= 0x3f;
|
||||
|
|
@ -504,11 +495,11 @@ Uchar TFar *cnct;
|
|||
}
|
||||
}
|
||||
|
||||
Static Void srch_number2(p)
|
||||
Uchar *p;
|
||||
static void
|
||||
srch_number2(u_char* p)
|
||||
{
|
||||
Uchar ch;
|
||||
Int i;
|
||||
u_char ch;
|
||||
int i;
|
||||
|
||||
suuji_class = (*p == N_0) ? C_N_SUUJILONG : C_N_KAZULONG;
|
||||
|
||||
|
|
@ -559,8 +550,8 @@ Uchar *p;
|
|||
}
|
||||
}
|
||||
|
||||
Static Void srchnum_sub(p)
|
||||
Uchar *p;
|
||||
static void
|
||||
srchnum_sub(u_char* p)
|
||||
{
|
||||
suuji_yptr = p;
|
||||
|
||||
|
|
@ -570,13 +561,14 @@ Uchar *p;
|
|||
|
||||
suuji_keta = 0;
|
||||
suuji_class = C_N_KAZU;
|
||||
srch_kurai1(p, (Uchar TFar *)NULL);
|
||||
srch_kurai1(p, (u_char*)NULL);
|
||||
if (suuji_exit) return;
|
||||
|
||||
srch_number2(p);
|
||||
}
|
||||
|
||||
Void srchnum()
|
||||
void
|
||||
srchnum(void)
|
||||
{
|
||||
suuji_len = suuji_exit = 0;
|
||||
|
||||
|
|
@ -592,12 +584,10 @@ Void srchnum()
|
|||
}
|
||||
}
|
||||
|
||||
Void setwdnum(p, len, wd)
|
||||
Uchar *p;
|
||||
Int len;
|
||||
Ushort *wd;
|
||||
void
|
||||
setwdnum(u_char* p, int len, u_short* wd)
|
||||
{
|
||||
suuji_len = (Uchar)len;
|
||||
suuji_len = (u_char)len;
|
||||
suuji_wkeep = wd;
|
||||
suuji_ukeep = NULL;
|
||||
headcode = headlen = 0;
|
||||
|
|
@ -606,12 +596,10 @@ Ushort *wd;
|
|||
srchnum_sub(p);
|
||||
}
|
||||
|
||||
Int setucnum(p, len, ud)
|
||||
Uchar *p;
|
||||
Int len;
|
||||
Uchar *ud;
|
||||
int
|
||||
setucnum(u_char* p, int len, u_char* ud)
|
||||
{
|
||||
suuji_len = (Uchar)len;
|
||||
suuji_len = (u_char)len;
|
||||
suuji_wkeep = NULL;
|
||||
suuji_ukeep = ud;
|
||||
headcode = headlen = 0;
|
||||
|
|
@ -619,6 +607,6 @@ Uchar *ud;
|
|||
|
||||
srchnum_sub(p);
|
||||
|
||||
return (Int)suuji_exit;
|
||||
return (int)suuji_exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
* from Sony Corporation.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: sstrcmp.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:31 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
Int sstrcmp(src, dst)
|
||||
Reg1 Uchar *src;
|
||||
Reg2 Uchar *dst;
|
||||
{
|
||||
for ( ; *src ; src++, dst++)
|
||||
if (*src != *dst) break;
|
||||
|
||||
return (*src - *dst);
|
||||
}
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
* from Sony Corporation.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: sstrlen.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:32 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
Int sstrlen(ptr)
|
||||
Reg1 Uchar *ptr;
|
||||
{
|
||||
Reg2 Uchar *head;
|
||||
|
||||
head = ptr;
|
||||
|
||||
while (*ptr) ptr++;
|
||||
|
||||
return (ptr - head);
|
||||
}
|
||||
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
* from Sony Corporation.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: sstrncmp.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:33 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_const.h"
|
||||
|
||||
Int sstrncmp(src, dst, len)
|
||||
Reg1 Uchar *src;
|
||||
Reg2 Uchar TFar *dst;
|
||||
Reg3 Int len;
|
||||
{
|
||||
|
||||
while (len-- > 0) {
|
||||
|
||||
if (*src > *dst)
|
||||
return CONT;
|
||||
|
||||
if (*src < *dst) {
|
||||
if (!*src) return PARTLY;
|
||||
return OVER;
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
|
||||
return MATCH;
|
||||
}
|
||||
|
||||
|
|
@ -31,18 +31,19 @@
|
|||
* $SonyRCSfile: study.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:38 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
Void mvmemi(), mvmemd(), memcpy();
|
||||
Void mvmemi(), mvmemd();
|
||||
|
||||
STDYIN *srchstdy();
|
||||
|
||||
Int study(stdy)
|
||||
STDYOUT *stdy;
|
||||
Int
|
||||
study(STDYOUT *stdy)
|
||||
{
|
||||
STDYOUT outp;
|
||||
STDYIN *p1;
|
||||
|
|
@ -138,10 +139,10 @@ STDYOUT *stdy;
|
|||
return ret;
|
||||
}
|
||||
|
||||
STDYIN *srchstdy(seg, ofs, dicid)
|
||||
TypeDicSeg seg;
|
||||
TypeDicOfs ofs;
|
||||
TypeDicID dicid;
|
||||
STDYIN* srchstdy(
|
||||
TypeDicSeg seg,
|
||||
TypeDicOfs ofs,
|
||||
TypeDicID dicid)
|
||||
{
|
||||
Int high;
|
||||
Int mid;
|
||||
|
|
|
|||
|
|
@ -31,20 +31,21 @@
|
|||
* $SonyRCSfile: wakachi.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:43 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_right.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
JREC *argjrec();
|
||||
CLREC *argclrec();
|
||||
Int terminate(), setconj();
|
||||
Int terminate();
|
||||
Void setclrec(), srchfzk();
|
||||
|
||||
Void wakachi()
|
||||
void
|
||||
wakachi (void)
|
||||
{
|
||||
JREC *jrec;
|
||||
CLREC *clrec;
|
||||
|
|
@ -123,7 +124,7 @@ Void wakachi()
|
|||
return;
|
||||
|
||||
if (jrec -> jlen) {
|
||||
if (clrec = argclrec((Int)jrec -> jlen)) {
|
||||
if ((clrec = argclrec((Int)jrec -> jlen)) != NULL) {
|
||||
clrec -> jnode = jrec;
|
||||
clrec -> right = R_MEISI;
|
||||
clrec -> kubun = K_TAIGEN;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue