Format source code

This commit is contained in:
Nishi 2026-06-18 13:40:14 +09:00
commit d0be6165c0
165 changed files with 30306 additions and 33687 deletions

384
setjrec.c
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,148 +28,135 @@
*/
/*
* $SonyRCSfile: setjrec.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: setjrec.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:17 $
*
* $Id$
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
#include "sj_hinsi.h"
#include "kanakan.h"
int
setj_atrb(unsigned char* p)
{
int setj_atrb(unsigned char* p) {
return 2;
}
int setj_ofs(unsigned char* p) {
int contf = TRUE;
int
setj_ofs(unsigned 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 ZenKataAssyuku:
p += setj_norm1(p); break;
case OffsetAssyuku:
p += setj_ofs(p); break;
case AiAttribute:
p += setj_atrb(p); break;
case LeadingHankaku:
p += setj_norm2(p); break;
case ZenHiraAssyuku:
p += setj_norm1(p);
break;
case KanjiAssyuku:
p += setj_knj(p); break;
case ZenKataAssyuku:
p += setj_norm1(p);
break;
case KanjiStrEnd:
contf = FALSE; break;
case OffsetAssyuku:
p += setj_ofs(p);
break;
default:
case AiAttribute:
p += setj_atrb(p);
break;
case LeadingHankaku:
p += setj_norm2(p);
break;
case KanjiAssyuku:
p += setj_knj(p);
break;
case KanjiStrEnd:
contf = FALSE;
break;
default:
p += setj_norm2(p);
}
} while (contf);
} while(contf);
return 2;
}
int setj_knj(unsigned char* p) {
int contf = TRUE;
int
setj_knj(unsigned 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 ZenKataAssyuku:
p += setj_norm1(p); break;
case OffsetAssyuku:
p += setj_ofs(p); break;
case AiAttribute:
p += setj_atrb(p); break;
case ZenHiraAssyuku:
p += setj_norm1(p);
break;
case LeadingHankaku:
p += setj_norm2(p); break;
case KanjiAssyuku:
p += setj_knj(p); break;
case ZenKataAssyuku:
p += setj_norm1(p);
break;
case KanjiStrEnd:
contf = FALSE; break;
case OffsetAssyuku:
p += setj_ofs(p);
break;
default:
case AiAttribute:
p += setj_atrb(p);
break;
case LeadingHankaku:
p += setj_norm2(p);
break;
case KanjiAssyuku:
p += setj_knj(p);
break;
case KanjiStrEnd:
contf = FALSE;
break;
default:
p += setj_norm2(p);
}
} while (contf);
} while(contf);
return 1;
}
int
setj_norm1(unsigned char* p)
{
int setj_norm1(unsigned char* p) {
return 1;
}
int
setj_norm2(unsigned char* p)
{
int setj_norm2(unsigned char* p) {
return 2;
}
int
setj_norm3(unsigned char* p)
{
int setj_norm3(unsigned char* p) {
return 3;
}
static int
chkhead(TypeGram gram)
{
if (!headcode) return TRUE;
if (headcode == SETTOU_DAI) {
if (gram == SUUSI) return TRUE;
chkhead(TypeGram gram) {
if(!headcode) return TRUE;
if(headcode == SETTOU_DAI) {
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;
}
}
@ -177,167 +164,150 @@ chkhead(TypeGram gram)
return FALSE;
}
void setjrec(unsigned char* tagp, int mode) {
TypeGram gram;
unsigned char* ptr;
unsigned char* endp;
unsigned char* tmp;
JREC* rec;
int plen;
int nlen;
int len;
void
setjrec(unsigned char* tagp, int mode)
{
TypeGram gram;
unsigned char *ptr;
unsigned char *endp;
unsigned 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(; ptr < endp; ptr = tmp + 1) {
for (tmp = ptr + 1; *tmp != HinsiBlkTerm ; ) {
for(tmp = ptr + 1; *tmp != HinsiBlkTerm;) {
switch(*tmp & KanjiModeMask) {
case ZenHiraAssyuku:
tmp += setj_norm1(tmp); break;
case ZenKataAssyuku:
tmp += setj_norm1(tmp); break;
case OffsetAssyuku:
tmp += setj_ofs(tmp); break;
case AiAttribute:
tmp += setj_atrb(tmp); break;
case LeadingHankaku:
tmp += setj_norm2(tmp); break;
case KanjiAssyuku:
tmp += setj_knj(tmp); break;
case ZenHiraAssyuku:
tmp += setj_norm1(tmp);
break;
case KanjiStrEnd:
tmp++; break;
case ZenKataAssyuku:
tmp += setj_norm1(tmp);
break;
default:
case OffsetAssyuku:
tmp += setj_ofs(tmp);
break;
case AiAttribute:
tmp += setj_atrb(tmp);
break;
case LeadingHankaku:
tmp += setj_norm2(tmp);
break;
case KanjiAssyuku:
tmp += setj_knj(tmp);
break;
case KanjiStrEnd:
tmp++;
break;
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(unsigned char* tagp, JREC* rec, TypeGram gram) {
unsigned char* ptr;
unsigned char* endp;
unsigned char* tmp;
int plen, nlen, len;
JREC* jrec;
void
setnumrec(unsigned char* tagp, JREC* rec, TypeGram gram)
{
unsigned char *ptr;
unsigned char *endp;
unsigned 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(; ptr < endp; ptr = tmp + 1) {
for (tmp = ptr + 1; *tmp != HinsiBlkTerm ; ) {
for(tmp = ptr + 1; *tmp != HinsiBlkTerm;) {
switch(*tmp & KanjiModeMask) {
case ZenHiraAssyuku:
tmp += setj_norm1(tmp); break;
case ZenKataAssyuku:
tmp += setj_norm1(tmp); break;
case OffsetAssyuku:
tmp += setj_ofs(tmp); break;
case AiAttribute:
tmp += setj_atrb(tmp); break;
case LeadingHankaku:
tmp += setj_norm2(tmp); break;
case KanjiAssyuku:
tmp += setj_knj(tmp); break;
case ZenHiraAssyuku:
tmp += setj_norm1(tmp);
break;
case KanjiStrEnd:
tmp++; break;
case ZenKataAssyuku:
tmp += setj_norm1(tmp);
break;
default:
case OffsetAssyuku:
tmp += setj_ofs(tmp);
break;
case AiAttribute:
tmp += setj_atrb(tmp);
break;
case LeadingHankaku:
tmp += setj_norm2(tmp);
break;
case KanjiAssyuku:
tmp += setj_knj(tmp);
break;
case KanjiStrEnd:
tmp++;
break;
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(unsigned char* tagp) {
JREC* rec;
void
setcrec(unsigned char* tagp)
{
JREC *rec;
if(!(rec = argjrec((int)ClYomiLen(tagp), (JREC*)NULL))) return;
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);
}