This commit is contained in:
Nishi 2026-06-19 01:49:53 +09:00
commit 73cb09624a
116 changed files with 19741 additions and 21522 deletions

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,91 +28,86 @@
*/
/*
* $SonyRCSfile: adddic.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: adddic.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:26 $
*/
#include <stdlib.h>
#include <string.h>
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static void sprt_seg(TypeDicSeg, TypeDicOfs);
static void apnd_uidx(TypeDicSeg, u_char *, int);
static int cal_nextym(u_char *);
static int usr_freelen();
static u_int checkdict(u_char *, TypeGram);
static void sprt_seg(TypeDicSeg, TypeDicOfs);
static void apnd_uidx(TypeDicSeg, u_char*, int);
static int cal_nextym(u_char*);
static int usr_freelen();
static u_int checkdict(u_char*, TypeGram);
u_int adddic(u_char* yomi, u_char* kanji, TypeGram hinsi) {
u_int err;
u_char yptr[MAXWDYOMILEN + 1];
u_char kptr[MAXWDKANJILEN + 1];
int klen;
TypeDicSeg segnum;
int saml;
TypeDicOfs dstofs;
TypeDicOfs douofs;
TypeDicOfs hnsofs;
TypeDicOfs knjofs;
TypeDicOfs nxtask;
TypeDicOfs newsiz;
TypeDicOfs oldsiz;
TypeDicOfs fresiz;
TypeIdxOfs freidx;
u_char* douptr;
u_char* dstptr;
TypeDicOfs pos;
u_char* p1;
int i;
int nlen, plen;
int size;
STDYIN* stdy;
STDYOUT stdydat;
u_int
adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
{
u_int err;
u_char yptr[MAXWDYOMILEN + 1];
u_char kptr[MAXWDKANJILEN + 1];
int klen;
TypeDicSeg segnum;
int saml;
TypeDicOfs dstofs;
TypeDicOfs douofs;
TypeDicOfs hnsofs;
TypeDicOfs knjofs;
TypeDicOfs nxtask;
TypeDicOfs newsiz;
TypeDicOfs oldsiz;
TypeDicOfs fresiz;
TypeIdxOfs freidx;
u_char *douptr;
u_char *dstptr;
TypeDicOfs pos;
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)))
return err;
inputyomi = yomi;
cnvstart = ystart = yptr;
cnvlen = sstrlen(yptr);
cnvlen = sstrlen(yptr);
if (err = checkdict(kanji, hinsi))
if(err = checkdict(kanji, hinsi))
return err;
if (!curdict -> maxunit)
if(!curdict->maxunit)
return AD_NOTUSERDICT;
klen = cvtknj(yomi, kanji, kptr);
newsiz = DOUONBLKSIZENUMBER + cnvlen + (klen !=0 ? klen+1 : 0) + 2;
newsiz = DOUONBLKSIZENUMBER + cnvlen + (klen != 0 ? klen + 1 : 0) + 2;
if (newsiz > MAXDOUONBLK)
if(newsiz > MAXDOUONBLK)
return AD_OVFLWDOUBLK;
if (newsiz > curdict->seglen)
if(newsiz > curdict->seglen)
return AD_OVFLWDOUBLK;
segnum = srchidx((TypeDicSeg)DICSEGBASE, cnvlen);
for ( ; ; ) {
for(;;) {
(*curdict->getdic)(curdict, segnum);
i = srchkana(&p1, &saml);
i = srchkana(&p1, &saml);
dstofs = douofs = p1 - dicbuf;
hnsofs = knjofs = 0;
if (i) {
i = srchgram(p1, &p1, hinsi);
if(i) {
i = srchgram(p1, &p1, hinsi);
dstofs = hnsofs = p1 - dicbuf;
if (i) {
if(i) {
srchkanji(&p1, kptr, klen);
if (*p1 != HINSIBLKTERM)
if(*p1 != HINSIBLKTERM)
return AD_AREXIST;
dstofs = knjofs = p1 - dicbuf;
}
@ -120,46 +115,45 @@ adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
p1 = dicbuf + douofs;
if (!hnsofs) {
if(!hnsofs) {
oldsiz = 0;
nlen = cnvlen - saml;
newsiz = DOUONBLKSIZENUMBER + nlen;
nlen = cnvlen - saml;
newsiz = DOUONBLKSIZENUMBER + nlen;
nxtask = cal_nextym(p1);
}
else {
} else {
oldsiz = newsiz = getsize(p1);
nxtask = 0;
nxtask = 0;
}
if (!knjofs) newsiz += 2;
if(!knjofs) newsiz += 2;
newsiz += (klen != 0 ? klen+1 : 0);
newsiz += (klen != 0 ? klen + 1 : 0);
fresiz = usr_freelen();
if ((unsigned int) (newsiz - oldsiz - nxtask) <=
(unsigned int) fresiz) break;
if((unsigned int)(newsiz - oldsiz - nxtask) <=
(unsigned int)fresiz) break;
if (segend(p1) && (segnum + 1 < curdict->segunit)) {
if(segend(p1) && (segnum + 1 < curdict->segunit)) {
segnum++;
continue;
}
if (curdict->segunit >= curdict->maxunit)
if(curdict->segunit >= curdict->maxunit)
return AD_OVFLWUSRDIC;
freidx = count_uidx();
if ((unsigned int) (douofs + newsiz) <= curdict->seglen) {
if (hnsofs)
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)
if((unsigned int)freidx < getplen(p1) + nlen + 1)
return AD_OVFLWINDEX;
if ((*curdict->putdic)(curdict, curdict->segunit))
if((*curdict->putdic)(curdict, curdict->segunit))
return AD_OVFLWUSRDIC;
sprt_seg(segnum, pos);
@ -168,11 +162,11 @@ adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
break;
}
if (segend(p1)) {
if ((unsigned int) freidx < cnvlen + 1)
if(segend(p1)) {
if((unsigned int)freidx < cnvlen + 1)
return AD_OVFLWINDEX;
if ((*curdict->putdic)(curdict, curdict->segunit))
if((*curdict->putdic)(curdict, curdict->segunit))
return AD_OVFLWUSRDIC;
curdict->segunit++;
@ -184,13 +178,12 @@ adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
mkidxtbl(curdict);
segnum++;
}
else {
} else {
nlen = getnlen(p1);
if ((unsigned int) freidx < getplen(p1) + nlen + 1)
if((unsigned int)freidx < getplen(p1) + nlen + 1)
return AD_OVFLWINDEX;
if ((*curdict->putdic)(curdict, curdict->segunit))
if((*curdict->putdic)(curdict, curdict->segunit))
return AD_OVFLWUSRDIC;
sprt_seg(segnum, douofs);
@ -201,16 +194,16 @@ adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
douptr = dicbuf + douofs;
if (nxtask) {
u_char *tp;
if(nxtask) {
u_char* tp;
size = getsize(douptr) - nxtask;
plen = getplen(douptr) + nxtask;
nlen = getnlen(douptr) - nxtask;
size = getsize(douptr) - nxtask;
plen = getplen(douptr) + nxtask;
nlen = getnlen(douptr) - nxtask;
*douptr = (size >> 8);
if (nlen & 0x10)
if(nlen & 0x10)
*douptr |= NOKORIYOMITOP;
if (plen & 0x10)
if(plen & 0x10)
*douptr |= ASSYUKUYOMITOP;
*(douptr + 1) = size;
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
@ -221,128 +214,124 @@ adddic(u_char *yomi, u_char *kanji, TypeGram hinsi)
}
dstptr = dicbuf + dstofs;
size = newsiz - oldsiz;
p1 = dicbuf + curdict->seglen;
size = newsiz - oldsiz;
p1 = dicbuf + curdict->seglen;
mvmemd(p1 - size, p1, p1 - dstptr - size);
if (!hnsofs) {
if (douofs == segtop() - dicbuf) {
if(!hnsofs) {
if(douofs == segtop() - dicbuf) {
chg_uidx(segnum, yptr, cnvlen);
}
*dstptr = 0;
nlen = cnvlen - saml;
if (nlen & 0x10)
*dstptr = 0;
nlen = cnvlen - saml;
if(nlen & 0x10)
*dstptr |= NOKORIYOMITOP;
if (saml & 0x10)
if(saml & 0x10)
*dstptr |= ASSYUKUYOMITOP;
*dstptr++ |= (size >> 8);
*dstptr++ = size;
*dstptr++ = ((nlen&0x0f)|((saml&0x0f)<<4));
*dstptr++ = size;
*dstptr++ = ((nlen & 0x0f) | ((saml & 0x0f) << 4));
while (saml < cnvlen) *dstptr++ = yptr[saml++];
}
else {
plen = getplen(douptr);
nlen = getnlen(douptr);
while(saml < cnvlen) *dstptr++ = yptr[saml++];
} else {
plen = getplen(douptr);
nlen = getnlen(douptr);
*douptr = (newsiz >> 8);
if (nlen & 0x10)
if(nlen & 0x10)
*douptr |= NOKORIYOMITOP;
if (plen & 0x10)
if(plen & 0x10)
*douptr |= ASSYUKUYOMITOP;
*(douptr + 1) = newsiz;
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
}
if (!knjofs)
if(!knjofs)
*dstptr++ = hinsi;
stdydat.stdy1.offset = dstptr - dicbuf;
for (saml = 0 ; saml < klen ; )
for(saml = 0; saml < klen;)
*dstptr++ = kptr[saml++];
if (klen > 0)
if(klen > 0)
*dstptr++ = KANJISTREND;
if (!knjofs)
if(!knjofs)
*dstptr++ = HINSIBLKTERM;
(*curdict->putdic)(curdict, segnum);
if (StudyExist()) {
if(StudyExist()) {
size -= nxtask;
for (i = STUDYCOUNT, stdy = STUDYDICT ; i-- ; stdy++) {
if (stdy -> dicid != curdict->dicid)
for(i = STUDYCOUNT, stdy = STUDYDICT; i--; stdy++) {
if(stdy->dicid != curdict->dicid)
continue;
if (stdy -> seg != segnum)
if(stdy->seg != segnum)
continue;
if (stdy -> offset >= dstofs)
stdy -> offset += size;
if(stdy->offset >= dstofs)
stdy->offset += size;
}
for (p1 = CLSTUDYDICT ; !iseocl(p1) ; p1 = ClNextTag(p1)) {
err = sstrncmp(yptr, (u_char *)ClYomiPos(p1),
(int)ClYomiLen(p1));
if (err == MATCH) {
for(p1 = CLSTUDYDICT; !iseocl(p1); p1 = ClNextTag(p1)) {
err = sstrncmp(yptr, (u_char*)ClYomiPos(p1),
(int)ClYomiLen(p1));
if(err == MATCH) {
delclsub(p1);
mkclidx();
putcldic();
break;
} else if (err == OVER)
} else if(err == OVER)
break;
}
}
stdydat.stdy1.seg = segnum;
stdydat.stdy1.dicid = curdict->dicid;
stdydat.stdy1.styno = 0;
stdydat.stdy1.sttkj = 0;
stdydat.stdy1.ka_kj = 0;
stdydat.stdy1.nmflg = 0;
stdydat.hinshi = hinsi;
stdydat.len = cnvlen;
stdydat.sttlen = 0;
stdydat.sttfg = 0;
stdydat.ka_fg = 0;
stdydat.stdy1.seg = segnum;
stdydat.stdy1.dicid = curdict->dicid;
stdydat.stdy1.styno = 0;
stdydat.stdy1.sttkj = 0;
stdydat.stdy1.ka_kj = 0;
stdydat.stdy1.nmflg = 0;
stdydat.hinshi = hinsi;
stdydat.len = cnvlen;
stdydat.sttlen = 0;
stdydat.sttfg = 0;
stdydat.ka_fg = 0;
(void)study(&stdydat);
return AD_DONE;
}
static int
checksub(u_char *kanji, TypeGram grm)
{
u_char *tagp;
u_char *ptr;
u_char *endp;
checksub(u_char* kanji, TypeGram grm) {
u_char* tagp;
u_char* ptr;
u_char* endp;
int flg, nlen;
int dounum;
u_char buf[MAXWDKANJILEN + 1];
dicinl = cnvlen;
dicinl = cnvlen;
dicsaml = 0;
prevseg = (TypeDicSeg)-1;
for (;;) {
if (!(tagp = srchdict(tagp)))
for(;;) {
if(!(tagp = srchdict(tagp)))
return 0;
if (cnvlen == getnlen(tagp) + getplen(tagp))
if(cnvlen == getnlen(tagp) + getplen(tagp))
break;
}
dounum = 0;
nlen = getnlen(tagp);
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
endp = tagp + getsize(tagp);
while (ptr < endp) {
while(ptr < endp) {
flg = (grm == *ptr++);
while (*ptr != HINSIBLKTERM) {
if (flg) {
while(*ptr != HINSIBLKTERM) {
if(flg) {
buf[getkanji(inputyomi, cnvlen, ptr, buf)] = 0;
if (cmpstr(kanji, buf))
if(cmpstr(kanji, buf))
return -1;
}
dounum++;
@ -355,22 +344,19 @@ checksub(u_char *kanji, TypeGram grm)
return dounum;
}
static u_int
checkdict(u_char *kanji, TypeGram grm)
{
DICTL *dp;
int dounum = 0;
int tmp;
DICT *tmpdict;
checkdict(u_char* kanji, TypeGram grm) {
DICTL* dp;
int dounum = 0;
int tmp;
DICT* tmpdict;
tmpdict = curdict;
for (dp = dictlist ; dp ; dp = dp -> next) {
for(dp = dictlist; dp; dp = dp->next) {
curdict = dp -> dict;
curdict = dp->dict;
if ((tmp = checksub(kanji, grm)) < 0) {
if((tmp = checksub(kanji, grm)) < 0) {
curdict = tmpdict;
return AD_AREXIST;
}
@ -379,29 +365,26 @@ checkdict(u_char *kanji, TypeGram grm)
}
curdict = tmpdict;
if (MAXKOUHONUMBER <= dounum)
if(MAXKOUHONUMBER <= dounum)
return AD_OVFLWDOUNUM;
return 0;
}
static int
cal_nextym(u_char *ptr)
{
cal_nextym(u_char* ptr) {
int count = 0;
u_char *src;
u_char* src;
int len;
if (!segend(ptr)) {
if(!segend(ptr)) {
src = cnvstart + getplen(ptr);
len = getnlen(ptr);
ptr += DOUONBLKSIZENUMBER;
while (len--) {
if (*ptr++ == *src++)
while(len--) {
if(*ptr++ == *src++)
count++;
else
break;
@ -410,37 +393,31 @@ cal_nextym(u_char *ptr)
return count;
}
static int
usr_freelen()
{
u_char *ptr;
usr_freelen() {
u_char* ptr;
ptr = segtop();
while (!segend(ptr))
while(!segend(ptr))
ptr += getsize(ptr);
return curdict->seglen - (ptr - dicbuf);
}
static void
sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
{
TypeDicSeg s;
u_char *pos;
u_char *p;
u_char *q;
int i;
int j;
int ylen, nlen;
TypeDicID dicid;
u_char yomi[MAXWDYOMILEN];
STDYIN *stdy;
sprt_seg(TypeDicSeg seg, TypeDicOfs ofs) {
TypeDicSeg s;
u_char* pos;
u_char* p;
u_char* q;
int i;
int j;
int ylen, nlen;
TypeDicID dicid;
u_char yomi[MAXWDYOMILEN];
STDYIN* stdy;
for (s = curdict->segunit - 1 ; s >= seg ; s--) {
for(s = curdict->segunit - 1; s >= seg; s--) {
(*curdict->getdic)(curdict, s);
(*curdict->putdic)(curdict, s + 1);
}
@ -451,22 +428,22 @@ sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
pos = dicbuf + ofs;
for (p = segtop() ; (p <= pos) && !segend(p) ; p = q) {
q = getntag(p);
i = getplen(p);
for(p = segtop(); (p <= pos) && !segend(p); p = q) {
q = getntag(p);
i = getplen(p);
nlen = getnlen(p);
j = (nlen != 0) ? nlen+1: 0;
j = (nlen != 0) ? nlen + 1 : 0;
p += DOUONBLKSIZENUMBER;
while (j-- > 0)
while(j-- > 0)
yomi[i++] = *p++;
}
nlen = getnlen(pos);
ylen = (i = getplen(pos)) + (j = nlen);
ylen = (i = getplen(pos)) + (j = nlen);
apnd_uidx(seg, yomi, ylen);
set_size(segtop(), getsize(pos) + i, 0, ylen);
set_size(segtop(), getsize(pos) + i, 0, ylen);
mvmemi(yomi, (p = segtop() + DOUONBLKSIZENUMBER), ylen);
@ -480,18 +457,18 @@ sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
(*curdict->putdic)(curdict, seg + 1);
if (StudyExist()) {
dicid = curdict -> dicid;
for (i = STUDYCOUNT, stdy = STUDYDICT ; i-- > 0 ; stdy++) {
if (stdy -> dicid != dicid)
if(StudyExist()) {
dicid = curdict->dicid;
for(i = STUDYCOUNT, stdy = STUDYDICT; i-- > 0; stdy++) {
if(stdy->dicid != dicid)
continue;
else if (stdy -> seg < seg)
else if(stdy->seg < seg)
continue;
else if (stdy -> seg > seg)
stdy -> seg += 1;
else if (stdy -> offset >= ofs) {
stdy -> seg += 1;
stdy -> offset -= j;
else if(stdy->seg > seg)
stdy->seg += 1;
else if(stdy->offset >= ofs) {
stdy->seg += 1;
stdy->offset -= j;
}
}
}
@ -501,22 +478,18 @@ sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
(*curdict->putdic)(curdict, seg);
}
static void
apnd_uidx(TypeDicSeg seg, u_char *yomi, int len)
{
u_char *p;
u_char *q;
apnd_uidx(TypeDicSeg seg, u_char* yomi, int len) {
u_char* p;
u_char* q;
p = get_idxptr(seg);
while (*p++)
;
while(*p++);
q = idxbuf + curdict->idxlen;
mvmemd(q - (len + 1), q, (int)(q - (len + 1) - p));
while (len--)
while(len--)
*p++ = *yomi++;
*p = 0;

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,14 +28,11 @@
*/
/*
* $SonyRCSfile: addelcmn.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: addelcmn.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:27 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_hinsi.h"
@ -43,51 +40,44 @@
#include "sj_kanakan.h"
void
set_size(u_char *p, int size, int plen, int nlen)
{
void set_size(u_char* p, int size, int plen, int nlen) {
*p = (u_char)(size >> 8);
if (nlen & 0x10) *p |= NOKORIYOMITOP;
if (plen & 0x10) *p |= ASSYUKUYOMITOP;
if(nlen & 0x10) *p |= NOKORIYOMITOP;
if(plen & 0x10) *p |= ASSYUKUYOMITOP;
*(p + 1) = (u_char)size;
*(p + 2) = (u_char)((nlen & 0x0f) | ((plen & 0x0f) << 4));
}
static int
isvyomi(u_char *yp)
{
int len;
isvyomi(u_char* yp) {
int len;
if (!*yp) return FALSE;
if(!*yp) return FALSE;
if (!(Chrtbl[*yp] & DICTOP)) return FALSE;
if(!(Chrtbl[*yp] & DICTOP)) return FALSE;
for (len = 0 ; *yp ; yp++) {
if (!(Chrtbl[*yp]) || (*yp >= Y_KUTEN)) return FALSE;
for(len = 0; *yp; yp++) {
if(!(Chrtbl[*yp]) || (*yp >= Y_KUTEN)) return FALSE;
if (++len > MAXWDYOMILEN) return FALSE;
if(++len > MAXWDYOMILEN) return FALSE;
}
return TRUE;
}
static int
isvknj(u_char *kanji)
{
int len;
isvknj(u_char* kanji) {
int len;
if (!*kanji) return FALSE;
if(!*kanji) return FALSE;
for (len = 0 ; *kanji ; ) {
if (*kanji == SS3) {
for(len = 0; *kanji;) {
if(*kanji == SS3) {
kanji += 3;
len += 2;
} else
if (isknj1(*kanji)) {
if(isknj1(*kanji)) {
kanji += 2;
len += 2;
}
@ -97,64 +87,54 @@ isvknj(u_char *kanji)
len += 2;
}
if (len > MAXWDKANJILEN) return FALSE;
if(len > MAXWDKANJILEN) return FALSE;
}
return TRUE;
}
static int
isgrm(TypeGram gram)
{
int grm = gram;
isgrm(TypeGram gram) {
int grm = gram;
if (MEISI_1 <= grm && grm <= D_MEISI_6) return TRUE;
if (MYOUJI <= grm && grm <= JOSUUSI2) return TRUE;
if (KEIYOUSI_1 <= grm && grm <= DO_ZAHEN) return TRUE;
if (DO_1DAN_1 <= grm && grm <= DO_WAGO_2) return TRUE;
if (DO_KAGO_5 <= grm && grm <= DO_WAGO_5) return TRUE;
if (DO_KAGO_6 <= grm && grm <= DO_WAGO_6) return TRUE;
if (DO_1DAN_3 <= grm && grm <= DO_WAGO_3) return TRUE;
if (DO_1DAN_4 <= grm && grm <= DO_WAGO_4) return TRUE;
if (DO_KAGO_7 <= grm && grm <= DO_WAGO_7) return TRUE;
if (DO_KAGO_8 <= grm && grm <= DO_WAGO_8) return TRUE;
if (SP_SA_MI1 <= grm && grm <= TANKANJI) return TRUE;
if(MEISI_1 <= grm && grm <= D_MEISI_6) return TRUE;
if(MYOUJI <= grm && grm <= JOSUUSI2) return TRUE;
if(KEIYOUSI_1 <= grm && grm <= DO_ZAHEN) return TRUE;
if(DO_1DAN_1 <= grm && grm <= DO_WAGO_2) return TRUE;
if(DO_KAGO_5 <= grm && grm <= DO_WAGO_5) return TRUE;
if(DO_KAGO_6 <= grm && grm <= DO_WAGO_6) return TRUE;
if(DO_1DAN_3 <= grm && grm <= DO_WAGO_3) return TRUE;
if(DO_1DAN_4 <= grm && grm <= DO_WAGO_4) return TRUE;
if(DO_KAGO_7 <= grm && grm <= DO_WAGO_7) return TRUE;
if(DO_KAGO_8 <= grm && grm <= DO_WAGO_8) return TRUE;
if(SP_SA_MI1 <= grm && grm <= TANKANJI) return TRUE;
return FALSE;
}
u_int addel_arg(u_char* yp, u_char* kp, TypeGram grm, u_char* nyp, int len) {
u_short err = 0;
if(!sj2cd_str(yp, nyp, len)) err |= AD_BADYOMI;
u_int
addel_arg(u_char *yp, u_char *kp, TypeGram grm, u_char *nyp, int len)
{
u_short err = 0;
if(!isvyomi(nyp)) err |= AD_BADYOMI;
if (!sj2cd_str(yp, nyp, len)) err |= AD_BADYOMI;
if(!isvknj(kp)) err |= AD_BADKANJI;
if (!isvyomi(nyp)) err |= AD_BADYOMI;
if (!isvknj(kp)) err |= AD_BADKANJI;
if (!isgrm(grm)) err |= AD_BADHINSI;
if(!isgrm(grm)) err |= AD_BADHINSI;
return err;
}
static void
yomi2kata(u_char *src, u_char *dst)
{
int first;
int second;
yomi2kata(u_char* src, u_char* dst) {
int first;
int second;
while (first = *src++) {
while(first = *src++) {
second = *src++;
if (first != 0xa4) {
if(first != 0xa4) {
*dst++ = first;
*dst++ = second;
}
@ -168,89 +148,78 @@ yomi2kata(u_char *src, u_char *dst)
*dst = 0;
}
static int
top_strcmp(u_char *src, u_char *dst)
{
int i;
top_strcmp(u_char* src, u_char* dst) {
int i;
for (i = 0 ; *src && (*src == *dst) ; src++, dst++) i++;
for(i = 0; *src && (*src == *dst); src++, dst++) i++;
i /= 2;
return (i > MAXYOMIASKNUMBER) ? MAXYOMIASKNUMBER : i;
}
static int
last_strcmp(u_char *src, u_char *dst)
{
int slen;
int dlen;
last_strcmp(u_char* src, u_char* dst) {
int slen;
int dlen;
slen = sstrlen(src);
dlen = sstrlen(dst);
if (dlen > MAXYOMIASKNUMBER * 2) return 0;
if(dlen > MAXYOMIASKNUMBER * 2) return 0;
if (sstrcmp(src + (slen - dlen), dst)) return 0;
if(sstrcmp(src + (slen - dlen), dst)) return 0;
return (dlen / 2);
}
int
cvtknj(u_char *yomi, u_char *knj, u_char *dst)
{
int cvtknj(u_char* yomi, u_char* knj, u_char* dst) {
u_char kana[MAXWDYOMILEN * 2 + 1];
int len;
u_char *keep;
u_char* keep;
keep = dst;
yomi2kata(yomi, kana);
if (len = top_strcmp(yomi, knj)) {
*dst = (u_char)(ZENHIRAASSYUKU | (len - 1));
}
else if (len = top_strcmp(kana, knj)) {
*dst = (u_char)(ZENKATAASSYUKU | (len - 1));
if(len = top_strcmp(yomi, knj)) {
*dst = (u_char)(ZENHIRAASSYUKU | (len - 1));
} else if(len = top_strcmp(kana, knj)) {
*dst = (u_char)(ZENKATAASSYUKU | (len - 1));
}
if (len) {
if(len) {
knj += len * 2;
dst++;
}
if (*knj) {
for ( ; ; ) {
if (len = last_strcmp(yomi, knj)) {
if(*knj) {
for(;;) {
if(len = last_strcmp(yomi, knj)) {
*dst++ = (u_char)(ZENHIRAASSYUKU | (len - 1));
break;
}
else if (len = last_strcmp(kana, knj)) {
} else if(len = last_strcmp(kana, knj)) {
*dst++ = (u_char)(ZENKATAASSYUKU | (len - 1));
break;
}
else if (*knj == SS2) {
} else if(*knj == SS2) {
knj++;
*dst++ = (u_char)LEADINGHANKAKU;
*dst++ = *knj++;
} else if (*knj == SS3) {
} else if(*knj == SS3) {
knj++;
*dst++ = (*knj & NORMALKANJIMASK);
knj++;
*dst++ = (*knj & NORMALKANJIMASK); knj++;
*dst++ = *knj++;
} else if (*knj & 0x80) {
*dst++ = (*knj & NORMALKANJIMASK); knj++;
*dst++ = (*knj & NORMALKANJIMASK); knj++;
}
else {
} else if(*knj & 0x80) {
*dst++ = (*knj & NORMALKANJIMASK);
knj++;
*dst++ = (*knj & NORMALKANJIMASK);
knj++;
} else {
*dst++ = (u_char)LEADINGHANKAKU;
*dst++ = *knj++;
}
if (!*knj) {
if(!*knj) {
break;
}
}
@ -260,12 +229,8 @@ cvtknj(u_char *yomi, u_char *knj, u_char *dst)
return (dst - keep);
}
int
srchkana(u_char **ptr, int *saml)
{
u_char *p;
int srchkana(u_char** ptr, int* saml) {
u_char* p;
int cmp;
int cnt = 0;
u_char same;
@ -275,34 +240,30 @@ srchkana(u_char **ptr, int *saml)
p = segtop();
while (!segend(p)) {
if (flg == 0) {
while(!segend(p)) {
if(flg == 0) {
cmp = yomicmp(cnvstart, p, &same);
if (cmp == OVER) break;
if (cmp == MATCH && *(cnvstart + same) == 0) {
*ptr = p;
if(cmp == OVER) break;
if(cmp == MATCH && *(cnvstart + same) == 0) {
*ptr = p;
*saml = same;
flg = 1;
flg = 1;
}
}
p = getntag(p);
cnt++;
}
if (flg != 0) return cnt;
if(flg != 0) return cnt;
*ptr = p;
*ptr = p;
*saml = same;
return 0;
}
int
srchgram(u_char *ptr, u_char **dst, TypeGram hinsi)
{
u_char *endp;
int srchgram(u_char* ptr, u_char** dst, TypeGram hinsi) {
u_char* endp;
int cnt = 0, nlen;
int flg = FALSE;
@ -310,79 +271,68 @@ srchgram(u_char *ptr, u_char **dst, TypeGram hinsi)
nlen = getnlen(ptr);
ptr += DOUONBLKSIZENUMBER + nlen;
while (ptr < endp) {
if (*ptr == hinsi) {
ptr += DOUONBLKSIZENUMBER + nlen;
while(ptr < endp) {
if(*ptr == hinsi) {
*dst = ptr;
flg = TRUE;
flg = TRUE;
}
do {
ptr += codesize(*ptr);
} while (*ptr != HINSIBLKTERM);
} while(*ptr != HINSIBLKTERM);
ptr++;
cnt++;
}
if (flg) return cnt;
if(flg) return cnt;
*dst = ptr;
return 0;
}
int
srchkanji(u_char **dst, u_char *knj, int klen)
{
u_char *ptr;
u_char *p, *q;
int srchkanji(u_char** dst, u_char* knj, int klen) {
u_char* ptr;
u_char *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;
while(*ptr != HINSIBLKTERM) {
for(p = ptr, q = knj, len = klen; len; len--)
if(*p++ != *q++) break;
if (!len) {
if(!len) {
*dst = ptr;
flg = TRUE;
flg = TRUE;
}
while (!(*ptr == KANJISTREND)) {
while(!(*ptr == KANJISTREND)) {
ptr += codesize(*ptr);
}
ptr++;
cnt++;
}
if (!flg) *dst = ptr;
if(!flg) *dst = ptr;
return cnt;
}
TypeIdxOfs
count_uidx()
{
u_char *p;
count_uidx() {
u_char* p;
p = get_idxptr(curdict->segunit - 1);
while (*p++) ;
while(*p++);
return (curdict->idxlen - (p - idxbuf));
}
void
chg_uidx(TypeDicSeg seg, u_char *yomi, int len)
{
u_char *p, *q;
int olen;
void chg_uidx(TypeDicSeg seg, u_char* yomi, int len) {
u_char *p, *q;
int olen;
p = get_idxptr(seg);
@ -390,13 +340,12 @@ chg_uidx(TypeDicSeg seg, u_char *yomi, int len)
q = idxbuf + curdict->idxlen;
if (len > olen) {
mvmemd(q - (len-olen), q, (int)(q - (len-olen) - p));
if(len > olen) {
mvmemd(q - (len - olen), q, (int)(q - (len - olen) - p));
} else {
mvmemi(p + (olen - len), p, (int)(q - (p + (olen - len))));
}
else {
mvmemi(p + (olen-len), p, (int)(q - (p + (olen-len))));
}
while (len--) *p++ = *yomi++;
while(len--) *p++ = *yomi++;
(*curdict->putidx)(curdict, 0);

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,12 +28,11 @@
*/
/*
* $SonyRCSfile: alloc.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: alloc.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:28 $
*/
#include <stdlib.h>
#include <sys/types.h>
#include "sj_rename.h"
@ -44,64 +43,57 @@
#include "sj_kanakan.h"
#define JREC_NUM 128
#define CLREC_NUM 128
#define JREC_NUM 128
#define CLREC_NUM 128
static JREC *jrec = NULL;
static CLREC *clrec = NULL;
static JREC* jrec = NULL;
static CLREC* clrec = NULL;
JREC *
alloc_jrec()
{
JREC *p;
int i;
JREC* alloc_jrec() {
JREC* p;
int i;
if (jrec == NULL) {
jrec = (JREC *)malloc(sizeof(JREC) * JREC_NUM);
if (jrec == NULL) return (JREC *)malloc(sizeof(JREC));
for (i = 0, p = jrec ; i < JREC_NUM - 1 ; i++, p++)
p -> jsort = p + 1;
p -> jsort = NULL;
if(jrec == NULL) {
jrec = (JREC*)malloc(sizeof(JREC) * JREC_NUM);
if(jrec == NULL) return (JREC*)malloc(sizeof(JREC));
for(i = 0, p = jrec; i < JREC_NUM - 1; i++, p++)
p->jsort = p + 1;
p->jsort = NULL;
}
p = jrec;
jrec = jrec -> jsort;
p = jrec;
jrec = jrec->jsort;
return p;
}
void
free_jrec(JREC *p)
{
if (p != NULL) {
p -> jsort = jrec;
jrec = p;
void free_jrec(JREC* p) {
if(p != NULL) {
p->jsort = jrec;
jrec = p;
}
}
CLREC *
alloc_clrec()
{
CLREC *p;
int i;
CLREC*
alloc_clrec() {
CLREC* p;
int i;
if (clrec == NULL) {
clrec = (CLREC *)malloc(sizeof(CLREC) * CLREC_NUM);
if (clrec == NULL) return (CLREC *)malloc(sizeof(CLREC));
for (i = 0, p = clrec ; i < CLREC_NUM - 1 ; i++, p++)
p -> clsort = p + 1;
p -> clsort = NULL;
if(clrec == NULL) {
clrec = (CLREC*)malloc(sizeof(CLREC) * CLREC_NUM);
if(clrec == NULL) return (CLREC*)malloc(sizeof(CLREC));
for(i = 0, p = clrec; i < CLREC_NUM - 1; i++, p++)
p->clsort = p + 1;
p->clsort = NULL;
}
p = clrec;
clrec = clrec -> clsort;
p = clrec;
clrec = clrec->clsort;
return p;
}
void
free_clrec(CLREC *p)
{
if (p != NULL) {
p -> clsort = clrec;
clrec = p;
void free_clrec(CLREC* p) {
if(p != NULL) {
p->clsort = clrec;
clrec = p;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,14 +28,11 @@
*/
/*
* $SonyRCSfile: charsize.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: charsize.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:29 $
*/
#include "sj_euc.h"
#include "sj_rename.h"
#include "sj_typedef.h"
@ -43,21 +40,18 @@
#include "sj_kanakan.h"
int
codesize(u_char code)
{
switch (code & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
case ZENKATAASSYUKU:
case KANJIASSYUKU:
case KANJISTREND:
int codesize(u_char code) {
switch(code & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
case ZENKATAASSYUKU:
case KANJIASSYUKU:
case KANJISTREND:
return 1;
case LEADINGHANKAKU:
case OFFSETASSYUKU:
case AIATTRIBUTE:
case LEADINGHANKAKU:
case OFFSETASSYUKU:
case AIATTRIBUTE:
return 2;
default:
return 2;
default:
return 2;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,276 +28,272 @@
*/
/*
* $SonyRCSfile: chrtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: chrtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:30 $
*/
#include "sj_const.h"
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
u_char chrtbl[256] =
{
0,
FZKTOP,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU + BEFORNUM,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
FZKTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
FZKTOP,
DICTOP,
DICTOP,
DEPEND,
DEPEND,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
FZK_KGU,
FZK_KGU,
FZK_KGU + MIDNUM,
FZK_KGU + MIDNUM,
FZK_KGU + TAI_KGU,
FZK_KGU + TAI_KGU,
TAI_KGU + BEFORNUM,
TAI_KGU,
FZK_KGU,
TAI_KGU,
TAI_KGU,
TAI_KGU,
TAI_KGU,
0
};
u_char chrtbl[256] =
{
0,
FZKTOP,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU + BEFORNUM,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + NUMBER,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DICTOP + TAI_KGU,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
FZKTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DICTOP,
DEPEND,
DICTOP,
DICTOP,
DICTOP,
FZKTOP,
DICTOP,
DICTOP,
DEPEND,
DEPEND,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
FZK_KGU,
FZK_KGU,
FZK_KGU + MIDNUM,
FZK_KGU + MIDNUM,
FZK_KGU + TAI_KGU,
FZK_KGU + TAI_KGU,
TAI_KGU + BEFORNUM,
TAI_KGU,
FZK_KGU,
TAI_KGU,
TAI_KGU,
TAI_KGU,
TAI_KGU,
0};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: cl2knj.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: cl2knj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:31 $
*/
@ -37,29 +37,26 @@
#include "sj_kanakan.h"
static CLREC *nextrecblk(), *prevrecblk();
static CLREC *nextrecblk(), *prevrecblk();
static void initkbuf(u_char*);
static void initkbuf(u_char *);
int
cl2knj(u_char *yomi, int len, u_char *kouho)
{
u_char *ptr1;
u_char *ptr2;
int cl2knj(u_char* yomi, int len, u_char* kouho) {
u_char* ptr1;
u_char* ptr2;
int i;
khcount = nkhcount = 0;
initkbuf(kouho);
if (len > MAXCLINPUTLEN * 2) len = MAXCLINPUTLEN * 2;
if(len > MAXCLINPUTLEN * 2) len = MAXCLINPUTLEN * 2;
ptr1 = yomi; ptr2 = hyomi;
for (i = 0 ; i < len ; i++) {
if (isknj1(*ptr1)) {
if (++i >= len) break;
ptr1 = yomi;
ptr2 = hyomi;
for(i = 0; i < len; i++) {
if(isknj1(*ptr1)) {
if(++i >= len) break;
}
ptr1 += sj2cd_chr(ptr1, ptr2++);
}
@ -67,19 +64,19 @@ cl2knj(u_char *yomi, int len, u_char *kouho)
strlcpy(orgyomi, yomi, (int)(ptr1 - yomi) + 1);
if (!hyomi[0]) return 0;
if(!hyomi[0]) return 0;
freework();
inputyomi = orgyomi;
cnvstart = ystart = hyomi;
cnvlen = sstrlen(hyomi);
cnvlen = sstrlen(hyomi);
mkjiritu(0);
mkbunsetu();
if (!maxclptr) wakachi();
if(!maxclptr) wakachi();
jrt1st = maxjptr;
clt1st = maxclptr;
@ -92,129 +89,104 @@ cl2knj(u_char *yomi, int len, u_char *kouho)
cvtclknj();
return hzstrlen(inputyomi, (int)clt1st -> cllen);
return hzstrlen(inputyomi, (int)clt1st->cllen);
}
int
nextcl(u_char *kouho, int mode)
{
CLREC *clptr;
int nextcl(u_char* kouho, int mode) {
CLREC* clptr;
initkbuf(kouho);
if (!khcount) return 0;
if(!khcount) return 0;
if (!mode && (selectid < khcount))
if(!mode && (selectid < khcount))
selectid++;
else if((mode < 2) && (clptr = nextrecblk())) {
selectid = 1;
clt1st = clptr;
clt1st = clptr;
mkkouho();
getrank();
}
else {
} else {
cvtclknj();
return 0;
}
cvtclknj();
return hzstrlen(inputyomi, (int)clt1st -> cllen);
return hzstrlen(inputyomi, (int)clt1st->cllen);
}
static CLREC*
nextrecblk()
{
CLREC *clptr;
int keeplen;
nextrecblk() {
CLREC* clptr;
int keeplen;
keeplen = clt1st -> cllen;
keeplen = clt1st->cllen;
clptr = clt1st -> clsort;
clptr = clt1st->clsort;
while (clptr && (int)clptr -> cllen == keeplen)
clptr = clptr -> clsort;
while(clptr && (int)clptr->cllen == keeplen)
clptr = clptr->clsort;
return clptr;
}
int
prevcl(u_char *kouho, int mode)
{
CLREC *clptr;
int prevcl(u_char* kouho, int mode) {
CLREC* clptr;
initkbuf(kouho);
if (!khcount) return 0;
if(!khcount) return 0;
if (!mode && (selectid > 1))
if(!mode && (selectid > 1))
selectid--;
else if ((mode < 2) && (clptr = prevrecblk())) {
else if((mode < 2) && (clptr = prevrecblk())) {
clt1st = clptr;
mkkouho();
getrank();
selectid = khcount;
}
else {
} else {
cvtclknj();
return 0;
}
cvtclknj();
return hzstrlen(inputyomi, (int)clt1st -> cllen);
return hzstrlen(inputyomi, (int)clt1st->cllen);
}
static CLREC*
prevrecblk()
{
CLREC *clptr;
CLREC *keepptr;
int keeplen;
int cllen;
prevrecblk() {
CLREC* clptr;
CLREC* keepptr;
int keeplen;
int cllen;
clptr = maxclptr;
if ((cllen = clt1st -> cllen) == clptr -> cllen)
if((cllen = clt1st->cllen) == clptr->cllen)
return NULL;
while ((int)clptr -> cllen > cllen) {
keeplen = clptr -> cllen;
while((int)clptr->cllen > cllen) {
keeplen = clptr->cllen;
keepptr = clptr;
while ((int)clptr -> cllen == keeplen)
clptr = clptr -> clsort;
while((int)clptr->cllen == keeplen)
clptr = clptr->clsort;
}
return keepptr;
}
static void
initkbuf(u_char *kouho)
{
initkbuf(u_char* kouho) {
kanjitmp = kouho;
memset(kanjitmp, 0, sizeof(STDYOUT) + 1);
}
int
selectnum()
{
int selectnum() {
return selectid;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,86 +28,75 @@
*/
/*
* $SonyRCSfile: clstudy.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: clstudy.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:32 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static u_char *delcldata(), *srchclpos();
static int delclold();
static u_char *delcldata(), *srchclpos();
static int delclold();
int
clstudy(u_char *yomi1, u_char *yomi2, STDYOUT *stdy)
{
int clstudy(u_char* yomi1, u_char* yomi2, STDYOUT* stdy) {
u_char ytmp[CLSTDY_TMPLEN];
u_char *dst, *ptr;
u_char *dst, *ptr;
int ret;
int len1, len2;
int alen, blen;
int i;
if (!StudyExist()) return CLSTUDYNODICT;
if(!StudyExist()) return CLSTUDYNODICT;
if (!yomi1 || !*yomi1) return CLSTUDYPARAERR;
if(!yomi1 || !*yomi1) return CLSTUDYPARAERR;
if (!yomi2 || !*yomi2) {
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
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))
if(!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
return CLSTUDYYOMIERR;
len1 = sstrlen(ytmp);
if (!sj2cd_str(yomi2, ytmp + len1, CLSTDY_TMPLEN - len1))
if(!sj2cd_str(yomi2, ytmp + len1, CLSTDY_TMPLEN - len1))
return CLSTUDYYOMIERR;
len2 = len1 + stdy -> len;
len2 = len1 + stdy->len;
ytmp[len2] = 0;
alen = len2 + CL_HDLEN;
if (alen + 1 >= CLSTUDYLEN) return CLSTUDYNOAREA;
if(alen + 1 >= CLSTUDYLEN) return CLSTUDYNOAREA;
blen = CLSTUDYTAIL - delcldata(ytmp) - 1;
while (blen < alen) {
if (!(i = delclold())) break;
while(blen < alen) {
if(!(i = delclold())) break;
blen += i;
}
if (blen >= alen) {
if(blen >= alen) {
dst = srchclpos(ytmp);
ptr = CLSTUDYTAIL - alen;
mvmemd(ptr, CLSTUDYTAIL, (ptr - dst));
ClYomiLen(dst) = (u_char)len2;
ClGramCode(dst) = stdy -> hinshi;
ClYomiLen(dst) = (u_char)len2;
ClGramCode(dst) = stdy->hinshi;
ClYomi1Len(dst) = (u_char)len1;
ClSetNum(dst, 1);
memcpy(ClYomiPos(dst), ytmp, len2);
ret = CLSTUDYNORMEND;
}
else
} else
ret = CLSTUDYNOAREA;
}
mkclidx();
@ -116,32 +105,28 @@ clstudy(u_char *yomi1, u_char *yomi2, STDYOUT *stdy)
return ret;
}
static u_char *
delcldata(u_char *ycode)
{
u_char *tagptr;
u_char *ptr1;
u_char *ptr2;
static u_char*
delcldata(u_char* ycode) {
u_char* tagptr;
u_char* ptr1;
u_char* ptr2;
int len1;
tagptr = CLSTUDYDICT;
while (!iseocl(tagptr)) {
while(!iseocl(tagptr)) {
ptr1 = ycode;
ptr2 = ClYomiPos(tagptr);
len1 = ClYomiLen(tagptr);
while (*ptr1 && len1) {
if (*ptr1 != *ptr2) break;
while(*ptr1 && len1) {
if(*ptr1 != *ptr2) break;
ptr1++;
ptr2++;
len1--;
}
if (!*ptr1 || !len1) {
if(!*ptr1 || !len1) {
delclsub(tagptr);
}
else {
} else {
tagptr = ClNextTag(tagptr);
}
}
@ -149,12 +134,8 @@ delcldata(u_char *ycode)
return tagptr;
}
void
delclsub(u_char *target)
{
u_char *src;
void delclsub(u_char* target) {
u_char* src;
int num;
int tmp;
int len;
@ -170,10 +151,10 @@ delclsub(u_char *target)
memset(CLSTUDYTAIL - len, 0, len);
src = CLSTUDYDICT;
while (!iseocl(src)) {
while(!iseocl(src)) {
tmp = ClGetNum(src);
if (tmp > num) {
if(tmp > num) {
tmp -= 1;
ClSetNum(src, tmp);
}
@ -182,32 +163,29 @@ delclsub(u_char *target)
}
}
static int
delclold()
{
u_char *tagptr;
u_char *target;
delclold() {
u_char* tagptr;
u_char* target;
int num;
int tmp;
target = NULL;
num = 0;
num = 0;
tagptr = CLSTUDYDICT;
while (!iseocl(tagptr)) {
while(!iseocl(tagptr)) {
tmp = ClGetNum(tagptr);
if (tmp >= num) {
num = tmp;
if(tmp >= num) {
num = tmp;
target = tagptr;
}
tagptr = ClNextTag(tagptr);
}
if (target) {
if(target) {
num = ClBlkLen(tagptr);
delclsub(target);
}
@ -215,21 +193,18 @@ delclold()
return num;
}
static u_char *
srchclpos(u_char *ycode)
{
u_char *tagptr;
u_char *target;
u_char *ptr1;
u_char *ptr2;
static u_char*
srchclpos(u_char* ycode) {
u_char* tagptr;
u_char* target;
u_char* ptr1;
u_char* ptr2;
int len;
int tmp;
target = NULL;
tagptr = CLSTUDYDICT;
while (!iseocl(tagptr)) {
while(!iseocl(tagptr)) {
tmp = ClGetNum(tagptr);
tmp++;
@ -238,19 +213,19 @@ srchclpos(u_char *ycode)
ptr1 = ycode;
ptr2 = ClYomiPos(tagptr);
len = ClYomiLen(tagptr);
while (*ptr1 && len) {
if (*ptr1 != *ptr2) break;
while(*ptr1 && len) {
if(*ptr1 != *ptr2) break;
ptr1++;
ptr2++;
len--;
}
if (!target) {
if (!len)
if(!target) {
if(!len)
;
else if (!*ptr1)
else if(!*ptr1)
target = tagptr;
else if (*ptr1 < *ptr2)
else if(*ptr1 < *ptr2)
target = tagptr;
}
tagptr = ClNextTag(tagptr);
@ -259,25 +234,21 @@ srchclpos(u_char *ycode)
return target ? target : tagptr;
}
void
mkclidx()
{
u_char *ptr;
void mkclidx() {
u_char* ptr;
int num;
int st, ed;
if (!StudyExist()) return;
if(!StudyExist()) return;
ptr = CLSTUDYDICT;
for (num = st = 0 ; st < 0x100 ; num++, st = ed) {
for(num = st = 0; st < 0x100; num++, st = ed) {
ed = st + CLSTUDYSTEP;
while (!iseocl(ptr)) {
if ((unsigned int) *ClYomiPos(ptr) >= st) break;
while(!iseocl(ptr)) {
if((unsigned int)*ClYomiPos(ptr) >= st) break;
ptr = ClNextTag(ptr);
}
if (ClYomiLen(ptr) && ((int)*ClYomiPos(ptr) < ed))
if(ClYomiLen(ptr) && ((int)*ClYomiPos(ptr) < ed))
CLSTUDYIDX[num] = ptr - CLSTUDYDICT;
else
CLSTUDYIDX[num] = (u_short)-1;

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,31 +28,25 @@
*/
/*
* $SonyRCSfile: cmpstr.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: cmpstr.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:32 $
*/
#include "sj_rename.h"
#include "sj_const.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
int
cmpstr(u_char *src, u_char *dst)
{
while (*src) {
if (*src != *dst) return FALSE;
int cmpstr(u_char* src, u_char* dst) {
while(*src) {
if(*src != *dst) return FALSE;
src++;
dst++;
}
if (*dst) return FALSE;
if(*dst) return FALSE;
return TRUE;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,41 +28,30 @@
*/
/*
* $SonyRCSfile: cvtclknj.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: cvtclknj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:38 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
cvtclknj()
{
KHREC *krec;
int i;
void cvtclknj() {
KHREC* krec;
int i;
if(!selectid) selectid = khcount;
if (!selectid) selectid = khcount;
i = khcount;
krec = kouhotbl;
i = khcount;
krec = kouhotbl;
while (i--) {
if ((int)krec -> rank == (int)selectid) break;
while(i--) {
if((int)krec->rank == (int)selectid) break;
krec++;
}
setstyrec(krec);
cvtkouho(krec);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,79 +28,66 @@
*/
/*
* $SonyRCSfile: cvtdict.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: cvtdict.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:40 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
cvtdict(KHREC *krec, CLREC *clrec, int flg)
{
TypeDicOfs ofs;
u_char *yptr;
int jlen;
int stblen;
int sttlen;
u_char *fptr;
int cllen;
JREC *jrec;
int i, j;
void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
TypeDicOfs ofs;
u_char* yptr;
int jlen;
int stblen;
int sttlen;
u_char* fptr;
int cllen;
JREC* jrec;
int i, j;
ofs = krec -> offs;
jrec = clrec -> jnode;
cllen = clrec -> cllen;
ofs = krec->offs;
jrec = clrec->jnode;
cllen = clrec->cllen;
yptr = inputyomi;
jlen = jrec -> jlen;
jlen = jrec->jlen;
if (i = jrec -> sttofs) {
if (i == SETTOU_KIGOU) {
if(i = jrec->sttofs) {
if(i == SETTOU_KIGOU) {
sttlen = 1;
fptr = yptr;
fptr = yptr;
}
else {
fptr = Settou_ptr(i);
fptr = Settou_ptr(i);
sttlen = SttYomiLen(fptr);
fptr++;
if (!krec -> sttkj) fptr += 2;
fptr++;
if(!krec->sttkj) fptr += 2;
}
*kanjitmp++ = *fptr++;
*kanjitmp++ = *fptr++;
jlen -= sttlen;
yptr += sttlen * 2;
yptr += sttlen * 2;
}
else
sttlen = 0;
if (flg) {
if(flg) {
(*Cvtnum_func[krec->mode - 1])(ystart + sttlen, yptr, jrec);
yptr += (i = jrec -> numlen) * 2;
yptr += (i = jrec->numlen) * 2;
jlen -= i;
if (jrec -> stbofs) {
if(jrec->stbofs) {
*kanjitmp++ = *yptr++;
*kanjitmp++ = *yptr++;
jlen--;
@ -109,71 +96,60 @@ cvtdict(KHREC *krec, CLREC *clrec, int flg)
stblen = 0;
}
else if ((i = jrec -> stbofs) && (fptr = getstb(jrec -> hinsi))) {
else if((i = jrec->stbofs) && (fptr = getstb(jrec->hinsi))) {
fptr += i - 1;
stblen = StbYomiLen(fptr);
jlen -= stblen;
}
else {
stblen = 0;
}
if (ofs) {
if (seldict(jrec -> dicid)) {
(*curdict->getdic)(curdict, jrec -> jseg);
if(ofs) {
if(seldict(jrec->dicid)) {
(*curdict->getdic)(curdict, jrec->jseg);
get_askknj();
kanjitmp +=
getkanji(yptr, jlen, dicbuf + ofs, kanjitmp);
getkanji(yptr, jlen, dicbuf + ofs, kanjitmp);
yptr += jlen * 2;
}
else {
while (jlen-- > 0) {
for ( i = 0; i < euc_codesize(*yptr); i++)
*kanjitmp++ = yptr[i];
} else {
while(jlen-- > 0) {
for(i = 0; i < euc_codesize(*yptr); i++)
*kanjitmp++ = yptr[i];
yptr += euc_codesize(*yptr);
}
}
}
if (stblen) {
i = StbKnjLen(fptr);
if(stblen) {
i = StbKnjLen(fptr);
fptr += stblen + 2;
while (i-- > 0) *kanjitmp++ = *fptr++;
while(i-- > 0) *kanjitmp++ = *fptr++;
yptr += stblen * 2;
}
i = cllen - (jrec -> jlen);
while (i-- > 0) {
for ( j = 0; j < euc_codesize(*yptr); j++)
*kanjitmp++ = yptr[j];
i = cllen - (jrec->jlen);
while(i-- > 0) {
for(j = 0; j < euc_codesize(*yptr); j++)
*kanjitmp++ = yptr[j];
yptr += euc_codesize(*yptr);
}
}
void cvtminasi(int len) {
u_char* ptr;
ptr = inputyomi;
void
cvtminasi(int len)
{
u_char *ptr;
while(len-- > 0) {
ptr = inputyomi;
while (len-- > 0) {
if (isknj1(*ptr)) {
if(isknj1(*ptr)) {
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
}
else if (*ptr == SS3) {
else if(*ptr == SS3) {
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
@ -183,40 +159,32 @@ cvtminasi(int len)
}
}
void
cvtwakachi(CLREC *clrec)
{
int jlen;
u_char *ym;
void cvtwakachi(CLREC* clrec) {
int jlen;
u_char* ym;
int cnt;
u_char ch;
ym = inputyomi;
ym = inputyomi;
cnt = jlen = clrec -> jnode -> jlen;
while (cnt-- > 0) {
if (isknj1(*ym)) {
if (*ym == 0xa4) {
cnt = jlen = clrec->jnode->jlen;
while(cnt-- > 0) {
if(isknj1(*ym)) {
if(*ym == 0xa4) {
ch = *++ym;
if (0xa1 <= ch && ch <= 0xf3) {
if(0xa1 <= ch && ch <= 0xf3) {
*kanjitmp++ = 0xa5;
}
else {
} else {
*kanjitmp++ = 0xa4;
}
*kanjitmp++ = ch;
ym++;
}
else {
} else {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
}
}
else if (*ym == SS3) {
} else if(*ym == SS3) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
@ -225,20 +193,18 @@ cvtwakachi(CLREC *clrec)
}
}
cnt = clrec -> cllen - jlen;
while (cnt-- > 0) {
cnt = clrec->cllen - jlen;
while(cnt-- > 0) {
if (isknj1(*ym)) {
if(isknj1(*ym)) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
}
else if (*ym == SS3) {
else if(*ym == SS3) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
} else {
*kanjitmp++ = *ym++;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,179 +28,148 @@
*/
/*
* $SonyRCSfile: cvtkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: cvtkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:41 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
cvtphknj()
{
int i, j;
CLREC *clrec;
CLREC *clkp;
void cvtphknj() {
int i, j;
CLREC* clrec;
CLREC* clkp;
if (!kanjilen) goto not_enough_memory;
if(!kanjilen) goto not_enough_memory;
khcount = 0;
clkp = NULL;
clkp = NULL;
stdytop = NULL;
clrec = clt1st;
while (clrec) {
if (ph_khtbl(clrec)) clkp = clrec;
clrec = clrec -> clsort;
}
clrec = clt1st;
while(clrec) {
if(ph_khtbl(clrec)) clkp = clrec;
clrec = clrec->clsort;
}
if (clkp && stdytop) {
if (stdytop -> nmflg)
ph_setkouho(clkp, (TypeDicOfs)0, (STDYIN *)0);
}
if(clkp && stdytop) {
if(stdytop->nmflg)
ph_setkouho(clkp, (TypeDicOfs)0, (STDYIN*)0);
}
kouhotbl[0].rank = 1;
kanjitmp = kanjibuf + 1;
setstyrec(kouhotbl);
cvtkouho(kouhotbl);
i = kanjitmp - kanjibuf;
if (i < kanjilen) {
if(i < kanjilen) {
kanjilen -= i;
ystart += clt1st -> cllen;
ystart += clt1st->cllen;
j = hzstrlen(inputyomi, (int)clt1st -> cllen);
j = hzstrlen(inputyomi, (int)clt1st->cllen);
kanjibuf[0] = (u_char)j;
inputyomi += j;
memcpy(kanjipos, kanjibuf, i);
kanjipos += i;
}
else
} else
kanjilen = 0;
not_enough_memory:
free_clall(clt1st);
free_jall (jrt1st);
free_jall(jrt1st);
}
void cvtkouho(KHREC* krec) {
CLREC* clrec;
clrec = krec->clrec;
void
cvtkouho(KHREC *krec)
{
CLREC *clrec;
clrec = krec -> clrec;
switch (clrec -> jnode -> class) {
case C_DICT:
switch(clrec->jnode->class) {
case C_DICT:
cvtdict(krec, clrec, FALSE);
break;
case C_N_ARABIA:
case C_N_ARACMA:
case C_N_KAZU:
case C_N_SUUJI:
case C_N_NANSUU:
case C_N_KANKURA:
case C_N_ARAKURA:
case C_N_KAZULONG:
case C_N_KAZULCMA:
case C_N_SUUJILONG:
case C_N_ARABIA:
case C_N_ARACMA:
case C_N_KAZU:
case C_N_SUUJI:
case C_N_NANSUU:
case C_N_KANKURA:
case C_N_ARAKURA:
case C_N_KAZULONG:
case C_N_KAZULCMA:
case C_N_SUUJILONG:
cvtdict(krec, clrec, TRUE);
break;
case C_BUNSETU :
case C_MINASI :
cvtminasi((int)clrec -> cllen);
case C_BUNSETU:
case C_MINASI:
cvtminasi((int)clrec->cllen);
break;
case C_WAKACHI :
case C_WAKACHI:
cvtwakachi(clrec);
break;
}
*kanjitmp++ = 0;
}
void
setstyrec(KHREC *krec)
{
JREC *jrec;
KHREC *kptr;
void setstyrec(KHREC* krec) {
JREC* jrec;
KHREC* kptr;
int ii;
u_char *fptr;
STDYOUT stdy;
u_char* fptr;
STDYOUT stdy;
jrec = krec -> clrec -> jnode;
jrec = krec->clrec->jnode;
if (krec -> mode && !krec -> offs) {
for (ii = khcount, kptr = kouhotbl ; ii--; kptr++)
if (kptr -> rank == 1) break;
if(krec->mode && !krec->offs) {
stdy.stdy1.offset = kptr -> offs;
stdy.stdy1.seg = kptr -> clrec -> jnode -> jseg;
stdy.stdy1.styno = kptr -> styno;
stdy.stdy1.dicid = kptr -> clrec -> jnode -> dicid;
for(ii = khcount, kptr = kouhotbl; ii--; kptr++)
if(kptr->rank == 1) break;
stdy.stdy1.offset = kptr->offs;
stdy.stdy1.seg = kptr->clrec->jnode->jseg;
stdy.stdy1.styno = kptr->styno;
stdy.stdy1.dicid = kptr->clrec->jnode->dicid;
stdy.stdy1.nmflg = 1;
}
else {
stdy.stdy1.offset = krec -> offs;
stdy.stdy1.seg = jrec -> jseg;
stdy.stdy1.styno = krec -> styno;
stdy.stdy1.dicid = jrec -> dicid;
stdy.stdy1.offset = krec->offs;
stdy.stdy1.seg = jrec->jseg;
stdy.stdy1.styno = krec->styno;
stdy.stdy1.dicid = jrec->dicid;
stdy.stdy1.nmflg = 0;
}
stdy.stdy1.sttkj = krec -> sttkj;
stdy.stdy1.ka_kj = krec -> ka_kj;
stdy.hinshi = jrec -> hinsi;
stdy.len = jrec -> jlen;
stdy.sttfg = krec -> sttfg;
stdy.ka_fg = krec -> ka_fg;
stdy.stdy1.sttkj = krec->sttkj;
stdy.stdy1.ka_kj = krec->ka_kj;
stdy.hinshi = jrec->hinsi;
stdy.len = jrec->jlen;
stdy.sttfg = krec->sttfg;
stdy.ka_fg = krec->ka_fg;
if (jrec -> stbofs && (fptr = getstb(jrec -> hinsi)))
stdy.len -= StbYomiLen(fptr + jrec -> stbofs - 1);
if(jrec->stbofs && (fptr = getstb(jrec->hinsi)))
stdy.len -= StbYomiLen(fptr + jrec->stbofs - 1);
if (fptr = Settou_ptr(jrec -> sttofs))
if(fptr = Settou_ptr(jrec->sttofs))
stdy.sttlen = SttYomiLen(fptr);
else
stdy.sttlen = 0;
memcpy(kanjitmp, (u_char *)&stdy, sizeof(STDYOUT));
memcpy(kanjitmp, (u_char*)&stdy, sizeof(STDYOUT));
kanjitmp += sizeof(STDYOUT);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,81 +28,72 @@
*/
/*
* $SonyRCSfile: deldic.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: deldic.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:42 $
*/
#include <string.h>
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static int del_douon(TypeDicSeg, u_char *, TypeDicOfs);
static int del_segment(TypeDicSeg);
static int del_douon(TypeDicSeg, u_char*, TypeDicOfs);
static int del_segment(TypeDicSeg);
static void del_uidx(TypeDicSeg);
static void del_stdy(TypeDicSeg, TypeDicOfs, int);
u_int deldic(u_char* yomi, u_char* kanji, TypeGram hinsi) {
u_char yptr[MAXWDYOMILEN + 1];
u_char kptr[MAXWDKANJILEN + 1];
u_short err;
int knjlen;
TypeDicSeg useg;
TypeDicOfs ofs;
u_char * p1, *p2, *p3;
int dblknum;
int hblknum;
int kblknum;
int samlen;
u_char * stp, *edp;
int size, len;
u_int
deldic(u_char *yomi, u_char *kanji, TypeGram hinsi)
{
u_char yptr[MAXWDYOMILEN + 1];
u_char kptr[MAXWDKANJILEN + 1];
u_short err;
int knjlen;
TypeDicSeg useg;
TypeDicOfs ofs;
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)))
return err;
if (!curdict -> maxunit) return AD_NOTUSERDICT;
if(!curdict->maxunit) return AD_NOTUSERDICT;
knjlen = cvtknj(yomi, kanji, kptr);
cnvstart = yptr;
cnvlen = sstrlen(yptr);
cnvlen = sstrlen(yptr);
useg = srchidx((TypeDicSeg)DICSEGBASE, cnvlen);
(*curdict->getdic)(curdict, useg);
if (!(dblknum = srchkana(&p1, &samlen))) return AD_NOMIDASI;
if(!(dblknum = srchkana(&p1, &samlen))) return AD_NOMIDASI;
if (!(hblknum = srchgram(p1, &p2, hinsi))) return AD_NOHINSI;
if(!(hblknum = srchgram(p1, &p2, hinsi))) return AD_NOHINSI;
p3 = p2;
p3 = p2;
kblknum = srchkanji(&p3, kptr, knjlen);
if (*p3 == HINSIBLKTERM) return AD_NOKANJI;
if(*p3 == HINSIBLKTERM) return AD_NOKANJI;
ofs = p3 - dicbuf;
edp = skipkstr(p3);
if (kblknum == 1) {
if (hblknum == 1) {
if (dblknum == 1) {
if(kblknum == 1) {
if(hblknum == 1) {
if(dblknum == 1) {
return del_segment(useg);
}
else {
} else {
return del_douon(useg, p1, ofs);
}
}
else {
} else {
stp = p2;
edp++;
}
}
else {
} else {
stp = p3;
}
@ -115,7 +106,7 @@ deldic(u_char *yomi, u_char *kanji, TypeGram hinsi)
memset(edp, DICSEGTERM, dicbuf + curdict->seglen - edp);
set_size(p1, (int)(getsize(p1) - size),
(int)getplen(p1), (int)getnlen(p1));
(int)getplen(p1), (int)getnlen(p1));
(*curdict->putdic)(curdict, useg);
@ -124,30 +115,25 @@ deldic(u_char *yomi, u_char *kanji, TypeGram hinsi)
return AD_DONE;
}
static int
del_douon(TypeDicSeg seg, u_char *ptr, TypeDicOfs ofs)
{
u_char *nxt, *p1, *p2;
del_douon(TypeDicSeg seg, u_char* ptr, TypeDicOfs ofs) {
u_char *nxt, *p1, *p2;
int size;
int nlen, plen, len;
nxt = getntag(ptr);
if (segend(nxt)) {
if(segend(nxt)) {
size = nxt - ptr;
memset(ptr, DICSEGTERM, dicbuf + curdict->seglen - nxt);
}
else {
} else {
size = getsize(nxt);
nlen = getnlen(nxt);
plen = getplen(nxt);
if (ptr == segtop()) {
if (nlen + plen > (unsigned int) count_uidx()
+ sstrlen(get_idxptr(seg)))
if(ptr == segtop()) {
if(nlen + plen > (unsigned int)count_uidx() + sstrlen(get_idxptr(seg)))
return AD_OVFLWINDEX;
}
@ -163,7 +149,7 @@ del_douon(TypeDicSeg seg, u_char *ptr, TypeDicOfs ofs)
size = p1 - p2;
memset(dicbuf + curdict->seglen - size, DICSEGTERM, size);
if (ptr == segtop()) {
if(ptr == segtop()) {
chg_uidx(seg, ptr + DOUONBLKSIZENUMBER, nlen + len);
}
}
@ -175,25 +161,21 @@ del_douon(TypeDicSeg seg, u_char *ptr, TypeDicOfs ofs)
return AD_DONE;
}
static int
del_segment(TypeDicSeg seg)
{
int i;
STDYIN *styp;
TypeDicID dicid;
TypeStyNum stdynum;
TypeDicSeg sg;
del_segment(TypeDicSeg seg) {
int i;
STDYIN* styp;
TypeDicID dicid;
TypeStyNum stdynum;
TypeDicSeg sg;
if (curdict->segunit > 1) {
for (sg = seg + 1 ; sg < curdict->segunit ; sg++) {
if(curdict->segunit > 1) {
for(sg = seg + 1; sg < curdict->segunit; sg++) {
(*curdict->getdic)(curdict, sg);
(*curdict->putdic)(curdict, sg - 1);
}
curdict->segunit--;
}
else {
} else {
memset(dicbuf, DICSEGTERM, (int)curdict->seglen);
dicbuf[0] = 0;
(*curdict->putdic)(curdict, DICSEGBASE);
@ -203,28 +185,28 @@ del_segment(TypeDicSeg seg)
del_uidx(seg);
if (StudyExist()) {
if(StudyExist()) {
dicid = curdict->dicid;
for (i = 0, styp = STUDYDICT ; i < STUDYCOUNT ; ) {
if (styp -> dicid != dicid)
for(i = 0, styp = STUDYDICT; i < STUDYCOUNT;) {
if(styp->dicid != dicid)
;
else if (styp -> seg > seg)
styp -> seg -= 1;
else if (styp -> seg < seg)
else if(styp->seg > seg)
styp->seg -= 1;
else if(styp->seg < seg)
;
else {
stdynum = styp -> styno;
stdynum = styp->styno;
STUDYCOUNT--;
mvmemi((u_char *)(styp + 1), (u_char *)styp,
sizeof(*styp) * (STUDYCOUNT - i));
mvmemi((u_char*)(styp + 1), (u_char*)styp,
sizeof(*styp) * (STUDYCOUNT - i));
continue;
}
i++;
styp++;
}
for (i = 0, styp = STUDYDICT ; i < STUDYCOUNT ; i++, styp++)
if (styp -> styno > stdynum) styp -> styno -= 1;
for(i = 0, styp = STUDYDICT; i < STUDYCOUNT; i++, styp++)
if(styp->styno > stdynum) styp->styno -= 1;
putstydic();
}
@ -232,17 +214,13 @@ del_segment(TypeDicSeg seg)
return AD_DONE;
}
static void
del_uidx(TypeDicSeg seg)
{
u_char *p, *q;
del_uidx(TypeDicSeg seg) {
u_char *p, *q;
int len;
p = get_idxptr(seg);
for (q = p ; *q++; )
;
for(q = p; *q++;);
mvmemi(q, p, idxbuf + curdict->idxlen - q);
@ -254,41 +232,38 @@ del_uidx(TypeDicSeg seg)
mkidxtbl(curdict);
}
static void
del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size)
{
int i;
TypeStyNum stdynum;
STDYIN *stdy;
TypeDicID dicid;
del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size) {
int i;
TypeStyNum stdynum;
STDYIN* stdy;
TypeDicID dicid;
if (StudyExist()) {
if(StudyExist()) {
stdynum = 0;
dicid = curdict->dicid;
for (i = 0, stdy = STUDYDICT ; i < STUDYCOUNT ; ) {
if (stdy -> dicid != dicid)
dicid = curdict->dicid;
for(i = 0, stdy = STUDYDICT; i < STUDYCOUNT;) {
if(stdy->dicid != dicid)
;
else if (stdy -> seg != seg)
else if(stdy->seg != seg)
;
else if (stdy -> offset > ofs)
stdy -> offset -= size;
else if(stdy->offset > ofs)
stdy->offset -= size;
else if (stdy -> offset == ofs) {
stdynum = stdy -> styno;
else if(stdy->offset == ofs) {
stdynum = stdy->styno;
STUDYCOUNT--;
mvmemi((u_char *)(stdy + 1), (u_char *)stdy,
sizeof(*stdy) * (STUDYCOUNT - i));
mvmemi((u_char*)(stdy + 1), (u_char*)stdy,
sizeof(*stdy) * (STUDYCOUNT - i));
continue;
}
i++;
stdy++;
}
for (i = 0, stdy = STUDYDICT ; i < STUDYCOUNT ; i++, stdy++)
if (stdy -> styno > stdynum) (stdy -> styno)--;
for(i = 0, stdy = STUDYDICT; i < STUDYCOUNT; i++, stdy++)
if(stdy->styno > stdynum) (stdy->styno)--;
putstydic();
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,26 +28,20 @@
*/
/*
* $SonyRCSfile: dict.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: dict.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:45 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
get_askknj()
{
u_char *p;
u_char *q;
u_char *r;
void get_askknj() {
u_char* p;
u_char* q;
u_char* r;
int i = 0, csize;
int flg;
@ -55,34 +49,30 @@ get_askknj()
q += *p++;
while (p < q) {
while(p < q) {
askknj[i] = p;
r = NULL;
r = NULL;
flg = TRUE;
do {
csize = codesize(*p);
if (p[csize] == KANJISTREND) flg = FALSE;
if(p[csize] == KANJISTREND) flg = FALSE;
if (!r && (*p != AIATTRIBUTE))
if(!r && (*p != AIATTRIBUTE))
r = p;
p += csize;
} while (flg);
} while(flg);
p++;
askknj_k[i++] = r;
}
}
int seldict(TypeDicID id) {
DICTL* dp;
int
seldict(TypeDicID id)
{
DICTL *dp;
for (dp = dictlist ; dp ; dp = dp -> next) {
if ((curdict = dp -> dict) -> dicid == id)
for(dp = dictlist; dp; dp = dp->next) {
if((curdict = dp->dict)->dicid == id)
return TRUE;
}
curdict = NULL;
@ -90,11 +80,8 @@ seldict(TypeDicID id)
return FALSE;
}
u_char *
get_idxptr(TypeDicSeg seg)
{
u_char*
get_idxptr(TypeDicSeg seg) {
(*curdict->getofs)(curdict);
(*curdict->getidx)(curdict);

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,54 +28,44 @@
*/
/*
* $SonyRCSfile: functbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: functbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:46 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
VFunc 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
};
VFunc 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};
UCPFunc 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
};
UCPFunc 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};
IFunc 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
};
IFunc 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};
IFunc 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,
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb
};
IFunc 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,
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb};
u_char *makekan_1byte(), *makekan_knj(), *makekan_ofs();
u_char *makekan_norm(), *makekan_none();
UCPFunc 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,
makekan_knj, makekan_ofs, makekan_norm, makekan_none
};
u_char *makekan_1byte(), *makekan_knj(), *makekan_ofs();
u_char *makekan_norm(), *makekan_none();
UCPFunc 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,
makekan_knj, makekan_ofs, makekan_norm, makekan_none};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,15 +28,11 @@
*/
/*
* $SonyRCSfile: fuzoku.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: fuzoku.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:47 $
*/
#include "sj_kcnv.h"
#include "sj_hinsi.h"
#include "sj_right.h"
@ -45,31 +41,30 @@
#include "sj_kanakan.h"
static int
fzkstrcmp(u_char *yptr, u_char *fzkp, int *saml)
{
int asklen, nkrlen;
fzkstrcmp(u_char* yptr, u_char* fzkp, int* saml) {
int asklen, nkrlen;
asklen = FzkAskLen(fzkp);
if (*saml < asklen) return CONT;
if(*saml < asklen) return CONT;
if (*saml > asklen) return OVER;
if(*saml > asklen) return OVER;
nkrlen = FzkNkrLen(fzkp);
yptr += asklen;
fzkp ++;
fzkp++;
while (nkrlen--) {
if (*yptr > *fzkp)
while(nkrlen--) {
if(*yptr > *fzkp)
return CONT;
else if (*yptr < *fzkp) {
if (!*yptr) return PARTLY;
else if(*yptr < *fzkp) {
if(!*yptr) return PARTLY;
return OVER;
}
else{
else {
yptr++;
fzkp++;
(*saml)++;
@ -79,98 +74,90 @@ fzkstrcmp(u_char *yptr, u_char *fzkp, int *saml)
return MATCH;
}
void setclrec(JREC* jrec, u_char* yptr, TypeCnct right) {
CLREC* new;
TypeGram hinsi;
int len;
if(!(len = yptr - cnvstart)) return;
void
setclrec(JREC *jrec, u_char *yptr, TypeCnct right)
{
CLREC *new;
TypeGram hinsi;
int len;
if(len > MAXCLINPUTLEN) return;
if (!(len = yptr - cnvstart)) return;
if(!(new = argclrec(len))) return;
if (len > MAXCLINPUTLEN) return;
new->jnode = jrec;
new->gobiln = gobilen;
new->right = right;
new->fzk_ka = fzk_ka_flg;
(jrec->count)++;
if (!(new = argclrec(len))) return;
hinsi = jrec->hinsi;
new -> jnode = jrec;
new -> gobiln = gobilen;
new -> right = right;
new -> fzk_ka = fzk_ka_flg;
(jrec -> count)++;
if(hinsi >= DO_SAHEN && hinsi <= SP_KA_ONB)
new->kubun = K_DOUSHI;
hinsi = jrec -> hinsi;
if (hinsi >= DO_SAHEN && hinsi <= SP_KA_ONB)
new -> kubun = K_DOUSHI;
else if ((hinsi >= KEIYOUSI_1 && hinsi <= KE_DOUSI_9) ||
(hinsi == SP_KEIYOUSI)){
else if((hinsi >= KEIYOUSI_1 && hinsi <= KE_DOUSI_9) ||
(hinsi == SP_KEIYOUSI)) {
if(right == R_FZKMEISI)
new -> kubun = K_TAIGEN;
new->kubun = K_TAIGEN;
else
new -> kubun = K_YOUGEN;
new->kubun = K_YOUGEN;
}
else if (hinsi == RENTAISI)
new -> kubun = K_RENTAISI;
else if(hinsi == RENTAISI)
new->kubun = K_RENTAISI;
else if ((hinsi >= FUKUSI_1 && hinsi <= FUKUSI_9) ||
(hinsi == SP_FUKUSI))
new -> kubun = K_FUKUSI;
else if((hinsi >= FUKUSI_1 && hinsi <= FUKUSI_9) ||
(hinsi == SP_FUKUSI))
new->kubun = K_FUKUSI;
else if (hinsi == SETUZOKU || hinsi==KANDOUSI ||
hinsi == TANKANJI || hinsi==AISATU)
new -> kubun = K_SONOTA;
else if(hinsi == SETUZOKU || hinsi == KANDOUSI ||
hinsi == TANKANJI || hinsi == AISATU)
new->kubun = K_SONOTA;
else if (gobilen) {
if (hinsi >= MEISI_5 && hinsi <= MEISI_7)
new -> kubun = K_DOUSHI;
else if(gobilen) {
if(hinsi >= MEISI_5 && hinsi <= MEISI_7)
new->kubun = K_DOUSHI;
else if (hinsi == D_MEISI_4)
new -> kubun = K_DOUSHI;
else if(hinsi == D_MEISI_4)
new->kubun = K_DOUSHI;
else if (hinsi == SETUBI_7 || hinsi == SETUBI_8)
new -> kubun = K_DOUSHI;
else if(hinsi == SETUBI_7 || hinsi == SETUBI_8)
new->kubun = K_DOUSHI;
else if(hinsi == D_MEISI_5)
new->kubun = K_YOUGEN;
else if (hinsi == D_MEISI_5)
new -> kubun = K_YOUGEN;
else if (hinsi == SETUBI_5 || hinsi == SETUBI_6)
new -> kubun = K_YOUGEN;
else if(hinsi == SETUBI_5 || hinsi == SETUBI_6)
new->kubun = K_YOUGEN;
else
new -> kubun = K_TAIGEN;
}
else if (hinsi >= MEISI_5 && hinsi <= MEISI_7) {
if (right >= R_I && right <= R_ITADAKE)
new -> kubun = K_DOUSHI;
new->kubun = K_TAIGEN;
} else if(hinsi >= MEISI_5 && hinsi <= MEISI_7) {
if(right >= R_I && right <= R_ITADAKE)
new->kubun = K_DOUSHI;
else if (right >= R_DESHI && right <= R_TAI)
new -> kubun = K_DOUSHI;
else if(right >= R_DESHI && right <= R_TAI)
new->kubun = K_DOUSHI;
else if (right >= R_NAI && right <= R_MEIREI2)
new -> kubun = K_DOUSHI;
else if(right >= R_NAI && right <= R_MEIREI2)
new->kubun = K_DOUSHI;
else if (right == R_TE2 || right == R_TERU)
new -> kubun = K_DOUSHI;
else if(right == R_TE2 || right == R_TERU)
new->kubun = K_DOUSHI;
else
new -> kubun = K_TAIGEN;
}
else
new -> kubun = K_TAIGEN;
new->kubun = K_TAIGEN;
} else
new->kubun = K_TAIGEN;
}
static int
fzkcnct(TypeCnct right, TypeCnct left)
{
u_char *cncttbl;
fzkcnct(TypeCnct right, TypeCnct left) {
u_char* cncttbl;
if (right && left) {
if(right && left) {
cncttbl = Rigtadr(right);
left--;
if (cncttbl[left >> 3] << (left & 0x07) & 0x80)
if(cncttbl[left >> 3] << (left & 0x07) & 0x80)
return TRUE;
}
@ -178,95 +165,91 @@ fzkcnct(TypeCnct right, TypeCnct left)
}
RECURS
void
srchfzk(JREC *jrec, u_char *yptr, TypeCnct right, int level)
{
u_char *fzk;
int len = 0;
int cmp;
u_char *next;
FREC *fzkrec;
int i;
int nlen;
TypeCnct rt;
void srchfzk(JREC* jrec, u_char* yptr, TypeCnct right, int level) {
u_char* fzk;
int len = 0;
int cmp;
u_char* next;
FREC* fzkrec;
int i;
int nlen;
TypeCnct rt;
if ((level >= MAXFLVL) && !(Chrtbl[*yptr] & FZK_KGU)) return;
if (terminate(right, yptr) && Chrtbl[*yptr] & FZK_KGU){
if (!level) fzk_ka_flg = 0;
if((level >= MAXFLVL) && !(Chrtbl[*yptr] & FZK_KGU)) return;
if(terminate(right, yptr) && Chrtbl[*yptr] & FZK_KGU) {
if(!level) fzk_ka_flg = 0;
yptr++;
while (Chrtbl[*yptr] & FZK_KGU) yptr++;
while(Chrtbl[*yptr] & FZK_KGU) yptr++;
setclrec(jrec, yptr, (TypeCnct)R_FZKKGU);
return;
}
if (right == R_CUT) return;
if (!*yptr) return;
if (!(*yptr >= _XA && *yptr <= _NN)) return;
if(right == R_CUT) return;
if(!*yptr) return;
if(!(*yptr >= _XA && *yptr <= _NN)) return;
fzkrec = fzktbl;
for (i = fzkcount ; i ; i--, fzkrec++) {
if (yptr != fzkrec -> yomip) continue;
fzk = fzkrec -> fzkp;
for(i = fzkcount; i; i--, fzkrec++) {
if(yptr != fzkrec->yomip) continue;
fzk = fzkrec->fzkp;
len = FzkAskLen(fzk) + (nlen = FzkNkrLen(fzk)) + 1;
if (!fzkcnct(right, (TypeCnct)FzkLeft(fzk))) continue;
if (!level) fzk_ka_flg = FzkStrKa(fzk);
if(!fzkcnct(right, (TypeCnct)FzkLeft(fzk))) continue;
if(!level) fzk_ka_flg = FzkStrKa(fzk);
next = yptr + len;
if (terminate(rt = FzkRight(fzk), next)) {
if(terminate(rt = FzkRight(fzk), next)) {
setclrec(jrec, next, rt);
}
srchfzk(jrec, next, rt, level + 1);
}
if (len) return;
if(len) return;
if(!(fzk = Fzkadr(*yptr - _XA))) return;
if (!(fzk = Fzkadr(*yptr - _XA))) return;
yptr++;
for ( ; *fzk != FZKEND ; fzk += nlen + (i ? 4 : 3)) {
nlen = FzkNkrLen(fzk);
i = FzkHasCode(fzk);
for(; *fzk != FZKEND; fzk += nlen + (i ? 4 : 3)) {
nlen = FzkNkrLen(fzk);
i = FzkHasCode(fzk);
cmp = fzkstrcmp(yptr, fzk, &len);
if (cmp == OVER)
if(cmp == OVER)
break;
else if (cmp == PARTLY)
else if(cmp == PARTLY)
break;
else if ((cmp != MATCH) || isdpnd(*(yptr + len)))
else if((cmp != MATCH) || isdpnd(*(yptr + len)))
continue;
fzktbl[fzkcount].yomip = yptr - 1;
fzktbl[fzkcount].fzkp = fzk;
fzktbl[fzkcount].yomip = yptr - 1;
fzktbl[fzkcount].fzkp = fzk;
fzkcount++;
if (!fzkcnct(right, (TypeCnct)FzkLeft(fzk))) continue;
if(!fzkcnct(right, (TypeCnct)FzkLeft(fzk))) continue;
if(!level) fzk_ka_flg = FzkStrKa(fzk);
if (!level) fzk_ka_flg = FzkStrKa(fzk);
next = yptr + len;
if (terminate(rt = FzkRight(fzk), next)) {
if(terminate(rt = FzkRight(fzk), next)) {
setclrec(jrec, next, rt);
}
srchfzk(jrec, next, rt, level + 1);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,69 +28,61 @@
*/
/*
* $SonyRCSfile: getkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: getkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:49 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static u_char *code2kanji();
static u_char* code2kanji();
u_char *
getkan_none(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
u_char*
getkan_none(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
return d;
}
u_char *
getkan_hira(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
int cnt, csize;
u_char*
getkan_hira(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
int cnt, csize;
csize = codesize(*s);
cnt = (*s & KANJICODEMASK) + 1;
cnt = (*s & KANJICODEMASK) + 1;
if (flg && (s[csize] == KANJISTREND)) ym += (yl - cnt) * 2;
if(flg && (s[csize] == KANJISTREND)) ym += (yl - cnt) * 2;
cnt *= 2;
while (cnt-- > 0) *d++ = *ym++;
while(cnt-- > 0) *d++ = *ym++;
return d;
}
u_char *
getkan_kata(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
int cnt, csize;
u_char ch;
u_char*
getkan_kata(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
int cnt, csize;
u_char ch;
csize = codesize(*s);
cnt = (*s & KANJICODEMASK) + 1;
cnt = (*s & KANJICODEMASK) + 1;
if (flg && (s[csize] == KANJISTREND)) ym += (yl - cnt) * 2;
if(flg && (s[csize] == KANJISTREND)) ym += (yl - cnt) * 2;
while (cnt-- > 0) {
if (*ym == 0xa4) {
while(cnt-- > 0) {
if(*ym == 0xa4) {
ch = *++ym;
if (0xa1 <= ch && ch <= 0xf3) {
if(0xa1 <= ch && ch <= 0xf3) {
*d++ = 0xa5;
}
else {
} else {
*d++ = 0xa4;
}
*d++ = ch;
ym++;
}
else {
} else {
*d++ = *ym++;
*d++ = *ym++;
}
@ -99,104 +91,108 @@ getkan_kata(u_char *s, u_char *d, u_char *ym, int yl, int flg)
return d;
}
u_char *
getkan_knj(u_char *s, u_char *d, u_char *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);
}
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),
d, ym, yl, 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),
d, ym, yl, flg);
}
u_char *
getkan_norm(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
u_char*
getkan_norm(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
u_char c;
if (*s != 0) {
if(*s != 0) {
c = s[1];
if (c & 0x80)
*d++ = SS3;
if(c & 0x80)
*d++ = SS3;
*d++ = *s | 0x80;
*d++ = c | 0x80;
*d++ = c | 0x80;
} else {
*d++ = *s;
}
return d;
}
u_char *
getkan_ascii(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
u_char*
getkan_ascii(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
u_char c;
c = s[1];
if (c & 0x80)
*d++ = SS2;
if(c & 0x80)
*d++ = SS2;
*d++ = c;
return d;
}
static u_char *
code2kanji(u_char *s, u_char *d, u_char *ym, int yl, int flg)
{
static u_char*
code2kanji(u_char* s, u_char* d, u_char* ym, int yl, int flg) {
int csize;
for ( ; ; ) {
for(;;) {
csize = codesize(*s);
if (s[csize] == KANJISTREND) {
if(s[csize] == KANJISTREND) {
switch(*s & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
d = getkan_hira(s, d, ym, yl, flg); break;
case ZENHIRAASSYUKU:
d = getkan_hira(s, d, ym, yl, flg);
break;
case ZENKATAASSYUKU:
d = getkan_kata(s, d, ym, yl, flg); break;
case ZENKATAASSYUKU:
d = getkan_kata(s, d, ym, yl, flg);
break;
case OFFSETASSYUKU:
d = getkan_ofs(s, d, ym, yl, flg); break;
case OFFSETASSYUKU:
d = getkan_ofs(s, d, ym, yl, flg);
break;
case AIATTRIBUTE:
d = getkan_none(s, d, ym, yl, flg); break;
case AIATTRIBUTE:
d = getkan_none(s, d, ym, yl, flg);
break;
case LEADINGHANKAKU:
d = getkan_ascii(s, d, ym, yl, flg); break;
case LEADINGHANKAKU:
d = getkan_ascii(s, d, ym, yl, flg);
break;
case KANJIASSYUKU:
d = getkan_knj(s, d, ym, yl, flg); break;
case KANJIASSYUKU:
d = getkan_knj(s, d, ym, yl, flg);
break;
default:
d = getkan_norm(s, d, ym, yl, flg);
default:
d = getkan_norm(s, d, ym, yl, flg);
}
break;
}
else
} else
switch(*s & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
d = getkan_hira(s, d, ym, yl, FALSE); break;
case ZENHIRAASSYUKU:
d = getkan_hira(s, d, ym, yl, FALSE);
break;
case ZENKATAASSYUKU:
d = getkan_kata(s, d, ym, yl, FALSE); break;
case ZENKATAASSYUKU:
d = getkan_kata(s, d, ym, yl, FALSE);
break;
case OFFSETASSYUKU:
d = getkan_ofs(s, d, ym, yl, FALSE); break;
case OFFSETASSYUKU:
d = getkan_ofs(s, d, ym, yl, FALSE);
break;
case AIATTRIBUTE:
d = getkan_none(s, d, ym, yl, FALSE); break;
case AIATTRIBUTE:
d = getkan_none(s, d, ym, yl, FALSE);
break;
case LEADINGHANKAKU:
d = getkan_ascii(s, d, ym, yl, FALSE); break;
case LEADINGHANKAKU:
d = getkan_ascii(s, d, ym, yl, FALSE);
break;
case KANJIASSYUKU:
d = getkan_knj(s, d, ym, yl, FALSE); break;
case KANJIASSYUKU:
d = getkan_knj(s, d, ym, yl, FALSE);
break;
default:
default:
d = getkan_norm(s, d, ym, yl, FALSE);
}
@ -206,15 +202,10 @@ code2kanji(u_char *s, u_char *d, u_char *ym, int yl, int flg)
return d;
}
int
getkanji(u_char *ym, int yl, u_char *ptr, u_char *buf)
{
u_char *q;
int getkanji(u_char* ym, int yl, u_char* ptr, u_char* buf) {
u_char* q;
q = code2kanji(ptr, buf, ym, yl, TRUE);
return q - buf;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,164 +28,126 @@
*/
/*
* $SonyRCSfile: getrank.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: getrank.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:50 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static void setstynum(), setnspr(), regetrank();
static void setstynum(), setnspr(), regetrank();
void getrank() {
void
getrank()
{
trank = nrank = 1;
setstynum();
regetrank();
}
static void
setstynum()
{
KHREC *kptr;
STDYIN *sptr;
setstynum() {
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);
for(kptr = kouhotbl, count = khcount; count--; kptr++) {
if (!sptr) continue;
sptr = srchstdy(kptr->clrec->jnode->jseg, kptr->offs,
kptr->clrec->jnode->dicid);
setnspr(kptr, sptr);
if(!sptr) continue;
setnspr(kptr, sptr);
}
}
static void
setnspr(KHREC *kptr, STDYIN *sptr)
{
KHREC *ptr;
int keepnm;
TypeStyNum styno;
setnspr(KHREC* kptr, STDYIN* sptr) {
KHREC* ptr;
int keepnm;
TypeStyNum styno;
styno = kptr -> styno = sptr -> styno;
styno = kptr->styno = sptr->styno;
keepnm = trank;
for (ptr = kouhotbl ; ptr < kptr ; ptr++) {
for(ptr = kouhotbl; ptr < kptr; ptr++) {
if (styno < ptr -> styno) {
ptr -> rank++;
if(styno < ptr->styno) {
ptr->rank++;
keepnm--;
}
else if (styno == ptr -> styno) {
else if(styno == ptr->styno) {
if (kptr -> sttfg && kptr -> ka_fg) {
if ((sptr -> sttkj == kptr -> sttkj) &&
(sptr -> ka_kj == kptr -> ka_kj)) {
ptr -> rank++;
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++;
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++;
else if(kptr->ka_fg) {
if(sptr->ka_kj == kptr->ka_kj) {
ptr->rank++;
keepnm--;
}
}
}
}
kptr -> rank = (u_char)keepnm;
kptr->rank = (u_char)keepnm;
trank++;
if (keepnm <= nrank) nrank++;
if(keepnm <= nrank) nrank++;
if (sptr -> nmflg && (nrank > keepnm)) nrank = keepnm;
if(sptr->nmflg && (nrank > keepnm)) nrank = keepnm;
}
static void
regetrank()
{
KHREC *kptr;
int count;
int tmp;
regetrank() {
KHREC* kptr;
int count;
int tmp;
if(nrank < trank) {
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 = (u_char)tmp++;
}
else
kptr -> rank = (u_char)trank++;
for(count = khcount, kptr = kouhotbl; count--; kptr++) {
if(!(kptr->rank)) {
if(tmp && kptr->mode && !(kptr->offs)) {
kptr->rank = (u_char)tmp++;
} else
kptr->rank = (u_char)trank++;
}
else if ((short)kptr -> rank >= nrank)
kptr -> rank += (u_char)nkhcount;
else if((short)kptr->rank >= nrank)
kptr->rank += (u_char)nkhcount;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,13 +28,11 @@
*/
/*
* $SonyRCSfile: global.c,v $
* $SonyRevision: 1.2 $
* $SonyRCSfile: global.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/12/09 11:27:06 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_rename.h"
@ -48,11 +46,10 @@
#include "sj_kanakan.h"
Global *global_work_base;
Global* global_work_base;
Global *work_base;
Global* work_base;
STDY *stdy_base;
int serv_errno;
STDY* stdy_base;
int serv_errno;

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: hzstrlen.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: hzstrlen.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:52 $
*/
@ -41,28 +41,24 @@
#include "sj_kanakan.h"
int
euc_codesize(u_char c)
{
if ((c & KANJIMODEMASK) == 0x90) {
int euc_codesize(u_char c) {
if((c & KANJIMODEMASK) == 0x90) {
return 1;
} else if (isknj1(c)) {
} else if(isknj1(c)) {
return 2;
} else if (c == SS3) {
} else if(c == SS3) {
return 3;
} else {
return 1;
}
}
int
hzstrlen(u_char *ptr, int len)
{
u_char *head;
int hzstrlen(u_char* ptr, int len) {
u_char* head;
head = ptr;
while (len-- > 0) ptr += euc_codesize(*ptr);
while(len-- > 0) ptr += euc_codesize(*ptr);
return (ptr - head);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,45 +28,39 @@
*/
/*
* $SonyRCSfile: init.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: init.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:54 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
seg_count(DICT *dict)
{
u_char *p;
u_char *q;
TypeDicSeg segcnt = 0;
void seg_count(DICT* dict) {
u_char* p;
u_char* q;
TypeDicSeg segcnt = 0;
if (dict-> getidx) {
if(dict->getidx) {
(*dict->getidx)(dict);
p = idxbuf;
q = p + dict->idxlen;
while (p < q && *p) {
while(p < q && *p) {
segcnt++;
while (*p++) ;
while(*p++);
}
}
dict->segunit = (segcnt == 0) ? 1 : segcnt;
}
void
mkidxtbl(DICT *dict)
{
u_char *p;
TypeDicSeg seg;
void mkidxtbl(DICT* dict) {
u_char* p;
TypeDicSeg seg;
if (!dict->getidx || !dict->getofs) return;
if(!dict->getidx || !dict->getofs) return;
seg = 0;
@ -74,16 +68,13 @@ mkidxtbl(DICT *dict)
(*dict->getofs)(dict);
idxofs[0] = 0;
for (p = idxbuf ; p < idxbuf + dict->idxlen && seg < dict->segunit ; ) {
for(p = idxbuf; p < idxbuf + dict->idxlen && seg < dict->segunit;) {
idxofs[seg++] = p - idxbuf;
while (*p++) ;
while(*p++);
}
}
void
initwork()
{
jrt1st = jrt2nd = maxjptr = (JREC *)0;
clt1st = clt2nd = maxclptr = (CLREC *)0;
void initwork() {
jrt1st = jrt2nd = maxjptr = (JREC*)0;
clt1st = clt2nd = maxclptr = (CLREC*)0;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,31 +28,27 @@
*/
/*
* $SonyRCSfile: istrcmp.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: istrcmp.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:55 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_const.h"
#include "sj_kanakan.h"
int
istrcmp(u_char *yomip, u_char *idxp, int ylen, int ilen)
{
for (;;) {
int istrcmp(u_char* yomip, u_char* idxp, int ylen, int ilen) {
for(;;) {
if ((ilen | ylen) == 0) return MATCH;
if((ilen | ylen) == 0) return MATCH;
if (ilen == 0) return UNDER;
if(ilen == 0) return UNDER;
if ((ylen == 0) || (*yomip < *idxp)) return OVER;
if((ylen == 0) || (*yomip < *idxp)) return OVER;
if (*yomip > *idxp) return UNDER;
if(*yomip > *idxp) return UNDER;
yomip++;
idxp++;
@ -60,4 +56,3 @@ istrcmp(u_char *yomip, u_char *idxp, int ylen, int ilen)
ilen--;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,33 +28,29 @@
*/
/*
* $SonyRCSfile: memory.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: memory.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:58 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
JREC *
free_jlst(JREC *p)
{
JREC *jpk;
JREC *jp;
JREC *jn;
JREC* free_jlst(JREC* p) {
JREC* jpk;
JREC* jp;
JREC* jn;
jp = NULL;
for ( ; p ; p = jn) {
for(; p; p = jn) {
jn = p -> jsort;
jn = p->jsort;
if (p -> count) {
if (jp)
jp -> jsort = p;
if(p->count) {
if(jp)
jp->jsort = p;
else
jpk = p;
jp = p;
@ -65,36 +61,33 @@ free_jlst(JREC *p)
}
}
if (jp) jp -> jsort = NULL;
if(jp) jp->jsort = NULL;
return jpk;
}
CLREC *
free_clst(CLREC *p, int l)
{
CLREC *cpk;
CLREC *cp;
CLREC *cn;
CLREC*
free_clst(CLREC* p, int l) {
CLREC* cpk;
CLREC* cp;
CLREC* cn;
cp = cpk = NULL;
for ( ; p ; p = cn) {
for(; p; p = cn) {
cn = p -> clsort;
cn = p->clsort;
if ((int)p -> cllen == l) {
if (p == selcl) {
if (cp) {
p -> clsort = cpk;
cpk = p;
}
else
if((int)p->cllen == l) {
if(p == selcl) {
if(cp) {
p->clsort = cpk;
cpk = p;
} else
cpk = cp = p;
}
else {
if (cp)
cp -> clsort = p;
} else {
if(cp)
cp->clsort = p;
else
cpk = p;
cp = p;
@ -102,49 +95,42 @@ free_clst(CLREC *p, int l)
}
else {
(p -> jnode -> count)--;
(p->jnode->count)--;
free_clrec(p);
}
}
if (cp) cp -> clsort = NULL;
if(cp) cp->clsort = NULL;
return cpk;
}
void
free_clall(CLREC *p)
{
CLREC *next;
void free_clall(CLREC* p) {
CLREC* next;
while (p) {
(p -> jnode -> count)--;
next = p -> clsort;
while(p) {
(p->jnode->count)--;
next = p->clsort;
free_clrec(p);
p = next;
}
}
void
free_jall(JREC *p)
{
JREC *next;
void free_jall(JREC* p) {
JREC* next;
while (p) {
next = p -> jsort;
while(p) {
next = p->jsort;
free_jrec(p);
p = next;
}
}
void
freework()
{
void freework() {
free_clall(maxclptr);
clt1st = maxclptr = NULL;
free_jall(maxjptr);
jrt1st = maxjptr = NULL;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,47 +28,42 @@
*/
/*
* $SonyRCSfile: mk2claus.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mk2claus.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:00 $
*/
#include "sj_kcnv.h"
#include "sj_right.h"
#include "sj_kanakan.h"
static int
set2nd(CLREC *clrec)
{
set2nd(CLREC* clrec) {
CLREC *rec2;
CLREC* rec2;
mkjiritu(DO_IKKATU | DO_CLSTUDY);
mkbunsetu();
if (!maxclptr) {
if(!maxclptr) {
wakachi();
return clrec -> cllen;
return clrec->cllen;
}
for (rec2 = maxclptr ; rec2 ; rec2 = rec2 -> clsort) {
if (terminate(rec2->right, cnvstart+rec2->cllen) != SHU)
for(rec2 = maxclptr; rec2; rec2 = rec2->clsort) {
if(terminate(rec2->right, cnvstart + rec2->cllen) != SHU)
break;
}
return rec2 ? (clrec -> cllen + rec2 -> cllen) : (clrec -> cllen);
return rec2 ? (clrec->cllen + rec2->cllen) : (clrec->cllen);
}
void
mk2claus()
{
u_char *keepptr;
void mk2claus() {
u_char* keepptr;
int keeplen;
CLREC *clrec;
CLREC* clrec;
int len;
int save2ln;
int prty;
@ -79,16 +74,16 @@ mk2claus()
prty = maxprty = prty2 = 0;
clt2nd = maxclptr = NULL;
jrt2nd = maxjptr = NULL;
jrt2nd = maxjptr = NULL;
selcl = clt1st;
if (selcl -> right == R_FZKKGU) {
if(selcl->right == R_FZKKGU) {
pritiny();
return;
}
if (cnvlen == selcl -> cllen) {
if(cnvlen == selcl->cllen) {
pritiny();
return;
}
@ -97,13 +92,13 @@ mk2claus()
keeplen = cnvlen;
len = count = 0;
for (clrec = selcl ; clrec && count < 5 ; clrec = clrec -> clsort) {
for(clrec = selcl; clrec && count < 5; clrec = clrec->clsort) {
cnvstart = keepptr + clrec -> cllen;
cnvlen = keeplen - clrec -> cllen;
cnvstart = keepptr + clrec->cllen;
cnvlen = keeplen - clrec->cllen;
if (len != clrec -> cllen) {
if (clt2nd != maxclptr) {
if(len != clrec->cllen) {
if(clt2nd != maxclptr) {
free_clall(maxclptr);
free_jall(maxjptr);
}
@ -111,37 +106,37 @@ mk2claus()
save2ln = set2nd(clrec);
count++;
len = clrec -> cllen;
len = clrec->cllen;
prty2 = 0;
}
if (Termtbl[clrec -> right] & T_SHUUJO)
clrec -> cl2len = (u_char)len;
if(Termtbl[clrec->right] & T_SHUUJO)
clrec->cl2len = (u_char)len;
else
clrec -> cl2len = (u_char)save2ln;
clrec->cl2len = (u_char)save2ln;
if (selcl -> cl2len > clrec -> cl2len) continue;
if(selcl->cl2len > clrec->cl2len) continue;
prty = priority(clrec) - prty2;
prty2++;
if (selcl -> cl2len == clrec -> cl2len) {
if (clrec -> cllen == nextcllen) {
if (selcl -> cllen != nextcllen)
if(selcl->cl2len == clrec->cl2len) {
if(clrec->cllen == nextcllen) {
if(selcl->cllen != nextcllen)
;
else if (prty <= maxprty)
else if(prty <= maxprty)
continue;
}
else if (prty <= maxprty)
else if(prty <= maxprty)
continue;
}
selcl = clrec;
selcl = clrec;
maxprty = prty;
if (clt2nd == maxclptr) continue;
if(clt2nd == maxclptr) continue;
free_clall(clt2nd);
free_jall(jrt2nd);
@ -149,14 +144,13 @@ mk2claus()
clt2nd = maxclptr;
}
if (clt2nd != maxclptr) {
if(clt2nd != maxclptr) {
free_clall(maxclptr);
maxclptr = NULL;
maxclptr = NULL;
free_jall(maxjptr);
maxjptr = NULL;
maxjptr = NULL;
}
cnvstart = keepptr;
cnvlen = keeplen;
cnvlen = keeplen;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,29 +28,25 @@
*/
/*
* $SonyRCSfile: mkbunset.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mkbunset.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:02 $
*/
#include "sj_kcnv.h"
#include "sj_hinsi.h"
#include "sj_kanakan.h"
void
mkbunsetu()
{
JREC *jrec;
TypeGram hinsi;
u_char *cnj;
CREC crec[4];
int count;
TypeCnct right;
u_char *next;
int i;
void mkbunsetu() {
JREC* jrec;
TypeGram hinsi;
u_char* cnj;
CREC crec[4];
int count;
TypeCnct right;
u_char* next;
int i;
fzkcount = 0;
@ -58,18 +54,18 @@ mkbunsetu()
jrec = maxjptr;
while (jrec) {
while(jrec) {
if (jrec -> stbofs && (cnj = getstb(jrec -> hinsi)))
hinsi = StbHinsi(cnj + jrec -> stbofs - 1);
if(jrec->stbofs && (cnj = getstb(jrec->hinsi)))
hinsi = StbHinsi(cnj + jrec->stbofs - 1);
else
hinsi = jrec -> hinsi;
hinsi = jrec->hinsi;
if (right = Connadr[hinsi]) {
if(right = Connadr[hinsi]) {
gobilen = 0;
next = cnvstart + jrec->jlen;
next = cnvstart + jrec->jlen;
if (terminate(right, next)) {
if(terminate(right, next)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
}
@ -77,15 +73,15 @@ mkbunsetu()
srchfzk(jrec, next, right, 0);
}
else if (count = setconj(hinsi, jrec, crec)) {
else if(count = setconj(hinsi, jrec, crec)) {
for (i = count ; i-- > 0 ; ) {
for(i = count; i-- > 0;) {
right = crec[i].right;
right = crec[i].right;
gobilen = crec[i].len;
next = cnvstart + jrec->jlen + gobilen;
next = cnvstart + jrec->jlen + gobilen;
if (terminate(right, next)) {
if(terminate(right, next)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
}
@ -94,73 +90,68 @@ mkbunsetu()
}
}
jrec = jrec -> jsort;
jrec = jrec->jsort;
}
}
CLREC *
argclrec(int len)
{
CLREC *ptr;
CLREC *rec;
CLREC *child;
CLREC*
argclrec(int len) {
CLREC* ptr;
CLREC* rec;
CLREC* child;
rec = alloc_clrec();
if (!rec) {
if (!maxclptr)
if(!rec) {
if(!maxclptr)
return NULL;
ptr = NULL;
rec = maxclptr;
while (child = rec -> clsort) {
while(child = rec->clsort) {
ptr = rec;
rec = child;
}
if (len <= (int) rec -> cllen)
if(len <= (int)rec->cllen)
return NULL;
if (ptr)
ptr -> clsort = NULL;
if(ptr)
ptr->clsort = NULL;
else
maxclptr = NULL;
if (rec -> jnode) (rec -> jnode)--;
if(rec->jnode) (rec->jnode)--;
}
memset((u_char *)rec, 0, sizeof(*rec));
rec -> cllen = rec -> cl2len = (u_char)len;
memset((u_char*)rec, 0, sizeof(*rec));
rec->cllen = rec->cl2len = (u_char)len;
if (!maxclptr) {
if(!maxclptr) {
maxclptr = rec;
return rec;
}
ptr = maxclptr;
if (((int)ptr -> cllen < len) ||
(((int)ptr -> cllen == len) &&
(ptr -> jnode -> hinsi == TANKANJI))) {
rec -> clsort = maxclptr;
maxclptr = rec;
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 &&
child->jnode->hinsi == TANKANJI)){
ptr -> clsort = rec;
rec -> clsort = child;
while(child = ptr->clsort) {
if((int)child->cllen < len ||
((int)child->cllen == len &&
child->jnode->hinsi == TANKANJI)) {
ptr->clsort = rec;
rec->clsort = child;
return rec;
}
else
} else
ptr = child;
}
ptr -> clsort = rec;
ptr->clsort = rec;
return rec;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,26 +28,23 @@
*/
/*
* $SonyRCSfile: mkjiritu.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mkjiritu.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:03 $
*/
#include <string.h>
#include "sj_kcnv.h"
#include "sj_kanakan.h"
static void dic_mu(), dic_cl();
static void dic_mu(), dic_cl();
void
mkjiritu(int mode)
{
void mkjiritu(int mode) {
u_char chkind1;
u_char chkind2;
JREC *jrec;
u_char *stb;
JREC* jrec;
u_char* stb;
headcode = headlen = 0;
@ -55,25 +52,25 @@ mkjiritu(int mode)
chkind1 = Chrtbl[*cnvstart];
if (chkind1 & DICTOP) {
if(chkind1 & DICTOP) {
dic_mu(mode);
}
if (mode & DO_CLSTUDY) dic_cl();
if(mode & DO_CLSTUDY) dic_cl();
srchnum();
if (srchhead() && cnvlen != headlen) {
if(srchhead() && cnvlen != headlen) {
cnvstart += headlen;
cnvlen -= headlen;
chkind2 = Chrtbl[*cnvstart];
if (chkind2 & DICTOP) {
if(chkind2 & DICTOP) {
dic_mu(mode);
}
if (headcode == SETTOU_DAI) {
if(headcode == SETTOU_DAI) {
srchnum();
}
@ -81,109 +78,105 @@ mkjiritu(int mode)
cnvlen += headlen;
}
for (jrec = maxjptr ; jrec ; jrec = jrec -> jsort) {
if (stb = getstb(jrec -> hinsi))
for(jrec = maxjptr; jrec; jrec = jrec->jsort) {
if(stb = getstb(jrec->hinsi))
setubi(jrec, stb);
}
}
static void
dic_mu(int mode)
{
u_char *tagp;
DICTL *dp;
dic_mu(int mode) {
u_char* tagp;
DICTL* dp;
for (dp = dictlist ; dp ; dp = dp -> next) {
curdict = dp -> dict;
dicinl = 1;
for(dp = dictlist; dp; dp = dp->next) {
curdict = dp->dict;
dicinl = 1;
dicsaml = 0;
prevseg = -1;
while (tagp = srchdict(tagp)) setjrec(tagp, mode);
while(tagp = srchdict(tagp)) setjrec(tagp, mode);
}
}
JREC *
argjrec(int len, JREC *rec)
{
JREC *ptr;
JREC *jrec;
JREC *child;
JREC* argjrec(int len, JREC* rec) {
JREC* ptr;
JREC* jrec;
JREC* child;
jrec = alloc_jrec();
if (!jrec) {
if (!maxjptr) return NULL;
if(!jrec) {
if(!maxjptr) return NULL;
ptr = NULL;
ptr = NULL;
jrec = maxjptr;
while (child = jrec -> jsort) {
while(child = jrec->jsort) {
ptr = jrec;
jrec = child;
}
if (len <= (int) jrec -> jlen) return NULL;
if(len <= (int)jrec->jlen) return NULL;
if (ptr)
ptr -> jsort = NULL;
if(ptr)
ptr->jsort = NULL;
else
maxjptr = NULL;
}
if (rec)
memcpy((u_char *)jrec, (u_char *)rec, sizeof(JREC));
if(rec)
memcpy((u_char*)jrec, (u_char*)rec, sizeof(JREC));
else
memset((u_char *)jrec, 0, sizeof(*jrec));
jrec -> jlen = (u_char)len;
memset((u_char*)jrec, 0, sizeof(*jrec));
jrec->jlen = (u_char)len;
if (!maxjptr) {
maxjptr = jrec;
jrec -> jsort = NULL;
if(!maxjptr) {
maxjptr = jrec;
jrec->jsort = NULL;
return jrec;
}
ptr = maxjptr;
if ((int)ptr -> jlen < len) {
jrec -> jsort = maxjptr;
maxjptr = jrec;
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) {
if((int)child->jlen < len) break;
ptr = child;
}
ptr -> jsort = jrec;
jrec -> jsort = child;
ptr->jsort = jrec;
jrec->jsort = child;
return jrec;
}
static void
dic_cl()
{
u_char *p;
u_short pos;
dic_cl() {
u_char* p;
u_short pos;
int len;
int cmp;
if (!StudyExist()) return;
if(!StudyExist()) return;
if ((pos = CLSTUDYIDX[(short) *cnvstart / CLSTUDYSTEP]) != (u_short)-1) {
if((pos = CLSTUDYIDX[(short)*cnvstart / CLSTUDYSTEP]) != (u_short)-1) {
for (p = CLSTUDYDICT + pos ; !iseocl(p) ; p = ClNextTag(p)) {
cmp = sstrncmp(cnvstart, (u_char *)ClYomiPos(p),
len = ClYomiLen(p));
for(p = CLSTUDYDICT + pos; !iseocl(p); p = ClNextTag(p)) {
cmp = sstrncmp(cnvstart, (u_char*)ClYomiPos(p),
len = ClYomiLen(p));
if (cmp == MATCH) {
if (!isdpnd(*(cnvstart + len))) {
if(cmp == MATCH) {
if(!isdpnd(*(cnvstart + len))) {
setcrec(p);
}
}
else if (cmp == OVER)
else if(cmp == OVER)
break;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,14 +28,11 @@
*/
/*
* $SonyRCSfile: mkkouho.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mkkouho.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:04 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_hinsi.h"
@ -44,39 +41,34 @@
#include "sj_kanakan.h"
static void getkhtbl(), cl_kanji();
static int diffknj();
static void cl_numcmn();
static u_char *makekan();
static void getkhtbl(), cl_kanji();
static int diffknj();
static void cl_numcmn();
static u_char* makekan();
void
mkkouho()
{
CLREC *clrec;
int keeplen;
void mkkouho() {
CLREC* clrec;
int keeplen;
khcount = nkhcount = 0;
keeplen = clt1st -> cllen;
keeplen = clt1st->cllen;
clrec = clt1st;
do {
getkhtbl(clrec);
clrec = clrec -> clsort;
} while (clrec && (keeplen == clrec -> cllen));
clrec = clrec->clsort;
} while(clrec && (keeplen == clrec->cllen));
}
static void
getkhtbl(CLREC *clrec)
{
JREC *jrec;
getkhtbl(CLREC* clrec) {
JREC* jrec;
jrec = clrec -> jnode;
jrec = clrec->jnode;
switch (jrec -> class) {
switch(jrec->class) {
case C_DICT:
cl_kanji(jrec, clrec);
break;
@ -101,162 +93,148 @@ getkhtbl(CLREC *clrec)
}
}
static void
cl_kanji(JREC *jrec, CLREC *clrec)
{
u_char *ptr;
cl_kanji(JREC* jrec, CLREC* clrec) {
u_char* ptr;
int kcount = khcount;
if (seldict(jrec -> dicid)) {
(*curdict->getdic)(curdict, jrec -> jseg);
if(seldict(jrec->dicid)) {
(*curdict->getdic)(curdict, jrec->jseg);
ptr = dicbuf + jrec->jofsst + 1;
get_askknj();
while (*ptr != HINSIBLKTERM) {
if (diffknj(jrec, ptr, kcount)) {
while(*ptr != HINSIBLKTERM) {
if(diffknj(jrec, ptr, kcount)) {
setkouho(clrec, (TypeDicOfs)(ptr - dicbuf), 0);
}
ptr = skipkstr(ptr);
}
}
else {
} else {
setkouho(clrec, (TypeDicOfs)1, 0);
}
}
u_char *
makekan_none(u_char *s, u_char *d, int flg)
{
u_char*
makekan_none(u_char* s, u_char* d, int flg) {
return d;
}
u_char *
makekan_1byte(u_char *s, u_char *d, int flg)
{
if ((*s & KANJIMODEMASK) == ZENHIRAASSYUKU)
*d++ = 0x10 | (*s & KNJASSYUKUMASK);
u_char*
makekan_1byte(u_char* s, u_char* d, int flg) {
if((*s & KANJIMODEMASK) == ZENHIRAASSYUKU)
*d++ = 0x10 | (*s & KNJASSYUKUMASK);
else
*d++ = 0x90 | (*s & KNJASSYUKUMASK);
*d++ = 0x90 | (*s & KNJASSYUKUMASK);
if (flg) *d++ = KANJISTREND;
if(flg) *d++ = KANJISTREND;
return d;
}
u_char *
makekan_knj(u_char *s, u_char *d, int flg)
{
u_char*
makekan_knj(u_char* s, u_char* d, int flg) {
return makekan(askknj[*s & KNJASSYUKUMASK], d, flg);
}
u_char *makekan_ofs(u_char *s, u_char *d, int flg)
{
return makekan(dicbuf + ((*s & KANJICODEMASK) << 8) + *(s + 1),
d, flg);
u_char* makekan_ofs(u_char* s, u_char* d, int flg) {
return makekan(dicbuf + ((*s & KANJICODEMASK) << 8) + *(s + 1),
d, flg);
}
u_char *
makekan_norm(u_char *s, u_char *d, int flg)
{
u_char*
makekan_norm(u_char* s, u_char* d, int flg) {
u_char c;
if (*s != 0) {
if(*s != 0) {
c = s[1];
if (c & 0x80)
*d++ = SS3;
if(c & 0x80)
*d++ = SS3;
*d++ = *s | 0x80;
*d++ = c | 0x80;
*d++ = c | 0x80;
} else {
*d++ = *s;
}
if (flg) *d++ = KANJISTREND;
if(flg) *d++ = KANJISTREND;
return d;
}
u_char *
makekan_ascii(u_char *s, u_char *d, int flg)
{
u_char*
makekan_ascii(u_char* s, u_char* d, int flg) {
u_char c;
c = s[1];
if (c & 0x80)
*d++ = SS2;
if(c & 0x80)
*d++ = SS2;
*d++ = c;
if (flg) *d++ = KANJISTREND;
if(flg) *d++ = KANJISTREND;
return d;
}
static u_char *
makekan(u_char *s, u_char *d, int flg)
{
static u_char*
makekan(u_char* s, u_char* d, int flg) {
int csize;
for ( ; ; ) {
for(;;) {
csize = codesize(*s);
if (s[csize] == KANJISTREND) {
if(s[csize] == KANJISTREND) {
switch(*s & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
d = makekan_1byte(s, d, flg); break;
case ZENHIRAASSYUKU:
d = makekan_1byte(s, d, flg);
break;
case ZENKATAASSYUKU:
d = makekan_1byte(s, d, flg); break;
case ZENKATAASSYUKU:
d = makekan_1byte(s, d, flg);
break;
case OFFSETASSYUKU:
d = makekan_ofs(s, d, flg); break;
case OFFSETASSYUKU:
d = makekan_ofs(s, d, flg);
break;
case AIATTRIBUTE:
d = makekan_none(s, d, flg); break;
case AIATTRIBUTE:
d = makekan_none(s, d, flg);
break;
case LEADINGHANKAKU:
d = makekan_ascii(s, d, flg); break;
case LEADINGHANKAKU:
d = makekan_ascii(s, d, flg);
break;
case KANJIASSYUKU:
d = makekan_knj(s, d, flg); break;
case KANJIASSYUKU:
d = makekan_knj(s, d, flg);
break;
default:
default:
d = makekan_norm(s, d, flg);
}
break;
}
else
} else
switch(*s & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
d = makekan_1byte(s, d, FALSE); break;
case ZENHIRAASSYUKU:
d = makekan_1byte(s, d, FALSE);
break;
case ZENKATAASSYUKU:
d = makekan_1byte(s, d, FALSE); break;
case ZENKATAASSYUKU:
d = makekan_1byte(s, d, FALSE);
break;
case OFFSETASSYUKU:
d = makekan_ofs(s, d, FALSE); break;
case OFFSETASSYUKU:
d = makekan_ofs(s, d, FALSE);
break;
case AIATTRIBUTE:
d = makekan_none(s, d, FALSE); break;
case AIATTRIBUTE:
d = makekan_none(s, d, FALSE);
break;
case LEADINGHANKAKU:
d = makekan_ascii(s, d, FALSE); break;
case LEADINGHANKAKU:
d = makekan_ascii(s, d, FALSE);
break;
case KANJIASSYUKU:
d = makekan_knj(s, d, FALSE); break;
case KANJIASSYUKU:
d = makekan_knj(s, d, FALSE);
break;
default:
default:
d = makekan_norm(s, d, FALSE);
}
s += codesize(*s);
@ -265,138 +243,124 @@ makekan(u_char *s, u_char *d, int flg)
return d;
}
#define PEND 2
#define QEND 1
#define PEND 2
#define QEND 1
static int
sameknj(u_char *p, u_char plen, u_char *q, u_char qlen)
{
int i;
int j;
int endf = 0;
int brkf;
sameknj(u_char* p, u_char plen, u_char* q, u_char qlen) {
int i;
int j;
int endf = 0;
int brkf;
do {
if ((i = euc_codesize(*p)) != euc_codesize(*q)) return FALSE;
if((i = euc_codesize(*p)) != euc_codesize(*q)) return FALSE;
brkf = 0;
for (j = 0; j < i; j++) {
if (p[j] != q[j] ) {
for(j = 0; j < i; j++) {
if(p[j] != q[j]) {
brkf = 1;
break;
}
}
if (brkf) break;
if(brkf) break;
if (p[i] == KANJISTREND) endf += PEND;
if (q[i] == KANJISTREND) endf += QEND;
if(p[i] == KANJISTREND) endf += PEND;
if(q[i] == KANJISTREND) endf += QEND;
p += i;
q += i;
} while (!endf);
} while(!endf);
switch (endf) {
case (PEND | QEND):
if (plen == qlen) return TRUE;
switch(endf) {
case(PEND | QEND):
if(plen == qlen) return TRUE;
break;
case PEND:
i = plen;
i = plen;
plen = qlen;
qlen = i;
p = q;
p = q;
case QEND:
if (p[euc_codesize(*p)] != KANJISTREND) break;
if ((*p & KANJIMODEMASK) != 0x10 ) break;
if (qlen != plen - (*p & KANJICODEMASK) - 1) break;
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;
if ((*q & KANJIMODEMASK) != 0x10 ) break;
if ((*p & KANJIMODEMASK) != 0x10 ) break;
if (plen - (*p & KANJICODEMASK) != qlen - (*q & KANJICODEMASK))
if(q[euc_codesize(*q)] != KANJISTREND) break;
if(p[euc_codesize(*p)] != KANJISTREND) break;
if((*q & KANJIMODEMASK) != 0x10) break;
if((*p & KANJIMODEMASK) != 0x10) break;
if(plen - (*p & KANJICODEMASK) != qlen - (*q & KANJICODEMASK))
break;
return TRUE;
}
return FALSE;
}
#undef PEND
#undef QEND
#undef PEND
#undef QEND
static int
diffknj(JREC *jrec, u_char *ptr, int num)
{
KHREC *kptr;
JREC *jptr;
int i;
u_char kbuf1[MAXWDKANJILEN];
u_char kbuf2[MAXWDKANJILEN];
diffknj(JREC* jrec, u_char* ptr, int num) {
KHREC* kptr;
JREC* jptr;
int i;
u_char kbuf1[MAXWDKANJILEN];
u_char kbuf2[MAXWDKANJILEN];
if (jrec -> hinsi == TANKANJI) return TRUE;
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)
for(i = 0, kptr = kouhotbl; i < num; i++, kptr++) {
if((jptr = kptr->clrec->jnode) == jrec)
return FALSE;
if (jptr -> hinsi == TANKANJI) continue;
if(jptr->hinsi == TANKANJI) continue;
if (jptr -> class != jrec -> class) continue;
if(jptr->class != jrec->class) continue;
if (jptr -> dicid != jrec -> dicid) continue;
if(jptr->dicid != jrec->dicid) continue;
if (jptr -> jseg != jrec -> jseg) continue;
if(jptr->jseg != jrec->jseg) continue;
if (jptr -> sttofs != jrec -> sttofs) continue;
if(jptr->sttofs != jrec->sttofs) continue;
if (jptr -> stbofs != jrec -> stbofs) continue;
if(jptr->stbofs != jrec->stbofs) continue;
makekan(dicbuf + kptr -> offs, kbuf2, TRUE);
makekan(dicbuf + kptr->offs, kbuf2, TRUE);
if (sameknj(kbuf1, jrec -> jlen, kbuf2, jptr -> jlen))
if(sameknj(kbuf1, jrec->jlen, kbuf2, jptr->jlen))
return FALSE;
}
return TRUE;
}
static int
chrck_numtbl(u_short flg, u_short cond)
{
u_short must;
chrck_numtbl(u_short flg, u_short cond) {
u_short must;
if (cond = SelNumCond(cond)) {
if (must = (cond & SELNUMMUST)) {
if ((flg & must) != must) return FALSE;
if(cond = SelNumCond(cond)) {
if(must = (cond & SELNUMMUST)) {
if((flg & must) != must) return FALSE;
cond &= ~must;
}
if (cond && !(cond & flg)) return FALSE;
if(cond && !(cond & flg)) return FALSE;
}
return TRUE;
}
int sel_sjmode(JREC* jrec) {
u_short i;
u_short* p;
u_short* q;
int
sel_sjmode(JREC *jrec)
{
u_short i;
u_short *p;
u_short *q;
switch (jrec -> class) {
switch(jrec->class) {
case C_N_ARABIA:
case C_N_ARACMA:
case C_N_KAZU:
@ -414,52 +378,47 @@ sel_sjmode(JREC *jrec)
return SELARB;
}
while ((i = *p++) != SELNUMTERM) {
if (chrck_numtbl(jrec -> flags, i)) break;
while((i = *p++) != SELNUMTERM) {
if(chrck_numtbl(jrec->flags, i)) break;
}
if (i == SELNUMTERM) i = *q;
if(i == SELNUMTERM) i = *q;
return SelNumFunc(i);
}
static void
cl_numcmn(JREC *jrec, CLREC *clrec)
{
u_char *p;
int i;
u_short j;
u_short *tbl;
cl_numcmn(JREC* jrec, CLREC* clrec) {
u_char* p;
int i;
u_short j;
u_short* tbl;
p = cnvstart;
if ((i = jrec -> sttofs) == SETTOU_DAI)
if((i = jrec->sttofs) == SETTOU_DAI)
p += SttYomiLen(Settou_ptr(i));
else if (i == SETTOU_KIGOU)
else if(i == SETTOU_KIGOU)
p++;
if (jrec -> jofsst) {
if(jrec->jofsst) {
i = sel_sjmode(jrec);
if (seldict(jrec -> dicid)) {
(*curdict->getdic)(curdict, jrec -> jseg);
if(seldict(jrec->dicid)) {
(*curdict->getdic)(curdict, jrec->jseg);
p = dicbuf + jrec->jofsst + 1;
while (*p != HINSIBLKTERM) {
while(*p != HINSIBLKTERM) {
setkouho(clrec, (TypeDicOfs)(p - dicbuf), i);
p = skipkstr(p);
}
}
else {
} else {
setkouho(clrec, (TypeDicOfs)1, i);
}
}
else {
} else {
tbl = Selsjadrs(jrec->class - C_N_ARABIA);
while ((j = *tbl++) != SELNUMTERM) {
if (!chrck_numtbl(jrec -> flags, j)) continue;
while((j = *tbl++) != SELNUMTERM) {
if(!chrck_numtbl(jrec->flags, j)) continue;
setkouho(clrec, (TypeDicOfs)0, (int)SelNumFunc(j));
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,15 +28,11 @@
*/
/*
* $SonyRCSfile: mknumber.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mknumber.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:05 $
*/
#include "sj_kcnv.h"
#include "sj_yomi.h"
#include "sj_suuji.h"
@ -44,32 +40,31 @@
#include "sj_kanakan.h"
static int
word2char(u_short wd, u_char *tbl, int keta, int flg)
{
word2char(u_short wd, u_char* tbl, int keta, int flg) {
int mask;
int num;
u_char *src;
u_char* src;
for (mask = 0x1000 ; mask ; mask >>= 4) {
switch (num = (unsigned int)wd / mask) {
for(mask = 0x1000; mask; mask >>= 4) {
switch(num = (unsigned int)wd / mask) {
case 0:
break;
case _NUM0:
if (!flg) break;
if(!flg) break;
default:
src = tbl + (num - _NUM0) * 2;
src = tbl + (num - _NUM0) * 2;
*kanjitmp++ = *src++;
*kanjitmp++ = *src;
flg = TRUE;
flg = TRUE;
if (keta && !(keta % 3)) {
if(keta && !(keta % 3)) {
*kanjitmp++ = COMMAHIGH;
*kanjitmp++ = COMMALOW;
}
}
if (keta) keta--;
if(keta) keta--;
wd &= (mask - 1);
}
@ -77,300 +72,250 @@ word2char(u_short wd, u_char *tbl, int keta, int flg)
}
static void
words2num(u_short *wd, u_char *tbl, int flgc)
{
words2num(u_short* wd, u_char* tbl, int flgc) {
int i;
int keta;
int flg;
u_char *kp = kanjitmp;
u_char* kp = kanjitmp;
if (flgc) {
if(flgc) {
keta = NUMKETALENGTH - 1;
flg = FALSE;
}
else {
flg = FALSE;
} else {
keta = 0;
flg = TRUE;
flg = TRUE;
}
for (i = NUMWORDBUF ; i-- > 0 ; ) {
for(i = NUMWORDBUF; i-- > 0;) {
flg = word2char(*(wd + i), tbl, keta, flg);
if (keta) keta -= 4;
if(keta) keta -= 4;
}
if (kp == kanjitmp) {
if(kp == kanjitmp) {
*kanjitmp++ = *tbl++;
*kanjitmp++ = *tbl;
}
}
void
num_type00(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type00(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num1tbl, FALSE);
}
void
num_type01(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type01(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num1tbl, FALSE);
}
void
num_type02(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type02(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num1tbl, TRUE);
}
void
num_type03(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type03(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num2tbl, FALSE);
}
void
num_type04(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type04(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num2tbl, FALSE);
}
void
num_type05(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type05(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num2tbl, TRUE);
}
void
num_type06(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type06(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num3tbl, FALSE);
}
void
num_type07(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type07(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
words2num(num, Num3tbl, FALSE);
}
static void
kan_num(u_short *wd, u_char *tbl1, u_char *tbl2)
{
kan_num(u_short* wd, u_char* tbl1, u_char* tbl2) {
int ii;
u_short tmp;
u_short tmp;
int mask;
int num;
int flg;
u_char *kurai1;
u_char *kurai2;
u_char *src;
u_char *keep = kanjitmp;
u_char* kurai1;
u_char* kurai2;
u_char* src;
u_char* keep = kanjitmp;
kurai2 = Num6tbl - 2;
mask = 0;
mask = 0;
wd += NUMWORDBUF - 1;
flg = FALSE;
for (ii = NUMKETALENGTH ; ii-- > 0 ; ) {
if (!mask) {
if (flg) {
for(ii = NUMKETALENGTH; ii-- > 0;) {
if(!mask) {
if(flg) {
*kanjitmp++ = *kurai2++;
*kanjitmp++ = *kurai2++;
}
else
} else
kurai2 += 2;
mask = 0x1000;
tmp = *wd--;
flg = FALSE;
mask = 0x1000;
tmp = *wd--;
flg = FALSE;
kurai1 = tbl2;
}
if ((num = (unsigned int)tmp / mask) > _NUM0) {
if ((num != _NUM1) || !*kurai1) {
src = tbl1 + (num - _NUM0) * 2;
if((num = (unsigned int)tmp / mask) > _NUM0) {
if((num != _NUM1) || !*kurai1) {
src = tbl1 + (num - _NUM0) * 2;
*kanjitmp++ = *src++;
*kanjitmp++ = *src;
}
if (*kurai1) {
if(*kurai1) {
*kanjitmp++ = *kurai1++;
*kanjitmp++ = *kurai1++;
}
flg = TRUE;
}
else
} else
kurai1 += 2;
tmp &= (mask - 1);
mask >>= 4;
}
if (kanjitmp == keep) {
if(kanjitmp == keep) {
*kanjitmp++ = *tbl1++;
*kanjitmp++ = *tbl1;
}
}
void
num_type08(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type08(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
kan_num(num, Num2tbl, Num4tbl);
}
void
num_type09(u_char *s1, u_char *s2, JREC *jrec)
{
u_short num[NUMWORDBUF];
void num_type09(u_char* s1, u_char* s2, JREC* jrec) {
u_short num[NUMWORDBUF];
setwdnum(s1, (int)jrec -> numlen, num);
setwdnum(s1, (int)jrec->numlen, num);
kan_num(num, Num3tbl, Num5tbl);
}
void num_type10(u_char* s1, u_char* s2, JREC* jrec) {
int i;
void
num_type10(u_char *s1, u_char *s2, JREC *jrec)
{
int i;
for (i = jrec -> numlen ; i > 0 ; i--) {
if (Chrtbl[*s1++] & NUMBER) {
for(i = jrec->numlen; i > 0; i--) {
if(Chrtbl[*s1++] & NUMBER) {
*kanjitmp++ = *s2++;
*kanjitmp++ = *s2++;
}
else
} else
s2 += euc_codesize(*s2);
}
}
void num_type11(u_char* s1, u_char* s2, JREC* jrec) {
int i;
int j;
i = j = jrec->numlen;
if(!(Chrtbl[*(s1 + j - 4)] & NUMBER)) j -= (j - 1) / 4;
void
num_type11(u_char *s1, u_char *s2, JREC *jrec)
{
int i;
int j;
i = j = jrec -> numlen;
if (!(Chrtbl[*(s1 + j - 4)] & NUMBER)) j -= (j - 1) / 4;
for ( ; i > 0 ; i--) {
if (Chrtbl[*s1++] & NUMBER) {
for(; i > 0; i--) {
if(Chrtbl[*s1++] & NUMBER) {
*kanjitmp++ = *s2++;
*kanjitmp++ = *s2++;
if (--j > 0) {
if ((j % 3) == 0) {
if(--j > 0) {
if((j % 3) == 0) {
*kanjitmp++ = COMMAHIGH;
*kanjitmp++ = COMMALOW;
}
}
}
else
} else
s2 += euc_codesize(*s2);
}
}
void num_type12(u_char* s1, u_char* s2, JREC* jrec) {
int i;
int j;
void
num_type12(u_char *s1, u_char *s2, JREC *jrec)
{
int i;
int j;
for (i = jrec -> numlen ; i > 0 ; i--) {
if (Chrtbl[j = *s1++] & NUMBER) {
j = (j - N_0) * 2;
for(i = jrec->numlen; i > 0; i--) {
if(Chrtbl[j = *s1++] & NUMBER) {
j = (j - N_0) * 2;
*kanjitmp++ = Num2tbl[j];
*kanjitmp++ = Num2tbl[j + 1];
}
}
}
static void
num_kurai(u_char *p, int len, u_char *tbl)
{
int i;
int j;
u_char tmp;
num_kurai(u_char* p, int len, u_char* tbl) {
int i;
int j;
u_char tmp;
for (i = 0 ; i < len ; i++) {
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)) {
*kanjitmp++ = Num4tbl[j = (3 - j) * 2];
*kanjitmp++ = Num4tbl[j + 1];
}
if (j = ((tmp >> 6) & 3)) {
if(j = ((tmp >> 6) & 3)) {
*kanjitmp++ = Num6tbl[j = (3 - j) * 2];
*kanjitmp++ = Num6tbl[j + 1];
}
}
}
void num_type13(u_char* s1, u_char* s2, JREC* jrec) {
u_char num[NUMKETALENGTH];
int len;
void
num_type13(u_char *s1, u_char *s2, JREC *jrec)
{
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(u_char* s1, u_char* s2, JREC* jrec) {
u_char num[NUMKETALENGTH];
int len;
void
num_type14(u_char *s1, u_char *s2, JREC *jrec)
{
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);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,21 +28,16 @@
*/
/*
* $SonyRCSfile: mvmemd.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mvmemd.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:05 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
void
mvmemd(u_char *src, u_char *dest, int len)
{
while (len-- > 0) *(--dest) = *(--src);
void mvmemd(u_char* src, u_char* dest, int len) {
while(len-- > 0) *(--dest) = *(--src);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,21 +28,16 @@
*/
/*
* $SonyRCSfile: mvmemi.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: mvmemi.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:06 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
void
mvmemi(u_char *src, u_char *dest, int len)
{
while (len-- > 0) *dest++ = *src++;
void mvmemi(u_char* src, u_char* dest, int len) {
while(len-- > 0) *dest++ = *src++;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,29 +28,24 @@
*/
/*
* $SonyRCSfile: peepdic.c,v $
* $SonyRevision: 1.2 $
* $SonyRCSfile: peepdic.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1995/07/21 05:22:51 $
*/
#include "sj_kcnv.h"
#include "sj_yomi.h"
#include "sj_kanakan.h"
static int prev_kanji(), prev_hinsi(), prev_douon();
static int next_kanji(), next_hinsi(), next_douon();
static void set_kanji(), set_buf(), add_yomi();
static void set_idxyomi();
static int prev_kanji(), prev_hinsi(), prev_douon();
static int next_kanji(), next_hinsi(), next_douon();
static void set_kanji(), set_buf(), add_yomi();
static void set_idxyomi();
static void cd2sjh_chr(u_char ch, u_char *dst);
static void cd2sjh_chr(u_char ch, u_char* dst);
int
getusr(u_char *buf)
{
int getusr(u_char* buf) {
int nlen;
peepyomi[0] = peepknj[0] = peepgrm = 0;
@ -60,12 +55,12 @@ getusr(u_char *buf)
peepdptr = segtop();
if (segend(peepdptr)) return 0;
if(segend(peepdptr)) return 0;
add_yomi();
nlen = getnlen(peepdptr);
peephptr = peepdptr + DOUONBLKSIZENUMBER + nlen;
nlen = getnlen(peepdptr);
peephptr = peepdptr + DOUONBLKSIZENUMBER + nlen;
peepgrm = *peephptr;
@ -78,13 +73,11 @@ getusr(u_char *buf)
return -1;
}
int
nextusr(u_char *buf)
{
int nextusr(u_char* buf) {
(*curdict->getdic)(curdict, peepidx);
get_askknj();
if (next_kanji()) {
if(next_kanji()) {
set_kanji();
set_buf(buf);
@ -95,13 +88,11 @@ nextusr(u_char *buf)
return 0;
}
int
prevusr(u_char *buf)
{
int prevusr(u_char* buf) {
(*curdict->getdic)(curdict, peepidx);
get_askknj();
if (prev_kanji()) {
if(prev_kanji()) {
set_kanji();
set_buf(buf);
@ -113,27 +104,25 @@ prevusr(u_char *buf)
}
static void
set_kanji()
{
int len;
set_kanji() {
int len;
len = getkanji(peepyomi, getnlen(peepdptr) + getplen(peepdptr),
peepkptr, peepknj);
len = getkanji(peepyomi, getnlen(peepdptr) + getplen(peepdptr),
peepkptr, peepknj);
*(peepknj + len) = 0;
}
static void
set_buf(u_char *buf)
{
u_char *p;
int i, csize;
set_buf(u_char* buf) {
u_char* p;
int i, csize;
for (p = peepyomi ; *p ; ) *buf++ = *p++;
for(p = peepyomi; *p;) *buf++ = *p++;
*buf++ = 0;
for (p = peepknj ; *p ; ) {
for(p = peepknj; *p;) {
csize = euc_codesize(*p);
for (i = 0; i < csize; i++ ) *buf++ = *p++;
for(i = 0; i < csize; i++) *buf++ = *p++;
}
*buf++ = 0;
@ -142,45 +131,43 @@ set_buf(u_char *buf)
}
static int
prev_kanji()
{
u_char *p1;
u_char *p2;
prev_kanji() {
u_char* p1;
u_char* p2;
p1 = peephptr + 1;
if (peepkptr <= p1) return prev_hinsi();
if(peepkptr <= p1) return prev_hinsi();
p2 = peepkptr;
while (p1 < p2) {
while(p1 < p2) {
peepkptr = p1;
p1 = skipkstr(p1);
p1 = skipkstr(p1);
}
return -1;
}
static int
prev_hinsi()
{
u_char *p1;
u_char *p2;
int nlen;
prev_hinsi() {
u_char* p1;
u_char* p2;
int nlen;
nlen = getnlen(peepdptr);
p1 = peepdptr + DOUONBLKSIZENUMBER + nlen;
p1 = peepdptr + DOUONBLKSIZENUMBER + nlen;
if (peephptr <= p1) return prev_douon();
if(peephptr <= p1) return prev_douon();
p2 = peephptr;
while (p1 < p2) {
while(p1 < p2) {
peephptr = p1;
p1 = skiphblk(p1);
p1 = skiphblk(p1);
}
peepgrm = *peephptr;
p1 = peephptr + 1;
while (*p1 != HINSIBLKTERM) {
while(*p1 != HINSIBLKTERM) {
peepkptr = p1;
p1 = skipkstr(p1);
@ -190,14 +177,13 @@ prev_hinsi()
}
static int
prev_douon()
{
u_char *p1;
u_char *p2;
int nlen;
prev_douon() {
u_char* p1;
u_char* p2;
int nlen;
if (peepdptr <= segtop()) {
if (peepidx <= DICSEGBASE) return 0;
if(peepdptr <= segtop()) {
if(peepidx <= DICSEGBASE) return 0;
(*curdict->getdic)(curdict, --peepidx);
get_askknj();
@ -211,9 +197,8 @@ prev_douon()
add_yomi();
p1 = getntag(p1);
} while (!segend(p1));
}
else {
} while(!segend(p1));
} else {
set_idxyomi();
p1 = segtop();
@ -224,17 +209,17 @@ prev_douon()
add_yomi();
p1 = getntag(p1);
} while (p1 < p2);
} while(p1 < p2);
}
nlen = getnlen(peepdptr);
p1 = peepdptr + DOUONBLKSIZENUMBER + nlen;
p1 = peepdptr + DOUONBLKSIZENUMBER + nlen;
p2 = getntag(peepdptr);
do {
peephptr = p1;
p1 = skiphblk(p1);
} while (p1 < p2);
p1 = skiphblk(p1);
} while(p1 < p2);
peepgrm = *peephptr;
@ -243,19 +228,18 @@ prev_douon()
peepkptr = p1;
p1 = skipkstr(p1);
} while (*p1 != HINSIBLKTERM);
} while(*p1 != HINSIBLKTERM);
return -1;
}
static int
next_kanji()
{
u_char *p1;
next_kanji() {
u_char* p1;
p1 = skipkstr(peepkptr);
if (*p1 == HINSIBLKTERM) return next_hinsi();
if(*p1 == HINSIBLKTERM) return next_hinsi();
peepkptr = p1;
@ -263,13 +247,12 @@ next_kanji()
}
static int
next_hinsi()
{
u_char *p1;
next_hinsi() {
u_char* p1;
p1 = skiphblk(peephptr);
if (p1 >= getntag(peepdptr)) return next_douon();
if(p1 >= getntag(peepdptr)) return next_douon();
peephptr = p1;
@ -281,32 +264,29 @@ next_hinsi()
}
static int
next_douon()
{
u_char *p1;
int nlen;
next_douon() {
u_char* p1;
int nlen;
p1 = getntag(peepdptr);
if (segend(p1)) {
if (peepidx + 1 < curdict->segunit) {
if(segend(p1)) {
if(peepidx + 1 < curdict->segunit) {
(*curdict->getdic)(curdict, ++peepidx);
get_askknj();
peepdptr = segtop();
set_idxyomi();
}
else
return 0;
}
else {
} else
return 0;
} else {
peepdptr = p1;
}
add_yomi();
nlen = getnlen(peepdptr);
peephptr = peepdptr + DOUONBLKSIZENUMBER + nlen;
nlen = getnlen(peepdptr);
peephptr = peepdptr + DOUONBLKSIZENUMBER + nlen;
peepgrm = *peephptr;
@ -316,13 +296,12 @@ next_douon()
}
static void
set_idxyomi()
{
u_char *p1, *p2;
set_idxyomi() {
u_char *p1, *p2;
if (p2 = get_idxptr(peepidx)) {
if(p2 = get_idxptr(peepidx)) {
p1 = peepyomi;
while (*p2) {
while(*p2) {
cd2sjh_chr(*p2++, p1);
p1 += 2;
}
@ -331,10 +310,9 @@ set_idxyomi()
}
static void
add_yomi()
{
add_yomi() {
int nlen;
u_char *p1, *p2;
u_char *p1, *p2;
nlen = getnlen(peepdptr);
@ -342,7 +320,7 @@ add_yomi()
p2 = peepdptr + DOUONBLKSIZENUMBER;
while (nlen--) {
while(nlen--) {
cd2sjh_chr(*p2++, p1);
p1 += 2;
}
@ -351,46 +329,35 @@ add_yomi()
}
static void
cd2sjh_chr(u_char ch, u_char *dst)
{
if (ch == _TYOUON) {
cd2sjh_chr(u_char ch, u_char* dst) {
if(ch == _TYOUON) {
*dst++ = 0xa1;
*dst++ = 0xbc;
}
else if (ch == _IGETA) {
} else if(ch == _IGETA) {
*dst++ = 0xa1;
*dst++ = 0xf4;
}
else if (ch == _ATTO) {
} else if(ch == _ATTO) {
*dst++ = 0xa1;
*dst++ = 0xf7;
}
else if (ch == _YUUBIN) {
} else if(ch == _YUUBIN) {
*dst++ = 0xa2;
*dst++ = 0xa9;
}
else if (ch < N_0) {
}
else if (ch <= N_9) {
} else if(ch < N_0) {
} else if(ch <= N_9) {
*dst++ = 0xa3;
*dst++ = ch + 0xa0;
}
else if (ch <= A_Z) {
} else if(ch <= A_Z) {
*dst++ = 0xa3;
*dst++ = ch + 0xa7;
}
else if (ch <= A_z) {
} else if(ch <= A_z) {
*dst++ = 0xa3;
*dst++ = ch + 0xad;
}
else if (ch <= _NN) {
} else if(ch <= _NN) {
*dst++ = 0xa4;
*dst++ = ch + 0x53;
}
else if (ch <= _XKE) {
} else if(ch <= _XKE) {
*dst++ = 0xa5;
*dst++ = ch + 0x53;
}
else {
} else {
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,29 +28,26 @@
*/
/*
* $SonyRCSfile: ph2knj.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: ph2knj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:09 $
*/
#include "sj_kcnv.h"
#include "sj_yomi.h"
#include "sj_kanakan.h"
int
ph2knj(u_char *zyomi, u_char *kanji, int knjlen)
{
u_char *ptr;
u_char *dst;
int ph2knj(u_char* zyomi, u_char* kanji, int knjlen) {
u_char* ptr;
u_char* dst;
int i;
for (ptr = zyomi, dst = hyomi, i = 0 ; *ptr ; ) {
if (i++ >= MAXPHINPUTLEN) { *kanji = 0; return 0; }
for(ptr = zyomi, dst = hyomi, i = 0; *ptr;) {
if(i++ >= MAXPHINPUTLEN) {
*kanji = 0;
return 0;
}
ptr += sj2cd_chr(ptr, dst++);
}
*dst = 0;
@ -59,23 +56,23 @@ ph2knj(u_char *zyomi, u_char *kanji, int knjlen)
prevclgrm = 0;
prevclrow = 0;
khcount = 0;
khcount = 0;
nextcllen = 0;
inputyomi = zyomi;
cnvstart = ystart = hyomi;
cnvlen = sstrlen(hyomi);
cnvlen = sstrlen(hyomi);
kanjipos = kanji;
kanjilen = knjlen;
while (cnvlen && kanjilen) {
if (!clt1st) {
while(cnvlen && kanjilen) {
if(!clt1st) {
mkjiritu(DO_CLSTUDY | DO_IKKATU);
mkbunsetu();
if (!maxclptr) wakachi();
if(!maxclptr) wakachi();
jrt1st = maxjptr;
clt1st = maxclptr;
@ -85,29 +82,27 @@ ph2knj(u_char *zyomi, u_char *kanji, int knjlen)
selclrec();
prevclgrm = selcl -> jnode -> hinsi;
prevclrow = selcl -> right;
prevclgrm = selcl->jnode->hinsi;
prevclrow = selcl->right;
clt1st = free_clst(clt1st, (int)selcl -> cllen);
jrt1st = free_jlst(jrt1st);
clt1st = free_clst(clt1st, (int)selcl->cllen);
jrt1st = free_jlst(jrt1st);
cnvstart += selcl -> cllen;
cnvlen -= selcl -> cllen;
cnvstart += selcl->cllen;
cnvlen -= selcl->cllen;
cvtphknj();
cvtphknj();
clt1st = clt2nd;
jrt1st = jrt2nd;
clt1st = clt2nd;
jrt1st = jrt2nd;
}
if (!kanjilen) {
free_clall(clt1st);
free_jall (jrt1st);
}
if(!kanjilen) {
free_clall(clt1st);
free_jall(jrt1st);
}
*kanjipos = 0;
return(inputyomi - zyomi);
return (inputyomi - zyomi);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: ph_khtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: ph_khtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:09 $
*/
@ -38,55 +38,52 @@
#include "sj_kanakan.h"
static void
ph_setsty(CLREC *clrec)
{
JREC *jrec;
TypeDicOfs offset;
u_char *ptr;
STDYIN *sptr;
ph_setsty(CLREC* clrec) {
JREC* jrec;
TypeDicOfs offset;
u_char* ptr;
STDYIN* sptr;
if (!seldict((jrec = clrec -> jnode) -> dicid)) {
if (!khcount)
ph_setkouho(clrec, (TypeDicOfs)1, (STDYIN *)NULL);
if(!seldict((jrec = clrec->jnode)->dicid)) {
if(!khcount)
ph_setkouho(clrec, (TypeDicOfs)1, (STDYIN*)NULL);
return;
}
(*curdict->getdic)(curdict, jrec -> jseg);
(*curdict->getdic)(curdict, jrec->jseg);
ptr = dicbuf + jrec->jofsst + 1;
for ( ; *ptr != HINSIBLKTERM ; ptr = skipkstr(ptr)) {
for(; *ptr != HINSIBLKTERM; ptr = skipkstr(ptr)) {
offset = ptr - dicbuf;
sptr = srchstdy(jrec -> jseg, offset, jrec -> dicid);
sptr = srchstdy(jrec->jseg, offset, jrec->dicid);
if (!khcount){
if(!khcount) {
ph_setkouho(clrec, offset, sptr);
continue;
}
if (!sptr) continue;
if(!sptr) continue;
if (sptr -> styno < kouhotbl[0].styno) {
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)) {
else if(sptr->styno == kouhotbl->styno) {
if(!(kouhotbl[0].ka_fg &&
sptr->ka_kj == kouhotbl[0].ka_kj)) {
ph_setkouho(clrec, offset, sptr);
}
}
}
}
int
ph_khtbl(CLREC *clrec)
{
JREC *jrec;
int flg = FALSE;
int ph_khtbl(CLREC* clrec) {
JREC* jrec;
int flg = FALSE;
switch((jrec = clrec -> jnode) -> class) {
switch((jrec = clrec->jnode)->class) {
case C_DICT:
ph_setsty(clrec);
break;
@ -101,19 +98,17 @@ ph_khtbl(CLREC *clrec)
case C_N_KAZULONG:
case C_N_KAZULCMA:
case C_N_SUUJILONG:
if (jrec -> jofsst) {
if(jrec->jofsst) {
ph_setsty(clrec);
break;
}
else
} else
flg = TRUE;
case C_BUNSETU:
case C_MINASI:
case C_WAKACHI:
if (!khcount) ph_setkouho(clrec, (TypeDicOfs)0, (STDYIN *)0);
if(!khcount) ph_setkouho(clrec, (TypeDicOfs)0, (STDYIN*)0);
break;
}
return flg;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,13 +28,11 @@
*/
/*
* $SonyRCSfile: priority.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: priority.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:10 $
*/
#include "sj_kcnv.h"
#include "sj_hinsi.h"
#include "sj_right.h"
@ -43,49 +41,44 @@
#include "sj_kanakan.h"
static int
isfukusi(TypeGram hinsi)
{
if (FUKUSI_1 <= hinsi && hinsi <= FUKUSI_7)
isfukusi(TypeGram hinsi) {
if(FUKUSI_1 <= hinsi && hinsi <= FUKUSI_7)
return TRUE;
else if (hinsi == MEISI_11 || hinsi == D_MEISI_6)
else if(hinsi == MEISI_11 || hinsi == D_MEISI_6)
return TRUE;
return FALSE;
}
static int
istaigen(TypeCnct right)
{
if (right == R_MEISI || right == R_DMEISI || right == R_SMEISI1)
istaigen(TypeCnct right) {
if(right == R_MEISI || right == R_DMEISI || right == R_SMEISI1)
return TRUE;
if (right == R_WO_MEISI || right == R_DAIMEISI || right == R_JOSUUSI)
if(right == R_WO_MEISI || right == R_DAIMEISI || right == R_JOSUUSI)
return TRUE;
if (right == R_RENYOU1 || (R_RENYOU3 <= right && right <= R_SA5RENYOU4))
if(right == R_RENYOU1 || (R_RENYOU3 <= right && right <= R_SA5RENYOU4))
return TRUE;
return FALSE;
}
static int
taicnt(TypeGram hinsi1, TypeGram hinsi2)
{
if (hinsi2 == TANKANJI) return 0;
taicnt(TypeGram hinsi1, TypeGram hinsi2) {
if(hinsi2 == TANKANJI) return 0;
if (MYOUJI <= hinsi1 && hinsi1 <= KEN_KU) {
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
if(MYOUJI <= hinsi1 && hinsi1 <= KEN_KU) {
if(MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
return Taipri(hinsi1 - MYOUJI, hinsi2);
else
return 3;
}
else if ((MEISI_1 <= hinsi1 && hinsi1 <= MEISI_11) ||
hinsi1 == D_MEISI_2) {
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9) {
} else if((MEISI_1 <= hinsi1 && hinsi1 <= MEISI_11) ||
hinsi1 == D_MEISI_2) {
if(MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9) {
return Taipri(5, hinsi2);
}
else
} else
return 5;
}
else {
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
if(MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
return Taipri(6, hinsi2);
else
return 4;
@ -93,70 +86,65 @@ taicnt(TypeGram hinsi1, TypeGram hinsi2)
}
static int
sttcnt(TypeGram hinsi1, TypeGram hinsi2)
{
if (SETTOU_1 <= hinsi1 && hinsi1 <= SETTOU_5) {
if (MEISI_1 <= hinsi2 && hinsi2 <= SUUSI)
sttcnt(TypeGram hinsi1, TypeGram hinsi2) {
if(SETTOU_1 <= hinsi1 && hinsi1 <= SETTOU_5) {
if(MEISI_1 <= hinsi2 && hinsi2 <= SUUSI)
return Sttpri(hinsi1 - SETTOU_1, hinsi2);
}
return 4;
}
int
priority(CLREC *clrec)
{
int prty;
CLREC *cl2rec;
int keeplen;
TypeGram hinsi1;
int i;
int prev = 0;
int priority(CLREC* clrec) {
int prty;
CLREC* cl2rec;
int keeplen;
TypeGram hinsi1;
int i;
int prev = 0;
if (clrec->cllen == clrec->cl2len) return 0xff;
if(clrec->cllen == clrec->cl2len) return 0xff;
if (clrec->jnode->class == C_BUNSETU) {
if(clrec->jnode->class == C_BUNSETU) {
prty = Termtbl[clrec->right] & GETPRI;
return(0xf0 + prty);
return (0xf0 + prty);
}
hinsi1 = clrec->jnode->hinsi;
if (prevclrow == R_WO || prevclrow == R_WO_S ||
prevclrow == R_NI1 || prevclrow == R_DRENYOU2) {
if (clrec -> kubun == K_DOUSHI || isfukusi(hinsi1))
if(prevclrow == R_WO || prevclrow == R_WO_S ||
prevclrow == R_NI1 || prevclrow == R_DRENYOU2) {
if(clrec->kubun == K_DOUSHI || isfukusi(hinsi1))
prev = 5;
}
else if (istaigen(prevclrow)) {
else if(istaigen(prevclrow)) {
if (clrec -> kubun == K_TAIGEN)
if(clrec->kubun == K_TAIGEN)
prev = taicnt(prevclgrm, hinsi1);
else
prev = 0;
}
else if (prevclrow == R_SETTOU) {
if (clrec -> jnode -> sttofs)
else if(prevclrow == R_SETTOU) {
if(clrec->jnode->sttofs)
prty = 2;
else
prty = sttcnt(prevclgrm, hinsi1);
}
if (hinsi1 >= SETUBI_1 && hinsi1 <= SETUBI_9 && (!prev)) {
if(hinsi1 >= SETUBI_1 && hinsi1 <= SETUBI_9 && (!prev)) {
prty = 1;
goto finish;
}
cl2rec = maxclptr;
keeplen = cl2rec -> cllen;
cl2rec = maxclptr;
keeplen = cl2rec->cllen;
if (clrec->right == R_WO || clrec->right == R_WO_S ||
clrec->right == R_NI1 || clrec->right == R_DRENYOU2) {
while (cl2rec && (int)cl2rec->cllen == keeplen) {
if (cl2rec->kubun == K_DOUSHI) {
if(clrec->right == R_WO || clrec->right == R_WO_S ||
clrec->right == R_NI1 || clrec->right == R_DRENYOU2) {
while(cl2rec && (int)cl2rec->cllen == keeplen) {
if(cl2rec->kubun == K_DOUSHI) {
prty = 14;
goto finish;
}
@ -164,42 +152,40 @@ priority(CLREC *clrec)
}
}
else if (clrec->right == R_SETTOU) {
else if(clrec->right == R_SETTOU) {
prty = 0;
while (cl2rec && (int)cl2rec -> cllen == keeplen) {
if (cl2rec -> jnode -> sttofs )
while(cl2rec && (int)cl2rec->cllen == keeplen) {
if(cl2rec->jnode->sttofs)
i = 2;
else
i = sttcnt(hinsi1, cl2rec->jnode->hinsi);
if (i > prty)
if(i > prty)
prty = i;
cl2rec = cl2rec -> clsort;
cl2rec = cl2rec->clsort;
}
goto finish;
}
else if (istaigen(clrec->right)) {
else if(istaigen(clrec->right)) {
prty = 0;
while (cl2rec && (int)cl2rec->cllen == keeplen) {
while(cl2rec && (int)cl2rec->cllen == keeplen) {
i = taicnt(hinsi1, cl2rec->jnode->hinsi);
if (i > prty)
if(i > prty)
prty = i;
cl2rec = cl2rec->clsort;
}
if (clrec->jnode->stbofs) {
if(clrec->jnode->stbofs) {
prty -= 3;
}
goto finish;
}
prty = Termtbl[clrec->right];
if (prty & RENTAI) {
while (cl2rec && (int)cl2rec->cllen == keeplen) {
if (cl2rec -> kubun == K_TAIGEN) {
if(prty & RENTAI) {
while(cl2rec && (int)cl2rec->cllen == keeplen) {
if(cl2rec->kubun == K_TAIGEN) {
prty &= GETPRI;
goto finish;
}
@ -211,15 +197,14 @@ priority(CLREC *clrec)
else {
prty &= GETPRI;
if (prty == P_RENYOU_J || prty == P_RENYOU_M ) {
while (clrec->cllen != 1 && cl2rec &&
(int)cl2rec->cllen == keeplen ) {
if (cl2rec->kubun == K_DOUSHI) {
if(prty == P_RENYOU_J || prty == P_RENYOU_M) {
while(clrec->cllen != 1 && cl2rec &&
(int)cl2rec->cllen == keeplen) {
if(cl2rec->kubun == K_DOUSHI) {
prty = 6;
goto finish;
}
else if (cl2rec->jnode->hinsi == SETUBI_1 ||
cl2rec->jnode->hinsi == SETUBI_2) {
} else if(cl2rec->jnode->hinsi == SETUBI_1 ||
cl2rec->jnode->hinsi == SETUBI_2) {
prty = 7;
goto finish;
}
@ -229,57 +214,53 @@ priority(CLREC *clrec)
}
}
finish:
cl2rec = maxclptr;
if (hinsi1 == SUUSI) prty -= 4;
if(hinsi1 == SUUSI) prty -= 4;
if (cl2rec -> jnode -> hinsi == SUUSI) prty -= 3;
if(cl2rec->jnode->hinsi == SUUSI) prty -= 3;
if (cl2rec->jnode->class == C_DICT &&
cl2rec->jnode->jlen == 1 && (cl2rec->kubun != K_DOUSHI)) {
if(cl2rec->jnode->class == C_DICT &&
cl2rec->jnode->jlen == 1 && (cl2rec->kubun != K_DOUSHI)) {
prty -= 2;
}
if ((!istaigen(clrec->right)) && (cl2rec->jnode->hinsi == SETUBI_2)) {
if((!istaigen(clrec->right)) && (cl2rec->jnode->hinsi == SETUBI_2)) {
prty -= 4;
}
prty += 20 - clrec->cllen + clrec->jnode->jlen + clrec->gobiln;
return(prty + prev);
return (prty + prev);
}
void pritiny() {
CLREC* clrec;
int keeplen;
int i, prty = 0;
void
pritiny()
{
CLREC *clrec;
int keeplen;
int i, prty = 0;
clrec = selcl;
keeplen = clrec->cllen;
clrec = selcl;
keeplen = clrec -> cllen;
if (istaigen(prevclrow)) {
while (clrec && (int)clrec -> cllen == keeplen) {
i = taicnt(prevclgrm, clrec -> jnode -> hinsi);
if (i > prty) {
if(istaigen(prevclrow)) {
while(clrec && (int)clrec->cllen == keeplen) {
i = taicnt(prevclgrm, clrec->jnode->hinsi);
if(i > prty) {
selcl = clrec;
prty = i;
prty = i;
}
clrec = clrec -> clsort;
clrec = clrec->clsort;
}
}
else {
while (clrec && (int)clrec -> cllen == keeplen) {
if (clrec -> jnode -> hinsi >= MYOUJI &&
clrec -> jnode -> hinsi <= KEN_KU)
clrec = clrec -> clsort;
while(clrec && (int)clrec->cllen == keeplen) {
if(clrec->jnode->hinsi >= MYOUJI &&
clrec->jnode->hinsi <= KEN_KU)
clrec = clrec->clsort;
else if (clrec -> jnode -> hinsi == TANKANJI)
else if(clrec->jnode->hinsi == TANKANJI)
return;
else {
selcl = clrec;
@ -288,4 +269,3 @@ pritiny()
}
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,77 +28,221 @@
*/
/*
* $SonyRCSfile: prtytbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: prtytbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:11 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
u_char taipri[7][45] = {
u_char taipri[7][45] = {
{ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 3, 20, 4, 3, 3, 4, 4, 4, 4,
4, 4, 4, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 3, 20, 4, 3, 3, 4, 4, 4, 4,
4, 4, 4, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6},
{0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 3, 3, 3, 3, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6},
{ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 3, 3, 3, 3, 3, 3, 0, 0,
0, 3, 3, 3, 4, 5, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 4, 4, 4, 4, 6},
{0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 3, 3, 3, 3, 3, 3, 0, 0,
0, 3, 3, 3, 4, 5, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 4, 4, 4, 4, 6},
{ 0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 4, 4, 4, 4, 4, 4, 0, 0,
0, 4, 4, 4, 20, 20, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 4, 4, 4, 4, 4, 4, 0, 0,
0, 4, 4, 4, 20, 20, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6},
{ 0, 8, 8, 8, 8, 8, 7, 8, 8, 8,
8, 8, 3, 6, 7, 3, 3, 5, 0, 0,
0, 3, 3, 3, 3, 3, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 8, 8, 11, 5, 7, 7, 7, 7, 7},
{0, 8, 8, 8, 8, 8, 7, 8, 8, 8,
8, 8, 3, 6, 7, 3, 3, 5, 0, 0,
0, 3, 3, 3, 3, 3, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 8, 8, 11, 5, 7, 7, 7, 7, 7},
{ 0, 5, 6, 6, 6, 6, 5, 6, 6, 6,
6, 6, 3, 3, 3, 3, 3, 5, 0, 0,
0, 3, 3, 3, 3, 3, 5, 5, 5, 5,
4, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5}
};
{0, 5, 6, 6, 6, 6, 5, 6, 6, 6,
6, 6, 3, 3, 3, 3, 3, 5, 0, 0,
0, 3, 3, 3, 3, 3, 5, 5, 5, 5,
4, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5}};
u_char sttpri[5][31] = {
{
0,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
2,
4,
4,
4,
4,
4,
0,
0,
0,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
},
u_char sttpri[5][31] = {
{
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
0,
0,
0,
4,
4,
4,
10,
10,
4,
4,
4,
4,
4,
},
{ 0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 2, 4, 4, 4, 4, 4, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, },
{
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
0,
0,
0,
10,
10,
4,
4,
4,
4,
4,
4,
4,
4,
},
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
0, 4, 4, 4, 10, 10, 4, 4, 4, 4, 4, },
{
0,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
0,
0,
0,
4,
4,
4,
4,
4,
4,
4,
4,
4,
15,
},
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
0, 10, 10, 4, 4, 4, 4, 4, 4, 4, 4, },
{ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, },
{ 0, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 9, 9, 9, 9, 9, 9, 0, 0,
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }
};
{
0,
12,
12,
12,
12,
12,
12,
12,
12,
12,
12,
12,
9,
9,
9,
9,
9,
9,
0,
0,
0,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
}};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,126 +28,123 @@
*/
/*
* $SonyRCSfile: s2ctbl.c,v $
* $SonyRevision: 1.2 $
* $SonyRCSfile: s2ctbl.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1995/07/21 05:22:51 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_yomi.h"
#include "sj_kanakan.h"
u_char kigou[] = {
Y_L_KAKKO,
Y_KUTEN,
Y_TOUTEN,
Y_COMMA,
Y_PERIOD,
Y_L_KAKKO,
Y_L_KAKKO,
Y_L_KAKKO,
Y_BIKKURI,
Y_BIKKURI,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
_TYOUON,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_L_KAKKO,
Y_QUOTA,
Y_L_KAKKO,
Y_QUOTA,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_S_KIGOU2,
Y_S_KIGOU1,
Y_S_KIGOU1,
Y_S_KIGOU2,
Y_S_KIGOU1,
Y_S_KIGOU2,
_IGETA,
Y_KIGOU,
Y_KIGOU,
_ATTO,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
_YUUBIN,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU
};
u_char kigou[] = {
Y_L_KAKKO,
Y_KUTEN,
Y_TOUTEN,
Y_COMMA,
Y_PERIOD,
Y_L_KAKKO,
Y_L_KAKKO,
Y_L_KAKKO,
Y_BIKKURI,
Y_BIKKURI,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
_TYOUON,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_L_KAKKO,
Y_QUOTA,
Y_L_KAKKO,
Y_QUOTA,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_L_KAKKO,
Y_R_KAKKO,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_S_KIGOU2,
Y_S_KIGOU1,
Y_S_KIGOU1,
Y_S_KIGOU2,
Y_S_KIGOU1,
Y_S_KIGOU2,
_IGETA,
Y_KIGOU,
Y_KIGOU,
_ATTO,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
_YUUBIN,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU,
Y_KIGOU};

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,77 +28,77 @@
*/
/*
* $SonyRCSfile: selclrec.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: selclrec.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:14 $
*/
#include "sj_kcnv.h"
#include "sj_kanakan.h"
void
selclrec()
{
int len;
CLREC *rec;
void selclrec() {
int len;
CLREC* rec;
nextcllen = 0;
len = selcl -> cllen;
len = selcl->cllen;
rec = clt1st;
while (rec) {
if (len >= (unsigned int) rec -> cllen) break;
rec = rec -> clsort;
while(rec) {
if(len >= (unsigned int)rec->cllen) break;
rec = rec->clsort;
}
while (rec) {
if (len > (unsigned int) rec -> cllen) return;
if (rec -> jnode -> class == C_BUNSETU) break;
rec = rec -> clsort;
while(rec) {
if(len > (unsigned int)rec->cllen) return;
if(rec->jnode->class == C_BUNSETU) break;
rec = rec->clsort;
}
if (!rec) return;
if(!rec) return;
len = ClYomi1Len(CLSTUDYDICT + rec->jnode->jofsst);
nextcllen = rec -> cllen - len;
nextcllen = rec->cllen - len;
while (rec) {
if (len == rec -> cllen) {
while(rec) {
if(len == rec->cllen) {
selcl = rec;
break;
}
else if (len > (unsigned int) rec -> cllen) {
else if(len > (unsigned int)rec->cllen) {
rec = NULL;
break;
}
rec = rec -> clsort;
rec = rec->clsort;
}
if (rec == NULL) {
int klen;
u_char ch;
if(rec == NULL) {
int klen;
u_char ch;
free_clall(clt1st);
free_jall(jrt1st);
klen = cnvlen;
cnvlen = len;
ch = *(cnvstart + len);
klen = cnvlen;
cnvlen = len;
ch = *(cnvstart + len);
*(cnvstart + len) = 0;
mkjiritu(DO_IKKATU);
mkbunsetu();
if (!maxclptr) wakachi();
if(!maxclptr) wakachi();
jrt1st = maxjptr;
selcl = clt1st = maxclptr;
cnvlen = klen;
cnvlen = klen;
*(cnvstart + len) = ch;
}
free_clall(clt2nd); clt2nd = NULL;
free_jall(jrt2nd); jrt2nd = NULL;
free_clall(clt2nd);
clt2nd = NULL;
free_jall(jrt2nd);
jrt2nd = NULL;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: selsuuji.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: selsuuji.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:15 $
*/
@ -40,84 +40,72 @@
#include "sj_kanakan.h"
static u_short selsjAR[] = {
SELARB0,
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELNUMTERM
};
static u_short selsjAR[] = {
SELARB0,
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELNUMTERM};
static u_short selsjARCM[] = {
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELARB0,
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELNUMTERM
};
static u_short selsjARCM[] = {
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELARB0,
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELNUMTERM};
static u_short selsjKAZU[] = {
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELARB0,
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELNUMTERM
};
static u_short selsjKAZU[] = {
SELKANSJYM | JFLAG_NN0,
SELKANSJYM2 | SELNUM1_23_10_1 | JFLAG_NN0,
SELKANSJ0 | JFLAG_NK2,
SELARB0,
SELARBCMA | JFLAG_NK4 | JFLAG_NN0,
SELNUMTERM};
static u_short selsjSUUJI[] = {
SELKANSJ0,
SELARB0,
SELNUMTERM
};
static u_short selsjSUUJI[] = {
SELKANSJ0,
SELARB0,
SELNUMTERM};
static u_short selsjNANSUU[] = {
SELKANSJYM,
SELNUMTERM
};
static u_short selsjNANSUU[] = {
SELKANSJYM,
SELNUMTERM};
static u_short selsjAR17[] = {
SELLONGARB,
SELLONGARBCMA,
SELNUMTERM
};
static u_short selsjAR17[] = {
SELLONGARB,
SELLONGARBCMA,
SELNUMTERM};
static u_short selsjAR17CM[] = {
SELLONGARBCMA,
SELLONGARB,
SELNUMTERM
};
static u_short selsjAR17CM[] = {
SELLONGARBCMA,
SELLONGARB,
SELNUMTERM};
static u_short selsjAR17SJ[] = {
SELLONGARB,
SELLONGSJ,
SELNUMTERM
};
static u_short selsjAR17SJ[] = {
SELLONGARB,
SELLONGSJ,
SELNUMTERM};
static u_short selsjKANKURA[] = {
SELKANSJKR,
SELARBKR,
SELNUMTERM
};
static u_short selsjKANKURA[] = {
SELKANSJKR,
SELARBKR,
SELNUMTERM};
static u_short selsjARAKURA[] = {
SELARBKR,
SELKANSJKR | JFLAG_NSN,
SELNUMTERM
};
static u_short selsjARAKURA[] = {
SELARBKR,
SELKANSJKR | JFLAG_NSN,
SELNUMTERM};
u_short *selsjadrs[] = {
selsjAR,
selsjARCM,
selsjKAZU,
selsjSUUJI,
selsjNANSUU,
selsjKANKURA,
selsjARAKURA,
selsjAR17,
selsjAR17CM,
selsjAR17SJ
};
u_short* selsjadrs[] = {
selsjAR,
selsjARCM,
selsjKAZU,
selsjSUUJI,
selsjNANSUU,
selsjKANKURA,
selsjARAKURA,
selsjAR17,
selsjAR17CM,
selsjAR17SJ};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,13 +28,11 @@
*/
/*
* $SonyRCSfile: setconj.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: setconj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:16 $
*/
#include "sj_kcnv.h"
#include "sj_right.h"
#include "sj_hinsi.h"
@ -43,32 +41,31 @@
#include "sj_kanakan.h"
static int
cnjstrcmp(u_char *yptr, u_char *cnjp, int *saml)
{
int asklen;
int nkrlen;
cnjstrcmp(u_char* yptr, u_char* cnjp, int* saml) {
int asklen;
int nkrlen;
asklen = CnjAskLen(cnjp);
if (*saml < asklen) return CONT;
if(*saml < asklen) return CONT;
if (*saml > asklen) return OVER;
if(*saml > asklen) return OVER;
nkrlen = CnjNkrLen(cnjp);
yptr += asklen;
cnjp ++;
cnjp++;
while (nkrlen--) {
if (*yptr > *cnjp)
while(nkrlen--) {
if(*yptr > *cnjp)
return CONT;
else if (*yptr < *cnjp) {
if (!*yptr) return PARTLY;
else if(*yptr < *cnjp) {
if(!*yptr) return PARTLY;
return OVER;
}
else{
else {
yptr++;
cnjp++;
(*saml)++;
@ -79,22 +76,21 @@ cnjstrcmp(u_char *yptr, u_char *cnjp, int *saml)
}
static TypeCnct
cnvrow(JREC *rec, TypeCnct row)
{
TypeGram hinsi;
int stt;
cnvrow(JREC* rec, TypeCnct row) {
TypeGram hinsi;
int stt;
hinsi = rec -> hinsi;
hinsi = rec->hinsi;
if ((stt = rec -> sttofs) == SETTOU_O) {
if((stt = rec->sttofs) == SETTOU_O) {
if (R_RENYOU1 <= row && row <= R_SA5RENYOU1)
if(R_RENYOU1 <= row && row <= R_SA5RENYOU1)
row += 6;
else if (R_RENYOU3 <= row && row <= R_SA5RENYOU3)
else if(R_RENYOU3 <= row && row <= R_SA5RENYOU3)
row += 3;
else if((hinsi>=KEIYOUSI_1 && hinsi<=KE_DOUSI_9)||
else if((hinsi >= KEIYOUSI_1 && hinsi <= KE_DOUSI_9) ||
(hinsi == MEISI_5) || (hinsi == MEISI_9))
;
@ -102,52 +98,50 @@ cnvrow(JREC *rec, TypeCnct row)
row = 0;
}
else if (stt == SETTOU_GO) {
else if(stt == SETTOU_GO) {
if (hinsi == MEISI_7 && row == R_SMEISI1)
if(hinsi == MEISI_7 && row == R_SMEISI1)
row++;
}
return row;
}
int
setconj(TypeGram hinsi, JREC *jrec, CREC *crec)
{
u_char *yptr;
int cmp;
TypeCnct right;
int saml;
int ofslen;
int count = 0;
u_char *cnj;
int setconj(TypeGram hinsi, JREC* jrec, CREC* crec) {
u_char* yptr;
int cmp;
TypeCnct right;
int saml;
int ofslen;
int count = 0;
u_char* cnj;
if (cnj = Conjadr(hinsi)) {
if(cnj = Conjadr(hinsi)) {
saml = ofslen = 0;
yptr = cnvstart + jrec -> jlen;
yptr = cnvstart + jrec->jlen;
if ((*cnj) & TYOUONFLG) {
while (*yptr == _TYOUON) {
if((*cnj) & TYOUONFLG) {
while(*yptr == _TYOUON) {
yptr++;
ofslen++;
}
}
for ( ; *cnj != CNJEND ; cnj += CnjRecLen(cnj)) {
for(; *cnj != CNJEND; cnj += CnjRecLen(cnj)) {
cmp = cnjstrcmp(yptr, cnj, &saml);
if (cmp == OVER) break;
if(cmp == OVER) break;
if (cmp == PARTLY) break;
if(cmp == PARTLY) break;
if (cmp != MATCH) continue;
if(cmp != MATCH) continue;
if (isdpnd(*(yptr + saml))) continue;
if(isdpnd(*(yptr + saml))) continue;
if (right = cnvrow(jrec, (TypeCnct)CnjRight(cnj))) {
crec -> len = (u_char)(ofslen + saml);
crec -> right = right;
if(right = cnvrow(jrec, (TypeCnct)CnjRight(cnj))) {
crec->len = (u_char)(ofslen + saml);
crec->right = right;
count++;
crec++;
}
@ -156,4 +150,3 @@ setconj(TypeGram hinsi, JREC *jrec, CREC *crec)
return count;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: setjrec.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: setjrec.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:17 $
*/
@ -39,127 +39,122 @@
#include "sj_kanakan.h"
int
setj_atrb(u_char *p)
{
int setj_atrb(u_char* p) {
return 2;
}
int
setj_ofs(u_char *p)
{
int contf = TRUE;
int setj_ofs(u_char* p) {
int contf = TRUE;
p = dicbuf + ((*p & KANJICODEMASK) << 8) + *(p + 1);
p = dicbuf + ((*p & KANJICODEMASK) << 8) + *(p + 1);
do {
if (p[codesize(*p)] == KANJISTREND) contf = FALSE;
if(p[codesize(*p)] == KANJISTREND) contf = FALSE;
switch(*p & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
p += setj_norm1(p); break;
case ZENHIRAASSYUKU:
p += setj_norm1(p);
break;
case ZENKATAASSYUKU:
p += setj_norm1(p); break;
case ZENKATAASSYUKU:
p += setj_norm1(p);
break;
case OFFSETASSYUKU:
p += setj_ofs(p); break;
case OFFSETASSYUKU:
p += setj_ofs(p);
break;
case AIATTRIBUTE:
p += setj_atrb(p); break;
case AIATTRIBUTE:
p += setj_atrb(p);
break;
case LEADINGHANKAKU:
p += setj_norm2(p); break;
case LEADINGHANKAKU:
p += setj_norm2(p);
break;
case KANJIASSYUKU:
p += setj_knj(p); break;
case KANJIASSYUKU:
p += setj_knj(p);
break;
case KANJISTREND:
contf = FALSE; break;
case KANJISTREND:
contf = FALSE;
break;
default:
default:
p += setj_norm2(p);
}
} while (contf);
} while(contf);
return 2;
}
int
setj_knj(u_char *p)
{
int contf = TRUE;
int setj_knj(u_char* p) {
int contf = TRUE;
p = askknj[*p & KNJASSYUKUMASK];
do {
if (p[codesize(*p)]== KANJISTREND) contf = FALSE;
if(p[codesize(*p)] == KANJISTREND) contf = FALSE;
switch(*p & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
p += setj_norm1(p); break;
case ZENHIRAASSYUKU:
p += setj_norm1(p);
break;
case ZENKATAASSYUKU:
p += setj_norm1(p); break;
case ZENKATAASSYUKU:
p += setj_norm1(p);
break;
case OFFSETASSYUKU:
p += setj_ofs(p); break;
case OFFSETASSYUKU:
p += setj_ofs(p);
break;
case AIATTRIBUTE:
p += setj_atrb(p); break;
case AIATTRIBUTE:
p += setj_atrb(p);
break;
case LEADINGHANKAKU:
p += setj_norm2(p); break;
case LEADINGHANKAKU:
p += setj_norm2(p);
break;
case KANJIASSYUKU:
p += setj_knj(p); break;
case KANJIASSYUKU:
p += setj_knj(p);
break;
case KANJISTREND:
contf = FALSE; break;
case KANJISTREND:
contf = FALSE;
break;
default:
default:
p += setj_norm2(p);
}
} while (contf);
} while(contf);
return 1;
}
int
setj_norm1(u_char *p)
{
int setj_norm1(u_char* p) {
return 1;
}
int
setj_norm2(u_char *p)
{
int setj_norm2(u_char* p) {
return 2;
}
int
setj_norm3(u_char *p)
{
int setj_norm3(u_char* p) {
return 3;
}
static u_char
chkhead(TypeGram gram)
{
if (!headcode) return TRUE;
chkhead(TypeGram gram) {
if(!headcode) return TRUE;
if (headcode == SETTOU_DAI) {
if(headcode == SETTOU_DAI) {
if (gram == SUUSI) return TRUE;
if(gram == SUUSI) return TRUE;
}
else {
gram--;
if ((Scncttbl(headcode-1, gram >> 3) << (gram & 0x07)) & 0x80) {
if((Scncttbl(headcode - 1, gram >> 3) << (gram & 0x07)) & 0x80) {
return TRUE;
}
}
@ -167,146 +162,148 @@ chkhead(TypeGram gram)
return FALSE;
}
void
setjrec(u_char *tagp, int mode)
{
TypeGram gram;
u_char *ptr;
u_char *endp;
u_char *tmp;
JREC *rec;
int plen;
int nlen;
int len;
void setjrec(u_char* tagp, int mode) {
TypeGram gram;
u_char* ptr;
u_char* endp;
u_char* tmp;
JREC* rec;
int plen;
int nlen;
int len;
plen = getplen(tagp);
nlen = getnlen(tagp);
len = plen + nlen;
if (headcode) len += headlen;
if(headcode) len += headlen;
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
endp = tagp + getsize(tagp);
for ( ; ptr < endp ; ptr = tmp + 1) {
for (tmp = ptr + 1; *tmp != HINSIBLKTERM ; ) {
for(; ptr < endp; ptr = tmp + 1) {
for(tmp = ptr + 1; *tmp != HINSIBLKTERM;) {
switch(*tmp & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
tmp += setj_norm1(tmp); break;
case ZENHIRAASSYUKU:
tmp += setj_norm1(tmp);
break;
case ZENKATAASSYUKU:
tmp += setj_norm1(tmp); break;
case ZENKATAASSYUKU:
tmp += setj_norm1(tmp);
break;
case OFFSETASSYUKU:
tmp += setj_ofs(tmp); break;
case OFFSETASSYUKU:
tmp += setj_ofs(tmp);
break;
case AIATTRIBUTE:
tmp += setj_atrb(tmp); break;
case AIATTRIBUTE:
tmp += setj_atrb(tmp);
break;
case LEADINGHANKAKU:
tmp += setj_norm2(tmp); break;
case LEADINGHANKAKU:
tmp += setj_norm2(tmp);
break;
case KANJIASSYUKU:
tmp += setj_knj(tmp); break;
case KANJIASSYUKU:
tmp += setj_knj(tmp);
break;
case KANJISTREND:
tmp++; break;
case KANJISTREND:
tmp++;
break;
default:
default:
tmp += setj_norm2(tmp);
}
}
if ((gram = *ptr) == IKKATU && !(mode & DO_IKKATU)) continue;
if((gram = *ptr) == IKKATU && !(mode & DO_IKKATU)) continue;
if (!chkhead(gram)) continue;
if(!chkhead(gram)) continue;
if (!(rec = argjrec(len, (JREC *)NULL))) continue;
if(!(rec = argjrec(len, (JREC*)NULL))) continue;
rec -> jseg = prevseg;
rec -> jofsst = ptr - dicbuf;
rec -> jofsed = tmp - dicbuf;
rec -> class = C_DICT;
rec -> dicid = curdict->dicid;
rec -> hinsi = gram;
rec -> sttofs = headcode;
rec->jseg = prevseg;
rec->jofsst = ptr - dicbuf;
rec->jofsed = tmp - dicbuf;
rec->class = C_DICT;
rec->dicid = curdict->dicid;
rec->hinsi = gram;
rec->sttofs = headcode;
}
}
void
setnumrec(u_char *tagp, JREC *rec, TypeGram gram)
{
u_char *ptr;
u_char *endp;
u_char *tmp;
int plen, nlen, len;
JREC *jrec;
void setnumrec(u_char* tagp, JREC* rec, TypeGram gram) {
u_char* ptr;
u_char* endp;
u_char* tmp;
int plen, nlen, len;
JREC* jrec;
plen = getplen(tagp);
nlen = getnlen(tagp);
len = plen + nlen;
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
ptr = tagp + DOUONBLKSIZENUMBER + nlen;
endp = tagp + getsize(tagp);
for ( ; ptr < endp ; ptr = tmp + 1) {
for (tmp = ptr + 1; *tmp != HINSIBLKTERM ; ) {
for(; ptr < endp; ptr = tmp + 1) {
for(tmp = ptr + 1; *tmp != HINSIBLKTERM;) {
switch(*tmp & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
tmp += setj_norm1(tmp); break;
case ZENHIRAASSYUKU:
tmp += setj_norm1(tmp);
break;
case ZENKATAASSYUKU:
tmp += setj_norm1(tmp); break;
case ZENKATAASSYUKU:
tmp += setj_norm1(tmp);
break;
case OFFSETASSYUKU:
tmp += setj_ofs(tmp); break;
case OFFSETASSYUKU:
tmp += setj_ofs(tmp);
break;
case AIATTRIBUTE:
tmp += setj_atrb(tmp); break;
case AIATTRIBUTE:
tmp += setj_atrb(tmp);
break;
case LEADINGHANKAKU:
tmp += setj_norm2(tmp); break;
case LEADINGHANKAKU:
tmp += setj_norm2(tmp);
break;
case KANJIASSYUKU:
tmp += setj_knj(tmp); break;
case KANJIASSYUKU:
tmp += setj_knj(tmp);
break;
case KANJISTREND:
tmp++; break;
case KANJISTREND:
tmp++;
break;
default:
default:
tmp += setj_norm2(tmp);
}
}
if (gram != *ptr) continue;
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;
jrec -> jofsst = ptr - dicbuf;
jrec -> jofsed = tmp - dicbuf;
jrec -> dicid = curdict->dicid;
jrec->jseg = prevseg;
jrec->jofsst = ptr - dicbuf;
jrec->jofsed = tmp - dicbuf;
jrec->dicid = curdict->dicid;
}
}
void setcrec(u_char* tagp) {
JREC* rec;
if(!(rec = argjrec((int)ClYomiLen(tagp), (JREC*)NULL))) return;
void
setcrec(u_char *tagp)
{
JREC *rec;
if (!(rec = argjrec((int)ClYomiLen(tagp), (JREC *)NULL))) return;
rec -> jofsst = tagp - CLSTUDYDICT;
rec -> class = C_BUNSETU;
rec -> hinsi = ClGramCode(tagp);
rec->jofsst = tagp - CLSTUDYDICT;
rec->class = C_BUNSETU;
rec->hinsi = ClGramCode(tagp);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: setkouho.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: setkouho.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:20 $
*/
@ -39,96 +39,94 @@
#include "sj_kanakan.h"
static int hiraknj();
static int hiraknj();
void
setkouho(CLREC *clrec, TypeDicOfs offs, int mode)
{
JREC *jrec;
KHREC *kptr;
u_char *fptr;
void setkouho(CLREC* clrec, TypeDicOfs offs, int mode) {
JREC* jrec;
KHREC* kptr;
u_char* fptr;
int flg;
int i;
if (khcount >= MAXKOUHONUMBER) return;
if(khcount >= MAXKOUHONUMBER) return;
jrec = clrec -> jnode;
jrec = clrec->jnode;
kptr = &kouhotbl[khcount++];
if (mode && !offs) nkhcount++;
if(mode && !offs) nkhcount++;
kptr -> clrec = clrec;
kptr -> offs = offs;
kptr -> rank = 0;
kptr -> styno = 0;
kptr -> mode = (u_char)mode;
kptr->clrec = clrec;
kptr->offs = offs;
kptr->rank = 0;
kptr->styno = 0;
kptr->mode = (u_char)mode;
if (jrec -> flags & JFLAG_KA) {
kptr -> ka_fg = 1;
kptr -> ka_kj = 1;
flg = 1;
}
else if (clrec -> fzk_ka) {
kptr -> ka_fg = 1;
kptr -> ka_kj = 0;
flg = 2;
}
else {
kptr -> ka_fg = 0;
kptr -> ka_kj = 0;
flg = 0;
if(jrec->flags & JFLAG_KA) {
kptr->ka_fg = 1;
kptr->ka_kj = 1;
flg = 1;
} else if(clrec->fzk_ka) {
kptr->ka_fg = 1;
kptr->ka_kj = 0;
flg = 2;
} else {
kptr->ka_fg = 0;
kptr->ka_kj = 0;
flg = 0;
}
kptr -> sttfg = kptr -> sttkj = 0;
kptr->sttfg = kptr->sttkj = 0;
if (!(fptr = Settou_ptr(jrec -> sttofs))) return;
if(!(fptr = Settou_ptr(jrec->sttofs))) return;
if (!SttHiraKnj(fptr)) return;
if(!SttHiraKnj(fptr)) return;
kptr -> sttfg = 1;
kptr -> sttkj = 0;
kptr->sttfg = 1;
kptr->sttkj = 0;
i = hiraknj(dicbuf + offs);
if (offs > 1 && (i == 2 || i == 3)) return;
if(offs > 1 && (i == 2 || i == 3)) return;
if (khcount >= MAXKOUHONUMBER) return;
if(khcount >= MAXKOUHONUMBER) return;
kptr++;
khcount++;
if (mode && !offs) nkhcount++;
if(mode && !offs) nkhcount++;
kptr -> clrec = clrec;
kptr -> offs = offs;
kptr -> rank = 0;
kptr -> styno = 0;
kptr -> mode = (u_char)mode;
kptr->clrec = clrec;
kptr->offs = offs;
kptr->rank = 0;
kptr->styno = 0;
kptr->mode = (u_char)mode;
kptr -> sttfg = 1;
kptr -> sttkj = 1;
kptr->sttfg = 1;
kptr->sttkj = 1;
switch (flg) {
case 1: kptr -> ka_fg = kptr -> ka_kj = 1; break;
case 2: kptr -> ka_fg = 1; kptr -> ka_kj = 0; break;
default: kptr -> ka_fg = kptr -> ka_kj = 0; break;
switch(flg) {
case 1:
kptr->ka_fg = kptr->ka_kj = 1;
break;
case 2:
kptr->ka_fg = 1;
kptr->ka_kj = 0;
break;
default:
kptr->ka_fg = kptr->ka_kj = 0;
break;
}
}
void ph_setkouho(CLREC* clrec, TypeDicOfs offs, STDYIN* sptr) {
JREC* jrec;
u_char* p;
void
ph_setkouho(CLREC *clrec, TypeDicOfs offs, STDYIN *sptr)
{
JREC *jrec;
u_char *p;
if (sptr) {
stdytop = sptr;
kouhotbl[0].styno = sptr -> styno;
kouhotbl[0].sttkj = sptr -> sttkj;
}
else {
if(sptr) {
stdytop = sptr;
kouhotbl[0].styno = sptr->styno;
kouhotbl[0].sttkj = sptr->sttkj;
} else {
kouhotbl[0].styno = -1;
kouhotbl[0].sttkj = 0;
}
@ -137,139 +135,112 @@ ph_setkouho(CLREC *clrec, TypeDicOfs offs, STDYIN *sptr)
kouhotbl[0].offs = offs;
kouhotbl[0].rank = 0;
kouhotbl[0].mode = sel_sjmode(jrec = clrec -> jnode);
kouhotbl[0].mode = sel_sjmode(jrec = clrec->jnode);
kouhotbl[0].sttfg = (u_char)
((p = Settou_ptr(jrec->sttofs)) ? (SttHiraKnj(p)?1:0) : 0);
kouhotbl[0].sttfg = (u_char)((p = Settou_ptr(jrec->sttofs)) ? (SttHiraKnj(p) ? 1 : 0) : 0);
if (jrec -> flags & JFLAG_KA) {
if(jrec->flags & JFLAG_KA) {
kouhotbl[0].ka_fg =
kouhotbl[0].ka_kj = 1;
}
else if (clrec -> fzk_ka) {
kouhotbl[0].ka_kj = 1;
} else if(clrec->fzk_ka) {
kouhotbl[0].ka_fg = 1;
kouhotbl[0].ka_kj = 0;
}
else {
} else {
kouhotbl[0].ka_fg =
kouhotbl[0].ka_kj = 0;
kouhotbl[0].ka_kj = 0;
}
khcount = 1;
}
static int
hiraknj(u_char *p)
{
char flg = TRUE;
int i;
int result;
hiraknj(u_char* p) {
char flg = TRUE;
int i;
int result;
do {
if (p[codesize(*p)] == KANJISTREND) flg = FALSE;
if(p[codesize(*p)] == KANJISTREND) flg = FALSE;
switch(*p & KANJIMODEMASK) {
case ZENHIRAASSYUKU:
result = hiraknj_hask(p, &i); break;
case ZENHIRAASSYUKU:
result = hiraknj_hask(p, &i);
break;
case ZENKATAASSYUKU:
result = hiraknj_kask(p, &i); break;
case ZENKATAASSYUKU:
result = hiraknj_kask(p, &i);
break;
case OFFSETASSYUKU:
result = hiraknj_ofs(p, &i); break;
case OFFSETASSYUKU:
result = hiraknj_ofs(p, &i);
break;
case AIATTRIBUTE:
result = hiraknj_atrb(p, &i); break;
case AIATTRIBUTE:
result = hiraknj_atrb(p, &i);
break;
case LEADINGHANKAKU:
result = hiraknj_norm(p, &i); break;
case LEADINGHANKAKU:
result = hiraknj_norm(p, &i);
break;
case KANJIASSYUKU:
result = hiraknj_knj(p, &i); break;
case KANJIASSYUKU:
result = hiraknj_knj(p, &i);
break;
default:
default:
result = hiraknj_hira(p, &i);
}
if (result) return result;
if(result) return result;
p += i;
} while (flg);
} while(flg);
return 0;
}
int
hiraknj_atrb(u_char *p, int *len)
{
int hiraknj_atrb(u_char* p, int* len) {
*len = 2;
return 0;
}
int
hiraknj_ofs(u_char *p, int *len)
{
int hiraknj_ofs(u_char* p, int* len) {
*len = 2;
return hiraknj(dicbuf + ((*p & KANJICODEMASK) << 8) + *(p + 1));
return hiraknj(dicbuf + ((*p & KANJICODEMASK) << 8) + *(p + 1));
}
int
hiraknj_knj(u_char *p, int *len)
{
int hiraknj_knj(u_char* p, int* len) {
*len = 1;
return hiraknj(askknj[*p & KNJASSYUKUMASK]);
}
int
hiraknj_hask(u_char *p, int *len)
{
int hiraknj_hask(u_char* p, int* len) {
*len = 1;
return 2;
}
int
hiraknj_kask(u_char *p, int *len)
{
int hiraknj_kask(u_char* p, int* len) {
*len = 1;
return 3;
}
int hiraknj_norm(u_char *p, int *len)
{
int hiraknj_norm(u_char* p, int* len) {
*len = codesize(*p);
return 1;
}
int
hiraknj_hira(u_char *p, int *len)
{
u_char ch;
int hiraknj_hira(u_char* p, int* len) {
u_char ch;
*len = codesize(*p);
ch = *(p + 1);
ch = *(p + 1);
switch (*p) {
switch(*p) {
case 0x24:
if (ch >= 0x21 && ch <= 0x73) return 2;
if(ch >= 0x21 && ch <= 0x73) return 2;
return 1;
case 0x25:
if (ch >= 0x21 && ch <= 0x76) return 3;
if(ch >= 0x21 && ch <= 0x76) return 3;
return 1;
default:

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,56 +28,49 @@
*/
/*
* $SonyRCSfile: setubi.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: setubi.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:22 $
*/
#include "sj_kcnv.h"
#include "sj_hinsi.h"
#include "sj_kanakan.h"
u_char*
getstb(TypeGram hinsi)
{
if (hinsi < MEISI_1 || hinsi > TIMEI) return NULL;
getstb(TypeGram hinsi) {
if(hinsi < MEISI_1 || hinsi > TIMEI) return NULL;
return Stbadr(hinsi);
}
void
setubi(JREC *rec, u_char *stbtbl)
{
u_char *stb;
u_char *yptr;
u_char *sptr;
void setubi(JREC* rec, u_char* stbtbl) {
u_char* stb;
u_char* yptr;
u_char* sptr;
int slen;
JREC *new;
int cmp;
JREC* new;
int cmp;
stb = stbtbl--;
yptr = cnvstart + rec -> jlen;
yptr = cnvstart + rec->jlen;
for ( ; *stb ; stb = sptr + slen + StbKnjLen(stb)) {
for(; *stb; stb = sptr + slen + StbKnjLen(stb)) {
slen = StbYomiLen(stb);
sptr = StbYomiTop(stb);
cmp = sstrncmp(yptr, sptr, slen);
if (cmp == OVER || cmp == PARTLY) break;
if(cmp == OVER || cmp == PARTLY) break;
if ((cmp != MATCH) || isdpnd(*(yptr + slen))) continue;
if((cmp != MATCH) || isdpnd(*(yptr + slen))) continue;
if (!(new = argjrec((int)(rec -> jlen + slen), rec))) continue;
if(!(new = argjrec((int)(rec->jlen + slen), rec))) continue;
new -> stbofs = (u_char)(stb - stbtbl);
new -> flags |= StbBakeru(stb) ? JFLAG_KA : 0;
new->stbofs = (u_char)(stb - stbtbl);
new->flags |= StbBakeru(stb) ? JFLAG_KA : 0;
}
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,104 +28,93 @@
*/
/*
* $SonyRCSfile: sj2code.c,v $
* $SonyRevision: 1.2 $
* $SonyRCSfile: sj2code.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1995/07/21 05:22:51 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_yomi.h"
#include "sj_kanakan.h"
int
sj2cd_chr(u_char *euc, u_char *yomi)
{
u_char chr;
int sj2cd_chr(u_char* euc, u_char* yomi) {
u_char chr;
if ((chr = *euc++) == EUC_a1) {
if((chr = *euc++) == EUC_a1) {
chr = *euc;
if (chr < EUC_START)
if(chr < EUC_START)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END)
else if(chr <= EUC_END)
*yomi = Kigou[chr - EUC_START];
else
*yomi = Y_ZENKAKU;
} else if (chr == EUC_a2) {
} else if(chr == EUC_a2) {
chr = *euc;
if (chr < EUC_START)
if(chr < EUC_START)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END_KIGOU)
else if(chr <= EUC_END_KIGOU)
*yomi = Kigou[chr - EUC_START + 94];
else
*yomi = Y_ZENKAKU;
} else if (chr == EUC_a3) {
} else if(chr == EUC_a3) {
chr = *euc;
if (chr < EUC_0)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END_0)
*yomi = chr - EUC_0 + N_0;
else if (chr < EUC_A)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END_A)
*yomi = chr - EUC_A + A_A;
else if (chr < EUC_a)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END_a)
*yomi = chr - EUC_a + A_a;
else
*yomi = Y_ZENKAKU;
} else if (chr == EUC_a4) {
chr = *euc;
if (chr < EUC_START)
if(chr < EUC_0)
*yomi = Y_ZENKAKU;
else if (chr <= EUC_END_HIRA)
*yomi = chr - EUC_START + _XA;
else if(chr <= EUC_END_0)
*yomi = chr - EUC_0 + N_0;
else if(chr < EUC_A)
*yomi = Y_ZENKAKU;
else if(chr <= EUC_END_A)
*yomi = chr - EUC_A + A_A;
else if(chr < EUC_a)
*yomi = Y_ZENKAKU;
else if(chr <= EUC_END_a)
*yomi = chr - EUC_a + A_a;
else
*yomi = Y_ZENKAKU;
} else if (chr == EUC_a5) {
} else if(chr == EUC_a4) {
chr = *euc;
if (chr == EUC_VU)
if(chr < EUC_START)
*yomi = Y_ZENKAKU;
else if(chr <= EUC_END_HIRA)
*yomi = chr - EUC_START + _XA;
else
*yomi = Y_ZENKAKU;
} else if(chr == EUC_a5) {
chr = *euc;
if(chr == EUC_VU)
*yomi = _VU;
else if (chr == EUC_XKA)
else if(chr == EUC_XKA)
*yomi = _XKA;
else if (chr == EUC_XKE)
else if(chr == EUC_XKE)
*yomi = _XKE;
else
*yomi = Y_ZENKAKU;
}
else {
if (!(chr & 0x80)) {
} else {
if(!(chr & 0x80)) {
*yomi = Y_HANKAKU;
return 1;
} else if (chr == SS2) {
} else if(chr == SS2) {
*yomi = Y_HANKAKU;
} else if (chr == SS3) {
} else if(chr == SS3) {
*yomi = Y_ZENKAKU;
return 3;
} else
*yomi = Y_ZENKAKU;
} else
*yomi = Y_ZENKAKU;
}
return 2;
}
int sj2cd_str(u_char* euc, u_char* yomi, int len) {
if(!len--) return FALSE;
int
sj2cd_str(u_char *euc, u_char *yomi, int len)
{
if (!len--) return FALSE;
while (*euc && len--) euc += sj2cd_chr(euc, yomi++);
while(*euc && len--) euc += sj2cd_chr(euc, yomi++);
*yomi = 0;
return *euc ? FALSE : TRUE;

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: skiphblk.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: skiphblk.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:24 $
*/
@ -39,15 +39,13 @@
#include "sj_kanakan.h"
u_char *
skiphblk(u_char *ptr)
{
u_char*
skiphblk(u_char* ptr) {
ptr++;
while (*ptr != HINSIBLKTERM) ptr = skipkstr(ptr);
while(*ptr != HINSIBLKTERM) ptr = skipkstr(ptr);
ptr++;
return ptr;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: skipkstr.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: skipkstr.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:25 $
*/
@ -42,20 +42,19 @@
#include "sj_kanakan.h"
u_char *
skipkstr(u_char *ptr)
{
int contf = TRUE, csize;
u_char*
skipkstr(u_char* ptr) {
int contf = TRUE, csize;
do {
csize = codesize(*ptr);
if (ptr[csize] == KANJISTREND) contf = FALSE;
if(ptr[csize] == KANJISTREND) contf = FALSE;
ptr += csize;
} while (contf);
} while(contf);
ptr++;
ptr++;
return ptr;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: srchdict.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: srchdict.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:26 $
*/
@ -37,41 +37,38 @@
#include "sj_kanakan.h"
int
yomicmp(u_char *ptr1, u_char *ptr2, u_char *saml)
{
int i, j;
int same;
int yomicmp(u_char* ptr1, u_char* ptr2, u_char* saml) {
int i, j;
int same;
same = *saml;
i = getplen(ptr2);
j = getnlen(ptr2);
if (j == 0) {
if(j == 0) {
ptr2 = get_idxptr(prevseg);
for (i = same ; i ; i--)
if (*ptr1++ != *ptr2++) return OVER;
for(i = same; i; i--)
if(*ptr1++ != *ptr2++) return OVER;
j = sstrlen(ptr2);
}
else if (i > same)
else if(i > same)
return CONT;
else {
if (i < same) same = i;
if(i < same) same = i;
ptr1 += same;
ptr2 += DOUONBLKSIZENUMBER;
}
while (j-- > 0) {
if (*ptr1 > *ptr2) {
while(j-- > 0) {
if(*ptr1 > *ptr2) {
*saml = same;
return CONT;
}
else if (*ptr1++ < *ptr2++) {
} else if(*ptr1++ < *ptr2++) {
return OVER;
}
same++;
@ -81,24 +78,21 @@ yomicmp(u_char *ptr1, u_char *ptr2, u_char *saml)
return MATCH;
}
u_char *
srchdict(u_char *tagp)
{
TypeDicSeg segno;
int cmp;
int maxlen;
u_char*
srchdict(u_char* tagp) {
TypeDicSeg segno;
int cmp;
int maxlen;
maxlen = (cnvlen > MAXWDYOMILEN) ? MAXWDYOMILEN : cnvlen;
while ((int)dicinl <= maxlen) {
while((int)dicinl <= maxlen) {
segno = srchidx(prevseg, (int)dicinl);
(*curdict->getdic)(curdict, segno);
if (prevseg != segno) {
if(prevseg != segno) {
prevseg = segno;
@ -109,11 +103,11 @@ srchdict(u_char *tagp)
tagp = getntag(tagp);
if (segend(tagp)) {
if(segend(tagp)) {
prevseg = ++segno;
if (segno >= curdict->segunit) return NULL;
if(segno >= curdict->segunit) return NULL;
(*curdict->getdic)(curdict, segno);
@ -121,23 +115,23 @@ srchdict(u_char *tagp)
}
}
if (tagp == dicbuf) {
if(tagp == dicbuf) {
get_askknj();
tagp += *tagp + 1;
}
while (!segend(tagp)) {
while(!segend(tagp)) {
cmp = yomicmp(cnvstart, tagp, &dicsaml);
if ((int)dicsaml > maxlen) return NULL;
if((int)dicsaml > maxlen) return NULL;
if (cmp == OVER)
if(cmp == OVER)
return NULL;
else if (cmp == MATCH) {
else if(cmp == MATCH) {
if (isdpnd(*(cnvstart + dicsaml))) {
if(isdpnd(*(cnvstart + dicsaml))) {
break;
}
@ -153,4 +147,3 @@ srchdict(u_char *tagp)
return NULL;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,40 +28,35 @@
*/
/*
* $SonyRCSfile: srchhead.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: srchhead.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:28 $
*/
#include "sj_kcnv.h"
#include "sj_yomi.h"
#include "sj_kanakan.h"
int
srchhead()
{
if (*cnvstart == _O) {
int srchhead() {
if(*cnvstart == _O) {
headcode = SETTOU_O;
headlen = 1;
headlen = 1;
return TRUE;
}
else if (*cnvstart == _GO) {
else if(*cnvstart == _GO) {
headcode = SETTOU_GO;
headlen = 1;
headlen = 1;
return TRUE;
}
else if ((*cnvstart == _DA) && (*(cnvstart + 1) == _I)) {
else if((*cnvstart == _DA) && (*(cnvstart + 1) == _I)) {
headcode = SETTOU_DAI;
headlen = 2;
headlen = 2;
return TRUE;
}
headcode = headlen = 0;
return FALSE;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: srchidx.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: srchidx.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:29 $
*/
@ -38,18 +38,17 @@
#include "sj_kanakan.h"
TypeDicSeg
srchidx(TypeDicSeg low, int len)
{
TypeDicSeg high;
TypeDicSeg mid;
int cmp;
u_char *target;
srchidx(TypeDicSeg low, int len) {
TypeDicSeg high;
TypeDicSeg mid;
int cmp;
u_char* target;
if ((high = curdict->segunit - 1) < 1) return 0;
if((high = curdict->segunit - 1) < 1) return 0;
if (low == (TypeDicSeg)-1) low = 0;
if(low == (TypeDicSeg)-1) low = 0;
while (low <= high) {
while(low <= high) {
mid = (low + high) >> 1;
@ -57,11 +56,11 @@ srchidx(TypeDicSeg low, int len)
cmp = istrcmp(cnvstart, target, len, sstrlen(target));
if (cmp == OVER) {
if(cmp == OVER) {
high = mid - 1;
}
else if(cmp != MATCH){
else if(cmp != MATCH) {
low = mid + 1;
}
@ -72,4 +71,3 @@ srchidx(TypeDicSeg low, int len)
return (cmp == OVER && mid != DICSEGBASE) ? mid - 1 : mid;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: srchnum.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: srchnum.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:30 $
*/
@ -41,138 +41,131 @@
#include "sj_kanakan.h"
static void srch_kurai1(), srch_kurai2();
static void srch_kurai1(), srch_kurai2();
static void
srch_josuu_sub(JREC *jrec, TypeGram gram)
{
u_char *tagp;
DICTL *dp;
srch_josuu_sub(JREC* jrec, TypeGram gram) {
u_char* tagp;
DICTL* dp;
for (dp = dictlist ; dp ; dp = dp -> next) {
curdict = dp -> dict;
dicinl = 1;
for(dp = dictlist; dp; dp = dp->next) {
curdict = dp->dict;
dicinl = 1;
dicsaml = 0;
prevseg = -1;
while (tagp = srchdict(tagp)) setnumrec(tagp, jrec, gram);
while(tagp = srchdict(tagp)) setnumrec(tagp, jrec, gram);
}
}
static void
srch_josuu(JREC *jrec)
{
u_char *kp;
srch_josuu(JREC* jrec) {
u_char* kp;
int klen;
int len;
if (headcode && headcode != SETTOU_DAI) return;
if(headcode && headcode != SETTOU_DAI) return;
kp = cnvstart;
klen = cnvlen;
cnvstart += (len = jrec -> numlen);
cnvlen -= len;
cnvstart += (len = jrec->numlen);
cnvlen -= len;
srch_josuu_sub(jrec, JOSUUSI);
if (!headcode) srch_josuu_sub(jrec, JOSUUSI2);
if(!headcode) srch_josuu_sub(jrec, JOSUUSI2);
cnvstart = kp;
cnvlen = klen;
cnvlen = klen;
}
static void
setnrec_sub(u_char *p, u_short flag, int stb)
{
JREC *rec;
int len1;
int len2;
setnrec_sub(u_char* p, u_short flag, int stb) {
JREC* rec;
int len1;
int len2;
len1 = len2 = p - suuji_yptr;
if (headcode) len1 += headlen;
if (stb) len2--;
if(headcode) len1 += headlen;
if(stb) len2--;
if ((int)suuji_len == len2) {
if (suuji_wkeep) {
memcpy((u_char *)suuji_wkeep, (u_char *)suuji_wbuf,
sizeof(suuji_wbuf[0]) * NUMWORDBUF);
if((int)suuji_len == len2) {
if(suuji_wkeep) {
memcpy((u_char*)suuji_wkeep, (u_char*)suuji_wbuf,
sizeof(suuji_wbuf[0]) * NUMWORDBUF);
}
if (suuji_ukeep) {
if(suuji_ukeep) {
memcpy(suuji_ukeep, suuji_ubuf, NUMKETALENGTH);
}
suuji_exit = suuji_keta;
return;
}
if (rec = argjrec(len1, (JREC *)NULL)) {
rec -> class = suuji_class;
rec -> hinsi = SUUSI;
rec -> sttofs = headcode;
rec -> stbofs = (u_char)stb;
rec -> flags = flag;
rec -> numlen = (u_char)len2;
if(rec = argjrec(len1, (JREC*)NULL)) {
rec->class = suuji_class;
rec->hinsi = SUUSI;
rec->sttofs = headcode;
rec->stbofs = (u_char)stb;
rec->flags = flag;
rec->numlen = (u_char)len2;
if (!stb) srch_josuu(rec);
if(!stb) srch_josuu(rec);
}
}
static void
setnrec(u_char *p, u_short flag)
{
setnrec(u_char* p, u_short flag) {
setnrec_sub(p, flag, 0);
if (!headcode && (*p == Y_S_KIGOU2)) {
if(!headcode && (*p == Y_S_KIGOU2)) {
setnrec_sub(p + 1, flag, -1);
}
}
static u_char*
srchtbl(u_char ch, u_char *tbl, int rec, int n)
{
srchtbl(u_char ch, u_char* tbl, int rec, int n) {
int high, low, mid;
u_char *p;
u_char* p;
if (!ch) return NULL;
if(!ch) return NULL;
low = 0;
low = 0;
high = n - 1;
while (low <= high) {
while(low <= high) {
mid = (low + high) / 2;
p = tbl + mid * rec;
p = tbl + mid * rec;
if (ch == *p)
if(ch == *p)
break;
else if (ch < *p)
else if(ch < *p)
high = mid - 1;
else
low = mid + 1;
}
if (low > high) return NULL;
if(low > high) return NULL;
while (mid-- > 0 && ch == *(p - rec)) p -= rec;
while(mid-- > 0 && ch == *(p - rec)) p -= rec;
return p;
}
static int
isconnect(u_char *cnct, int num)
{
isconnect(u_char* cnct, int num) {
return (cnct[num / 8] & (0x80 >> (num % 8)));
}
static int
string_cmp(u_char *s, int l, u_char *d)
{
u_char *p;
string_cmp(u_char* s, int l, u_char* d) {
u_char* p;
p = s;
while (*s && l-- > 0) {
if (*s != *d) return 0;
while(*s && l-- > 0) {
if(*s != *d) return 0;
s++;
d++;
}
@ -181,8 +174,7 @@ string_cmp(u_char *s, int l, u_char *d)
}
static int
check_num(u_char *ptr)
{
check_num(u_char* ptr) {
int i;
int j;
int k;
@ -191,37 +183,37 @@ check_num(u_char *ptr)
int lketa;
int flg = FALSE;
int cnt;
u_short flag;
u_short flag;
memset((u_char *)suuji_wbuf, 0, sizeof(u_short) * 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;
for(i = suuji_keta; --i >= 0;) {
if(hketa >= 4) return FALSE;
tmp = suuji_ubuf[i];
if (j = ((tmp >> 6) & 3)) {
if (j < hketa) return FALSE;
if (j > hketa) {
if(j = ((tmp >> 6) & 3)) {
if(j < hketa) return FALSE;
if(j > hketa) {
flag |= JFLAG_N01;
do {
suuji_wbuf[hketa] |= (_NUM0<<(lketa*4));
if (++lketa >= 4) {
suuji_wbuf[hketa] |= (_NUM0 << (lketa * 4));
if(++lketa >= 4) {
lketa = 0;
hketa++;
}
} while (j > hketa);
} while(j > hketa);
}
}
k = ((tmp >> 4) & 3);
if (j || k) {
if (k < lketa) return FALSE;
if (k > lketa) {
if(j || k) {
if(k < lketa) return FALSE;
if(k > lketa) {
flag |= JFLAG_N01;
do {
suuji_wbuf[hketa] |= (_NUM0<<(lketa*4));
suuji_wbuf[hketa] |= (_NUM0 << (lketa * 4));
lketa++;
} while (k > lketa);
} while(k > lketa);
}
flg = TRUE;
}
@ -230,16 +222,16 @@ check_num(u_char *ptr)
cnt++;
j = (1 << tmp);
if (j & NUMBERS1) flag |= JFLAG_NS1;
if (j & NUMBER01) flag |= JFLAG_N01;
if (j & NUMBER23) flag |= JFLAG_N23;
if(j & NUMBERS1) flag |= JFLAG_NS1;
if(j & NUMBER01) flag |= JFLAG_N01;
if(j & NUMBER23) flag |= JFLAG_N23;
if (tmp != _NUM0) {
if(tmp != _NUM0) {
flg = FALSE;
switch (lketa) {
switch(lketa) {
case 0:
if (tmp == _NUM1) flag |= JFLAG_N_1;
if(tmp == _NUM1) flag |= JFLAG_N_1;
break;
case 1:
@ -247,22 +239,22 @@ check_num(u_char *ptr)
break;
}
}
if (++lketa >= 4) {
if(++lketa >= 4) {
lketa = 0;
hketa++;
}
}
if (flg) return FALSE;
if(flg) return FALSE;
if (suuji_keta == 1 || tmp != _NUM0) flag |= JFLAG_NN0;
if(suuji_keta == 1 || tmp != _NUM0) flag |= JFLAG_NN0;
if (hketa)
if(hketa)
flag |= (JFLAG_NK4 | JFLAG_NK2);
else if (lketa > 1)
else if(lketa > 1)
flag |= JFLAG_NK2;
if (cnt > 1) flag |= JFLAG_NSN;
if(cnt > 1) flag |= JFLAG_NSN;
setnrec(ptr, flag);
@ -270,57 +262,56 @@ check_num(u_char *ptr)
}
static void
srch_number1(u_char *ptr)
{
u_char ch;
u_char mode;
u_char *p;
int l;
TypeClass cls;
int len;
u_char *tptr;
srch_number1(u_char* ptr) {
u_char ch;
u_char mode;
u_char* p;
int l;
TypeClass cls;
int len;
u_char* tptr;
if (suuji_keta >= NUMKETALENGTH) return;
if(suuji_keta >= NUMKETALENGTH) return;
if (!(p = srchtbl((ch = *ptr), Suuji_tbl, SJTBLRECLEN, SJTBLRECNUM)))
if(!(p = srchtbl((ch = *ptr), Suuji_tbl, SJTBLRECLEN, SJTBLRECNUM)))
return;
len = suuji_yptr + MAXCLINPUTLEN - ptr;
for ( ; *SjTblYPos(p) == ch ; p += SJTBLRECLEN) {
if (!(l = string_cmp(SjTblYPos(p), SJTBLYLEN, ptr))) continue;
for(; *SjTblYPos(p) == ch; p += SJTBLRECLEN) {
if(!(l = string_cmp(SjTblYPos(p), SJTBLYLEN, ptr))) continue;
if (l > len) continue;
if(l > len) continue;
mode = *SjTblModeP(p);
mode = *SjTblModeP(p);
suuji_ubuf[suuji_keta++] = SjTblNumber(mode);
tptr = ptr + l;
tptr = ptr + l;
switch (suuji_class) {
switch(suuji_class) {
case C_N_ARABIA:
if (!(mode & SJTBLNARABIAF)) break;
if(!(mode & SJTBLNARABIAF)) break;
check_num(tptr);
srch_number1(tptr);
srch_kurai2(tptr, (u_char *)NULL);
srch_kurai2(tptr, (u_char*)NULL);
break;
case C_N_SUUJI:
if (mode & (SJTBLNARABIAF | SJTBLNYOMIF)) break;
if(mode & (SJTBLNARABIAF | SJTBLNYOMIF)) break;
check_num(tptr);
srch_number1(tptr);
srch_kurai1(tptr, (u_char *)NULL);
srch_kurai2(tptr, (u_char *)NULL);
srch_kurai1(tptr, (u_char*)NULL);
srch_kurai2(tptr, (u_char*)NULL);
break;
case C_N_KAZU:
case C_N_NANSUU:
if (mode & SJTBLNNARABIF) break;
if (mode & SJTBLNNANSUUF) {
cls = suuji_class;
if(mode & SJTBLNNARABIF) break;
if(mode & SJTBLNNANSUUF) {
cls = suuji_class;
suuji_class = C_N_NANSUU;
}
@ -328,32 +319,29 @@ srch_number1(u_char *ptr)
srch_kurai1(tptr, SjTblCnctP(p));
srch_kurai2(tptr, SjTblCnctP(p));
if (mode & SJTBLNNANSUUF) suuji_class = cls;
if(mode & SJTBLNNANSUUF) suuji_class = cls;
break;
default:
if (mode & SJTBLNARABIAF) {
if(mode & SJTBLNARABIAF) {
suuji_class = C_N_ARABIA;
check_num(tptr);
srch_number1(tptr);
srch_kurai2(tptr, (u_char *)NULL);
srch_kurai2(tptr, (u_char*)NULL);
suuji_class = C_N_KAZU;
}
else if (mode & SJTBLNYOMIF) {
if (mode & SJTBLNNANSUUF)
} else if(mode & SJTBLNYOMIF) {
if(mode & SJTBLNNANSUUF)
suuji_class = C_N_NANSUU;
else
suuji_class = C_N_KAZU;
check_num(tptr);
}
else if (mode & SJTBLNNARABIF) {
} else if(mode & SJTBLNNARABIF) {
suuji_class = C_N_SUUJI;
check_num(tptr);
srch_number1(tptr);
break;
}
else {
} else {
suuji_class = C_N_SUUJI;
srch_number1(tptr);
@ -370,35 +358,33 @@ srch_number1(u_char *ptr)
}
static void
srch_kurai1(u_char *ptr, u_char *cnct)
{
u_char ch;
u_char *p;
int l;
int keta;
int mode;
TypeClass cls;
int len;
u_char *tptr;
srch_kurai1(u_char* ptr, u_char* cnct) {
u_char ch;
u_char* p;
int l;
int keta;
int mode;
TypeClass cls;
int len;
u_char* tptr;
if (!(p = srchtbl((ch = *ptr), Kurai1_tbl, KR1TBLRECLEN, KR1TBLRECNUM)))
if(!(p = srchtbl((ch = *ptr), Kurai1_tbl, KR1TBLRECLEN, KR1TBLRECNUM)))
return;
len = suuji_yptr + MAXCLINPUTLEN - ptr;
for ( ; *Kr1TblYPos(p) == ch ; p += KR1TBLRECLEN) {
if (!(l = string_cmp(Kr1TblYPos(p), KR1TBLYLEN, ptr))) continue;
for(; *Kr1TblYPos(p) == ch; p += KR1TBLRECLEN) {
if(!(l = string_cmp(Kr1TblYPos(p), KR1TBLYLEN, ptr))) continue;
if (l > len) continue;
if(l > len) continue;
mode = *Kr1TblModeP(p);
keta = Kr1TblKeta(mode);
tptr = ptr + l;
if (suuji_class != C_N_KAZU && suuji_class != C_N_NANSUU) {
cls = suuji_class;
suuji_class = (suuji_class == C_N_ARABIA) ?
C_N_ARAKURA : C_N_KANKURA;
if(suuji_class != C_N_KAZU && suuji_class != C_N_NANSUU) {
cls = suuji_class;
suuji_class = (suuji_class == C_N_ARABIA) ? C_N_ARAKURA : C_N_KANKURA;
suuji_ubuf[suuji_keta - 1] |= (keta << 4);
check_num(tptr);
suuji_class = cls;
@ -406,23 +392,22 @@ srch_kurai1(u_char *ptr, u_char *cnct)
continue;
}
if (cnct) {
if (!isconnect(cnct, (int)Kr1TblCnct(mode))) continue;
if(cnct) {
if(!isconnect(cnct, (int)Kr1TblCnct(mode))) continue;
suuji_ubuf[suuji_keta - 1] |= (keta << 4);
}
else {
if (!Kr1TblTop(mode)) continue;
if (suuji_keta >= NUMKETALENGTH) continue;
} else {
if(!Kr1TblTop(mode)) continue;
if(suuji_keta >= NUMKETALENGTH) continue;
suuji_ubuf[suuji_keta++] = (_NUM1 | (keta << 4));
}
check_num(tptr);
srch_number1(tptr);
srch_kurai1(tptr, (u_char *)NULL);
srch_kurai1(tptr, (u_char*)NULL);
srch_kurai2(tptr, Kr1TblCnctP(p));
if (cnct)
if(cnct)
suuji_ubuf[suuji_keta - 1] &= 0xcf;
else
suuji_keta--;
@ -430,59 +415,56 @@ srch_kurai1(u_char *ptr, u_char *cnct)
}
static void
srch_kurai2(u_char *ptr, u_char *cnct)
{
u_char ch;
u_char *p;
int l;
int keta;
int mode;
TypeClass cls;
int len;
u_char *tptr;
srch_kurai2(u_char* ptr, u_char* cnct) {
u_char ch;
u_char* p;
int l;
int keta;
int mode;
TypeClass cls;
int len;
u_char* tptr;
if ((suuji_ubuf[0] & 0x0f) == _NUM0) return;
if((suuji_ubuf[0] & 0x0f) == _NUM0) return;
if (!(p = srchtbl((ch = *ptr), Kurai2_tbl, KR2TBLRECLEN, KR2TBLRECNUM)))
if(!(p = srchtbl((ch = *ptr), Kurai2_tbl, KR2TBLRECLEN, KR2TBLRECNUM)))
return;
len = suuji_yptr + MAXCLINPUTLEN - ptr;
for ( ; *Kr2TblYPos(p) == ch ; p += KR2TBLRECLEN) {
if (!(l = string_cmp(Kr2TblYPos(p), KR2TBLYLEN, ptr))) continue;
for(; *Kr2TblYPos(p) == ch; p += KR2TBLRECLEN) {
if(!(l = string_cmp(Kr2TblYPos(p), KR2TBLYLEN, ptr))) continue;
if (l > len) continue;
if(l > len) continue;
mode = *Kr2TblModeP(p);
keta = Kr2TblKeta(mode);
tptr = ptr + l;
if (suuji_class != C_N_KAZU && suuji_class != C_N_NANSUU) {
if(suuji_class != C_N_KAZU && suuji_class != C_N_NANSUU) {
suuji_ubuf[suuji_keta - 1] |= (keta << 6);
cls = suuji_class;
suuji_class = (suuji_class == C_N_ARABIA) ?
C_N_ARAKURA : C_N_KANKURA;
cls = suuji_class;
suuji_class = (suuji_class == C_N_ARABIA) ? C_N_ARAKURA : C_N_KANKURA;
check_num(tptr);
suuji_class = cls;
suuji_ubuf[suuji_keta - 1] &= 0x3f;
continue;
}
if (cnct) {
if (!isconnect(cnct, (int)Kr2TblCnct(mode))) continue;
if(cnct) {
if(!isconnect(cnct, (int)Kr2TblCnct(mode))) continue;
suuji_ubuf[suuji_keta - 1] |= (keta << 6);
}
else {
if (suuji_keta >= NUMKETALENGTH) continue;
} else {
if(suuji_keta >= NUMKETALENGTH) continue;
suuji_ubuf[suuji_keta++] = (_NUM1 | (keta << 6));
}
check_num(tptr);
srch_number1(tptr);
srch_kurai1(tptr, (u_char *)NULL);
srch_kurai1(tptr, (u_char*)NULL);
if (cnct)
if(cnct)
suuji_ubuf[suuji_keta - 1] &= 0x3f;
else
suuji_keta--;
@ -490,53 +472,47 @@ srch_kurai2(u_char *ptr, u_char *cnct)
}
static void
srch_number2(u_char *p)
{
u_char ch;
int i;
srch_number2(u_char* p) {
u_char ch;
int i;
suuji_class = (*p == N_0) ? C_N_SUUJILONG : C_N_KAZULONG;
suuji_keta = suuji_comma = 0;
for (i = 0 ; i < MAXCLINPUTLEN ; i++) {
if ((ch = *p++) == Y_COMMA) {
if (suuji_keta) {
if (suuji_comma) {
if (suuji_comma != 3) break;
for(i = 0; i < MAXCLINPUTLEN; i++) {
if((ch = *p++) == Y_COMMA) {
if(suuji_keta) {
if(suuji_comma) {
if(suuji_comma != 3) break;
} else {
if(suuji_keta >= 4) break;
if(*suuji_yptr == N_0) break;
}
else {
if (suuji_keta >= 4) break;
if (*suuji_yptr == N_0) break;
}
}
else
} else
break;
suuji_comma = 1;
ch = *p++;
}
else if (suuji_comma) {
ch = *p++;
} else if(suuji_comma) {
suuji_comma++;
}
if (suuji_comma > 3) break;
if(suuji_comma > 3) break;
if (!(Chrtbl[ch] & NUMBER)) break;
if(!(Chrtbl[ch] & NUMBER)) break;
if (suuji_keta < NUMKETALENGTH) {
if(suuji_keta < NUMKETALENGTH) {
suuji_ubuf[suuji_keta] = ch - N_0 + _NUM0;
}
suuji_keta++;
if (!suuji_comma && suuji_keta > NUMKETALENGTH) {
if(!suuji_comma && suuji_keta > NUMKETALENGTH) {
setnrec(p, 0);
}
else if (suuji_comma == 3) {
if (suuji_keta <= NUMKETALENGTH) {
} else if(suuji_comma == 3) {
if(suuji_keta <= NUMKETALENGTH) {
suuji_class = C_N_ARACMA;
check_num(p);
}
else {
} else {
suuji_class = C_N_KAZULCMA;
setnrec(p, 0);
}
@ -545,32 +521,29 @@ srch_number2(u_char *p)
}
static void
srchnum_sub(u_char *p)
{
srchnum_sub(u_char* p) {
suuji_yptr = p;
suuji_comma = suuji_keta = 0;
suuji_class = 0;
suuji_class = 0;
srch_number1(p);
suuji_keta = 0;
suuji_keta = 0;
suuji_class = C_N_KAZU;
srch_kurai1(p, (u_char *)NULL);
if (suuji_exit) return;
srch_kurai1(p, (u_char*)NULL);
if(suuji_exit) return;
srch_number2(p);
}
void
srchnum()
{
void srchnum() {
suuji_len = suuji_exit = 0;
srchnum_sub(cnvstart);
if (!headcode && (*cnvstart == Y_S_KIGOU1)) {
if(!headcode && (*cnvstart == Y_S_KIGOU1)) {
headcode = SETTOU_KIGOU;
headlen = 1;
headlen = 1;
srchnum_sub(cnvstart + 1);
@ -578,29 +551,24 @@ srchnum()
}
}
void
setwdnum(u_char *p, int len, u_short *wd)
{
void setwdnum(u_char* p, int len, u_short* wd) {
suuji_len = (u_char)len;
suuji_wkeep = wd;
suuji_ukeep = NULL;
headcode = headlen = 0;
suuji_exit = 0;
suuji_exit = 0;
srchnum_sub(p);
}
int
setucnum(u_char *p, int len, u_char *ud)
{
int setucnum(u_char* p, int len, u_char* ud) {
suuji_len = (u_char)len;
suuji_wkeep = NULL;
suuji_ukeep = ud;
headcode = headlen = 0;
suuji_exit = 0;
suuji_exit = 0;
srchnum_sub(p);
return (int)suuji_exit;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,23 +28,19 @@
*/
/*
* $SonyRCSfile: sstrcmp.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: sstrcmp.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:31 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
int
sstrcmp(u_char *src, u_char *dst)
{
for ( ; *src ; src++, dst++)
if (*src != *dst) break;
int sstrcmp(u_char* src, u_char* dst) {
for(; *src; src++, dst++)
if(*src != *dst) break;
return (*src - *dst);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,27 +28,22 @@
*/
/*
* $SonyRCSfile: sstrlen.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: sstrlen.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:32 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
int
sstrlen(u_char *ptr)
{
u_char *head;
int sstrlen(u_char* ptr) {
u_char* head;
head = ptr;
while (*ptr) ptr++;
while(*ptr) ptr++;
return (ptr - head);
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,30 +28,26 @@
*/
/*
* $SonyRCSfile: sstrncmp.c,v $
* $SonyRevision: 1.1 $
* $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"
#include "sj_kanakan.h"
int
sstrncmp(u_char *src, u_char *dst, int len)
{
int sstrncmp(u_char* src, u_char* dst, int len) {
while (len-- > 0) {
while(len-- > 0) {
if (*src > *dst)
if(*src > *dst)
return CONT;
if (*src < *dst) {
if (!*src) return PARTLY;
if(*src < *dst) {
if(!*src) return PARTLY;
return OVER;
}
src++;
@ -60,4 +56,3 @@ sstrncmp(u_char *src, u_char *dst, int len)
return MATCH;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,14 +28,11 @@
*/
/*
* $SonyRCSfile: stbtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: stbtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:34 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_yomi.h"
@ -43,105 +40,118 @@
#include "sj_kanakan.h"
static u_char name_stb[] = {
0x22, MEISI_1, _KU, _NN,
0xb7, 0xaf,
0x22, MEISI_1, _SA, _MA,
0xcd, 0xcd,
0x24, MEISI_1, _SA, _NN,
0xa4, 0xb5, 0xa4, 0xf3,
0x12, MEISI_1, _SI,
0xbb, 0xe1,
0x36, MEISI_1, _TI, _XYA, _NN,
0xa4, 0xc1, 0xa4, 0xe3, 0xa4, 0xf3,
0x22, MEISI_1, _DO, _NO,
0xc5, 0xc2,
0x00
};
static u_char name_stb[] = {
0x22, MEISI_1, _KU, _NN,
0xb7, 0xaf,
0x22, MEISI_1, _SA, _MA,
0xcd, 0xcd,
0x24, MEISI_1, _SA, _NN,
0xa4, 0xb5, 0xa4, 0xf3,
0x12, MEISI_1, _SI,
0xbb, 0xe1,
0x36, MEISI_1, _TI, _XYA, _NN,
0xa4, 0xc1, 0xa4, 0xe3, 0xa4, 0xf3,
0x22, MEISI_1, _DO, _NO,
0xc5, 0xc2,
0x00};
static u_char timei_stb[] = {
0x22, MEISI_1, _E, _KI,
0xb1, 0xd8,
0x44, MEISI_1, _E, _KI, _HA, _TU,
0xb1, 0xd8, 0xc8, 0xaf,
0x44, MEISI_1, _E, _KI, _YU, _KI,
0xb1, 0xd8, 0xb9, 0xd4,
0x22, MEISI_1, _GU, _NN,
0xb7, 0xb4,
0x12, MEISI_1, _SI,
0xbb, 0xd4,
0x32, MEISI_1, _TI, _XYO, _U,
0xc4, 0xae,
0x22, MEISI_1, _HA, _TU,
0xc8, 0xaf,
0x22, MEISI_1, _MA, _TI,
0xc4, 0xae,
0x22, MEISI_1, _MU, _RA,
0xc2, 0xbc,
0x00
};
static u_char timei_stb[] = {
0x22, MEISI_1, _E, _KI,
0xb1, 0xd8,
0x44, MEISI_1, _E, _KI, _HA, _TU,
0xb1, 0xd8, 0xc8, 0xaf,
0x44, MEISI_1, _E, _KI, _YU, _KI,
0xb1, 0xd8, 0xb9, 0xd4,
0x22, MEISI_1, _GU, _NN,
0xb7, 0xb4,
0x12, MEISI_1, _SI,
0xbb, 0xd4,
0x32, MEISI_1, _TI, _XYO, _U,
0xc4, 0xae,
0x22, MEISI_1, _HA, _TU,
0xc8, 0xaf,
0x22, MEISI_1, _MA, _TI,
0xc4, 0xae,
0x22, MEISI_1, _MU, _RA,
0xc2, 0xbc,
0x00};
static u_char meisi_stb[] = {
0x44, MEISI_6, _A, _TU, _KA, _I,
0xb0, 0xb7, 0xa4, 0xa4,
0x1a, MEISI_6, _KA,
0xb2, 0xbd,
0x22, MEISI_8, _TE, _KI,
0xc5, 0xaa,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x22, MEISI_8, _HU, _U,
0xc9, 0xf7,
0x00
};
static u_char meisi_stb[] = {
0x44, MEISI_6, _A, _TU, _KA, _I,
0xb0, 0xb7, 0xa4, 0xa4,
0x1a, MEISI_6, _KA,
0xb2, 0xbd,
0x22, MEISI_8, _TE, _KI,
0xc5, 0xaa,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x22, MEISI_8, _HU, _U,
0xc9, 0xf7,
0x00};
static u_char sahen_stb[] = {
0x44, MEISI_6, _A, _TU, _KA, _I,
0xb0, 0xb7, 0xa4, 0xa4,
0x1a, MEISI_6, _KA,
0xb2, 0xbd,
0x12, MEISI_11, _GO,
0xb8, 0xe5,
0x22, MEISI_11, _GO, _TO,
0xcb, 0xe8,
0x32, MEISI_11, _ZI, _XYO, _U,
0xbe, 0xe5,
0x32, MEISI_11, _TI, _XYU, _U,
0xc3, 0xe6,
0x22, MEISI_8, _TE, _KI,
0xc5, 0xaa,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x22, MEISI_8, _HU, _U,
0xc9, 0xf7,
0x22, MEISI_11, _MA, _E,
0xc1, 0xb0,
0x00
};
static u_char sahen_stb[] = {
0x44, MEISI_6, _A, _TU, _KA, _I,
0xb0, 0xb7, 0xa4, 0xa4,
0x1a, MEISI_6, _KA,
0xb2, 0xbd,
0x12, MEISI_11, _GO,
0xb8, 0xe5,
0x22, MEISI_11, _GO, _TO,
0xcb, 0xe8,
0x32, MEISI_11, _ZI, _XYO, _U,
0xbe, 0xe5,
0x32, MEISI_11, _TI, _XYU, _U,
0xc3, 0xe6,
0x22, MEISI_8, _TE, _KI,
0xc5, 0xaa,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x22, MEISI_8, _HU, _U,
0xc9, 0xf7,
0x22, MEISI_11, _MA, _E,
0xc1, 0xb0,
0x00};
static u_char human_stb[] = {
0x24, MEISI_1, _SA, _NN,
0xa4, 0xb5, 0xa4, 0xf3,
0x00
};
static u_char human_stb[] = {
0x24, MEISI_1, _SA, _NN,
0xa4, 0xb5, 0xa4, 0xf3,
0x00};
static u_char ippan_stb[] = {
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x00
};
static u_char ippan_stb[] = {
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _I,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa4,
0x56, FUKUSI_1, _NI, _TO, _MO, _NA, _U,
0xa4, 0xcb, 0xc8, 0xbc, 0xa4, 0xa6,
0x00};
u_char *stbadr[] = {
0,
ippan_stb, ippan_stb, ippan_stb, meisi_stb, sahen_stb,
sahen_stb, sahen_stb, meisi_stb, meisi_stb, meisi_stb,
ippan_stb, ippan_stb, human_stb, ippan_stb, ippan_stb,
ippan_stb, ippan_stb, ippan_stb, 0, 0,
name_stb, name_stb, 0, timei_stb,
u_char* stbadr[] = {
0,
ippan_stb,
ippan_stb,
ippan_stb,
meisi_stb,
sahen_stb,
sahen_stb,
sahen_stb,
meisi_stb,
meisi_stb,
meisi_stb,
ippan_stb,
ippan_stb,
human_stb,
ippan_stb,
ippan_stb,
ippan_stb,
ippan_stb,
ippan_stb,
0,
0,
name_stb,
name_stb,
0,
timei_stb,
};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,63 +28,44 @@
*/
/*
* $SonyRCSfile: stttbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: stttbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:37 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_kanakan.h"
static u_char o_settou[] = {
0xA1, 0xb8, 0xe6, 0xa4, 0xaa
};
static u_char o_settou[] = {
0xA1, 0xb8, 0xe6, 0xa4, 0xaa};
static u_char go_settou[] = {
0xA1, 0xb8, 0xe6, 0xa4, 0xb4
};
static u_char go_settou[] = {
0xA1, 0xb8, 0xe6, 0xa4, 0xb4};
static u_char dai_settou[] = {
0x22, 0xc2, 0xe8, 0xc2, 0xe8
};
static u_char dai_settou[] = {
0x22, 0xc2, 0xe8, 0xc2, 0xe8};
static u_char kigou_settou[] = {
0x01
};
static u_char kigou_settou[] = {
0x01};
u_char* settou_ptr[] = {
NULL, o_settou, go_settou, dai_settou, kigou_settou};
u_char scncttbl[2][24] = {
{
u_char *settou_ptr[] = {
NULL, o_settou, go_settou, dai_settou, kigou_settou
};
0x48, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0xff,
0x00, 0x1f, 0xf0, 0x00, 0xff, 0x00, 0x00, 0x00},
u_char scncttbl[2][24] = {
{
0x48, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{
0x18, 0x18, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0xff,
0x22, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1f, 0xf0, 0x00, 0xff, 0x00, 0x00, 0x00
},
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{
0x22, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: study.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: study.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:38 $
*/
@ -37,96 +37,94 @@
#include "sj_kanakan.h"
int
study(STDYOUT *stdy)
{
STDYOUT outp;
STDYIN *p1;
STDYIN *p2;
int wcnt;
int ret;
TypeDicSeg seg;
TypeDicOfs ofs;
TypeStyNum nm;
TypeStyNum wi;
int study(STDYOUT* stdy) {
STDYOUT outp;
STDYIN* p1;
STDYIN* p2;
int wcnt;
int ret;
TypeDicSeg seg;
TypeDicOfs ofs;
TypeStyNum nm;
TypeStyNum wi;
if (!StudyExist()) return STUDYNODICT;
if(!StudyExist()) return STUDYNODICT;
memcpy((u_char *)&outp, (u_char *)stdy, sizeof(outp));
memcpy((u_char*)&outp, (u_char*)stdy, sizeof(outp));
if (outp.stdy1.offset == 0) return STUDYNOTSTUDY;
if(outp.stdy1.offset == 0) return STUDYNOTSTUDY;
p1 = srchstdy(outp.stdy1.seg, outp.stdy1.offset, outp.stdy1.dicid);
if (p1) {
nm = p1 -> styno;
if(p1) {
nm = p1->styno;
for (wcnt = STUDYCOUNT, p2 = STUDYDICT ; wcnt-- ; p2++) {
if (p2 -> styno < nm) p2 -> styno++;
for(wcnt = STUDYCOUNT, p2 = STUDYDICT; wcnt--; p2++) {
if(p2->styno < nm) p2->styno++;
}
p1 -> styno = 1;
p1->styno = 1;
if (outp.sttfg) p1 -> sttkj = outp.stdy1.sttkj;
if (outp.ka_fg) p1 -> ka_kj = outp.stdy1.ka_kj;
if(outp.sttfg) p1->sttkj = outp.stdy1.sttkj;
if(outp.ka_fg) p1->ka_kj = outp.stdy1.ka_kj;
p1 -> nmflg = outp.stdy1.nmflg;
p1->nmflg = outp.stdy1.nmflg;
putstydic();
return STUDYNORMEND;
}
if(STUDYCOUNT >= STUDYMAX) {
if (STUDYCOUNT >= STUDYMAX) {
p1 = STUDYDICT; p2 = NULL; wi = 0;
for (wcnt = STUDYMAX ; wcnt-- ; p1++) {
if ((nm = p1 -> styno + 1) > wi) {
p1 = STUDYDICT;
p2 = NULL;
wi = 0;
for(wcnt = STUDYMAX; wcnt--; p1++) {
if((nm = p1->styno + 1) > wi) {
wi = nm;
p2 = p1;
}
p1 -> styno = nm;
p1->styno = nm;
}
if (p2) {
mvmemi((u_char *)(p2 + 1), (u_char *)p2,
(STUDYTAIL - p2) * STUDYRECSIZE);
if(p2) {
mvmemi((u_char*)(p2 + 1), (u_char*)p2,
(STUDYTAIL - p2) * STUDYRECSIZE);
STUDYCOUNT -= 1;
}
else
} else
return STUDYERROR;
ret = STUDYFULLAREA;
}
else {
} else {
p1 = STUDYDICT;
for (wcnt = STUDYCOUNT ; wcnt-- ; p1++) p1 -> styno++;
for(wcnt = STUDYCOUNT; wcnt--; p1++) p1->styno++;
ret = STUDYNORMEND;
}
p1 = STUDYDICT;
p1 = STUDYDICT;
seg = outp.stdy1.seg;
for (wcnt = STUDYCOUNT ; wcnt && (p1 -> seg < seg) ; ) {
wcnt--; p1++;
}
ofs = outp.stdy1.offset;
while (wcnt-- && (p1 -> seg == seg)) {
if (p1 -> offset > ofs) break;
for(wcnt = STUDYCOUNT; wcnt && (p1->seg < seg);) {
wcnt--;
p1++;
}
mvmemd((u_char *)(STUDYTAIL - 1), (u_char *)STUDYTAIL,
(u_char *)(STUDYTAIL - 1) - (u_char *)p1);
p1 -> offset = outp.stdy1.offset;
p1 -> seg = outp.stdy1.seg;
p1 -> dicid = outp.stdy1.dicid;
p1 -> styno = 1;
p1 -> sttkj = (outp.sttfg) ? outp.stdy1.sttkj : 0;
p1 -> ka_kj = (outp.ka_fg) ? outp.stdy1.ka_kj : 0;
p1 -> nmflg = outp.stdy1.nmflg;
ofs = outp.stdy1.offset;
while(wcnt-- && (p1->seg == seg)) {
if(p1->offset > ofs) break;
p1++;
}
mvmemd((u_char*)(STUDYTAIL - 1), (u_char*)STUDYTAIL,
(u_char*)(STUDYTAIL - 1) - (u_char*)p1);
p1->offset = outp.stdy1.offset;
p1->seg = outp.stdy1.seg;
p1->dicid = outp.stdy1.dicid;
p1->styno = 1;
p1->sttkj = (outp.sttfg) ? outp.stdy1.sttkj : 0;
p1->ka_kj = (outp.ka_fg) ? outp.stdy1.ka_kj : 0;
p1->nmflg = outp.stdy1.nmflg;
STUDYCOUNT += 1;
putstydic();
@ -134,54 +132,51 @@ study(STDYOUT *stdy)
return ret;
}
STDYIN *
srchstdy(TypeDicSeg seg, TypeDicOfs ofs, TypeDicID dicid)
{
STDYIN*
srchstdy(TypeDicSeg seg, TypeDicOfs ofs, TypeDicID dicid) {
int high;
int mid;
int low;
STDYIN *ptr;
STDYIN* ptr;
if(!StudyExist()) return NULL;
if (!StudyExist()) return NULL;
if(!STUDYCOUNT || !ofs) return NULL;
if (!STUDYCOUNT || !ofs) return NULL;
low = 0;
low = 0;
high = STUDYCOUNT - 1;
for ( ; ; ) {
for(;;) {
mid = ((low + high) >> 1);
if (STUDYDICT[mid].seg > seg)
if(STUDYDICT[mid].seg > seg)
high = mid - 1;
else if (STUDYDICT[mid].seg < seg)
else if(STUDYDICT[mid].seg < seg)
low = mid + 1;
else
break;
if (low > high) return NULL;
if(low > high) return NULL;
}
low = mid + 1;
ptr = &STUDYDICT[mid];
while (ptr -> seg == seg) {
if (ptr -> offset < ofs) break;
if (ptr -> dicid == dicid && ptr -> offset == ofs) return ptr;
if (!mid--) break;
while(ptr->seg == seg) {
if(ptr->offset < ofs) break;
if(ptr->dicid == dicid && ptr->offset == ofs) return ptr;
if(!mid--) break;
ptr--;
}
ptr = &STUDYDICT[low];
mid = STUDYCOUNT - low;
while (mid-- && ptr -> seg == seg) {
if (ptr -> offset > ofs) break;
if (ptr -> dicid == dicid && ptr -> offset == ofs) return ptr;
while(mid-- && ptr->seg == seg) {
if(ptr->offset > ofs) break;
if(ptr->dicid == dicid && ptr->offset == ofs) return ptr;
ptr++;
}
return NULL;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,14 +28,11 @@
*/
/*
* $SonyRCSfile: suujitbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: suujitbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:39 $
*/
#include "sj_const.h"
#include "sj_rename.h"
#include "sj_typedef.h"
@ -44,153 +41,126 @@
#include "sj_kanakan.h"
#define NA SJTBLNARABIAF
#define NY SJTBLNYOMIF
#define NN SJTBLNNARABIF
#define NS SJTBLNNANSUUF
#define NA SJTBLNARABIAF
#define NY SJTBLNYOMIF
#define NN SJTBLNNARABIF
#define NS SJTBLNNANSUUF
u_char suuji_tbl[] = {
N_0, _NIL, _NIL, _NUM0 | NA, 0x00, 0x00,
N_1, _NIL, _NIL, _NUM1 | NA, 0xec, 0x07,
N_2, _NIL, _NIL, _NUM2 | NA, 0xec, 0x07,
N_3, _NIL, _NIL, _NUM3 | NA, 0xff, 0x07,
N_4, _NIL, _NIL, _NUM4 | NA, 0xec, 0x07,
N_5, _NIL, _NIL, _NUM5 | NA, 0xec, 0x07,
N_6, _NIL, _NIL, _NUM6 | NA, 0xec, 0xc7,
N_7, _NIL, _NIL, _NUM7 | NA, 0xec, 0x07,
N_8, _NIL, _NIL, _NUM8 | NA, 0xec, 0xc7,
N_9, _NIL, _NIL, _NUM9 | NA, 0xec, 0x07,
_I, _TI, _NIL, _NUM1, 0x00, 0x05,
_I, _XTU, _NIL, _NUM1S | NY, 0x20, 0x02,
_KI, _XYU, _U, _NUM9, 0xec, 0x07,
_KU, _NIL, _NIL, _NUM9 | NY, 0x00, 0x00,
_GO, _NIL, _NIL, _NUM5, 0xec, 0x07,
_GO, _U, _NIL, _NUM5 | NN, 0x00, 0x00,
_SA, _NN, _NIL, _NUM3, 0xd3, 0x07,
_SI, _NIL, _NIL, _NUM4 | NY, 0x80, 0x00,
_SI, _I, _NIL, _NUM4 | NN, 0x00, 0x00,
_SI, _TI, _NIL, _NUM7, 0xec, 0x07,
_SU, _U, _NIL, _NUMS | NY | NS, 0xec, 0x07,
_ZE, _RO, _NIL, _NUM0 | NN, 0x00, 0x00,
_NA, _NA, _NIL, _NUM7, 0xec, 0x07,
_NA, _NN, _NIL, _NUMN | NY | NS, 0xf3, 0x07,
_NI, _NIL, _NIL, _NUM2, 0xec, 0x07,
_NI, _I, _NIL, _NUM2 | NN, 0x00, 0x00,
_HA, _TI, _NIL, _NUM8, 0xc0, 0x05,
_HA, _XTU, _NIL, _NUM8 | NY, 0x20, 0xc2,
_MA, _RU, _NIL, _NUM0 | NN, 0x00, 0x00,
_YO, _NIL, _NIL, _NUM4 | NY, 0x00, 0x00,
_YO, _NN, _NIL, _NUM4, 0xec, 0x07,
_RE, _I, _NIL, _NUM0 | NN, 0xec, 0x00,
_RO, _KU, _NIL, _NUM6, 0xe0, 0x07,
_RO, _XTU, _NIL, _NUM6 | NY, 0x00, 0xc2,
0};
u_char kurai1_tbl[] = {
_ZI, _XYU, _U, (1 << 4) + 0 + KR1TBLTOPF, 0x05,
_ZI, _XYU, _XTU, (1 << 4) + 1 + KR1TBLTOPF, 0x02,
_SE, _NN, _NIL, (3 << 4) + 2 + KR1TBLTOPF, 0x07,
_ZE, _NN, _NIL, (3 << 4) + 3, 0x05,
_HI, _XYA, _KU, (2 << 4) + 4 + KR1TBLTOPF, 0x07,
_HI, _XYA, _XTU, (2 << 4) + 5 + KR1TBLTOPF, 0x02,
_BI, _XYA, _KU, (2 << 4) + 6, 0x07,
_BI, _XYA, _XTU, (2 << 4) + 7, 0x00,
_PI, _XYA, _KU, (2 << 4) + 8, 0x07,
_PI, _XYA, _XTU, (2 << 4) + 9, 0x00,
0};
u_char suuji_tbl[] = {
N_0,_NIL,_NIL, _NUM0 | NA, 0x00, 0x00,
N_1,_NIL,_NIL, _NUM1 | NA, 0xec, 0x07,
N_2,_NIL,_NIL, _NUM2 | NA, 0xec, 0x07,
N_3,_NIL,_NIL, _NUM3 | NA, 0xff, 0x07,
N_4,_NIL,_NIL, _NUM4 | NA, 0xec, 0x07,
N_5,_NIL,_NIL, _NUM5 | NA, 0xec, 0x07,
N_6,_NIL,_NIL, _NUM6 | NA, 0xec, 0xc7,
N_7,_NIL,_NIL, _NUM7 | NA, 0xec, 0x07,
N_8,_NIL,_NIL, _NUM8 | NA, 0xec, 0xc7,
N_9,_NIL,_NIL, _NUM9 | NA, 0xec, 0x07,
_I, _TI, _NIL, _NUM1, 0x00, 0x05,
_I, _XTU,_NIL, _NUM1S | NY, 0x20, 0x02,
_KI,_XYU,_U, _NUM9, 0xec, 0x07,
_KU,_NIL,_NIL, _NUM9 | NY, 0x00, 0x00,
_GO,_NIL,_NIL, _NUM5, 0xec, 0x07,
_GO,_U, _NIL, _NUM5 | NN, 0x00, 0x00,
_SA,_NN, _NIL, _NUM3, 0xd3, 0x07,
_SI,_NIL,_NIL, _NUM4 | NY, 0x80, 0x00,
_SI,_I, _NIL, _NUM4 | NN, 0x00, 0x00,
_SI,_TI, _NIL, _NUM7, 0xec, 0x07,
_SU,_U, _NIL, _NUMS | NY | NS, 0xec, 0x07,
_ZE,_RO, _NIL, _NUM0 | NN, 0x00, 0x00,
_NA,_NA, _NIL, _NUM7, 0xec, 0x07,
_NA,_NN, _NIL, _NUMN | NY | NS, 0xf3, 0x07,
_NI,_NIL,_NIL, _NUM2, 0xec, 0x07,
_NI,_I, _NIL, _NUM2 | NN, 0x00, 0x00,
_HA,_TI, _NIL, _NUM8, 0xc0, 0x05,
_HA,_XTU,_NIL, _NUM8 | NY, 0x20, 0xc2,
_MA,_RU, _NIL, _NUM0 | NN, 0x00, 0x00,
_YO,_NIL,_NIL, _NUM4 | NY, 0x00, 0x00,
_YO,_NN, _NIL, _NUM4, 0xec, 0x07,
_RE,_I, _NIL, _NUM0 | NN, 0xec, 0x00,
_RO,_KU, _NIL, _NUM6, 0xe0, 0x07,
_RO,_XTU,_NIL, _NUM6 | NY, 0x00, 0xc2,
0
};
u_char kurai2_tbl[] = {
_O, _KU, _NIL, (2 << 4) + 13,
_TI, _XYO, _U, (3 << 4) + 14,
_MA, _NN, _NIL, (1 << 4) + 15,
0};
u_char num1tbl[] = {
0xa3, 0xb0,
0xa3, 0xb1,
0xa3, 0xb2,
0xa3, 0xb3,
0xa3, 0xb4,
0xa3, 0xb5,
0xa3, 0xb6,
0xa3, 0xb7,
0xa3, 0xb8,
0xa3, 0xb9,
0xa3, 0xb1,
0xbf, 0xf4,
0xb2, 0xbf};
u_char num2tbl[] = {
0xa1, 0xbb,
0xb0, 0xec,
0xc6, 0xf3,
0xbb, 0xb0,
0xbb, 0xcd,
0xb8, 0xde,
0xcf, 0xbb,
0xbc, 0xb7,
0xc8, 0xac,
0xb6, 0xe5,
0xb0, 0xec,
0xbf, 0xf4,
0xb2, 0xbf};
u_char kurai1_tbl[] = {
_ZI,_XYU,_U, (1<<4)+0+KR1TBLTOPF, 0x05,
_ZI,_XYU,_XTU, (1<<4)+1+KR1TBLTOPF, 0x02,
_SE,_NN, _NIL, (3<<4)+2+KR1TBLTOPF, 0x07,
_ZE,_NN, _NIL, (3<<4)+3, 0x05,
_HI,_XYA,_KU, (2<<4)+4+KR1TBLTOPF, 0x07,
_HI,_XYA,_XTU, (2<<4)+5+KR1TBLTOPF, 0x02,
_BI,_XYA,_KU, (2<<4)+6, 0x07,
_BI,_XYA,_XTU, (2<<4)+7, 0x00,
_PI,_XYA,_KU, (2<<4)+8, 0x07,
_PI,_XYA,_XTU, (2<<4)+9, 0x00,
0
};
u_char num3tbl[] = {
0xce, 0xed,
0xb0, 0xed,
0xc6, 0xf5,
0xbb, 0xb2,
0xbb, 0xcd,
0xb8, 0xde,
0xcf, 0xbb,
0xbc, 0xb7,
0xc8, 0xac,
0xb6, 0xe5,
0xb0, 0xed,
0xbf, 0xf4,
0xb2, 0xbf};
u_char num4tbl[] = {
0xc0, 0xe9,
0xc9, 0xb4,
0xbd, 0xbd,
0};
u_char num5tbl[] = {
0xc0, 0xe9,
0xc9, 0xb4,
0xbd, 0xa6,
0};
u_char kurai2_tbl[] = {
_O, _KU, _NIL, (2<<4)+13,
_TI,_XYO,_U, (3<<4)+14,
_MA,_NN, _NIL, (1<<4)+15,
0
};
u_char num1tbl[] = {
0xa3, 0xb0,
0xa3, 0xb1,
0xa3, 0xb2,
0xa3, 0xb3,
0xa3, 0xb4,
0xa3, 0xb5,
0xa3, 0xb6,
0xa3, 0xb7,
0xa3, 0xb8,
0xa3, 0xb9,
0xa3, 0xb1,
0xbf, 0xf4,
0xb2, 0xbf
};
u_char num2tbl[] = {
0xa1, 0xbb,
0xb0, 0xec,
0xc6, 0xf3,
0xbb, 0xb0,
0xbb, 0xcd,
0xb8, 0xde,
0xcf, 0xbb,
0xbc, 0xb7,
0xc8, 0xac,
0xb6, 0xe5,
0xb0, 0xec,
0xbf, 0xf4,
0xb2, 0xbf
};
u_char num3tbl[] = {
0xce, 0xed,
0xb0, 0xed,
0xc6, 0xf5,
0xbb, 0xb2,
0xbb, 0xcd,
0xb8, 0xde,
0xcf, 0xbb,
0xbc, 0xb7,
0xc8, 0xac,
0xb6, 0xe5,
0xb0, 0xed,
0xbf, 0xf4,
0xb2, 0xbf
};
u_char num4tbl[] = {
0xc0, 0xe9,
0xc9, 0xb4,
0xbd, 0xbd,
0
};
u_char num5tbl[] = {
0xc0, 0xe9,
0xc9, 0xb4,
0xbd, 0xa6,
0
};
u_char num6tbl[] = {
0xc3, 0xfb,
0xb2, 0xaf,
0xcb, 0xfc,
0
};
u_char num6tbl[] = {
0xc3, 0xfb,
0xb2, 0xaf,
0xcb, 0xfc,
0};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,45 +28,38 @@
*/
/*
* $SonyRCSfile: terminat.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: terminat.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:40 $
*/
#include "sj_kcnv.h"
#include "sj_right.h"
#include "sj_kanakan.h"
int
terminate(TypeCnct right, u_char *yomi)
{
u_char ch;
int terminate(TypeCnct right, u_char* yomi) {
u_char ch;
if ((yomi > cnvstart) && (Chrtbl[*(yomi - 1)] & NUMBER))
if((yomi > cnvstart) && (Chrtbl[*(yomi - 1)] & NUMBER))
return TRUE;
ch = *yomi;
if (Termtbl[right] & T_SHUUJO) {
if(Termtbl[right] & T_SHUUJO) {
if (!ch) return TRUE;
if(!ch) return TRUE;
if (Chrtbl[ch] & FZKTOP) return FALSE;
if(Chrtbl[ch] & FZKTOP) return FALSE;
if (!isdpnd(ch)) return SHU;
if(!isdpnd(ch)) return SHU;
}
if (Termtbl[right] & T_KANOU) {
if(Termtbl[right] & T_KANOU) {
if (ch && (Chrtbl[ch] & FZKTOP)) return FALSE;
if(ch && (Chrtbl[ch] & FZKTOP)) return FALSE;
if (!isdpnd(ch)) return TRUE;
if(!isdpnd(ch)) return TRUE;
}
return FALSE;
}

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,13 +28,11 @@
*/
/*
* $SonyRCSfile: termtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: termtbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:42 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_const.h"
@ -42,286 +40,285 @@
#include "sj_kanakan.h"
u_char termtbl[] = {
0,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_A,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + 8,
T_KANOU + P_JOSHI_B,
u_char termtbl[] = {
0,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_A,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + 8,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_E,
T_KANOU + P_JOSHI_B,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_E,
T_KANOU + P_JOSHI_B,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
0,
0,
0,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
T_KANOU + P_RENYOU_M,
0,
0,
0,
T_KANOU + P_RENYOU_J,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_RENYOU_J,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_RENYOU_J,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_JOSHI_C,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_JOSHI_C,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_SHUUJO+ P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_F,
T_SHUUJO + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 8,
T_KANOU + RENTAI + 10,
T_KANOU + RENTAI + 7,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 7,
T_KANOU + RENTAI + 6,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 7,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 8,
T_KANOU + RENTAI + 10,
T_KANOU + RENTAI + 7,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 7,
T_KANOU + RENTAI + 6,
T_KANOU + P_SHUUSI,
T_KANOU + RENTAI + 7,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_SHUUJO+ RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 7,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_SHUUJO + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 7,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
T_KANOU + RENTAI + 6,
0 + P_FUKA,
T_KANOU + RENTAI + 6,
0 + P_FUKA,
T_KANOU + 3,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_KAMEI,
T_KANOU + P_MEIREI,
T_KANOU + P_MEIREI,
T_SHUUJO+ P_MEIREI,
T_SHUUJO+ P_MEIREI,
0 + P_FUKA,
T_KANOU + RENTAI + 6,
0 + P_FUKA,
T_KANOU + 3,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_KAMEI,
T_KANOU + P_MEIREI,
T_KANOU + P_MEIREI,
T_SHUUJO + P_MEIREI,
T_SHUUJO + P_MEIREI,
T_KANOU + P_MEISI,
0 + P_FUKA,
T_KANOU + P_FUKA,
T_KANOU + P_MEISI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_MEISI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_E,
T_KANOU + P_MEISI,
0 + P_FUKA,
T_KANOU + P_FUKA,
T_KANOU + P_MEISI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_MEISI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_E,
T_KANOU + P_SHUUSI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_FUKUSI,
T_KANOU + P_FUKUSI,
T_KANOU + P_SHUUSI,
0 + P_FUKA,
T_KANOU + P_DAIMEISI,
T_KANOU + 7,
0 + P_FUKA,
T_SHUUJO+ P_JOSHI_E,
T_KANOU + P_SHUUSI,
T_KANOU + P_DAIMEISI,
T_KANOU + P_FUKUSI,
T_KANOU + P_FUKUSI,
T_KANOU + P_SHUUSI,
0 + P_FUKA,
T_KANOU + P_DAIMEISI,
T_KANOU + 7,
0 + P_FUKA,
T_SHUUJO + P_JOSHI_E,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_A,
T_KANOU + P_MEISI,
T_KANOU + P_JOSHI_B,
T_KANOU + P_RENYOU_F,
T_KANOU + P_F_FUKUSI,
0,
T_KANOU + P_JOSHI_F,
0,
0,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_A,
T_KANOU + P_MEISI,
T_KANOU + P_JOSHI_B,
T_KANOU + P_RENYOU_F,
T_KANOU + P_F_FUKUSI,
0,
T_KANOU + P_JOSHI_F,
0,
0,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_KANOU + P_RENYOU_F,
T_KANOU + P_RENYOU_J,
T_KANOU + P_RENYOU_F,
0 + P_FUKA,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
T_KANOU + P_SHUUSI,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_SHUUJO+ P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + 1,
T_KANOU + P_JOSHI_F,
T_KANOU + P_JOSHI_F,
T_KANOU + P_JOSHI_C,
T_KANOU + P_SHUUSI,
0 + P_FUKA,
0 + P_FUKA,
0 + P_FUKA,
T_SHUUJO + P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + 1,
T_KANOU + P_JOSHI_F,
T_KANOU + P_JOSHI_F,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_F,
T_KANOU + P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_F,
T_KANOU + P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_D,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_D,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_D,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_D,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_D,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_SHUUJO+ P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_SHUUJO + P_SHUUSI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_B,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
T_KANOU + P_JOSHI_C,
T_KANOU + P_JOSHI_C,
T_KANOU + P_KEISIKI,
T_KANOU + P_KEISIKI,
0 + P_JOSHI_C,
T_KANOU + P_SUUSI,
T_KANOU + P_SETUZOKU,
T_KANOU + P_KANDOU,
T_KANOU + P_SETTOU,
T_KANOU + P_FUKUSI,
T_KANOU + P_FZKKGU,
T_KANOU + P_MEISI,
T_KANOU + P_MEISI,
T_KANOU + P_MEISI,
0 + P_JOSHI_C,
T_KANOU + P_SUUSI,
T_KANOU + P_SETUZOKU,
T_KANOU + P_KANDOU,
T_KANOU + P_SETTOU,
T_KANOU + P_FUKUSI,
T_KANOU + P_FZKKGU,
T_KANOU + P_MEISI,
T_KANOU + P_MEISI,
T_KANOU + P_MEISI,
T_KANOU + P_MEISI,
0 + P_SETUBI,
T_KANOU + P_SETUBI,
T_KANOU + P_JOSUUSI,
T_KANOU + P_RENTAISI,
T_KANOU + P_TANKAN
};
T_KANOU + P_MEISI,
0 + P_SETUBI,
T_KANOU + P_SETUBI,
T_KANOU + P_JOSUUSI,
T_KANOU + P_RENTAISI,
T_KANOU + P_TANKAN};

View file

@ -1,6 +1,6 @@
/*
* 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,8 +28,8 @@
*/
/*
* $SonyRCSfile: wakachi.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: wakachi.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:43 $
*/
@ -39,18 +39,16 @@
#include "sj_kanakan.h"
void
wakachi()
{
JREC *jrec;
CLREC *clrec;
void wakachi() {
JREC* jrec;
CLREC* clrec;
CREC crec[4];
int count;
u_char *next;
TypeCnct right;
int i;
int maxlen;
CREC crec[4];
int count;
u_char* next;
TypeCnct right;
int i;
int maxlen;
free_jall(maxjptr);
maxjptr = NULL;
@ -58,49 +56,47 @@ wakachi()
maxlen = (cnvlen > MAXCLINPUTLEN) ? MAXCLINPUTLEN : cnvlen;
next = cnvstart;
if (Chrtbl[*next] & (TAI_KGU | FZK_KGU)) {
if(Chrtbl[*next] & (TAI_KGU | FZK_KGU)) {
while (*next && (Chrtbl[*next] & (TAI_KGU | FZK_KGU)))
while(*next && (Chrtbl[*next] & (TAI_KGU | FZK_KGU)))
next++;
if ((i = next - cnvstart) > maxlen) {
if((i = next - cnvstart) > maxlen) {
next = cnvstart + maxlen;
i = maxlen;
i = maxlen;
}
if (!(jrec = argjrec(i, (JREC *)NULL))) return;
if(!(jrec = argjrec(i, (JREC*)NULL))) return;
jrec -> class = C_WAKACHI;
jrec -> hinsi = D_MEISI_1;
jrec->class = C_WAKACHI;
jrec->hinsi = D_MEISI_1;
if (Chrtbl[*(next - 1)] & TAI_KGU)
if(Chrtbl[*(next - 1)] & TAI_KGU)
srchfzk(jrec, next, R_DAIMEISI, 0);
}
else {
if (!(jrec = argjrec(0, (JREC *)NULL))) return;
jrec -> class = C_WAKACHI;
jrec -> hinsi = MEISI_6;
if(!(jrec = argjrec(0, (JREC*)NULL))) return;
jrec->class = C_WAKACHI;
jrec->hinsi = MEISI_6;
while ((int)jrec -> jlen < maxlen) {
while((int)jrec->jlen < maxlen) {
count = setconj((TypeGram)MEISI_6, jrec, crec);
for (i = count ; i-- > 0 ; ) {
for(i = count; i-- > 0;) {
right = crec[i].right;
right = crec[i].right;
gobilen = crec[i].len;
next = cnvstart + jrec->jlen + gobilen;
next = cnvstart + jrec->jlen + gobilen;
if (gobilen) {
if (terminate(right, next)) {
if(gobilen) {
if(terminate(right, next)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
}
}
else if ((Chrtbl[*next] & NUMBER)
&& (jrec -> jlen)) {
} else if((Chrtbl[*next] & NUMBER) && (jrec->jlen)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
return;
@ -109,22 +105,21 @@ wakachi()
srchfzk(jrec, next, right, 0);
}
if (maxclptr) break;
if(maxclptr) break;
(jrec -> jlen)++;
(jrec->jlen)++;
}
}
if ((maxclptr) && (Chrtbl[*(cnvstart + jrec -> jlen)] & FZKTOP))
if((maxclptr) && (Chrtbl[*(cnvstart + jrec->jlen)] & FZKTOP))
return;
if (jrec -> jlen) {
if (clrec = argclrec((int)jrec -> jlen)) {
clrec -> jnode = jrec;
clrec -> right = R_MEISI;
clrec -> kubun = K_TAIGEN;
(jrec -> count)++;
if(jrec->jlen) {
if(clrec = argclrec((int)jrec->jlen)) {
clrec->jnode = jrec;
clrec->right = R_MEISI;
clrec->kubun = K_TAIGEN;
(jrec->count)++;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 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
@ -8,10 +8,10 @@
* 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.
@ -19,7 +19,7 @@
* 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
@ -28,12 +28,11 @@
*/
/*
* $SonyRCSfile: wc16_str.c,v $
* $SonyRevision: 1.3 $
* $SonyRCSfile: wc16_str.c,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1994/11/17 06:49:21 $
*/
#include <stdio.h>
#include <locale.h>
#include "wchar16.h"
@ -47,108 +46,93 @@
#define FALSE (0)
#endif
#define sjis2euc sj3_sjis2euc
#define euc2sjis sj3_euc2sjis
#define sjis2euc sj3_sjis2euc
#define euc2sjis sj3_euc2sjis
#define issjis1(c) (((0x81 <= (c)) && ((c) <= 0x9f)) || \
((0xe0 <= (c)) && ((c) <= 0xfc)))
#define iseuc(c) ((0xa1 <= (c)) && ((c) <= 0xfe))
#define iskana(c) ((0xa1 <= (c)) && ((c) <= 0xdf))
#define issjis1(c) (((0x81 <= (c)) && ((c) <= 0x9f)) || \
((0xe0 <= (c)) && ((c) <= 0xfc)))
#define iseuc(c) ((0xa1 <= (c)) && ((c) <= 0xfe))
#define iskana(c) ((0xa1 <= (c)) && ((c) <= 0xdf))
extern int current_locale;
int
sj3_iswcntrl16(wchar16_t wc)
{
if ((wc < 0x20) || (wc == 0x7f)) return TRUE;
int sj3_iswcntrl16(wchar16_t wc) {
if((wc < 0x20) || (wc == 0x7f)) return TRUE;
return FALSE;
}
int
sj3_iswupper16(wchar16_t wc)
{
if (((0x40 < wc) && (wc < 0x5b)) ||
((0xa3c0 < wc) && (wc < 0xa3db))) return TRUE;
int sj3_iswupper16(wchar16_t wc) {
if(((0x40 < wc) && (wc < 0x5b)) ||
((0xa3c0 < wc) && (wc < 0xa3db))) return TRUE;
return FALSE;
}
int
sj3_iswdigit16(wchar16_t wc)
{
if (((0x29 < wc) && (wc < 0x3a)) ||
((0xa3af < wc) && (wc < 0xa3ba))) return TRUE;
int sj3_iswdigit16(wchar16_t wc) {
if(((0x29 < wc) && (wc < 0x3a)) ||
((0xa3af < wc) && (wc < 0xa3ba))) return TRUE;
return FALSE;
}
int
sj3_iswxdigit16(wchar16_t wc)
{
if (((0x29 < wc) && (wc < 0x3a)) ||
((0xa3af < wc) && (wc < 0xa3ba))) return TRUE;
int sj3_iswxdigit16(wchar16_t wc) {
if(((0x29 < wc) && (wc < 0x3a)) ||
((0xa3af < wc) && (wc < 0xa3ba))) return TRUE;
if (((0x60 < wc) && (wc < 0x67)) ||
((0x40 < wc) && (wc < 0x47))) return TRUE;
if (((0xa3c0 < wc) && (wc < 0xa3c7)) ||
((0xa3e0 < wc) && (wc < 0xa3e6))) return TRUE;
if(((0x60 < wc) && (wc < 0x67)) ||
((0x40 < wc) && (wc < 0x47))) return TRUE;
if(((0xa3c0 < wc) && (wc < 0xa3c7)) ||
((0xa3e0 < wc) && (wc < 0xa3e6))) return TRUE;
return FALSE;
}
int
sj3_wslen16(wchar16_t *ws)
{
int i=0;
int sj3_wslen16(wchar16_t* ws) {
int i = 0;
if (!ws) return 0;
if(!ws) return 0;
while (*ws++) i++;
while(*ws++) i++;
return i;
}
int
sj3_wscmp16(wchar16_t *ws1, wchar16_t *ws2)
{
while ((*ws1 && *ws2) && (*ws1 == *ws2)) {
int sj3_wscmp16(wchar16_t* ws1, wchar16_t* ws2) {
while((*ws1 && *ws2) && (*ws1 == *ws2)) {
ws1++;
ws2++;
}
if (!*ws1 && !*ws2) return 0;
if (!*ws1) return -1;
if (!*ws2) return 1;
if (*ws1 < *ws2) return -1;
return 1;
}
int
sj3_wsncmp16(wchar16_t *ws1, wchar16_t *ws2, int n)
{
int i=0;
while ((*ws1 && *ws2) && (*ws1 == *ws2) && (i < n)) {
ws1++;
ws2++;
i++;
}
if (!*ws1 && !*ws2) return 0;
if (i == n) return 0;
if (!*ws1) return -1;
if (!*ws2) return 1;
if (*ws1 < *ws2) return -1;
if(!*ws1 && !*ws2) return 0;
if(!*ws1) return -1;
if(!*ws2) return 1;
if(*ws1 < *ws2) return -1;
return 1;
}
wchar16_t *
sj3_wscpy16(wchar16_t *ws1, wchar16_t *ws2)
{
wchar16_t *ws;
int sj3_wsncmp16(wchar16_t* ws1, wchar16_t* ws2, int n) {
int i = 0;
if (!ws2) return NULL;
while((*ws1 && *ws2) && (*ws1 == *ws2) && (i < n)) {
ws1++;
ws2++;
i++;
}
if(!*ws1 && !*ws2) return 0;
if(i == n) return 0;
if(!*ws1) return -1;
if(!*ws2) return 1;
if(*ws1 < *ws2) return -1;
return 1;
}
wchar16_t*
sj3_wscpy16(wchar16_t* ws1, wchar16_t* ws2) {
wchar16_t* ws;
if(!ws2) return NULL;
ws = ws1;
while (*ws2) {
while(*ws2) {
*ws++ = *ws2++;
}
*ws = 0;
@ -156,35 +140,33 @@ sj3_wscpy16(wchar16_t *ws1, wchar16_t *ws2)
return ws1;
}
wchar16_t *
sj3_wsncpy16(wchar16_t *ws1, wchar16_t *ws2, int n)
{
wchar16_t *ws;
int i=0;
wchar16_t*
sj3_wsncpy16(wchar16_t* ws1, wchar16_t* ws2, int n) {
wchar16_t* ws;
int i = 0;
if (!ws2) return NULL;
if(!ws2) return NULL;
ws = ws1;
while (*ws2 && (i < n)) {
while(*ws2 && (i < n)) {
*ws++ = *ws2++;
i++;
}
if (i < n) *ws = 0;
if(i < n) *ws = 0;
return ws1;
}
wchar16_t *
sj3_wscat16(wchar16_t *ws1, wchar16_t *ws2)
{
wchar16_t *ws;
wchar16_t*
sj3_wscat16(wchar16_t* ws1, wchar16_t* ws2) {
wchar16_t* ws;
if (!ws1) return NULL;
if (!ws2) return NULL;
if(!ws1) return NULL;
if(!ws2) return NULL;
ws = ws1;
while (*ws) ws++;
while (*ws2) {
while(*ws) ws++;
while(*ws2) {
*ws++ = *ws2++;
}
*ws = 0;
@ -192,31 +174,28 @@ sj3_wscat16(wchar16_t *ws1, wchar16_t *ws2)
return ws1;
}
wchar16_t
sj3_euc2wc16(unsigned int code)
{
sj3_euc2wc16(unsigned int code) {
wchar16_t wc = 0;
if (((code >> 16) & 0xff) == SS3) {
if(((code >> 16) & 0xff) == SS3) {
wc = code & 0xff7f;
} else if (((code >> 8) & 0xff) == SS2) {
} else if(((code >> 8) & 0xff) == SS2) {
wc = code & 0xff;
} else {
wc = code;
}
}
return wc;
}
wchar16_t
sj3_sjis2wc16(unsigned int code)
{
sj3_sjis2wc16(unsigned int code) {
unsigned short ch;
if ((code >> 8) & 0xff) {
if((code >> 8) & 0xff) {
ch = sjis2euc(code);
} else if (code & MSB) {
} else if(code & MSB) {
ch = (SS2 << 8) + (code & 0xff);
} else {
return code;
@ -225,20 +204,19 @@ sj3_sjis2wc16(unsigned int code)
}
unsigned int
sj3_wc2euc16(wchar16_t wc)
{
unsigned int code = 0;
sj3_wc2euc16(wchar16_t wc) {
unsigned int code = 0;
unsigned char tmp;
tmp = (wc >> 8) & 0xff;
if (tmp) {
if (wc & MSB) {
if(tmp) {
if(wc & MSB) {
code = wc;
} else {
code = (SS3 << 16) + wc + MSB;
}
} else {
if (wc & MSB) {
if(wc & MSB) {
code = (SS2 << 8) + wc;
} else {
code = wc;
@ -249,49 +227,46 @@ sj3_wc2euc16(wchar16_t wc)
}
unsigned int
sj3_wc2sjis16(wchar16_t wc)
{
sj3_wc2sjis16(wchar16_t wc) {
unsigned int ch;
ch = sj3_wc2euc16(wc);
if ((ch >> 16) == SS3) {
if((ch >> 16) == SS3) {
return 0;
} else if ((ch >> 8) == SS2) {
} else if((ch >> 8) == SS2) {
return (ch & 0xff);
} else if ((ch >> 8) & 0xff) {
} else if((ch >> 8) & 0xff) {
return euc2sjis(ch);
} else {
return wc;
}
}
int
sj3_wcs2eucs16(unsigned char *mb, wchar16_t *ws, int n)
{
int i = 0;
unsigned int code;
int sj3_wcs2eucs16(unsigned char* mb, wchar16_t* ws, int n) {
int i = 0;
unsigned int code;
unsigned char c;
while (*ws && (i < n)) {
while(*ws && (i < n)) {
code = sj3_wc2euc16(*ws);
if (c = ((code >> 16) & 0xff)) {
if(c = ((code >> 16) & 0xff)) {
*mb++ = c;
i++;
if (i == n) break;
if(i == n) break;
*mb++ = ((code >> 8) & 0xff);
i++;
if (i == n) break;
if(i == n) break;
*mb++ = code & 0xff;
i++;
if (i == n) break;
} else if (c = ((code >> 8) & 0xff)) {
i++;
if(i == n) break;
} else if(c = ((code >> 8) & 0xff)) {
*mb++ = c;
i++;
if (i == n) break;
if(i == n) break;
*mb++ = code & 0xff;
i++;
if (i == n) break;
} else if (c = (code & 0xff)) {
i++;
if(i == n) break;
} else if(c = (code & 0xff)) {
*mb++ = c;
i++;
} else {
@ -300,30 +275,28 @@ sj3_wcs2eucs16(unsigned char *mb, wchar16_t *ws, int n)
ws++;
}
if (!*ws) {
if(!*ws) {
*mb = '\0';
}
return i;
}
int
sj3_wcs2sjiss16(unsigned char *mb, wchar16_t *ws, int n)
{
int i = 0;
unsigned int code;
int sj3_wcs2sjiss16(unsigned char* mb, wchar16_t* ws, int n) {
int i = 0;
unsigned int code;
unsigned char c;
while (*ws && (i < n)) {
while(*ws && (i < n)) {
code = sj3_wc2sjis16(*ws);
if (c = ((code >> 8) & 0xff)) {
if(c = ((code >> 8) & 0xff)) {
*mb++ = c;
i++;
if (i == n) break;
if(i == n) break;
*mb++ = code & 0xff;
i++;
if (i == n) break;
} else if (c = (code & 0xff)) {
if(i == n) break;
} else if(c = (code & 0xff)) {
*mb++ = c;
i++;
} else {
@ -332,83 +305,73 @@ sj3_wcs2sjiss16(unsigned char *mb, wchar16_t *ws, int n)
ws++;
}
if (!*ws) {
if(!*ws) {
*mb = '\0';
}
return i;
}
int
sj3_eucs2wcs16(wchar16_t *ws, unsigned char *mb, int n)
{
int i = 0;
int sj3_eucs2wcs16(wchar16_t* ws, unsigned char* mb, int n) {
int i = 0;
unsigned int code;
while (*mb && (i < n)) {
if (*mb == SS3) {
while(*mb && (i < n)) {
if(*mb == SS3) {
code = *mb++ << 16;
code += *mb++ << 8;
code += *mb++;
} else if ((*mb == SS2) || (*mb & 0x80)) {
} else if((*mb == SS2) || (*mb & 0x80)) {
code = *mb++ << 8;
code += *mb++;
} else {
code = *mb++;
}
*ws = sj3_euc2wc16(code);
if (!*ws) return -1;
if(!*ws) return -1;
ws++;
i++;
}
if (!*mb) {
if(!*mb) {
*ws = 0;
}
return i;
}
int
sj3_sjiss2wcs16(wchar16_t *ws, unsigned char *mb, int n)
{
int i = 0;
int sj3_sjiss2wcs16(wchar16_t* ws, unsigned char* mb, int n) {
int i = 0;
unsigned int code;
while (*mb && (i < n)) {
if (issjis1(*mb)) {
while(*mb && (i < n)) {
if(issjis1(*mb)) {
code = *mb++ << 8;
code += *mb++;
} else {
code = *mb++;
}
*ws = sj3_sjis2wc16(code);
if (!*ws) return -1;
if(!*ws) return -1;
ws++;
i++;
}
if (!*mb) {
if(!*mb) {
*ws = 0;
}
return i;
}
int
sj3_mbstowcs16(wchar16_t *ws, unsigned char *mb, int n)
{
if (current_locale == LC_CTYPE_EUC)
return sj3_eucs2wcs16(ws, mb, n);
else
return sj3_sjiss2wcs16(ws, mb, n);
}
int
sj3_wcstombs16(unsigned char *mb, unsigned char *ws, int n)
{
if (current_locale == LC_CTYPE_EUC)
return sj3_wcs2eucs16(mb, ws, n);
int sj3_mbstowcs16(wchar16_t* ws, unsigned char* mb, int n) {
if(current_locale == LC_CTYPE_EUC)
return sj3_eucs2wcs16(ws, mb, n);
else
return sj3_wcs2sjiss16(mb, ws, n);
return sj3_sjiss2wcs16(ws, mb, n);
}
int sj3_wcstombs16(unsigned char* mb, unsigned char* ws, int n) {
if(current_locale == LC_CTYPE_EUC)
return sj3_wcs2eucs16(mb, ws, n);
else
return sj3_wcs2sjiss16(mb, ws, n);
}