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

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: dictmake.c,v $
* $SonyRevision: 1.1 $
* $SonyRCSfile: dictmake.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:03:35 $
*/
#include "sj_sysvdef.h"
#include <stdio.h>
#ifdef SVR4
@ -48,41 +45,40 @@
#include "sj3lib.h"
#include "sjtool.h"
#define IsEOL(c) ((c) == '\0')
#define IsBlank(c) ((c) == ' ' || (c) == '\t')
#define IsEOL(c) ((c) == '\0')
#define IsBlank(c) ((c) == ' ' || (c) == '\t')
extern int force_flag;
extern int verbose_flag;
extern int _sys_code;
extern int force_flag;
extern int verbose_flag;
extern int _sys_code;
static void touroku(y, k, h)
char *y, *k, *h;
static void touroku(y, k, h) char *y, *k, *h;
{
int err;
int grm;
int err;
int grm;
unsigned char buf[BUFSIZ], *hp;
if (_sys_code == SYS_SJIS) {
(void) sjistoeuc(buf, BUFSIZ, h, strlen(h)+1);
if(_sys_code == SYS_SJIS) {
(void)sjistoeuc(buf, BUFSIZ, h, strlen(h) + 1);
hp = buf;
} else {
hp = (unsigned char *) h;
hp = (unsigned char*)h;
}
if (!(grm = str2hns(hp))) {
if(!(grm = str2hns(hp))) {
error_out("\311\312\273\354\312\270\273\372\316\363\244\362\262\341\244\303\244\306\244\244\244\336\244\271 %s:%s:%s", y, k, h);
if (force_flag) return;
if(force_flag) return;
exit(1);
}
err = sj3_touroku_mb(y, k, grm);
switch (err) {
switch(err) {
case -1:
error_out("\245\265\241\274\245\320\244\254\315\356\244\301\244\336\244\267\244\277");
exit(1);
case 0:
if (verbose_flag)
if(verbose_flag)
normal_out("%s:%s:%s \244\362\305\320\317\277\244\267\244\336\244\267\244\277\n", y, k, h);
break;
@ -95,7 +91,7 @@ char *y, *k, *h;
exit(1);
case SJ3_WORD_EXIST:
if (verbose_flag)
if(verbose_flag)
normal_out("%s:%s:%s \244\317\305\320\317\277\244\265\244\354\244\306\244\244\244\336\244\271\n", y, k, h);
break;
@ -105,22 +101,22 @@ char *y, *k, *h;
case SJ3_DICT_FULL:
error_out("\244\263\244\354\260\312\276\345\274\255\275\361\244\362\302\347\244\255\244\257\244\307\244\255\244\336\244\273\244\363 %s:%s:%s", y, k, h);
if (force_flag) break;
if(force_flag) break;
exit(1);
case SJ3_BAD_YOMI_STR:
error_out("\305\320\317\277\244\307\244\255\244\312\244\244\306\311\244\337\244\307\244\271 %s", y);
if (force_flag) break;
if(force_flag) break;
exit(1);
case SJ3_BAD_KANJI_STR:
error_out("\305\320\317\277\244\307\244\255\244\312\244\244\264\301\273\372\244\307\244\271 %s:%s", y, k);
if (force_flag) break;
if(force_flag) break;
exit(1);
case SJ3_BAD_HINSI_CODE:
error_out("\305\320\317\277\244\307\244\255\244\312\244\244\311\312\273\354\244\307\244\271 %s:%s:%s", y, k, h);
if (force_flag) break;
if(force_flag) break;
exit(1);
case SJ3_INDEX_FULL:
@ -129,94 +125,92 @@ char *y, *k, *h;
case SJ3_TOUROKU_FAILED:
default:
error_out("\305\320\317\277\244\307\244\255\244\336\244\273\244\363\244\307\244\267\244\277 %s:%s:%s(%d)",
y, k, hns2str(h), h);
y, k, hns2str(h), h);
break;
}
}
void
dictmake(input)
char *input;
dictmake(input) char* input;
{
unsigned char buf[BUFSIZ];
FILE *fp;
unsigned char *p;
unsigned char *yom, *knj, *grm;
int c;
int flg;
static char *FormatErrorString = "\245\325\245\251\241\274\245\336\245\303\245\310\245\250\245\351\241\274:%s";
unsigned char buf[BUFSIZ];
FILE* fp;
unsigned char* p;
unsigned char *yom, *knj, *grm;
int c;
int flg;
static char* FormatErrorString = "\245\325\245\251\241\274\245\336\245\303\245\310\245\250\245\351\241\274:%s";
if (input && *input) {
if(input && *input) {
fp = fopen(input, "r");
if (!fp) {
if(!fp) {
error_out("%s \244\254\245\252\241\274\245\327\245\363\244\307\244\255\244\336\244\273\244\363", input);
exit(1);
}
}
else
} else
fp = stdin;
while (fgets((char *)buf, sizeof(buf), fp)) {
if ((p = (unsigned char *)strchr((char *)buf, '\n')))
while(fgets((char*)buf, sizeof(buf), fp)) {
if((p = (unsigned char*)strchr((char*)buf, '\n')))
*p = '\0';
else {
do {
c = fgetc(fp);
} while (c != '\n' && c != EOF);
} while(c != '\n' && c != EOF);
}
yom = buf;
while (IsBlank(*yom)) yom++;
if (IsEOL(*yom)) {
while(IsBlank(*yom)) yom++;
if(IsEOL(*yom)) {
error_out(FormatErrorString, buf);
if (force_flag) continue;
if(force_flag) continue;
break;
}
knj = yom;
while (!IsEOL(*knj) && !IsBlank(*knj)) knj++;
if (IsEOL(*knj)) {
while(!IsEOL(*knj) && !IsBlank(*knj)) knj++;
if(IsEOL(*knj)) {
error_out(FormatErrorString, buf);
if (force_flag) continue;
if(force_flag) continue;
break;
}
*knj++ = '\0';
while (IsBlank(*knj)) knj++;
if (IsEOL(*knj)) {
while(IsBlank(*knj)) knj++;
if(IsEOL(*knj)) {
error_out(FormatErrorString, buf);
if (force_flag) continue;
if(force_flag) continue;
break;
}
grm = knj;
while (!IsEOL(*grm) && !IsBlank(*grm)) grm++;
if (IsEOL(*grm)) {
while(!IsEOL(*grm) && !IsBlank(*grm)) grm++;
if(IsEOL(*grm)) {
error_out(FormatErrorString, buf);
if (force_flag) continue;
if(force_flag) continue;
break;
}
*grm++ = '\0';
while (IsBlank(*grm)) grm++;
if (IsEOL(*grm)) {
while(IsBlank(*grm)) grm++;
if(IsEOL(*grm)) {
error_out(FormatErrorString, buf);
if (force_flag) continue;
if(force_flag) continue;
break;
}
flg = -1;
while (*grm && flg) {
while(*grm && flg) {
p = grm;
while (!IsEOL(*p) && !IsBlank(*p) && (*p != ':')) p++;
if (IsEOL(*p))
while(!IsEOL(*p) && !IsBlank(*p) && (*p != ':')) p++;
if(IsEOL(*p))
flg = 0;
else
*p++ = '\0';
touroku(yom, knj, grm);
if (flg) {
if(flg) {
grm = p;
while (IsBlank(*grm)) grm++;
while(IsBlank(*grm)) grm++;
}
}
}