Format source code
This commit is contained in:
parent
b6df536fe9
commit
d0be6165c0
165 changed files with 30306 additions and 33687 deletions
186
cvtdict.c
186
cvtdict.c
|
|
@ -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,80 +28,67 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cvtdict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyRCSfile: cvtdict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:40 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
||||
TypeDicOfs ofs;
|
||||
unsigned char* yptr;
|
||||
int jlen;
|
||||
int stblen;
|
||||
int sttlen;
|
||||
unsigned char* fptr;
|
||||
int cllen;
|
||||
JREC* jrec;
|
||||
int i, j;
|
||||
|
||||
|
||||
void
|
||||
cvtdict(KHREC *krec, CLREC *clrec, int flg)
|
||||
{
|
||||
TypeDicOfs ofs;
|
||||
unsigned char *yptr;
|
||||
int jlen;
|
||||
int stblen;
|
||||
int sttlen;
|
||||
unsigned 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) != 0) {
|
||||
|
||||
if (i == SETTOU_KIGOU) {
|
||||
if((i = jrec->sttofs) != 0) {
|
||||
|
||||
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--;
|
||||
|
|
@ -110,71 +97,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) {
|
||||
unsigned char* ptr;
|
||||
|
||||
ptr = inputyomi;
|
||||
|
||||
void
|
||||
cvtminasi(int len)
|
||||
{
|
||||
unsigned 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++;
|
||||
|
|
@ -184,40 +160,32 @@ cvtminasi(int len)
|
|||
}
|
||||
}
|
||||
|
||||
void cvtwakachi(CLREC* clrec) {
|
||||
int jlen;
|
||||
unsigned char* ym;
|
||||
int cnt;
|
||||
unsigned char ch;
|
||||
|
||||
ym = inputyomi;
|
||||
|
||||
void
|
||||
cvtwakachi(CLREC *clrec)
|
||||
{
|
||||
int jlen;
|
||||
unsigned char *ym;
|
||||
int cnt;
|
||||
unsigned char ch;
|
||||
cnt = jlen = clrec->jnode->jlen;
|
||||
while(cnt-- > 0) {
|
||||
if(isknj1(*ym)) {
|
||||
|
||||
ym = inputyomi;
|
||||
|
||||
|
||||
cnt = jlen = clrec -> jnode -> jlen;
|
||||
while (cnt-- > 0) {
|
||||
if (isknj1(*ym)) {
|
||||
|
||||
if (*ym == 0xa4) {
|
||||
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++;
|
||||
|
|
@ -226,20 +194,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++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue