Import SJ3 2.0.1.20

Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
Masanori Ogino 2023-11-26 06:45:00 +09:00
commit b568905e51
208 changed files with 89304 additions and 0 deletions

284
CHANGES.eucJP Normal file
View file

@ -0,0 +1,284 @@
#
# $SonyId: CHANGES.eucJP,v 1.31 1998/04/08 13:11:09 notanaka Exp $
#
[After X11R6 contrib release]
number: 1
date: 1994/08/01
contents: sjis2euc と euc2sjis が半角カタカナも変換してくれると勘違いしていた。
source: sj3rkcv/wc16_str.c
number: 2
date: 1994/08/17
from: ASHIDA Isao
contents: (sj3-bugs 1) Lynux でコンパイルができない
source: dict/tool/hindo.c
source: dict/tool/offset.c
source: kanakan/depend.c
source: server/comuni.c
number: 3
date: 1994/10/21
contents: MaxClient の上限値を 512 にする。Client 構造体を動的に取る。
source: include/Const.h
source: include/Struct.h
source: server/comuni.c
source: server/execute.c
number: 4
date: 1994/10/21
contents: ユーザ辞書と学習ファイルのパーミッションのデフォルトを 600 にする。
source: include/Struct.h
source: server/execute.c
source: server/setup.c
number: 5
date: 1994/11/16
contents: fix spell miss(trdwr -> tirdwr) in warning message
source: server/comuni.c
number: 6
date: 1994/11/17
contents: SJIS の環境で、sj3 の変換結果の文字列がむちゃくちゃになる。
source: sj3rkcv/wc16_str.c
number: 7
date: 1994/11/22
contents: sj3_zentohan*()が全カタの「ム」以降の文字でおかしい(使ってないけど)
source: sj3rkcv/sj3_rkcv.c
number: 8
date: 1994/12/09
contents: sj3servで複数の辞書を扱えるようにして、sj3libにインタフェースを追加
source(add): doc/man/sj3mkdic.1
source: dict/dict/Imakefile
source: dict/tool/Imakefile
source: dict/tool/makedict.c
source: dict/tool/makeseg.c
source: include/sj_global.h
source: kanakan/global.c
source: patchlevel.h
source: server/execute.c
source: server/main.c
source: server/setup.c
source: server/time_stamp.c
source: server/version.c
source: sj3/eucmessage.c
source: sj3/libif.c
source: sj3/sjrc.c
source: sj3/version.c
source: sj3lib/sj.c
source: sj3rkcv/rk_conv.c
number: 9
date: 1995/02/03
from: Haruyuki Kawabe
contents: (sj3-bugs 3) [sj3serv]: [FileReadError]
source: kanakan/depend.c
source: server/version.c
number: 10
date: 1995/02/03
contents: FreeBSD で sj3 が動作するようにした。
source: dict/tool/file.c
source: kanakan/depend.c
source: server/main.c
source: server/time_stamp.c
source: server/version.c
source: sj3/sj3.c
source: sj3/sjgetchar.c
source: sj3/version.c
source: sj3lib/level1.c
number: 11
date: 1995/02/10
from: Manabe Takashi
contents: Linux で sj3 を動かすためのパッチをあてた。
source: include/sj_sysvdef.h
source: sj3/sj3.c
source: sj3/sjgetchar.c
source: sj3/version.c
number: 12
date: 1995/02/10
contents: sj3_zentohan()で漢字を入力すると字が化ける(使ってないけど)
source: sj3rkcv/sj3_rkcv.c
[After fix-1 release]
number: 13
date: 1995/03/14
from: Tsuyoshi Tada
contents: NetBSD/i386 でのコンパイルができるようにした。
source: sj3/sj3.c
source: sj3/sjgetchar.c
number: 14
date: 1995/04/05
contents: put_flush() が正常終了時に return value を返していない。
source: sj3lib/level1.c
number: 15
date: 1995/04/07
contents: NetBSD で環境変数 LANG が設定されていないと core dump する。
source: sj3/sj3.c
source: sj3/version.c
number: 16
date: 1995/04/17
contents: put_over() の引数が多いところがある(とりあえず実害はない)。
source: sj3lib/level1.c
number: 17
date: 1995/05/30
from: Yoshikatsu Kawabe
contents: (sj3-bugs 5) [SJ3]: Contrib new utility (sj3stat)
source(add): sj3stat/Imakefile
source(add): sj3stat/sj3stat.c
source: Imakefile
number: 18
date: 1995/07/18
from: Ryuichi MATSUMOTO
contents: (sj3-bugs 4) SJ3: Illegal Conversion (-ku, ku-ru)
source: dict/dict/visual.dic
number: 19
date: 1995/07/18
contents: sj3stat で client の情報が正しく取れない。
source: server/execute.c
source: server/version.c
source: server/time_stamp.c
number: 20
date: 1995/07/21
contents: 単語登録の読み文字列で[a-z],[ヴヵヶ],[#@〒]が正しく使用できない。
source: kanakan/peepdic.c
source: kanakan/s2ctbl.c
source: kanakan/sj2code.c
source: server/version.c
source: server/time_stamp.c
number: 21
date: 1996/02/15
contents: locale が正しく設定されていないと sj3dic が core dump する。
source: sj3dic/sj3dic.c
source: sj3dic/sjtool.h
source: sj3dic/codecnv.c
source: sj3dic/sjrc.c
number: 22
date: 1996/02/23
contents: sj3 の変換候補に読みを全角仮名にした候補をくわえた。
source: sj3/douon.c
source: sj3/libif.c
source: sj3/version.c
source: sj3h/sj3libsj3.h
source: sj3h/sj.h
number: 23
date: 1996/02/23
contents: 読みの全角仮名の候補を選択したとき、ユーザ辞書に登録されるようにした。
source: sj3/douon.c
source: sj3/version.c
number: 24
date: 1996/05/27
contents: 上記の修正についてマニュアルに記述を追加した。
source: doc/doc/Nihongo.ps.Z
number: 25
date: 1996/05/27
contents: 辞書が正常に作成できないことがある(SunOS Release 4.1.x)。
source: dict/tool/cnvhinsi.c
source: sj3h/sj3libsj3.h
number: 26
date: 1996/09/05
contents: sj3serv で使用されないグループ指定に関する文章とソースを削除した。
source: doc/man/sj3mkdic.1
source(delete): kanakan/srchgrp.c
number: 27
date: 1997/01/21
from: Hidekazu Kuroki
contents: (sj3-bugs 10) FreeBSD port のための修正
source(add): server/rc.sj3serv.FreeBSD
source(add): doc/Imakefile
source(add): doc/doc/Imakefile
source(add): doc/man/Imakefile
source: Imakefile
source: demo/sample.c
source: dict/dict/Imakefile
source: dict/tool/Imakefile
source: include/Const.h
source: server/Imakefile
source: sj3/Imakefile
source: sj3/edit.c
source: sj3/funckey.c
source: sj3/henkan.c
source: sj3/romaji.c
source: sj3/sj3.c
source: sj3/sjrc.c
source: sj3dic/Imakefile
source: sj3h/sj2.h
source: sj3lib/Imakefile
source: sj3stat/Imakefile
source: sj3stat/sj3stat.c
number: 28
date: 1997/01/22
from: Toya
contents: (sj3-bugs 9) [NOT bug...] easier(?) installation to non-default directory
source(add): include/Paths.h.in
source(add): sj3.tmpl
source: Imakefile
source: dict/dict/Imakefile
source: dict/tool/Imakefile
source: doc/man/Imakefile
source: doc/doc/Imakefile
source: include/Const.h
source: server/Imakefile
source: sj3/Imakefile
source: sj3/funckey.c
source: sj3/sjrc.c
source: sj3dic/Imakefile
source: sj3lib/Imakefile
source: sj3stat/Imakefile
number: 29
date: 1997/01/22
from: Iwama Yoshihiko
contents: (sj3-bugs 12) sj3: Can't compile sj3 command on BSD/OS
source: demo/sample.c
source: sj3/sj3.c
source: sj3/sjgetchar.c
source: sj3dic/codecnv.c
source: sj3dic/sjrc.c
number: 30
date: 1997/10/07
from: UO Youjiro
contents: (sj3-bugs 20) not work sj3serv on bsdi platform
source: kanakan/depend.c
number: 31
date: 1998/01/14
from: SL Baur
contents: (sj3-bugs 22) [PATCH] Port of sj3-2.0.1.17 to Linux/Libc6
source: include/sj_sysvdef.h
source: kanakan/depend.c
source: server/comuni.c
source: sj3lib/string.c
source: sj3/display.c
source: sj3/sjgetchar.c
source: sj3/sj3.c
number: 32
date: 1998/03/23
from: MURANAKA Masaki
contents: (sj3-bugs 23) Security bug on SJ3SERV
source: server/execute.c
source: server/time_stamp.c
source: server/version.c

64
Imakefile Normal file
View file

@ -0,0 +1,64 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.5 $
* $SonyDate: 1997/01/23 11:50:09 $
*/
#include "sj3.tmpl"
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
/*
* Add make rules to install manpages and other documents.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
SUBDIRS = dict doc kanakan server sj3lib sj3 sj3dic sj3stat demo
AllTarget(includes)
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
includes:: sj3.tmpl
cp include/Paths.h.in include/Paths.h
chmod +w include/Paths.h
(echo "#define RunCmdFile \"$(SJ3CONFDIR)/serverrc\""; \ @@\
echo "#define DictRootDir \"$(SJ3DICTDIR)\""; \ @@\
echo ""; \ @@\
echo "#define DEFRKFILE \"$(SJ3CONFDIR)/sjrk\""; \ @@\
echo "#define DEFRCFILE \"$(SJ3CONFDIR)/sjrc\""; \ @@\
echo "#define DEFKEYFILE \"$(SJ3CONFDIR)/cvtkey.\"") \ @@\
>> include/Paths.h
clean::
rm -f include/Paths.h

90
README Normal file
View file

@ -0,0 +1,90 @@
* What's SJ3
SJ3 is a Japanese input system developed by Sony Corporation.
SJ3 is composed of Kana-Kanji conversion server(sj3serv),
Kana-Kanji conversion client for terminal(sj3) and Kana-Kanji
conversion library(sj3lib).
* Configuration notice
Default communication interface between Kana-Kanji server and client
is socket in BSD and TLI in System V. If you want to use socket
in System V, you need to delete "-DTLI" from sj3.tmpl file.
And you can configure top directory to install SJ3 by setting
SJ3TOP variable in sj3.tmpl file.
The default value is '/usr/local'.
Attention, if you make sj3 on FreeBSD that does not have libxpg4,
please delete CODE_LIBS variable in sj3.tmpl file.
* How to make
In this directory,
# xmkmf
# make Makefiles
# make
# make install
Following files are installed after make install:
$(SJ3TOP)/dict/sj3/sj3main.dic Main dictionary(used by sj3serv)
$(SJ3TOP)/bin/sj3serv Kana-Kanji conversion server
$(SJ3TOP)/bin/sj3 Kana-Kanji conversion client
$(SJ3TOP)/bin/sj3dic User dictionary utility
$(SJ3TOP)/bin/sj3mkdic Dictionary converter
$(SJ3TOP)/bin/sj3stat Utility to show status of sj3serv
$(SJ3TOP)/include/sj3lib.h Header file for sj3lib
$(SJ3TOP)/lib/libsj3lib.a Kana-Kanji conversion library
$(SJ3TOP)/lib/sj3/serverrc Configuration file for sj3serv
$(SJ3TOP)/lib/sj3/sjrc Configuration file for sj3
$(SJ3TOP)/lib/sj3/sjrk Roma-Kana conversion file for sj3
$(SJ3TOP)/lib/sj3/cvtkey.xterm Mapping table between function key
$(SJ3TOP)/lib/sj3/cvtkey.news and escape sequence for sj3
$(SJ3TOP)/lib/sj3/cvtkey.nws511
$(SJ3TOP)/lib/sj3/cvtkey.nws517
* Source tree
dict/dict Main dictionary(text file)
dict/tool Tool for converting main dictionary from text file
to binary file
dict/include Header files for above tool
server Kana-Kanji conversion server
kanakan Kana-Kanji conversion part of server
include Header files for server
sj3lib Kana-Kanji conversion library
sj3 Kana-Kanji conversion client for terminal
sj3rkcv Roma-Kana conversion part of client
sj3h Header files for client and library
sj3dic User dictionary utility
sj3stat Utility to show status of sj3serv
demo Demonstration program for Kana-Kanji conversion
doc/man Online manual(Japanese)
doc/doc Operation guide for SJ3 and other documents(Japanese)
* Tested machine
Sony NEWS Workstation NEWS-OS 4.2.1a+
NEWS-OS 6.1.1
PC FreeBSD 2.1.5
* Bug report
If some bugs are found, please send bug report(Japanese or English)
using $(TOP)/xc/bug-report format to following e-mail address.
sj3-bugs@sm.sony.co.jp
* Acknowledgements
I would like to thank to the following people for compiled and tested:
Takashi Fujiwara (Fujitsu)
Katsuhisa Yano (Toshiba)
January 22, 1997
Nobuyuki Tanaka
Sony Corporation

97
README.eucJP Normal file
View file

@ -0,0 +1,97 @@
・SJ3 とは
SJ3 は、ソニー(株)で開発された日本語入力システムです。
SJ3 は、仮名漢字変換サーバ(sj3serv)と、端末用仮名漢字
クライアント(sj3)、仮名漢字変換ライブラリ(sj3lib)で構成
されています。
・コンフィグレーション
サーバ/クライアント間の通信のインターフェースについて
は、BSD の場合はソケット、System V の場合は TLI を使用
するようになっています。System V でソケットインターフェー
スを使用したい場合は、sj3.tmpl の -DTLI を削除してくだ
さい。
また、sj3.tmpl ファイルの SJ3TOP でインストールディレク
トリを指定することができます。デフォルトは /usr/local
です。
FreeBSD をお使いの方で、libxpg4 がリンクできなくて sj3
が make できない場合は sj3.tmpl ファイルの CODE_LIBS
の -lxpg4 の記述を削除してください。
・make の手順
このディレクトリにおいて以下のようにしてください。
Makefile を作成する
# xmkmf
# make Makefiles
make する
# make
インストールする
# make install
この操作によりインストールされるファイルをいかに示します。
$(SJ3TOP)/dict/sj3/sj3main.dic sj3serv が使用するメイン辞書
$(SJ3TOP)/bin/sj3serv 仮名漢字変換サーバ
$(SJ3TOP)/bin/sj3 端末用仮名漢字変換クライアント
$(SJ3TOP)/bin/sj3dic ユーザ辞書ユーティリティ
$(SJ3TOP)/bin/sj3mkdic 辞書生成ツール
$(SJ3TOP)/bin/sj3stat sj3serv への接続状況表示ユーティリティ
$(SJ3TOP)/include/sj3lib.h 仮名漢字変換ライブラリのヘッダファイル
$(SJ3TOP)/lib/libsj3lib.a 仮名漢字変換ライブラリ
$(SJ3TOP)/lib/sj3/serverrc sj3serv の設定ファイル
$(SJ3TOP)/lib/sj3/sjrc sj3 の設定ファイル
$(SJ3TOP)/lib/sj3/sjrk sj3 のローマ字仮名変換設定ファイル
$(SJ3TOP)/lib/sj3/cvtkey.xterm sj3 のファンクションキーとエスケープ
$(SJ3TOP)/lib/sj3/cvtkey.news シーケンスの対応を設定するファイル。
$(SJ3TOP)/lib/sj3/cvtkey.nws511
$(SJ3TOP)/lib/sj3/cvtkey.nws517
・ディレクトリ構成
dict/dict メイン辞書のテキストファイル
dict/tool 辞書のテキストファイルをバイナリファイルに
変換するツール
dict/include 上記のツールのソースで使用するヘッダファイル
server 仮名漢字変換サーバ
kanakan 仮名漢字変換サーバの仮名漢字変換部
include サーバで使用するヘッダファイル
sj3lib 仮名漢字変換ライブラリ
sj3 端末用仮名漢字変換クライアント
sj3rkcv 端末用仮名漢字変換クライアントのローマ字仮名変換部
sj3h クライアントとライブラリで使用するヘッダファイル
sj3dic ユーザ辞書ユーティリティ
sj3stat sj3serv への接続状況表示ユーティリティ
demo 仮名漢字変換ライブラリのデモプログラム
doc/man オンラインマニュアル
doc/doc SJ3 日本語入力ガイドとその他ドキュメント
・テスト機種
Sony NEWS Workstation NEWS-OS 4.2.1a+
NEWS-OS 6.1.1
PC FreeBSD 2.1.5
・バグレポート
SJ3 のバグを見つけた方は $(TOP)/xc/bug-report 形式で以下の mail
address に報告していただけると助かります。レポートは日本語又は
英語でお願いします。
sj3-bugs@sm.sony.co.jp
1997年1月23日
ソニー株式会社
田中信行

63
demo/Imakefile Normal file
View file

@ -0,0 +1,63 @@
/*
* 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
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:14 $
*/
DEFINES = -DORG
LOCAL_LIBRARIES = ../sj3lib/libsj3lib.a
#ifdef SonySysvArchitecture
SYS_LIBRARIES = -ljcode
#endif
INCLUDES = -I../sj3h -I../include -I../sj3lib
RKDIR = ../sj3rkcv
DEPLIBS = $(LOCAL_LIBRARIES)
SRC1 = sample.c
SRC2 = $(RKDIR)/rk_conv.c \
$(RKDIR)/sj3_rkcv.c \
$(RKDIR)/wc16_str.c
SRC = $(SRC1) $(SRC2)
OBJS = sample.o rk_conv.o sj3_rkcv.o wc16_str.o
AllTarget(sample)
NormalProgramTarget(sample,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),)
DependTarget()
LinkSourceFile(rk_conv.c,$(RKDIR))
LinkSourceFile(sj3_rkcv.c,$(RKDIR))
LinkSourceFile(wc16_str.c,$(RKDIR))

390
demo/sample.c Normal file
View file

@ -0,0 +1,390 @@
/*
* 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
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sample.c,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1997/01/23 11:26:29 $
*/
#include <stdio.h>
#include <locale.h>
#include <pwd.h>
#include "sj3lib.h"
#include "wchar16.h"
#define RETURN(c) ((c == '\n') || (c == '\r'))
/*
* Change a default value.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#define RKFILE "/usr/local/lib/sj3/sjrk"
#define LOCALHOST "localhost"
#define HBUFSIZ 512
#define QBUFSIZ 256
char *pname;
char *hname;
int current_locale = LC_CTYPE_EUC;
usage()
{
fprintf(stderr, "Usage: %s [-v] [-H hostname]\n", pname);
exit(1);
}
main (argc, argv)
int argc;
char **argv;
{
register int c;
int ret;
int vflag;
struct bunsetu bun[HBUFSIZ];
unsigned char alphabet[QBUFSIZ];
unsigned char yomi[HBUFSIZ];
unsigned char kanji[BUFSIZ];
char *uname, *loc;
extern char *optarg;
char *rindex(), *getlogin();
struct passwd *getpwuid(), *pwd;
int count=1;
loc = setlocale(LC_CTYPE, "");
if (strcmp(loc, "ja_JP.SJIS") == 0) {
current_locale = LC_CTYPE_SHIFTJIS;
} else if (strncmp(loc, "ja", 2) != 0 &&
strncmp(loc, "Ja", 2) != 0) {
fprintf(stderr, "Error: %s is not japanese locale\n", loc);
exit(1);
}
vflag = 0;
hname = NULL;
print_head();
pname = argv[0];
while ((c = getopt(argc, argv, "vk:H:")) != EOF) {
switch(c) {
case 'v':
vflag++;
break;
case 'H':
hname = optarg;
break;
case 'k':
fprintf(stderr, "optarg = %s\n", optarg);
count = atoi(optarg);
break;
case '?':
default :
usage();
break;
}
}
uname = getlogin();
if (uname == NULL || *uname == '\0') {
setpwent();
if ((pwd = getpwuid(getuid())) != NULL) {
uname = pwd->pw_name;
endpwent();
} else {
fprintf(stderr, "Can't get user name\n");
exit(1);
}
}
#ifndef ORG
while (count--) {
#endif
if (ret = sj3_rkinit(RKFILE)) {
if (ret == 1)
fprintf(stderr, "Can't open Romaji Kana Rule file %s\n",
RKFILE);
else
fprintf(stderr, "Error sj3_rkinit\n");
exit (1);
}
ret = sj3_open(hname, uname);
if (hname == NULL)
hname = LOCALHOST;
if (ret != 0) {
if (ret & SJ3_SERVER_DEAD) {
fprintf(stderr, "%s:sj3serv dead\n", hname);
exit(1);
}
else if (ret & SJ3_ALREADY_CONNECTED) {
fprintf(stderr, "Already connected %s:sj3serv\n",hname);
exit(1);
}
else if (ret & SJ3_CONNECT_ERROR) {
fprintf(stderr, "Can't connect %s:sj3serv\n", hname);
exit(1);
}
else if (ret & SJ3_CANNOT_OPEN_MDICT) {
fprintf(stderr, "Can't open sj3 main dictionary\n");
(void)sj3_close();
exit(1);
}
fprintf(stderr, "Warning sj3_open error (return 0x%x)\n", ret);
}
#ifdef ORG
while (1) {
fprintf(stdout, "[Input Alphabet] ");
if (fgets((char *)alphabet, QBUFSIZ, stdin) == NULL)
break;
if (RETURN(alphabet[0]))
break;
#else
sprintf(alphabet, "%s", "tonarinokyakuhayokukakikuukyakuda");
#endif
rkconvs(yomi, alphabet);
ret = sj3_getkan_mb(yomi, bun, kanji, BUFSIZ);
if (ret == -1) {
fprintf(stderr, "sj3_getkan: disconnected %s:sj3serv\n",
hname);
exit(1);
}
if (vflag)
pr_kanji(bun, ret);
if (bun[ret - 1].destlen == 0)
strcat(kanji, bun[ret - 1].srcstr);
fprintf(stdout, "[Output Yomi ]:[%s]\n", yomi);
fprintf(stdout, "[Output Kanji]:[%s]\n", kanji);
#ifdef ORG
}
#endif
(void)sj3_close();
#ifndef ORG
}
#endif
}
rkconvs(yomi, roma)
unsigned char *yomi;
unsigned char *roma;
{
register unsigned char *p, *q, *yp;
register int i;
int rlen;
int len;
unsigned char rbuf[16];
unsigned char ybuf[32];
unsigned char tmp[HBUFSIZ];
yp = tmp;
p = rbuf;
rlen = 0;
while (*roma != '\0' && !RETURN(*roma)) {
*p++ = *roma++;
*p = '\0';
rlen++;
while(1) {
if ((len = sj3_rkconv_mb(rbuf, ybuf)) > 0) {
q = ybuf;
while (*q != '\0') {
*yp++ = *q++;
}
i = rlen;
rlen = strlen(rbuf);
p = rbuf;
p += rlen;
if (len >= i)
break;
}
else if (len < 0) {
*yp++ = rbuf[0];
p = rbuf;
q = (p + 1);
while(*q != '\0')
*p++ = *q++;
*p = '\0';
rlen--;
}
else
break;
}
}
if (rlen > 0) {
*p++ = '\n';
*p = '\0';
rlen++;
while(rbuf[0] != '\0') {
if ((len = sj3_rkconv_mb(rbuf, ybuf)) > 0) {
q = ybuf;
while (*q != '\0') {
*yp++ = *q++;
}
rlen = strlen(rbuf);
p = rbuf;
p += rlen;
}
else {
*yp++ = rbuf[0];
p = rbuf;
q = (p + 1);
while(*q != '\0')
*p++ = *q++;
*p = '\0';
}
}
yp--;
}
*yp = '\0';
sj3_hantozen_mb(yomi, tmp);
}
print_head() {
fprintf(stdout, "\t*--------------------------------------------*\n");
fprintf(stdout, "\t* Sample Program for *\n");
fprintf(stdout, "\t* New Japanese Convert Library *\n");
fprintf(stdout, "\t* SJ3LIB *\n");
fprintf(stdout, "\t* *\n");
fprintf(stdout, "\t* Terminator of Input : Newline-code *\n");
fprintf(stdout, "\t* *\n");
fprintf(stdout, "\t* If you want to end this process, *\n");
fprintf(stdout, "\t* input Newline-code or Control-D. *\n");
fprintf(stdout, "\t*--------------------------------------------*\n");
}
str_make(out_str, in_str, len)
unsigned char *out_str;
unsigned char *in_str;
int len;
{
strncpy(out_str, in_str, len);
out_str += len;
*out_str = '\0';
}
pr_douon(yomi)
unsigned char *yomi;
{
register int i;
struct douon douon[BUFSIZ];
int douon_cnt;
douon_cnt = sj3_getdouon_mb(yomi, douon);
if (douon_cnt < 0) {
fprintf(stderr, "sj3_getdouon: disconnected %s:sj3serv\n",
hname);
exit(1);
}
fprintf(stdout, "\t\tsj3_getdouon(yomi, douon)");
fprintf(stdout, "...Douon count : %d\n", douon_cnt);
for (i = 0; i < douon_cnt; i++) {
fprintf(stdout, "\t\t--- * Douon : %d * ---\n", i);
fprintf(stdout, "\t\t\tdlen : %d\n", douon[i].dlen);
fprintf(stdout, "\t\t\tddata:[%s]\n",douon[i].ddata);
}
}
pr_bunsetu(now_bun, bunsetu_cnt)
struct bunsetu *now_bun;
int bunsetu_cnt;
{
unsigned char tmp_str[BUFSIZ];
unsigned char *yomi;
fprintf(stdout, "\t--- < Bunsetu : %d > ---\n", bunsetu_cnt);
fprintf(stdout, "\t\tsrclen : %d\n", now_bun -> srclen);
str_make(tmp_str, now_bun -> srcstr, now_bun -> srclen);
fprintf(stdout, "\t\tsrcstr:[%s]\n", tmp_str);
yomi = tmp_str;
if (now_bun->destlen > 0)
pr_douon(yomi);
else
fprintf(stderr, "\t\tNot Conversion Bunsetsu\n");
fprintf(stdout, "\t\tdestlen : %d\n", now_bun -> destlen);
str_make(tmp_str, now_bun -> deststr, now_bun -> destlen);
fprintf(stdout, "\t\tdeststr:[%s]\n", tmp_str);
}
pr_kanji(bun, bnum)
struct bunsetu *bun;
int bnum;
{
register int i;
fprintf(stdout, "\tsj3_getkan(yomi, kanji)");
fprintf(stdout, "...Bunsetu count : %d\n", bnum);
for (i = 0; i < bnum; i++)
pr_bunsetu(&(bun[i]), i);
}

41
dict/Imakefile Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:16 $
*/
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = tool dict
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

67
dict/dict/Imakefile Normal file
View file

@ -0,0 +1,67 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.4 $
* $SonyDate: 1997/01/23 11:20:50 $
*/
/*
* Change some make rules.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#include "../../sj3.tmpl"
TOOL_DIR = ../tool
TOOL_NAME = sj3mkdic
SRCS = ./visual.dic
OBJS = sj3main.dic
OUTPUT = Moutput
XCOMM INSTFLAGS = -o $(SJ3OWNER) -g $(SJ3GROUP) -m 444
all: $(OBJS)
$(OBJS): $(SRCS)
$(TOOL_DIR)/$(TOOL_NAME) $(SRCS) $(OBJS) > $(OUTPUT)
depend::
clean::
$(RM) $(OBJS) $(OUTPUT)
InstallNamedNonExec(sj3main.dic,sj3main.dic,$(SJ3DICTDIR))
install::
if [ ! -d $(SJ3DICTDIR)/user ]; then \ @@\
(mkdir $(SJ3DICTDIR)/user; \ @@\
chown $(SJ3OWNER) $(SJ3DICTDIR)/user; \ @@\
chgrp $(SJ3GROUP) $(SJ3DICTDIR)/user); fi

29803
dict/dict/visual.dic Normal file

File diff suppressed because it is too large Load diff

112
dict/include/sj_const.h Normal file
View file

@ -0,0 +1,112 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_const.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:24 $
*/
#ifndef _CONST_
#define _CONST_
#define MainSegmentLength 2048
#define MainIndexLength 2048
#define MainIndexNumber 512
#define MaxYomiLength 32
#define MaxKanjiLength 32
#define MaxHinsiNumber 16
#define MaxAtrNumber 16
#define MaxJosiNumber 16
#define MaxKnjAskNumber 16
#define MaxYomiAskNumber 16
#define DouonBlkSizeNumber 3
#define DouonBlkTerm 0xff
#define HinsiBlkTerm 0xff
#define NormalKanjiMask 0x7f
#define SS3Kanji 0x0080
#define ZenHiraAssyuku 0x80
#define OffsetAssyuku 0x90
#define ZenKataAssyuku 0xa0
#define AiAttribute 0xb0
#define KanjiAssyuku 0xc0
#define LeadingHankaku 0xd0
#define KanjiStrEnd 0x00
#define IsAssyuku 0x80
#define AssukuUse2byte 0x90
#define KnjAssyukuMask 0x0f
#define KanjiCodeMask 0x0f
#define KanjiModeMask 0xf0
#define AtrMsKanjiOfs 0xc0c0
#define MaxHindoNumber 2000
#define MaxOffsetNumber 1000
#define IllegalFormat "\245\325\245\251\241\274\245\336\245\303\245\310\244\254\260\333\276\357\244\307\244\271"
#define TooLongYomi "\306\311\244\337\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
#define TooLongKanji "\264\301\273\372\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
#define TooLongHinsi "\311\312\273\354\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
#define TooLongGroup "\245\260\245\353\241\274\245\327\314\276\244\254\260\333\276\357\244\307\244\271"
#define TooLongJosi "\275\365\273\354\312\270\273\372\316\363\244\254\260\333\276\357\244\307\244\271"
#define BadHinsi "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\311\312\273\354\244\307\244\271"
#define BadGroup "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\245\260\245\353\241\274\245\327\244\307\244\271"
#define BadJosi "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\275\365\273\354\244\307\244\271"
#define NoYomiString "\306\311\244\337\312\270\273\372\316\363\244\254\274\350\306\300\244\307\244\255\244\336\244\273\244\363"
#define NoKanjiString "\264\301\273\372\312\270\273\372\316\363\244\254\274\350\306\300\244\307\244\255\244\336\244\273\244\363"
#define TooManyAtr "\302\260\300\255\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
#define TooManyHinsi "\311\312\273\354\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
#define TooManyJosi "\275\365\273\354\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
#define NoDataInMain "\245\341\245\244\245\363\274\255\275\361\244\313\302\270\272\337\244\267\244\336\244\273\244\363"
#define TooManyTarget "\311\312\273\354\244\362\243\261\244\304\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244"
#define HinsiTankan cnvhinsi("\303\261\264\301")
#define FALSE 0
#define TRUE (!FALSE)
#define DIVLIST 1
#define ASSYUKUREC 2
#define STRING 3
#define HINDOREC 4
#define OFFSETREC 5
#define KANJIREC 6
#define HINSIREC 7
#define DOUONREC 8
#endif

49
dict/include/sj_macro.h Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_macro.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:25 $
*/
#include <sys/types.h>
#include <ctype.h>
#ifndef _MACRO_
#define _MACRO_
#define Isblank(c) ((c) == 0x20 || (c) == 0x09 || (c) == 0xa1a1)
#define Isillegal(c) ((c) < 0x20)
#endif

102
dict/include/sj_struct.h Normal file
View file

@ -0,0 +1,102 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_struct.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:26 $
*/
#include "sj_const.h"
#ifndef _STRUCT_
#define _STRUCT_
typedef struct kanji_rec {
int klen;
u_char *kptr;
int alen;
u_char *aptr;
struct kanji_rec *knext;
} KanjiRec;
typedef struct hinsi_rec {
int hinsi;
KanjiRec *krec;
struct hinsi_rec *hnext;
} HinsiRec;
typedef struct douon_rec {
u_char *yptr;
int dlen;
int hrec_num;
HinsiRec *hrec;
struct douon_rec *dnext;
} DouonRec;
typedef struct hindo_rec {
int klen;
u_char *kptr;
int exist;
int hindo;
int offset;
struct hindo_rec *anext;
struct assyuku_rec *arec;
} HindoRec;
typedef struct assyuku_rec {
int len;
HindoRec *nrec;
struct assyuku_rec *anext;
} AssyukuRec;
typedef struct offset_rec {
int klen;
u_char *kptr;
int offset;
} OffsetRec;
#endif

198
dict/tool/GramTable Normal file
View file

@ -0,0 +1,198 @@
"カ五1", 91,
"カ五2", 101,
"カ五3", 131,
"カ五4", 141,
"カ五5", 111,
"カ五6", 121,
"カ五7", 151,
"カ五8", 161,
"カ五音便", 185,
"カ変仮", 181,
"カ変終体", 180,
"カ変未", 178,
"カ変命", 182,
"カ変用", 179,
"ガ五1", 92,
"ガ五2", 102,
"ガ五3", 132,
"ガ五4", 142,
"ガ五5", 112,
"ガ五6", 122,
"ガ五7", 152,
"ガ五8", 162,
"サ五1", 93,
"サ五2", 103,
"サ五3", 133,
"サ五4", 143,
"サ五5", 113,
"サ五6", 123,
"サ五7", 153,
"サ五8", 163,
"サ変", 80,
"サ変仮", 175,
"サ変終体", 174,
"サ変未1", 171,
"サ変未2", 172,
"サ変未用", 173,
"サ変命1", 176,
"サ変命2", 177,
"ザ変", 81,
"タ五1", 94,
"タ五2", 104,
"タ五3", 134,
"タ五4", 144,
"タ五5", 114,
"タ五6", 124,
"タ五7", 154,
"タ五8", 164,
"ナ五", 95,
"バ五1", 96,
"バ五2", 105,
"バ五3", 135,
"バ五4", 145,
"バ五5", 115,
"バ五6", 125,
"バ五7", 155,
"バ五8", 165,
"マ五1", 97,
"マ五2", 106,
"マ五3", 136,
"マ五4", 146,
"マ五5", 116,
"マ五6", 126,
"マ五7", 156,
"マ五8", 166,
"ラ五1", 98,
"ラ五2", 107,
"ラ五3", 137,
"ラ五4", 147,
"ラ五5", 117,
"ラ五6", 127,
"ラ五7", 157,
"ラ五8", 167,
"ワ五1", 99,
"ワ五2", 108,
"ワ五3", 138,
"ワ五4", 148,
"ワ五5", 118,
"ワ五6", 128,
"ワ五7", 158,
"ワ五8", 168,
"挨拶", 187,
"衣服", -11,
"一括", 200,
"一段1", 90,
"一段2", 100,
"一段3", 130,
"一段4", 140,
"雨", -21,
"音楽", -20,
"海", -31,
"開閉", -4,
"活動", -5,
"感動", 28,
"企業", 23,
"魚", -14,
"形1", 60,
"形10", 69,
"形11", 70,
"形2", 61,
"形3", 62,
"形4", 63,
"形5", 64,
"形6", 65,
"形7", 66,
"形8", 67,
"形9", 68,
"形動1", 71,
"形動2", 72,
"形動3", 73,
"形動4", 74,
"形動5", 75,
"形動6", 76,
"形動7", 77,
"形動8", 78,
"形動9", 79,
"建築", -13,
"県区", 25,
"湖", -33,
"国", -12,
"試合", -10,
"事件", -27,
"時", -25,
"酒", -23,
"州", -29,
"出版", -18,
"所", -2,
"助数", 29,
"助数2", 54,
"乗物", -17,
"植物", -6,
"食物", -16,
"身体", -8,
"人", -1,
"数詞", 30,
"数詞2", 55,
"接続", 27,
"接頭1", 31,
"接頭2", 32,
"接頭3", 33,
"接頭4", 34,
"接頭5", 35,
"接尾1", 36,
"接尾2", 37,
"接尾3", 38,
"接尾4", 39,
"接尾5", 40,
"接尾6", 41,
"接尾7", 42,
"接尾8", 43,
"接尾9", 44,
"川", -30,
"組織", -3,
"贈物", -26,
"代1", 12,
"代2", 13,
"代3", 14,
"代4", 15,
"代5", 16,
"代6", 17,
"単漢", 189,
"地位", -7,
"地名", 24,
"丁寧1", 183,
"丁寧2", 184,
"電車", -34,
"都市", -24,
"島", -32,
"動物", -9,
"特殊形容", 188,
"特殊副", 186,
"病気", -15,
"苗字", 21,
"副1", 45,
"副2", 46,
"副3", 47,
"副4", 48,
"副5", 49,
"副6", 50,
"副7", 51,
"副8", 52,
"副9", 53,
"文字", -19,
"法", -35,
"名1", 1,
"名10", 10,
"名11", 11,
"名2", 2,
"名20", 18,
"名3", 3,
"名4", 4,
"名5", 5,
"名6", 6,
"名7", 7,
"名8", 8,
"名9", 9,
"名前", 22,
"鳴物", -28,
"連体", 26

79
dict/tool/Imakefile Normal file
View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.4 $
* $SonyDate: 1997/01/23 11:20:51 $
*/
/*
* Change some make rules.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#include "../../sj3.tmpl"
INCLUDES = -I../include -I../../include
INSTFLAGS = -o $(SJ3OWNER) -g $(SJ3GROUP) -m 755
SRCS = \
char.c \
cnvhinsi.c \
file.c \
global.c \
hindo.c \
knjcvt.c \
makedict.c \
makelist.c \
makeseg.c \
memory.c \
offset.c \
readline.c \
string.c
OBJS = \
char.o \
cnvhinsi.o \
file.o \
global.o \
hindo.o \
knjcvt.o \
makedict.o \
makelist.o \
makeseg.o \
memory.o \
offset.o \
readline.o \
string.o
AllTarget(sj3mkdic)
NormalProgramTarget(sj3mkdic,$(OBJS),,,)
DependTarget()
InstallProgramWithFlags(sj3mkdic,$(SJ3BINDIR),$(INSTFLAGS))

283
dict/tool/char.c Normal file
View file

@ -0,0 +1,283 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: char.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:32 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_euc.h"
#include "sj_const.h"
cnvyomi(code)
int code;
{
register u_short hh;
register u_char high;
register u_char low;
hh = ((code >> 16) & 0xffff);
high = ((code >> 8) & 0xff);
low = (code & 0xff);
if (!hh) {
if (high == 0xa1) {
switch (low) {
case 0xbc: return 1;
case 0xf4: return 2;
case 0xf7: return 3;
case 0xa7: return 4;
}
}
else if (high == 0xa2) {
if (low == 0xa9)
return 4;
}
else if (high == 0xa3) {
if (low < 0xb0)
;
else if (low <= 0xb9)
return(low - 0xb0 + 0x10);
else if (low < 0xc0)
;
else if (low <= 0xda)
return(low - 0xc1 + 0x1A);
else if (low < 0xe1)
;
else if (low <= 0xfa)
return(low - 0xe1 + 0x34);
}
else if (high == 0xa4) {
if (low < 0xa1)
;
else if (low <= 0xf3)
return(low - 0xa1 + 0x4e);
}
else if (high == 0xa5) {
switch (low) {
case 0xf4: return 0xa1;
case 0xf5: return 0xa2;
case 0xf6: return 0xa3;
}
}
}
return 0;
}
h2kcode(code)
int code;
{
register u_short hh;
register u_char high;
register u_char low;
hh = ((code >> 16) & 0xffff);
high = ((code >> 8) & 0xff);
low = (code & 0xff);
if (!hh) {
if (high != 0xa4)
return code;
else
return (code + 0x0100);
}
}
codesize(code)
u_char code;
{
switch (code&KanjiModeMask) {
case ZenHiraAssyuku:
case ZenKataAssyuku:
case KanjiAssyuku:
case KanjiStrEnd:
return 1;
case LeadingHankaku:
case OffsetAssyuku:
case AiAttribute:
return 2;
default:
return 2;
}
}
output_knj(fp, p, l)
FILE *fp;
register u_char *p;
register int l;
{
while (l > 0) {
switch (*p & KanjiModeMask) {
case ZenHiraAssyuku:
fprintf(fp, "\244\322%d", (*p++ & 0x0f) + 1);
l--;
break;
case ZenKataAssyuku:
fprintf(fp, "\245\253%d", (*p++ & 0x0f) + 1);
l--;
break;
case KanjiAssyuku:
fprintf(fp, "\260\265%1x", (*p++ & 0x0f));
l--;
break;
case LeadingHankaku:
#ifndef UseHankakuInDict
l = 0;
fprintf(stderr, "\244\252\244\253\244\267\244\244");
#else
fputc(*p++, fp); l--;
fputc(*p++, fp); l--;
#endif
break;
case OffsetAssyuku:
fprintf(fp, "ofs%1x", (*p++ & 0x0f));
l--;
fprintf(fp, "%02x", *p++); l--;
break;
case AiAttribute:
fprintf(fp, "\302\260%1x", (*p++ & 0x0f));
l--;
fprintf(fp, "%02x", *p++); l--;
break;
case KanjiStrEnd:
p++; l--;
break;
default:
if (p[1] & 0x80)
fputc(SS3, fp);
fputc((*p | 0x80), fp); l--; p++;
fputc((*p | 0x80), fp); l--; p++;
}
}
}
output_str(fp, p)
FILE *fp;
char *p;
{
while (*p) { fputc(*p, fp); p++; }
}
output_int(fp, p)
FILE *fp;
int *p;
{
while (*p) {
if (*p < 0x100) {
fputc(*p, fp); p++;
}
else if (*p < 0x10000) {
fputc((*p >> 8) & 0xff, fp);
fputc(*p & 0xff, fp); p++;
}
else if (*p < 0x1000000) {
fputc((*p >> 16) & 0xff, fp);
fputc((*p >> 8) & 0xff, fp);
fputc(*p & 0xff, fp); p++;
}
else {
fputc((*p >> 24) & 0xff, fp);
fputc((*p >> 16) & 0xff, fp);
fputc((*p >> 8) & 0xff, fp);
fputc(*p & 0xff, fp); p++;
}
}
}
yomi2zen(code)
int code;
{
static char num[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
switch (code) {
case 0x01: return 0xa1bc;
case 0x02: return 0xa1f4;
case 0x03: return 0xa1f7;
case 0x04: return 0xa2a9;
case 0xa1: return 0xa5f4;
case 0xa2: return 0xa5f5;
case 0xa3: return 0xa5f6;
default: break;
}
if (code < 0x10)
;
else if (code < 0x1a)
return(0xa300 + code - 0x10 + 0xb0);
else if (code < 0x34)
return(0xa300 + code - 0x1a + 0xc1);
else if (code < 0x4e)
return(0xa300 + code - 0x34 + 0xe1);
else if (code < 0xa1)
return(0xa400 + code - 0x4e + 0xa1);
return ((num[(code >> 4) & 0x0f] << 8) | num[code & 0x0f]);
}
output_yomi(fp, p)
FILE *fp;
u_char *p;
{
int i;
while (*p) {
i = yomi2zen(*p++);
fputc((i >> 8) & 0xff, fp);
fputc(i & 0xff, fp);
}
}

118
dict/tool/cnvhinsi.c Normal file
View file

@ -0,0 +1,118 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: cnvhinsi.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1996/05/27 06:59:47 $
*/
#include <stdio.h>
#include <sys/types.h>
struct gram_code {
char *name;
int code;
} gramtbl[] = {
#include "GramTable"
};
#define GramMax (sizeof(gramtbl)/sizeof(struct gram_code) - 1)
int u_strcmp(a, b)
u_char *a, *b;
{
if (!a || !b) return 0;
while (*a && *b) {
if (*a < *b) return -1;
if (*a > *b) return 1;
a++;
b++;
}
if (!*a && !*b) return 0;
if (!*a) return -1;
return 1;
}
int cnvhinsi(buf)
u_char *buf;
{
register int min;
register int max;
register int mid;
register int i;
min = 0;
max = GramMax;
while (min <= max) {
mid = (min + max) / 2;
i = u_strcmp(buf, gramtbl[mid].name);
if (i < 0) {
max = mid - 1;
}
else if (i > 0) {
min = mid + 1;
}
else {
return(gramtbl[mid].code);
}
}
return 0;
}
char *hinsi_str(code)
int code;
{
int i;
for (i = 0 ; i <= GramMax ; i++) {
if (gramtbl[i].code == code) return gramtbl[i].name;
}
return "Err";
}

169
dict/tool/file.c Normal file
View file

@ -0,0 +1,169 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: file.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1995/02/03 07:38:32 $
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
char *Malloc();
typedef struct filelist {
FILE *fp;
char *fname;
struct filelist *next;
} FileList;
static FileList *flist = NULL;
static char *get_fname(fp)
FILE *fp;
{
FileList *p;
for (p = flist ; p ; p = p -> next)
if (p -> fp == fp) return p -> fname;
return "some file";
}
FILE *Fopen(filename, type)
char *filename, *type;
{
FILE *fp;
char *p;
FileList *fl;
if (!(fp = fopen(filename, type))) {
fprintf(stderr, "Can't open %s mode \"%s\"\n", filename, type);
exit(1);
}
fl = (FileList *)Malloc(sizeof(*fl));
fl -> fname = Malloc(strlen(filename) + 1);
strcpy(fl -> fname, filename);
fl -> fp = fp;
fl -> next = flist;
return fp;
}
Fclose(fp)
FILE *fp;
{
FileList *p, *q;
if (fclose(fp) == EOF) {
fprintf(stderr, "Close error in %s\n", get_fname(fp));
exit(1);
}
for (p = flist, q = NULL ; p ; q = p, p = p -> next) {
if (p -> fp == fp) {
if (q)
q -> next = p -> next;
else
flist = p -> next;
free(p -> fname);
free(p);
break;
}
}
}
Fseek(fp, ofs, ptr)
FILE *fp;
long ofs;
int ptr;
{
if (fseek(fp, ofs, ptr) == 0) return 0;
fprintf(stderr, "Seek error in %s\n", get_fname(fp));
exit(1);
}
Ftell(fp)
FILE *fp;
{
return ftell(fp);
}
Fsize(filename)
char *filename;
{
struct stat buf;
#if defined(__NetBSD__) || defined(__FreeBSD__)
if (stat(filename, &buf) == 0) return (long)buf.st_size;
#else
if (stat(filename, &buf) == 0) return buf.st_size;
#endif
fprintf(stderr, "Stat error in %s\n", filename);
exit(1);
}
Fread(p, s, n, fp)
char *p;
int s, n;
FILE *fp;
{
if (fread(p, s, n, fp) == n) return n;
fprintf(stderr, "Read error in %s\n", get_fname(fp));
exit(1);
}
Fwrite(p, s, n, fp)
char *p;
int s, n;
FILE *fp;
{
if (fwrite(p, s, n, fp) == n) return n;
fprintf(stderr, "Write error in %s\n", get_fname(fp));
exit(1);
}
Fgetc(fp)
FILE *fp;
{
return fgetc(fp);
}
Fflush(fp)
FILE *fp;
{
fflush(fp);
}

58
dict/tool/global.c Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: global.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:35 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_struct.h"
DouonRec *douon_ptr = NULL;
int douon_num = 0;
int yomi_len = 0;
int hinsi_num = 0;
int kanji_len = 0;
HindoRec *hindo[MaxHindoNumber];
int hindo_num = 0;
OffsetRec *ofsrec[MaxOffsetNumber];
int ofsrec_num = 0;
AssyukuRec *assyuku = NULL;
HindoRec *askknj[MaxKnjAskNumber];
int askknj_num = 0;
int kanji_num = 0;

643
dict/tool/hindo.c Normal file
View file

@ -0,0 +1,643 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: hindo.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/08/17 01:50:26 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_struct.h"
extern HindoRec *hindo[];
extern int hindo_num;
extern AssyukuRec *assyuku;
extern HindoRec *askknj[];
extern int askknj_num;
extern int kanji_num;
OffsetRec *real_ofsrec();
check_hindo(ptr, len)
u_char *ptr;
int len;
{
int low, high, mid;
int i;
if (hindo_num <= 0) return 0;
low = 0; high = hindo_num - 1;
while (low <= high) {
mid = (low + high) / 2;
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, ptr, len);
if (i > 0)
high = mid - 1;
else if (i < 0)
low = ++mid;
else
return(hindo[mid]->exist + hindo[mid]->hindo);
}
return 0;
}
static AssyukuRec *makeassyuku(num)
int num;
{
AssyukuRec *arec;
arec = (AssyukuRec *)Malloc(sizeof(AssyukuRec));
if (!arec) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
exit(1);
}
arec -> len = num;
arec -> nrec = NULL;
arec -> anext = NULL;
return arec;
}
static assyuku_len(hrec)
HindoRec *hrec;
{
int org;
int old;
int new;
OffsetRec *p;
if (((*(hrec->kptr) & KanjiModeMask) == OffsetAssyuku) &&
(hrec->klen == 2)) {
p = real_ofsrec(hrec -> kptr);
org = check_hindo(p -> kptr, p -> klen);
old = p->klen * org + 2 * (hrec->exist + hrec->hindo);
new = p->klen + (hrec->exist + hrec->hindo + org);
}
else {
old = hrec -> klen * (hrec -> exist + hrec -> hindo);
new = hrec -> klen + (hrec -> exist + hrec -> hindo);
}
return (old - new);
}
static void set_assyuku(hrec)
HindoRec *hrec;
{
register AssyukuRec *arec;
register AssyukuRec *aprev;
register int len;
len = assyuku_len(hrec);
if (len <= 0) return;
arec = assyuku; aprev = NULL;
while (arec) {
if (arec -> len == len) {
hrec -> arec = arec;
hrec -> anext = arec -> nrec;
arec -> nrec = hrec;
return;
}
else if (arec -> len < len)
break;
aprev = arec;
arec = arec -> anext;
}
arec = makeassyuku(len);
hrec -> anext = NULL;
hrec -> arec = arec;
arec -> nrec = hrec;
if (aprev) {
arec -> anext = aprev -> anext;
aprev -> anext = arec;
}
else {
arec -> anext = assyuku;
assyuku = arec;
}
}
static void reset_assyuku(hrec)
HindoRec *hrec;
{
AssyukuRec *arec;
AssyukuRec *aptr;
AssyukuRec *aprev;
HindoRec *hptr;
HindoRec *hprev;
arec = hrec -> arec;
if (!arec) return;
hrec -> arec = NULL;
hptr = arec -> nrec; hprev = NULL;
while (hptr) {
if (hptr == hrec) break;
hprev = hptr;
hptr = hptr -> anext;
}
if (!hptr) return;
if (hprev) {
hprev -> anext = hrec -> anext;
hrec -> anext = NULL;
return;
}
if (hrec -> anext) {
arec -> nrec = hrec -> anext;
hrec -> anext = NULL;
return;
}
if (!assyuku) return;
aptr = assyuku; aprev = NULL;
while (aptr) {
if (aptr == arec) break;
aprev = aptr;
aptr = aptr -> anext;
}
if (!aptr) return;
if (aprev)
aprev -> anext = arec -> anext;
else
assyuku = arec -> anext;
Free(arec);
hrec -> anext = NULL;
}
static HindoRec *makehindo(ptr, len, alen)
u_char *ptr;
int len;
int alen;
{
HindoRec *hrec;
u_char *p;
hrec = (HindoRec *)Malloc(sizeof(HindoRec));
if (!hrec) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
exit(1);
}
p = (u_char *)Malloc(len);
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
exit(1);
}
hrec -> klen = len;
hrec -> kptr = p;
if (len == alen && len > 2) {
hrec -> hindo = 0;
hrec -> exist = 1;
hrec -> offset = ++kanji_num;
}
else {
hrec -> hindo = 1;
hrec -> exist = 0;
hrec -> offset = 0;
}
while (len-- > 0) *p++ = *ptr++;
hrec -> anext = NULL;
hrec -> arec = NULL;
return hrec;
}
static void set_hindo(ptr, len, alen)
u_char *ptr;
int len;
int alen;
{
HindoRec *hrec;
int low, high, mid;
int i;
if (hindo_num <= 0) {
hrec = makehindo(ptr, len, alen);
hindo[0]= hrec;
hindo_num = 1;
set_assyuku(hrec);
return;
}
low = 0; high = hindo_num - 1;
while (low <= high) {
mid = (low + high) / 2;
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, ptr, len);
if (i > 0)
high = mid - 1;
else if (i < 0)
low = ++mid;
else
break;
}
if (i) {
if (hindo_num >= MaxHindoNumber) {
fprintf(stderr, "\311\321\305\331\245\306\241\274\245\326\245\353\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
exit(1);
}
hrec = makehindo(ptr, len, alen);
for (i = hindo_num ; i > mid ; i--) hindo[i] = hindo[i - 1];
hindo[mid] = hrec;
hindo_num++;
}
else {
hrec = hindo[mid];
reset_assyuku(hrec);
if (hrec -> exist > 0)
hrec -> exist += 1;
else if (len == alen && len > 2) {
hrec -> exist = 1;
hrec -> offset = ++kanji_num;
}
else
hrec -> hindo += 1;
}
set_assyuku(hrec);
}
static void reset_hindo(p, l)
u_char *p;
int l;
{
HindoRec *hrec;
int low, high, mid;
int i;
if (hindo_num <= 0) return;
low = 0; high = hindo_num - 1;
while (low <= high) {
mid = (low + high) / 2;
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, p, l);
if (i > 0)
high = mid - 1;
else if (i < 0)
low = ++mid;
else {
hrec = hindo[mid];
reset_assyuku(hrec);
if (hrec -> exist > 0)
hrec -> exist -= 1;
else if (hrec -> hindo > 0)
hrec -> hindo -= 1;
if (hrec -> exist + hrec -> hindo == 0) {
while (++mid < hindo_num) {
hindo[mid - 1] = hindo[mid];
}
hindo_num--;
Free(hrec -> kptr);
Free(hrec);
}
else {
set_assyuku(hrec);
}
return;
break;
}
}
}
knjhnd_set(p, l)
u_char *p;
int l;
{
register u_char *kp1;
register u_char *kp2;
register int i;
register int kl1;
u_char tmp[MaxKanjiLength * 2 + MaxAtrNumber * 2 + 1];
for (kp1 = p, kl1 = l ; kl1 > 0 ; ) {
for (i = 0, kp2 = kp1 ; i < kl1 ; ) {
if (codesize(*kp2) == 1) {
tmp[i++] = *kp2++;
}
else if (codesize(*kp2) == 2) {
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
} else {
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
}
set_hindo(tmp, i, l);
}
kl1 -= codesize(*kp1);
kp1 += codesize(*kp1);
}
}
knjhnd_reset(p, l)
u_char *p;
int l;
{
register u_char *kp1;
register u_char *kp2;
register int i;
register int kl1;
u_char tmp[MaxKanjiLength * 2 + MaxAtrNumber * 2 + 1];
for (kp1 = p, kl1 = l ; kl1 > 0 ; ) {
for (i = 0, kp2 = kp1 ; i < kl1 ; ) {
if (codesize(*kp2) == 1) {
tmp[i++] = *kp2++;
}
else if (codesize(*kp2) == 2) {
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
} else {
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
tmp[i++] = *kp2++;
}
reset_hindo(tmp, i);
}
kl1 -= codesize(*kp1);
kp1 += codesize(*kp1);
}
}
static check_assyuku(p, q)
register HindoRec *p;
register HindoRec *q;
{
u_char ptmp[128], qtmp[128];
int plen;
int qlen;
plen = make_knjstr(p -> kptr, p -> klen, ptmp);
qlen = make_knjstr(q -> kptr, q -> klen, qtmp);
if (bubun_str(ptmp, plen, qtmp, qlen)) {
return -1;
}
if (overlap_str(ptmp, plen, qtmp, qlen))
return -1;
return 0;
}
decide_knjask()
{
int i, j;
AssyukuRec *p;
HindoRec *q;
u_char *r;
int len = 0;
askknj_num = 0;
for (p = assyuku ; p ; p = p -> anext) {
if (p -> len <= 0) break;
for (q = p -> nrec ; q ; q = q -> anext) {
i = q -> klen;
r = q -> kptr;
if (i > 2) {
while (i > 0) {
if ((*r & KanjiModeMask)
== OffsetAssyuku) {
break;
}
j = codesize(*r);
i -= j;
r += j;
}
if (i) continue;
}
if (askknj_num) {
for (i = 0 ; i < askknj_num ; i++) {
if (check_assyuku(askknj[i], q))
break;
}
if (i >= askknj_num) {
askknj[askknj_num++] = q;
len += p -> len;
if (askknj_num >= MaxKnjAskNumber)
goto end;
}
}
else {
askknj[askknj_num++] = q;
len += p -> len;
}
}
}
end:
{
int i, j, len;
u_char *p;
for (i = 0 ; i < askknj_num ; i++) {
len = askknj[i] -> klen;
p = askknj[i] -> kptr;
if (len <= 2) continue;
while (len > 0) {
if ((*p & KanjiModeMask) == OffsetAssyuku) {
printf("\245\252\245\325\245\273\245\303\245\310\260\265\275\314\244\362\264\336\244\340 %d\n", i);
}
j = codesize(*p);
len -= j;
p += j;
}
}
}
return len;
}
clear_hindo()
{
register int i;
for (i = 0 ; i < hindo_num ; i++) {
Free(hindo[i]->kptr);
Free(hindo[i]);
}
hindo_num = 0;
kanji_num = 0;
}
clear_assyuku()
{
register AssyukuRec *p;
while (assyuku) {
p = assyuku;
assyuku = assyuku -> anext;
Free(p);
}
}

276
dict/tool/knjcvt.c Normal file
View file

@ -0,0 +1,276 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: knjcvt.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:37 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_const.h"
#include "sj_struct.h"
typedef struct div_list {
int len;
u_char code[3];
struct div_list *child;
} DivList;
extern HindoRec *askknj[];
extern int askknj_num;
static free_divlist(p)
register DivList *p;
{
register DivList *q;
while (p) {
q = p -> child;
Free(p);
p = q;
}
}
static DivList *make_divrec()
{
register DivList *p;
p = (DivList *)Malloc(sizeof(DivList));
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
exit(1);
}
p -> child = NULL;
return p;
}
static make_divlist(parent, knj, len)
DivList *parent;
u_char *knj;
int len;
{
int i, j;
int num;
int minlen;
int tmplen;
DivList tmprec;
DivList *minrec;
minrec = make_divrec();
if (len == 0) {
free_divlist(minrec);
parent -> child = NULL;
return 0;
}
else if (len == 1) {
minrec -> len = len;
minrec -> code[0] = *knj;
parent -> child = minrec;
return len;
}
if (codesize(*knj) == 1) {
minrec -> len = 1;
minrec -> code[0] = *knj;
minlen = make_divlist(minrec, knj + 1, len - 1) + 1;
}
else if (codesize(*knj) == 2) {
minrec -> len = 2;
minrec -> code[0] = *knj;
minrec -> code[1] = *(knj + 1);
minlen = make_divlist(minrec, knj + 2, len - 2) + 2;
}
for (i = 0 ; i < len ; i = j) {
j = i + codesize(*(knj + i));
if (j <= 2 || !(num = isknjexist(knj, j))) continue;
tmprec.len = 2;
tmprec.code[0] = (OffsetAssyuku | ((num >> 8) & 0xff));
tmprec.code[1] = (num & 0xff);
tmprec.child = NULL;
tmplen = make_divlist(&tmprec, knj + j, len - j) + 2;
if (tmplen < minlen) {
free_divlist(minrec -> child);
*minrec = tmprec;
minlen = tmplen;
}
else
free_divlist(tmprec.child);
}
for (i = 0 ; i < askknj_num ; i++) {
if ((j = askknj[i] -> klen) > len) continue;
if (string_cmp(askknj[i]->kptr, j, knj, j)) continue;
tmprec.len = 1;
tmprec.code[0] = (KanjiAssyuku | i);
tmprec.child = NULL;
tmplen = make_divlist(&tmprec, knj + j, len - j) + 1;
if (tmplen < minlen) {
free_divlist(minrec -> child);
*minrec = tmprec;
minlen = tmplen;
}
else
free_divlist(tmprec.child);
}
parent -> child = minrec;
return minlen;
}
u_char *knjofscvt(ptr, len, ret)
u_char *ptr;
int len;
int *ret;
{
int i;
u_char *p, *q;
DivList parent, *dl;
askknj_num = 0;
parent.child = NULL;
i = make_divlist(&parent, ptr, len);
*ret = i;
p = (u_char *)Malloc(i);
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
for (q = p, dl = parent.child ; dl ; dl = dl -> child) {
*q++ = dl -> code[0];
if (dl -> len == 2) {
*q++ = dl -> code[1];
} else if (dl -> len == 3) {
*q++ = dl -> code[1];
*q++ = dl -> code[2];
}
}
free_divlist(parent.child);
return p;
}
u_char *knjcvt(ptr, len, ret)
u_char *ptr;
int len;
int *ret;
{
int i;
u_char *p, *q;
DivList parent, *dl;
parent.child = NULL;
i = make_divlist(&parent, ptr, len);
*ret = i;
p = (u_char *)Malloc(i);
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
for (q = p, dl = parent.child ; dl ; dl = dl -> child) {
*q++ = dl -> code[0];
if (dl -> len == 2) {
*q++ = dl -> code[1];
} else if (dl -> len == 3) {
*q++ = dl -> code[1];
*q++ = dl -> code[2];
}
}
free_divlist(parent.child);
if (i != q - p) {
printf("\244\263\244\263\n");
exit(1);
}
return p;
}

241
dict/tool/makedict.c Normal file
View file

@ -0,0 +1,241 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: makedict.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/12/09 11:27:05 $
*/
#include "sj_sysvdef.h"
#include <stdio.h>
#include <locale.h>
#ifdef SVR4
#include <string.h>
#else
#include <strings.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include "sj_const.h"
FILE *infp = NULL;
FILE *outfp = NULL;
char *Zalloc();
FILE *Fopen();
static char *idxtop = NULL;
main(argc, argv)
int argc;
char **argv;
{
int makelist();
parse(argc, argv);
while (readline()) setline(makelist);
flush_douon();
makehead((u_char *)argv[2]);
return 0;
}
char *make_idxlist(name)
char *name;
{
int i;
char *p;
i = strlen(name);
p = Zalloc(i + 2);
strcpy(p, name);
return p;
}
char *get_idxlist(name)
char *name;
{
FILE *fp;
int i;
char *p, *q, *r;
fp = Fopen(name, "r");
i = Fsize(name);
p = Zalloc(i + 2);
Fseek(fp, 0L, 0);
Fread(p, 1, i, fp);
Fclose(fp);
for (q = r = p ; *q ; ) {
while (*q <= ' ') q++;
while (*q > ' ') *r++ = *q++;
*r++ = 0;
q++;
}
*r = 0;
i = 0;
for (q = p ; *q ; ) {
if (fp = fopen(q, "r"))
fclose(fp);
else {
fprintf(stderr, "Can't open %s mode \"r\"\n", q);
i++;
}
while (*q++) ;
}
if (i) exit(1);
return p;
}
parse(argc, argv)
int argc;
char **argv;
{
int i;
char *progname = NULL;
char *p;
extern char *strrchr();
if (progname = strrchr(argv[0], '/'))
progname++;
else
progname = argv[0];
if (argc != 3) usage(progname);
p = argv[1];
idxtop = (*p == '-') ? get_idxlist(p + 1) : make_idxlist(p);
outfp = Fopen(argv[2], "w");
}
get_number(ptr)
register char *ptr;
{
register int i = 0;
while (*ptr >= '0' && *ptr <= '9') {
i = i * 10 + (*ptr++ - '0');
}
return(i);
}
usage(name)
char *name;
{
fprintf(stderr, "Usage: %s text_file binary_file\n",
name ? name : "encode");
exit(0);
}
int getch()
{
if (infp) {
int c;
if ((c = Fgetc(infp)) != EOF) return c;
Fclose(infp);
infp = NULL;
while (*idxtop++) ;
}
if (*idxtop) {
infp = Fopen(idxtop, "r");
fprintf(stderr, "Reading %s\n", idxtop);
fflush(stderr);
return getch();
}
return EOF;
}
mark_file(out)
FILE *out;
{
static char pathname[MAXPATHLEN];
static long pos;
if (out) {
FILE *fp;
int c;
fprintf(out, "%s:\t", pathname);
fp = Fopen(pathname, "r");
Fseek(fp, pos, 0);
c = Fgetc(fp);
while (c != EOF && c != '\n') {
fputc(c, out);
c = Fgetc(fp);
}
fputc('\n', out);
Fclose(fp);
}
else {
strcpy(pathname, idxtop);
pos = infp ? Ftell(infp) : 0;
}
}

648
dict/tool/makelist.c Normal file
View file

@ -0,0 +1,648 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: makelist.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:39 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_struct.h"
#ifndef SS2
#define SS2 0x8e
#endif
extern DouonRec *douon_ptr;
extern int douon_num;
extern int yomi_len;
extern int hinsi_num;
extern int kanji_len;
extern HindoRec *hindo[];
extern int hindo_num;
extern HindoRec *askknj[];
extern int askknj_num;
extern HindoRec *assyuku;
static DouonRec *drectmp = NULL;
static clearklist(krec)
register KanjiRec *krec;
{
register KanjiRec *p;
while (krec) {
Free(krec -> kptr);
Free(krec -> aptr);
p = krec;
krec = krec -> knext;
Free(p);
}
}
static clearhlist(hrec)
register HinsiRec *hrec;
{
register HinsiRec *p;
while (hrec) {
clearklist(hrec -> krec);
p = hrec;
hrec = hrec -> hnext;
Free(p);
}
}
clear_list()
{
register DouonRec *p;
register DouonRec *drec = douon_ptr;
while (drec) {
Free(drec -> yptr);
clearhlist(drec -> hrec);
p = drec;
drec = drec -> dnext;
Free(p);
}
douon_ptr = NULL;
}
static u_char *makekanji(yomi, kanji, atr, len)
int *yomi;
int *kanji;
int *atr;
int *len;
{
int kana[MaxYomiLength + 1];
u_char ktmp[MaxKanjiLength * 3 + MaxAtrNumber * 2 + 1];
register int i;
register int pos = 0;
int *p;
u_char *q;
for (p = yomi, i = 0 ; *p ; )
kana[i++] = h2kcode(*p++);
kana[i] = 0;
while (*atr) {
i = *atr;
atr++;
#ifndef NO_ATR
ktmp[pos++] = (AiAttribute | ((i >> 8) & 0xff));
ktmp[pos++] = (i & 0xff);
#endif
}
if (i = top_strcmp(yomi, kanji)) {
kanji += i;
ktmp[pos++] = (ZenHiraAssyuku | (i - 1));
}
else if (i = top_strcmp(kana, kanji)) {
kanji += i;
ktmp[pos++] = (ZenKataAssyuku | (i - 1));
}
while (*kanji) {
if (i = last_strcmp(yomi, kanji)) {
kanji += i;
ktmp[pos++] = (ZenHiraAssyuku | (i - 1));
}
else if (i = last_strcmp(kana, kanji)) {
kanji += i;
ktmp[pos++] = (ZenKataAssyuku | (i - 1));
}
else if (((*kanji >> 8) & 0xff) == SS2 || *kanji < 0x100) {
ktmp[pos] = LeadingHankaku;
ktmp[pos + 1] = (*kanji & 0xff);
kanji++;
pos += 2;
}
else {
if (*kanji < 0x10000) {
ktmp[pos] = ((*kanji >> 8) & NormalKanjiMask);
ktmp[pos + 1] = (*kanji & NormalKanjiMask);
kanji++;
pos += 2;
} else if (*kanji < 0x1000000) {
ktmp[pos] = ((*kanji >> 8) & NormalKanjiMask);
ktmp[pos + 1] = (*kanji & 0xff);
kanji++;
pos += 2;
} else {
fprintf(stderr, "Error: 4 byte code is found\n");
exit(0);
}
}
}
*len = pos;
q = (u_char *)Malloc(pos);
if (!q) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
memcpy(q, ktmp, pos);
return q;
}
static u_char *makeyomi(yomi)
int *yomi;
{
u_char tmp[MaxYomiLength + 1];
register int i;
register int j;
register int *y = yomi;
register u_char *p;
for (i = 0 ; *y ; ) {
j = cnvyomi(*y++);
if (j == 0) {
fprintf(stderr, "\311\324\300\265\244\312\312\270\273\372\244\254\306\311\244\337\244\313\273\310\244\357\244\354\244\306\244\244\244\336\244\271\n");
output_int(stderr, yomi); fputc('\n', stderr);
exit(1);
}
tmp[i++] = j;
}
tmp[i++] = 0;
p = (u_char *)Malloc(i);
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
memcpy(p, tmp, i);
return p;
}
static KanjiRec *make_krec(kcode, klen)
u_char *kcode;
int klen;
{
register KanjiRec *krec;
krec = (KanjiRec *)Malloc(sizeof(KanjiRec));
if (!krec) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
krec -> klen = klen;
krec -> kptr = kcode;
krec -> alen = 0;
krec -> aptr = NULL;
krec -> knext = NULL;
return krec;
}
static HinsiRec *make_hrec(hinsi)
int hinsi;
{
register HinsiRec *hrec;
hrec = (HinsiRec *)Malloc(sizeof(HinsiRec));
if (!hrec) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
hrec -> hinsi = hinsi;
hrec -> krec = NULL;
hrec -> hnext = NULL;
return hrec;
}
static DouonRec *make_drec(ycode)
u_char *ycode;
{
register DouonRec *drec;
drec = (DouonRec *)Malloc(sizeof(DouonRec));
if (!drec) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
exit(1);
}
drec -> yptr = ycode;
drec -> hrec_num = 0;
drec -> hrec = NULL;
drec -> dnext = NULL;
return drec;
}
static diff_ylen(drec)
DouonRec *drec;
{
register DouonRec *dptr;
register DouonRec *dprev;
register u_char *p1;
register u_char *p2;
register int ylen = 0;
dptr = douon_ptr; dprev = NULL;
while (dptr) {
dprev = dptr;
dptr = dptr -> dnext;
}
if (dprev) {
p1 = dprev -> yptr; p2 = drec -> yptr;
while (*p1 && (*p1 == *p2)) { p1++; p2++; }
if (*p1 == *p2) {
fprintf(stderr, "\305\371\244\267\244\244\306\311\244\337\244\316\306\261\262\273\270\354\245\326\245\355\245\303\245\257\244\254\244\242\244\353\n");
output_yomi(stderr, dprev -> yptr); fputc('\n', stderr);
exit(1);
}
else if (*p1 > *p2) {
fprintf(stderr, "\306\311\244\337\244\316\275\347\275\370\244\254\244\252\244\253\244\267\244\244\n");
output_yomi(stderr, dprev->yptr); fputc('\n', stderr);
output_yomi(stderr, drec->yptr); fputc('\n', stderr);
exit(1);
}
while (*p2++) ylen++;
}
return ylen;
}
static douon_knj(drec)
DouonRec *drec;
{
int i;
int len = 0;
u_char *p;
u_char *knjofscvt();
HinsiRec *hrec;
KanjiRec *krec;
for (hrec = drec -> hrec ; hrec ; hrec = hrec -> hnext) {
for (krec = hrec -> krec ; krec ; krec = krec -> knext) {
p = knjofscvt(krec -> kptr, krec -> klen, &i);
len += i + 1;
knjhnd_set(p, i);
krec -> alen = i;
krec -> aptr = p;
set_ofsrec(krec -> kptr, krec -> klen, 0);
}
}
return len;
}
static void make_d_list(drec)
DouonRec *drec;
{
DouonRec *dptr, *dprev;
HinsiRec *hptr;
KanjiRec *kptr;
int ylen;
int klen;
int hnum;
int len;
int i;
start:
if (douon_ptr == NULL) {
douon_num = 0;
yomi_len = 0;
hinsi_num = 0;
kanji_len = 0;
assyuku = NULL;
}
klen = douon_knj(drec);
ylen = diff_ylen(drec);
hnum = drec -> hrec_num;
i = 1 +
MaxKnjAskNumber +
douon_num * DouonBlkSizeNumber + DouonBlkSizeNumber +
yomi_len + ylen +
hinsi_num + hnum +
hinsi_num + hnum +
kanji_len + klen;
len = (i <= MainSegmentLength) ? 0 : decide_knjask();
if ((i - len) <= MainSegmentLength) {
if (douon_ptr) {
dptr = douon_ptr; dprev = NULL;
while (dptr) {
dprev = dptr;
dptr = dptr -> dnext;
}
dprev -> dnext = drec;
}
else {
douon_ptr = drec;
}
drec -> dnext = NULL;
drec -> dlen = ylen;
douon_num += 1;
yomi_len += ylen;
hinsi_num += hnum;
kanji_len += klen;
return;
}
else if (douon_ptr == NULL) {
fprintf(stderr, "\243\261\306\261\262\273\270\354\245\326\245\355\245\303\245\257\244\254\302\347\244\255\244\271\244\256\244\336\244\271\n");
exit(1);
}
for (hptr = drec -> hrec ; hptr ; hptr = hptr -> hnext) {
for (kptr = hptr -> krec ; kptr ; kptr = kptr -> knext) {
knjhnd_reset(kptr -> aptr, kptr -> alen);
Free(kptr -> aptr);
kptr -> aptr = NULL;
}
}
len = decide_knjask();
makeseg();
clear_list();
clear_hindo();
clear_ofsrec();
askknj_num = 0;
clear_assyuku();
goto start;
}
flush_douon()
{
if (drectmp) {
make_d_list(drectmp);
drectmp = NULL;
}
if (douon_ptr) {
decide_knjask();
makeseg();
clear_list();
clear_hindo();
clear_ofsrec();
askknj_num = 0;
}
}
void
makelist(yomi, kanji, hinsi, atr)
int *yomi;
int *kanji;
int hinsi;
int *atr;
{
u_char *ycode;
u_char *kcode;
int klen;
HinsiRec *hrec;
KanjiRec *krec, *kprev;
ycode = makeyomi(yomi);
kcode = makekanji(yomi, kanji, atr, &klen);
if (drectmp && strcmp(ycode, drectmp -> yptr)) {
make_d_list(drectmp);
drectmp = NULL;
}
if (!drectmp) {
drectmp = make_drec(ycode);
hrec = make_hrec(hinsi);
drectmp -> hrec = hrec;
drectmp -> hrec_num = 1;
krec = make_krec(kcode, klen);
hrec -> krec = krec;
return;
}
for (hrec = drectmp -> hrec ; hrec -> hnext ; hrec = hrec -> hnext)
if (hrec -> hinsi == hinsi) break;
if (hrec -> hinsi == hinsi) {
for (krec=hrec->krec ; krec ; krec=krec->knext) {
if ((krec -> klen == klen) &&
!memcmp(krec -> kptr, kcode, klen)) {
fprintf(stderr, "\306\261\260\354\244\316\275\317\270\354\244\254\302\270\272\337\244\267\244\277\n");
fprintf(stderr, "\t\306\311\244\337:");
output_int(stderr, yomi);
fprintf(stderr, "\n");
fprintf(stderr, "\t\264\301\273\372:");
output_int(stderr, kanji);
fprintf(stderr, "\n");
Free(kcode);
return;
}
kprev = krec;
}
kprev -> knext = make_krec(kcode, klen);
return;
}
hrec -> hnext = make_hrec(hinsi);
hrec = hrec -> hnext;
drectmp -> hrec_num += 1;
krec = make_krec(kcode, klen);
hrec -> krec = krec;
}

429
dict/tool/makeseg.c Normal file
View file

@ -0,0 +1,429 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: makeseg.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/12/09 11:27:05 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_struct.h"
#include "../../include/Dict.h"
extern HindoRec *askknj[];
extern int askknj_num;
extern DouonRec *douon_ptr;
extern FILE *outfp;
extern int douon_num;
static u_char index[MainSegmentLength];
static int idxpos = 0;
static int idxnum = 0;
OffsetRec *real_ofsrec();
u_char *knjcvt();
static u_char *set_ofsask(src, dst)
u_char *src;
u_char *dst;
{
int len;
u_char *ptr;
OffsetRec *ofsrec;
ofsrec = real_ofsrec(src);
for (len = ofsrec->klen, ptr = ofsrec->kptr ; len > 0 ; ) {
switch (*ptr & KanjiModeMask) {
case ZenHiraAssyuku:
case ZenKataAssyuku:
case KanjiAssyuku:
*dst++ = *ptr++;
len -= 1;
break;
case LeadingHankaku:
#ifndef UseHankakuInDict
fprintf(stderr, "\302\260\300\255\245\263\241\274\245\311\241\246\245\250\245\351\241\274\n");
exit(1);
#else
*dst++ = *ptr++;
*dst++ = *ptr++;
len -= 2;
break;
#endif
case OffsetAssyuku:
fprintf(stderr, "\306\363\275\305\244\313\245\252\245\325\245\273\245\303\245\310\244\254\273\262\276\310\244\265\244\354\244\306\244\244\244\353\n");
exit(1);
case AiAttribute:
*dst++ = *ptr++;
*dst++ = *ptr++;
len -= 2;
break;
case KanjiStrEnd:
*dst++ = *ptr++;
len--;
break;
default:
*dst++ = *ptr++;
*dst++ = *ptr++;
len -= 2;
}
}
return dst;
}
make_knjstr(src, len, dst)
u_char *src;
int len;
u_char *dst;
{
u_char *keep = dst;
while (len > 0) {
switch (*src & KanjiModeMask) {
case ZenHiraAssyuku:
case ZenKataAssyuku:
case KanjiAssyuku:
*dst++ = *src++;
len -= 1;
break;
case LeadingHankaku:
#ifndef UseHankakuInDict
fprintf(stderr, "\302\260\300\255\245\263\241\274\245\311\241\246\245\250\245\351\241\274\n");
exit(1);
#else
*dst++ = *src++;
*dst++ = *src++;
len -= 2;
break;
#endif
case OffsetAssyuku:
dst = set_ofsask(src, dst);
src += 2;
len -= 2;
break;
case AiAttribute:
*dst++ = *src++;
*dst++ = *src++;
len -= 2;
break;
case KanjiStrEnd:
*dst++ = *src++;
len--;
break;
default:
*dst++ = *src++;
*dst++ = *src++;
len -= 2;
}
}
return(dst - keep);
}
static make_knjask()
{
int i, j;
u_char *p;
u_char buf[128];
int len;
int tlen = 0;
for (i = 0 ; i < askknj_num ; i++) {
len = make_knjstr(askknj[i] -> kptr, askknj[i] -> klen, buf);
Free(askknj[i] -> kptr);
p = (u_char *)Malloc(len);
if (!p) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
exit(1);
}
memcpy(p, buf, len);
askknj[i] -> kptr = p;
askknj[i] -> klen = len;
tlen += len + 1;
}
return tlen;
}
void
makeseg()
{
u_char buf[MainSegmentLength];
DouonRec *drec;
HinsiRec *hrec;
KanjiRec *krec;
int i, j, k;
int slen;
u_char *dst;
u_char *sdst;
u_char *p, *q;
#ifndef HEHE
#define datset(i) { if (dst >= buf+sizeof(buf)) goto err; *dst++ = i; }
#else
#define datset(i) { *dst++; i; }
#endif
dst = buf;
i = make_knjask();
if (i >= 0x100) {
fprintf(stderr, "\264\301\273\372\260\265\275\314\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\353\n");
exit(1);
}
datset(i);
for (i = 0 ; i < askknj_num ; i++) {
p = askknj[i] -> kptr;
j = askknj[i] -> klen;
while (j > 0) {
k = codesize(*p);
datset(*p); p++;
if (k > 2) {
datset(*p); p++;
datset(*p); p++;
} else if (k > 1) {
datset(*p); p++;
}
j -= k;
}
datset(KanjiStrEnd);
}
clear_ofsrec();
for (drec = douon_ptr ; drec ; drec = drec->dnext) {
sdst = dst; dst += DouonBlkSizeNumber;
p = drec -> yptr;
slen = strlen(p) - drec -> dlen;
p += slen;
for (i = drec -> dlen ; i > 0 ; i--) {
datset(*p); p++;
}
for (hrec = drec->hrec ; hrec ; hrec = hrec->hnext) {
datset(hrec -> hinsi);
for (krec = hrec->krec ; krec ; krec = krec->knext) {
p = q = knjcvt(krec -> kptr, krec -> klen, &i);
set_ofsrec(krec->kptr, krec->klen, dst - buf);
while (i-- > 0) {
datset(*p); p++;
}
datset(KanjiStrEnd);
Free(q);
}
datset(HinsiBlkTerm);
}
i = dst - sdst;
*sdst = ((i >> 8) & 0x0f);
*(sdst + 1) = (i & 0xff);
if (drec -> dlen > 0x0f) *sdst |= 0x40;
*(sdst + 2) = (drec -> dlen & 0x0f);
if (slen > 0x0f) *sdst |= 0x80;
*(sdst + 2) |= ((slen << 4) & 0xf0);
}
if (dst < buf + sizeof(buf)) {
datset(DouonBlkTerm);
}
for (p = douon_ptr -> yptr ; ; ) {
if (idxpos < MainIndexLength) {
index[idxpos++] = *p;
}
else {
fprintf(stderr, "\245\244\245\363\245\307\245\303\245\257\245\271\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
exit(1);
}
if (!*p++) break;
}
if (idxpos < MainIndexLength) {
index[idxpos] = 0;
}
else {
fprintf(stderr, "\245\244\245\363\245\307\245\303\245\257\245\271\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
exit(1);
}
i = dst - buf;
while (dst < buf + sizeof(buf)) *dst++ = DouonBlkTerm;
if (Fseek(outfp,
(long)(HeaderLength + CommentLength + MainIndexLength
+ idxnum * MainSegmentLength),
0) < 0) {
fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\267\241\274\245\257\245\250\245\351\241\274\n");
exit(1);
}
if (Fwrite(buf, sizeof(buf), 1, outfp) != 1) {
fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\351\245\244\245\310\245\250\245\351\241\274\n");
exit(1);
}
Fflush(outfp);
printf("\245\273\245\260\245\341\245\363\245\310\310\326\271\346:%d:", idxnum++);
output_yomi(stdout, douon_ptr -> yptr);
printf("\t\245\273\245\260\245\341\245\363\245\310\304\271:%d", i);
printf("\t\306\261\262\273\270\354\277\364:%d\n", douon_num);
printf("\264\301\273\372\260\265\275\314\312\270\273\372\316\363:");
for (i = j = 0 ; i < askknj_num ; i++) {
putchar('\t');
if (i && j == 0) putchar('\t');
output_knj(stdout, askknj[i] -> kptr, askknj[i] -> klen);
printf(":%d", askknj[i] -> hindo + askknj[i] -> exist);
if (++j >= 4) {
putchar('\n');
j = 0;
}
}
if (j) putchar('\n');
putchar('\n');
fflush(stdout);
return;
err:
fprintf(stderr, "\245\273\245\260\245\341\245\363\245\310\271\275\300\256\303\346\244\313\245\320\245\303\245\325\245\241\244\254\244\242\244\325\244\354\244\277\n");
fprintf(stderr, "\245\273\245\260\245\341\245\363\245\310\300\350\306\254\244\316\306\311\244\337:");
output_yomi(stderr, douon_ptr -> yptr);
fputc('\n', stderr);
exit(1);
#undef datset
}
static void put4byte(p, n)
u_char *p;
long n;
{
p += 3;
*p-- = n; n >>= 8;
*p-- = n; n >>= 8;
*p-- = n; n >>= 8;
*p = n;
}
void makehead(dict_name)
u_char *dict_name;
{
u_char header[HeaderLength + CommentLength];
long i;
u_char *p;
#define IndexPos (HeaderLength + CommentLength)
memset(header, '\0', sizeof(header));
put4byte(header + VersionPos, DictVersion);
time(&i);
p = header + CommentPos;
sprintf((char *)p, "%s : %s", dict_name, ctime(&i));
while (*p) {
if (*p == '\n') { *p = 0; break; }
p++;
}
i = IndexPos;
put4byte(header + DictIdxPos, i);
put4byte(header + DictIdxLen, MainIndexLength);
i += MainIndexLength;
put4byte(header + DictSegPos, i);
put4byte(header + DictSegLen, MainSegmentLength);
put4byte(header + DictSegMax, 0);
put4byte(header + DictSegNum, idxnum);
put4byte(header + DictAIdxPos, 0);
put4byte(header + DictAIdxLen, 0);
put4byte(header + DictASegPos, 0);
put4byte(header + DictASegLen, 0);
Fseek(outfp, (long)HeaderPos, 0);
Fwrite(header, sizeof(header), 1, outfp);
Fseek(outfp, (long)IndexPos, 0);
Fwrite(index, MainIndexLength, 1, outfp);
#undef IndexPos
}

67
dict/tool/memory.c Normal file
View file

@ -0,0 +1,67 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: memory.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:42 $
*/
#include <stdio.h>
char *Malloc(size)
unsigned size;
{
char *p;
char *malloc();
p = malloc(size);
if (p == NULL) {
fprintf(stderr, "\245\341\245\342\245\352\244\254\263\316\312\335\244\307\244\255\244\336\244\273\244\363\244\307\244\267\244\277\241\243\n");
exit(1);
}
return p;
}
char *Zalloc(size)
int size;
{
char *p;
p = Malloc(size);
memset(p, '\0', size);
return p;
}
void Free(p)
char *p;
{
free(p);
}

188
dict/tool/offset.c Normal file
View file

@ -0,0 +1,188 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: offset.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/08/17 01:50:26 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_struct.h"
extern OffsetRec *ofsrec[];
extern int ofsrec_num;
static OffsetRec *makeoffset(ptr, len, ofs)
u_char *ptr;
int len;
int ofs;
{
OffsetRec *orec;
u_char *p;
orec = (OffsetRec *)Malloc(sizeof(OffsetRec));
p = (u_char *)Malloc(len);
memcpy(p, ptr, len);
orec -> kptr = p;
orec -> klen = len;
if (ofs)
orec -> offset = ofs;
else
orec -> offset = ofsrec_num + 1;
return orec;
}
void
set_ofsrec(ptr, len, ofs)
u_char *ptr;
int len;
int ofs;
{
OffsetRec *orec;
int low, high, mid;
int i;
if (ofsrec_num <= 0) {
orec = makeoffset(ptr, len, ofs);
ofsrec[0]= orec;
ofsrec_num++;
return;
}
low = 0; high = ofsrec_num - 1;
while (low <= high) {
mid = (low + high) / 2;
i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, ptr, len);
if (i > 0)
high = mid - 1;
else if (i < 0)
low = ++mid;
else
break;
}
if (i) {
if (ofsrec_num >= MaxOffsetNumber) {
fprintf(stderr, "\245\252\245\325\245\273\245\303\245\310\241\246\245\306\241\274\245\326\245\353\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
exit(1);
}
orec = makeoffset(ptr, len, ofs);
for (i = ofsrec_num ; i > mid ; i--) ofsrec[i] = ofsrec[i - 1];
ofsrec[mid] = orec;
ofsrec_num++;
}
}
isknjexist(knj, len)
u_char *knj;
int len;
{
int low, high, mid;
int i;
if (ofsrec_num <= 0) return 0;
low = 0; high = ofsrec_num - 1;
while (low <= high) {
mid = (low + high) / 2;
i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, knj, len);
if (i > 0)
high = mid - 1;
else if (i < 0)
low = ++mid;
else
return ofsrec[mid] -> offset;
}
return 0;
}
clear_ofsrec()
{
int i;
for (i = 0 ; i < ofsrec_num ; i++) {
Free(ofsrec[i] -> kptr);
Free(ofsrec[i]);
}
ofsrec_num = 0;
}
OffsetRec *real_ofsrec(ptr)
u_char *ptr;
{
int ofs;
int i;
OffsetRec **p;
ofs = (*ptr++ & KnjAssyukuMask);
ofs <<= 8;
ofs += *ptr;
for (i = ofsrec_num, p = ofsrec ; i-- > 0 ; p++)
if ((*p) -> offset == ofs)
return *p;
fprintf(stderr, "real_ofsrec() \244\307\260\333\276\357\244\312\276\365\302\326 %x\n", ofs);
exit(1);
}

272
dict/tool/readline.c Normal file
View file

@ -0,0 +1,272 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: readline.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:44 $
*/
#include <stdio.h>
#include "sj_euc.h"
#include "sj_const.h"
#include "sj_macro.h"
static long lineloc;
static int yomi[MaxYomiLength + 1];
static int kanji[MaxKanjiLength + 1];
static int hinsi[MaxHinsiNumber + 1];
static int atr[MaxAtrNumber + 1];
static error(s)
char *s;
{
register int c;
if (s) fprintf(stderr, "%s\n", s);
mark_file(stderr);
exit(1);
}
static readchar()
{
register int c1;
register int c2;
c1 = getch(); if (c1 == EOF) return EOF;
if (c1 != SS3) {
if (c1 & 0x80) {
c2 = getch(); if (c2 == EOF) error(NULL);
c1 = ((c1 & 0xff) << 8) + (c2 & 0xff);
}
} else {
c2 = getch(); if (c2 == EOF) error(NULL);
c1 = ((c1 & 0xff) << 8) + (c2 & 0xff);
c2 = getch(); if (c2 == EOF) error(NULL);
c1 = ((c1 & 0xffff) << 8) + (c2 & 0xff);
}
return c1;
}
static skip_blank()
{
register int c;
c = readchar();
while (Isblank(c)) c = readchar();
return c;
}
static readhinsi()
{
static int c = 0;
register int i;
unsigned char hinsi[128];
int flg;
retry:
if (c == '\n') {
c = 0;
return 0;
}
c = skip_blank();
if (c == '\n') {
c = 0;
return 0;
}
for (i = 0 ; !Isblank(c) ; ) {
if (c == '\n' || c == ':') break;
if (Isillegal(c)) error(IllegalFormat);
if (c > 0xffffff) {
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 24) & 0xff);
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 16) & 0xff);
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 8) & 0xff);
} else if (c > 0xffff) {
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 16) & 0xff);
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 8) & 0xff);
} else if (c > 0xff) {
if (i >= 126) error(TooLongHinsi);
hinsi[i++] = ((c >> 8) & 0xff);
}
if (i >= 127) error(TooLongHinsi);
hinsi[i++] = (c & 0xff);
c = readchar();
}
if (i == 0) return 0;
if (hinsi[0] == '[' && hinsi[i - 1] == ']') {
hinsi[i - 1] = 0;
i = cnvhinsi(hinsi + 1);
if (i > 0) {
fprintf(stderr, "\311\312\273\354 \"%s\" \244\313\263\347\270\314\244\254\244\304\244\244\244\306\244\244\244\353\n",
hinsi + 1);
}
else if (!i) {
fprintf(stderr, "\"%s\" \244\254\245\263\241\274\245\311\262\275\244\307\244\255\244\336\244\273\244\363\n",
hinsi + 1);
goto retry;
}
}
else {
hinsi[i] = 0;
i = cnvhinsi(hinsi);
if (!i) {
fprintf(stderr, "\"%s\" \244\254\245\263\241\274\245\311\262\275\244\307\244\255\244\336\244\273\244\363\n", hinsi);
goto retry;
}
}
return i;
}
int *readline()
{
register int c;
register int i;
register int j;
for ( ; ; ) {
mark_file(NULL);
c = skip_blank();
if (c == '#') {
while (c != '\n') c = skip_blank();
}
if (c == EOF) return NULL;
if (c != '\n') break;
}
for (i = 0 ; !Isblank(c) ; ) {
if (Isillegal(c)) error(IllegalFormat);
if (i >= MaxYomiLength) error(TooLongYomi);
yomi[i++] = c;
c = readchar();
}
yomi[i] = 0;
if (i == 0) error(NoYomiString);
c = skip_blank();
if (c != '"') {
for (i = 0 ; !Isblank(c) ; ) {
if (Isillegal(c)) error(IllegalFormat);
if (i >= MaxKanjiLength) error(TooLongKanji);
kanji[i++] = c;
c = readchar();
}
}
else {
c = readchar();
for (i = 0 ; c != '"' ; ) {
if (Isillegal(c)) error(IllegalFormat);
if (i >= MaxKanjiLength) error(TooLongKanji);
kanji[i++] = c;
c = readchar();
}
}
kanji[i] = 0;
if (i == 0) error(NoKanjiString);
i = j = 0;
while (c = readhinsi()) {
if (c < 0) {
if (i >= MaxAtrNumber) error(TooManyAtr);
atr[i++] = -c;
}
else {
if (j >= MaxHinsiNumber) error(TooManyHinsi);
hinsi[j++] = c;
}
}
atr[i] = 0;
if (j == 0) hinsi[j++] = HinsiTankan;
hinsi[j] = 0;
return yomi;
}
setline(func)
int (*func)();
{
register int i;
for (i = 0 ; hinsi[i] ; i++) (*func)(yomi, kanji, hinsi[i], atr);
}

232
dict/tool/string.c Normal file
View file

@ -0,0 +1,232 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: string.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:45 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_const.h"
bubun_str(p1, l1, p2, l2)
u_char *p1;
int l1;
u_char *p2;
int l2;
{
register u_char *p;
register int l;
register int i;
for (p = p1, l = l1 ; l > 0 ; ) {
if (l < l2) break;
for (i = 0 ; i < l2 ; i++)
if (*(p + i) != *(p2 + i)) break;
if (i >= l2) return 1;
i = codesize(*p);
p += i;
l -= i;
}
for (p = p2, l = l2 ; l > 0 ; ) {
if (l < l1) break;
for (i = 0 ; i < l1 ; i++) if (*(p + i) != *(p1 + i)) break;
if (i >= l1) return -1;
i = codesize(*p);
p += i;
l -= i;
}
return 0;
}
overlap_str(p1, l1, p2, l2)
u_char *p1;
u_char *p2;
int l1;
int l2;
{
register u_char *p;
register int l;
register int i;
register int j;
u_char tmp[MaxKanjiLength * 2 + MaxAtrNumber * 2];
for (p = p1, l = l1 ; l > 0 ; ) {
if (l < l2) {
for (i = 0 ; (i < l) && (*(p + i) == *(p2 + i)) ; i++) ;
if ((i >= l) && (l2 + l1 - l < sizeof(tmp))) {
for (i = 0 ; i < l1 ; i++)
tmp[i] = *(p1 + i);
for (j = l ; j < l2 ; i++, j++)
tmp[i] = *(p2 + j);
if (check_hindo(tmp, i)) {
return -1;
}
}
}
i = codesize(*p);
p += i;
l -= i;
}
for (p = p2, l = l2 ; l > 0 ; ) {
if (l < l1) {
for (i = 0 ; (i < l) && (*(p + i) == *(p1 + i)) ; i++) ;
if ((i >= l) && (l1 + l2 - l < sizeof(tmp))) {
for (i = 0 ; i < l2 ; i++)
tmp[i] = *(p2 + i);
for (j = l ; j < l1 ; i++, j++)
tmp[i] = *(p1 + j);
if (check_hindo(tmp, i)) {
return -1;
}
}
}
i = codesize(*p);
p += i;
l -= i;
}
return 0;
}
istrlen(s)
int *s;
{
register int *p;
for (p = s ; *p ; p++) ;
return(p - s);
}
istrcmp(s, d)
register int *s;
register int *d;
{
for ( ; *s && (*s == *d) ; s++, d++) ;
return (*s - *d);
}
top_strcmp(src, dst)
register int *src;
register int *dst;
{
register int i = 0;
for (i = 0 ; *src && (*src == *dst) ; src++, dst++)
i++;
return (i > MaxYomiAskNumber) ? MaxYomiAskNumber : i;
}
last_strcmp(src, dst)
int *src;
int *dst;
{
int slen, dlen;
slen = istrlen(src);
dlen = istrlen(dst);
if (dlen > MaxYomiAskNumber)
return 0;
if (istrcmp(src + (slen - dlen), dst))
return 0;
return dlen;
}
string_cmp(p1, l1, p2, l2)
register u_char *p1;
register u_char *p2;
register int l1;
register int l2;
{
while (l1 > 0 && l2 > 0) {
if (*p1 != *p2) return (*p1 - *p2);
p1++; l1--;
p2++; l2--;
}
if (l1 == l2) return 0;
if (l1 > l2) return 1;
return -1;
}

46
doc/Imakefile Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 1997 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1997/01/23 11:20:51 $
*/
/*
* Add make rules to install manpages and other documents.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = doc man
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

49
doc/doc/Imakefile Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 1997 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1997/01/23 11:20:51 $
*/
#include "../../sj3.tmpl"
/*
* Add make rules to install other documents.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
CONFDIR = $(SJ3CONFDIR)
DOCLIST = Nihongo.ps.Z hinsi.ms makedict.ms sj3lib.ms sj3serv.ms
all::
depend::
InstallMultiple($(DOCLIST),$(CONFDIR))

BIN
doc/doc/Nihongo.ps.Z Normal file

Binary file not shown.

489
doc/doc/hinsi.ms Normal file
View file

@ -0,0 +1,489 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"
.\"$SonyRCSfile: hinsi.ms,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:46 $
.\"
.TL
\fBsj3serv\fP で使用される品詞
.RS
.LP
ここでは \fBsj3serv\fP で使用している品詞分けについて説明します。
.RE
.SH
**注意点**
.RS
.SH
上一段・下一段動詞の扱い
.RS
例えば、カ行上一段動詞 "起きる" の場合、
.RS
語幹は     "お"
.br
活用語尾は   "き、きる、きれ、きろ、きよ"
.RE
となります。
.br
活用語尾の1字目に注目すると、いずれの活用形においても共通なので、
便宜的に "おき" までを語幹として扱うことにします。
これによって "行" 及び "上下"の区別は必要なくなり、
ただ "一段動詞" だけの分類分けで済ませています。
.RE
.RE
.NH
名詞
.RS
.LP
固有名詞を除いた名詞です。
.br
これらは複合名詞を作りやすいか否かによって2つに分けられます。
.br
複合名詞を作りやすいか否かは、主観によって判断しています。
.RE
.NH 2
複合名詞を作りやすい名詞
.RS
.IP 名1(MEISI_1) \w'            'u
他の分類に含まれない、複合名詞を作りやすい名詞
.IP 名2(MEISI_2)
接頭語 "お"
.IP 名3(MEISI_3)
接頭語 "ご"
.IP 名4(MEISI_4)
接尾語 "的" "化" のどちらか
.IP 名5(MEISI_5)
名詞+サ変動詞、接頭語 "お"
.IP 名6(MEISI_6)
名詞+サ変動詞
.IP 名7(MEISI_7)
名詞+サ変動詞、接頭語 "ご"
.IP 名8(MEISI_8)
名詞+形容動詞
.IP 名9(MEISI_9)
名詞+形容動詞、接頭語 "お"
.IP 名10(MEISI_10)
名詞+形容動詞、接頭語 "ご"
.IP 名11(MEISI_11)
名詞+副詞
.RE
.RE
.NH 2
複合名詞を作りにくい名詞
.RS
.IP 代1(D_MEISI_1) \w'            'u
他の分類に含まれない、複合名詞を作りにくい名詞
.IP 代2(D_MEISI_2)
接尾語 "さん"
.IP 代3(D_MEISI_3)
"~をする"
.IP 代4(D_MEISI_4)
名詞+サ変動詞
.IP 代5(D_MEISI_5)
名詞+形容動詞
.IP 代6(D_MEISI_6)
名詞+副詞
.RE
.RE
.NH
固有名詞
.RS
.IP 苗字(MYOUJI) \w'            'u
人名の姓
.IP 名前(NAMAE)
人名の名
.IP 企業(KIGYOU)
企業名
.IP 地名(TIMEI)
都道府県・区郡・市町村 および主要都市の駅名
.IP 県区(KEN_KU)
都道府県・区の・・県(都,府,区)付き
.RE
.RE
.NH
その他体言
.RS
.IP 連体(RENTAISI) \w'            'u
連体詞
.IP 接続(SETUZOKU)
接続詞
.IP 感動(KANDOUSI)
感動詞
.IP 助数(JOSUUSI1)
"第~" が接続できる
.IP 助数2(JOSUUSI2)
"第~”が接続できない
.IP 数詞(SUUSI)
数詞
.RE
.RE
.NH
接頭語
.RS
.IP 接頭1(SETTOU_1) \w'            'u
名詞(サ変名詞・刑動名詞含む)に接続
.IP 接頭2(SETTOU_2)
地名に接続(北、南、西、東 等)
.IP 接頭3(SETTOU_3)
人名に接続(故 など)
.IP 接頭4(SETTOU_4)
数詞に接続(第、計 等)
.IP 接頭5(SETTOU_5)
接頭1 より接続が強い
.RE
.RE
.NH
接尾語
.RS
.IP 接尾1(SETUBI_1) \w'            'u
名詞に接続、名詞扱い
.IP 接尾2(SETUBI_2)
名詞に接続、名詞扱い。ただし連濁形
.IP 接尾3(SETUBI_3)
接尾1 より接続が強い
.IP 接尾4(SETUBI_4)
地名に接続、名詞扱い
.IP 接尾5(SETUBI_5)
名詞に接続、形容詞扱い
.IP 接尾6(SETUBI_6)
名詞に接続、形容動詞扱い
.IP 接尾7(SETUBI_7)
名詞に接続、サ変名詞扱い
.IP 接尾8(SETUBI_8)
名詞に接続、一段動詞扱い
.IP 接尾9(SETUBI_9)
接尾語+副詞
.RE
.RE
.NH
副詞
.RS
.IP 副1(FUKUSI_1) \w'            'u
接続なし
.IP 副2(FUKUSI_2)
"~と" 接続
.IP 副3(FUKUSI_3)
"~と", サ変動詞語尾が接続
.IP 副4(FUKUSI_4)
サ変動詞語尾が接続
.IP 副5(FUKUSI_5)
"~に" 接続
.IP 副6(FUKUSI_6)
"~も" 接続
.IP 副7(FUKUSI_7)
"~の" 接続
.IP 副8(FUKUSI_8)
"~と", "~です、~だ" 接続
.IP 副9(FUKUSI_9)
"~と", サ変動詞語尾, "~です、~だ" 接続
.RE
.RE
.NH
形容詞
.RS
.RS
.DS
[さ]  "さ" が接続して名詞化する
[げ]  "げ" が接続して形容動詞化する
[め]  "め" が接続して形容動詞化する
[み]  "み" が接続して名詞化する
[がる] "がる" が接続して動詞化する
.DE
.RE
.sp
.IP 形1(KEIYOUSI_1) \w'            'u
上記付属語接続なし
.IP 形2(KEIYOUSI_2)
[さ]
.IP 形3(KEIYOUSI_3)
[さ、げ]
.IP 形4(KEIYOUSI_4)
[さ、がる]
.IP 形5(KEIYOUSI_5)
[さ、げ、がる]
.IP 形6(KEIYOUSI_6)
[さ、め、げ]
.IP 形7(KEIYOUSI_7)
[さ、め、げ、がる]
.IP 形8(KEIYOUSI_8)
[さ、み、め、げ、がる]
.IP 形9(KEIYOUSI_9)
接頭語 "お", [さ、げ、がる]
.IP 形10(KEIYOUSI_10)
接頭語 "お", [さ、め、げ、がる]
.IP 形11(KEIYOUSI_11)
[さ、み、め]
.RE
.RE
.NH
形容動詞
.RS
.IP 形動1(KE_DOUSI_1) \w'            'u
ダ活用
.IP 形動2(KE_DOUSI_2)
タリ活用
.IP 形動3(KE_DOUSI_3)
ダ活用、語幹で連体修飾
.IP 形動4(KE_DOUSI_4)
ダ活用、"~さ"
.IP 形動5(KE_DOUSI_5)
ダ活用、"~さ"、語幹で連体修飾
.IP 形動6(KE_DOUSI_6)
ダ活用、接頭語 "お" が接続
.IP 形動7(KE_DOUSI_7)
ダ活用、"~さ"、接頭語 "お" が接続
.IP 形動8(KE_DOUSI_8)
ダ活用、接頭語 "ご" が接続
.IP 形動9(KE_DOUSI_9)
ダ活用、"~の"
.RE
.RE
.NH
動詞
.RS
.IP サ変(DO_SAHEN) \w'            'u
サ変動詞、連用名詞扱いできない
.IP ザ変(DO_ZAHEN)
ザ変動詞。連用名詞扱いできない
.IP 一段1(DO_1DAN_1) \w'            'u
連用名詞扱いできない
.IP 一段2(DO_1DAN_2)
連用名詞扱いできない、接頭語 "お"
.IP 一段3(DO_1DAN_3)
連用名詞扱いできる
.IP 一段4(DO_1DAN_4)
連用名詞扱いできる、接頭語 "お"
.IP カ五1(DO_KAGO_1) \w'            'u
連用名詞扱いできない、
.IP カ五2(DO_KAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP カ五3(DO_KAGO_3)
連用名詞扱いできる
.IP カ五4(DO_KAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP カ五5(DO_KAGO_5)
連用名詞扱いできない、[け、ける、けれ]
.IP カ五6(DO_KAGO_6)
連用名詞扱いできない、[け、ける、けれ]、接頭語 "お"
.IP カ五7(DO_KAGO_7)
連用名詞扱いできる、[け、ける、けれ]
.IP カ五8(DO_KAGO_8)
連用名詞扱いできる、[け、ける、けれ]、接頭語 "お"
.IP ガ五1(DO_GAGO_1) \w'            'u
連用名詞扱いできない
.IP ガ五2(DO_GAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP ガ五3(DO_GAGO_3)
連用名詞扱いできる
.IP ガ五4(DO_GAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP ガ五5(DO_GAGO_5)
連用名詞扱いできない、[げ、げる、げれ]
.IP ガ五6(DO_GAGO_6)
連用名詞扱いできない、[げ、げる、げれ]、接頭語 "お"
.IP ガ五7(DO_GAGO_7)
連用名詞扱いできる、[げ、げる、げれ]
.IP ガ五8(DO_GAGO_8)
連用名詞扱いできる、[げ、げる、げれ]、接頭語 "お"
.IP サ五1(DO_SAGO_1) \w'            'u
連用名詞扱いできない
.IP サ五2(DO_SAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP サ五3(DO_SAGO_3)
連用名詞扱いできる
.IP サ五4(DO_SAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP サ五5(DO_SAGO_5)
連用名詞扱いできない、[せ、せる、せれ]
.IP サ五6(DO_SAGO_6)
連用名詞扱いできない、[せ、せる、せれ]、接頭語 "お"
.IP サ五7(DO_SAGO_7)
連用名詞扱いできる、[せ、せる、せれ]
.IP サ五8(DO_SAGO_8)
連用名詞扱いできる、[せ、せる、せれ]、接頭語 "お"
.IP タ五1(DO_TAGO_1) \w'            'u
連用名詞扱いできない
.IP タ五2(DO_TAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP タ五3(DO_TAGO_3)
連用名詞扱いできる
.IP タ五4(DO_TAGO_4)
連用名詞扱いできる、接頭語"お"
.IP タ五5(DO_TAGO_5)
連用名詞扱いできない、[て、てる、てれ]
.IP タ五6(DO_TAGO_6)
連用名詞扱いできない、[て、てる、てれ]、接頭語 "お"
.IP タ五7(DO_TAGO_7)
連用名詞扱いできる、[て、てる、てれ]
.IP タ五8(DO_TAGO_8)
連用名詞扱いできる、[て、てる、てれ]、接頭語 "お"
.IP ナ五(DO_NAGO) \w'            'u
連用名詞扱いできない
.IP バ五1(DO_BAGO_1) \w'            'u
連用名詞扱いできない
.IP バ五2(DO_BAGO_2)
連用名詞扱いできない、"お"
.IP バ五3(DO_BAGO_3)
連用名詞扱いできる
.IP バ五4(DO_BAGO_4)
連用名詞扱いできる、"お"
.IP バ五5(DO_BAGO_5)
連用名詞扱いできない、[べ、べる、べれ]
.IP バ五6(DO_BAGO_6)
連用名詞扱いできない、[べ、べる、べれ]、接頭語 "お"
.IP バ五7(DO_BAGO_7)
連用名詞扱いできる、[べ、べる、べれ]
.IP バ五8(DO_BAGO_8)
連用名詞扱いできる、[べ、べる、べれ]、接頭語 "お"
.IP マ五1(DO_MAGO_1) \w'            'u
連用名詞扱いできない、
.IP マ五2(DO_MAGO_2)
連用名詞扱いできない、"お"
.IP マ五3(DO_MAGO_3)
連用名詞扱いできる
.IP マ五4(DO_MAGO_4)
連用名詞扱いできる、"お"
.IP マ五5(DO_MAGO_5)
連用名詞扱いできない、[め、める、めれ]
.IP マ五6(DO_MAGO_6)
連用名詞扱いできない、[め、める、めれ]、接頭語 "お"
.IP マ五7(DO_MAGO_7)
連用名詞扱いできる、[め、める、めれ]
.IP マ五8(DO_MAGO_8)
連用名詞扱いできる、[め、める、めれ]、接頭語 "お"
.IP ラ五1(DO_RAGO_1) \w'            'u
連用名詞扱いできない
.IP ラ五2(DO_RAGO_2)
連用名詞扱いできない、"お"
.IP ラ五3(DO_RAGO_3)
連用名詞扱いできる
.IP ラ五4(DO_RAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP ラ五5(DO_RAGO_5)
連用名詞扱いできない、[れ、れる、れれ]
.IP ラ五6(DO_RAGO_6)
連用名詞扱いできない、[れ、れる、れれ]、接頭語 "お"
.IP ラ五7(DO_RAGO_7)
連用名詞扱いできる、[れ、れる、れれ]
.IP ラ五8(DO_RAGO_8)
連用名詞扱いできる、[れ、れる、れれ]、接頭語 "お"
.IP ワ五1(DO_WAGO_1) \w'            'u
連用名詞扱いできない
.IP ワ五2(DO_WAGO_1)
連用名詞扱いできない、"お"
.IP ワ五3(DO_WAGO_1)
連用名詞扱いできる
.IP ワ五4(DO_WAGO_1)
連用名詞扱いできる、接頭語 "お"
.IP ワ五5(DO_WAGO_1)
連用名詞扱いできない、[え、える、えれ]
.IP ワ五6(DO_WAGO_1)
連用名詞扱いできない、[え、える、えれ]、接頭語 "お"
.IP ワ五7(DO_WAGO_1)
連用名詞扱いできる、[え、える、えれ]
.IP ワ五8(DO_WAGO_1)
連用名詞扱いできる、[え、える、えれ]、接頭語 "お"
.RE
.RE
.NH
特殊品詞
.RS
分類不可能な語、特殊な活用をする語句など
.sp
.IP 単漢(TANKANJI) \w'            'u
単漢字
.sp
.IP サ変未1(SP_SA_MI1) \w'            'u
さ
.IP サ変未2(SP_SA_MI2)
せ
.IP サ変未用(SP_SA_YOU)
し
.IP サ変終体(SP_SA_SYU)
する
.IP サ変仮(SP_SA_KAT)
すれ
.IP サ変命1(SP_SA_ME1)
しろ
.IP サ変命2(SP_SA_ME2)
せよ
.sp
.IP カ変未(SP_KA_MIZ)
こ
.IP カ変用(SP_KA_YOU)
き
.IP カ変終体(SP_KA_SYU)
くる
.IP カ変仮(SP_KA_KAT)
くれ
.IP カ変命(SP_KA_ME1)
こい
.sp
.IP 丁寧1(TEINEI1)
いらっしゃい、おっしゃい、ください、なさい
.IP 丁寧2(TEINEI2)
ござい
.sp
.IP カ五音便(SP_KA_ONB)
いっ
.sp
.IP 特殊副(SP_FUKUSI)
こう、そう、どう
.sp
.IP 挨拶(AISATU)
ありがとう、おめでとう、おはよう
.sp
.IP 特殊形容(SP_KEIYOUSI)
いい
.sp
.IP 一括(IKKATU) \w'            'u
文節変換では参照されない語。"関連辞書" で関連を定義するために存在する語。
.RE
.RE

91
doc/doc/makedict.ms Normal file
View file

@ -0,0 +1,91 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"
.\"$SonyRCSfile: makedict.ms,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:47 $
.\"
.TL
辑今栏喇ツ〖ル makedict
.RS
.LP
\fBmakedict\fP は、簿叹戳机恃垂サ〖バ \fBsj3serv\fP で蝗脱する辑今を
侯喇するためのツ〖ルです。
.sp
このツ〖ルを蝗脱することにより、エディタで试礁された辑今を \fBsj3serv\fP で
蝗脱材墙な妨轮に恃垂することが叫丸ます。
.sp
试礁材墙ファイルは、笆布のような妨及をしています。
.RS
.DS
あ           啊           儡片1:
あ           倡           カ皋2:
あ           鄂           カ皋4:
あ           汤           カ皋2:
あ           税           カ皋3:
            ¨
.DE
.RE
それぞれのフィ〖ルドは笆布の罢蹋を积ちます。
.RS
.DS
妈1フィ〖ルド  粕み∈链逞ひらがな∷
妈2フィ〖ルド  誊弄の叫蜗
妈3フィ〖ルド  墒混の事び
.DE
.RE
ここで称フィ〖ルド粗は、1つ笆惧のスペ〖スあるいはタブで惰磊られている
涩妥があります。また称乖は、粕みでソ〖トされていなければなりません。
.sp
妈3フィ〖ルド∈墒混のフィ〖ルド∷には、侍绘で年盗されている墒混を淡揭します。
.sp
1つの较胳にたいして剩眶の墒混を回年するときには、笆布のようにします。
.RS
.DS
あい          唉           洛4:サ皋5:
あえ          あえ          ガ皋3:办檬1:
あお          滥           洛1:妨11:
            ¨
.DE
.RE
なおこの辑今では、挛咐∈叹混ˇ甥混ˇ息挛混など润宠脱のもの∷については
较胳そのままを、脱咐∈瓢混ˇ妨推混ˇ妨推瓢混など宠脱するもの∷に
簇しては胳创のみを判峡しなければなりません。
.sp
このような试礁材墙ファイルから \fBsj3serv\fP で蝗脱材墙な辑今を栏喇するには、
\fBmakedict\fP を蝗脱して笆布のようにします。
.RS
.DS
makedict \fIsrc_file_name\fP \fIdst_file_name\fP
.DE
.RE
エラ〖がなく悸乖が姜位したときには、\fIsrc_file_name\fP で回年された
试礁材墙ファイルが恃垂され、\fIdst_file_name\fP で回年されたファイルに
呈羌されています。
.RE

619
doc/doc/sj3lib.ms Normal file
View file

@ -0,0 +1,619 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"Modifier: Nobuyuki Tanaka, Sony Corporation
.\"
.\"$SonyRCSfile: sj3lib.ms,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:48 $
.\"
.TL
sj3lib ライブラリ
.AB
.LP
\fBsj3lib\fP は、ソニー(株)で開発された仮名漢字変換サーバ \fIsj3serv\fP と
通信し仮名漢字変換を行う、クライアント用ライブラリです。
.sp
アプリケーションプログラムは、\fBsj3lib\fP を使用することにより
\& \fIsj3serv\fP を使用した仮名漢字変換を行うことが可能となります。
.AE
.SH
はじめに
.RS
.IP ・
\fBsj3lib\fP では、関数や変数に sj3_ で始まる名前を使用していますので、
sj3_ で始まる関数名、変数名の使用はお避けください。
.IP ・
\fBsj3lib\fP で扱う文字コードは、関数名の最後に "_euc" がついているときは、
EUC です。"_mb" がついている場合は、引数の文字コードがプログラム実行時の
ロケールに依存します。なにも付いてないときには、引数の文字コードにシフト
JIS を使用します。
.IP ・
メイン辞書、ユーザ辞書、学習ファイルは、接続するサーバの動作しているマシン上のものが使用されます。
.br
これらのファイルは、デフォルトではディレクトリ \fB/usr/dict/sj3\fP の下におかれますが、サーバのセットアップファイルにより変更が可能です。
.IP ・
ユーザ辞書と学習ファイルは、関数 sj3_open で指定されたユーザ名を USER と
すれば、\fBuser/USER/private.dic\fP と \fBuser/USER/study.dat\fP です。
.RE
.NH
サーバの使用開始
.RS
.LP
.DS
sj3_open(hname, uname)
char *hname; /* ホスト名へのポインタ */
char *uname; /* ユーザ名へのポインタ */
.DE
.sp
文字列へのポインタ \fBhname\fP で指定されたホスト上のサーバ \fIsj3serv\fP に
対し、ユーザ名としてポインタ \fBuname\fP で指定される文字列を使用し、
接続を試みます。
.sp
接続には、ホスト名へのポインタ \fBhname\fP がナルポインタ、あるいは、
空の文字列または文字列 unix へのポインタの時には AF_UNIX ソケットを、
それ以外のときには AF_INET ソケットを使用します。
.sp
接続できたときには、サーバの立ち上げ時に指定された辞書ディレクトリ内にある
メイン辞書 sj3main.dic、ユーザ辞書 user/\fBuname\fP/private.dic、
学習ファイル user/\fBuname\fP/study.dat をオープンします。
.br
指定されたユーザ用のディレクトリ、ユーザ辞書、学習ファイルが
存在しないときには、それらの生成を試みます。
.sp
この関数は、かな漢字変換ルーチンを使用する以前に必ず呼ばなければなりません。
.sp
サーバと正常に接続できたときには 0 を、何かエラーのあったときには 0 以外の
エラーステータスを返します。
.sp
エラーステータスはヘッダファイル \fB/usr/include/sj3lib.h\fP で
定義されるビットアサインされた値で、詳細は以下のとおりです。
.sp
.IP "\fBSJ3_SERVER_DEAD\fP
接続処理中にサーバがダウンしました。
.IP "\fBSJ3_CONNECT_ERROR\fP
サーバがない、あるいは接続できません。
.IP "\fBSJ3_ALREADY_CONNECTED\fP
すでにサーバと接続済です。
.IP "\fBSJ3_CANNOT_OPEN_MDICT\fP
メイン辞書がオープンできません。
.IP "\fBSJ3_CANNOT_OPEN_UDICT\fP
ユーザ辞書がオープンできません。
.IP "\fBSJ3_CANNOT_OPEN_STUDY\fP
学習ファイルがオープンでいません。
.IP "\fBSJ3_CANNOT_MAKE_UDIR\fP
個人ファイルのためのディレクトリが作成できません。
.IP "\fBSJ3_CANNOT_MAKE_UDICT\fP
ユーザ辞書が作成できません。
.IP "\fBSJ3_CANNOT_MAKE_STUDY\fP
学習ファイルが作成できません。
.RE
.sp
エラーステータスには、これらのうち少なくとも 1 ビットが立っています。
.br
エラーステータスのうち \fBSJ3_SERVER_DEAD\fP あるいは \fBSJ3_CONNECT_ERROR\fP が
返されたとき以外は、サーバとの接続が確立されています。
.RE
.NH
サーバの使用終了
.RS
.LP
.DS
sj3_close()
.DE
.sp
\fIsj3_open\fP によって確立されたサーバとの接続を切り放します。
.br
メイン辞書、ユーザ辞書、学習ファイルのすべてがオープンされているものとして、
それらのクローズを試みます。
.sp
この関数は、かな漢字変換ルーチンの使用を終えるときに呼ばなければなりません。
.sp
サーバとの使用を正常に終了できたときには 0 を、
何かエラーのあったときには 0 以外のエラーステータスを返します。
.sp
エラーステータスはヘッダファイル \fB/usr/include/sj3lib.h\fP で
定義されるビットアサインされた値で、詳細は以下のとおりです。
.sp
.IP "\fBSJ3_SERVER_DEAD\fP
切り放し処理中にサーバがダウンしました。
.IP "\fBSJ3_DISCONNECT_ERROR\fP
サーバで内部エラーがありました。
.IP "\fBSJ3_NOT_CONNECTED\fP
サーバと接続されていません。
.IP "\fBSJ3_NOT_OPENED_MDICT\fP
メイン辞書がオープンされていません。
.IP "\fBSJ3_NOT_OPENED_UDICT\fP
ユーザ辞書がオープンされていません。
.IP "\fBSJ3_NOT_OPENED_STUDY\fP
学習ファイルがオープンされていません。
.IP "\fBSJ3_CLOSE_MDICT_ERROR\fP
メイン辞書がクローズできません。
.IP "\fBSJ3_CLOSE_UDICT_ERROR\fP
ユーザ辞書がクローズできません。
.IP "\fBSJ3_CLOSE_STUDY_ERROR\fP
学習ファイルがクローズできません。
.RE
.sp
エラーステータスには、これらのうち少なくとも 1 ビットが立っています。
.br
どのエラーステータスが返っても、サーバとの接続は切れています。
.RE
.NH
文章一括変換
.RS
.LP
.DS
sj3_getkan(yomi, bun, knjbuf, knjsiz)
sj3_getkan_euc(yomi, bun, knjbuf, knjsiz)
sj3_getkan_mb(yomi, bun, knjbuf, knjsiz)
unsigned char *yomi; /* 読み文字列へのポインタ */
struct bunsetu bun[]; /* 文節構造体へのポインタ */
unsigned char *knjbuf; /* 漢字文字列格納領域へのポインタ */
int knjsiz; /* 漢字文字列格納領域の大きさ */
.DE
.sp
与えられた読みを文章一括変換し、その結果を返します。
.br
ポインタ \fByomi\fP で指定された読み文字列をかな漢字変換し、
ポインタ \fBknjbuf\fP で示される大きさ \fBknjsiz\fP の領域に
変換結果の漢字文字列を、配列 \fBstruct bunsetu bun[]\fP に
各文節に関する情報をセットします。
.br
\fBstruct bunsetu\fP はヘッダファイル \fB/usr/include/sj3lib.h\fP で
宣言されている以下のような構造体です。
.sp
.RS
.DS
struct bunsetu {
int srclen; /* 読みの長さ */
int destlen; /* 漢字の長さ */
unsigned char *srcstr; /* 読みへのポインタ */
unsigned char *deststr; /* 漢字へのポインタ */
struct studyrec dcid; /* 学習のためのデータ */
};
.DE
.RE
.sp
読みが漢字文字列に変換できたときには、これらの要素はきちんと設定されますが、
ポインタ \fBknjbuf\fP で示される領域の大きさ \fBbufsiz\fP が小さいなどの
原因で漢字文字列を返せない文節が生じたときには、その読み文字列への
ポインタを \fBsrcstr\fP に、またその長さを \fBsrclen\fP に持ち、
\fBdestlen\fP が 0 で \fBdeststr\fP がナルポインタの構造体が生成されます。
.sp
読みとして与えられる文字列は、
シフト JIS または EUC の 2 バイトコードで構成されていることが原則ですが、
1 バイトコードが混じっていてもかまいません。
ただしその際には、1 バイトコードは漢字に変換されることはありません。
.br
読み文字列はナルで終了していなければならず、
最大でも 256 文字を越えてはなりません。
.br
配列 \fBstruct bunsetu bun[]\fP の実体は、ユーザプログラム側で
取らなければなりません。
その大きさは最大で読み文字数分必要となります。
.br
変換時に必要とされるポインタ \fBknjbuf\fP で示される領域の大きさは、
変換する文字数や登録されている単語の長さなどによって
変化します。最低でも 1024 バイト程度はあったほうが良いでしょう。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
読みがナル文字列だった、あるいは読みが長すぎたときには 0 が返されます。
.br
正常終了したときには、配列 \fBstruct sj3bunsetu bun[]\fP にセットされた
文節数が返されます。
.RE
.NH
同音意義語数の取得
.RS
.LP
.DS
sj3_douoncnt(yomi)
sj3_douoncnt_euc(yomi)
sj3_douoncnt_mb(yomi)
unsigned char *yomi; /* 読み文字列へのポインタ */
.DE
.sp
与えられた読みを文節変換し、リターン値として同音意義語数を返します。
.sp
ポインタ \fByomi\fP によって読みとして与えられる文字列は、
シフト JIS または EUC の 2 バイトコードで構成されていることが原則ですが、
1 バイトコードが混じっていてもかまいません。
ただしその際には、1 バイトコードは漢字に変換されることはありません。
.br
読み文字列はナルで終了していなければならず、
最大でも 64 文字を越えてはなりません。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
読みがナル文字列だった、あるいは読みが長すぎた、または与えられた
読みで 1 文節が構成されなかったときには 0 が返されます。
.br
正常終了したときには同音語数が返されます。
.RE
.NH
同音意義語の取得
.RS
.LP
.DS
sj3_getdouon(yomi, dou)
sj3_getdouon_euc(yomi, dou)
sj3_getdouon_mb(yomi, dou)
unsigned char *yomi; /* 読み文字列へのポインタ */
struct douon *dou; /* 同音意義語構造体へのポインタ */
.DE
.sp
与えられた読みを文節変換し、同音意義語を与えられた構造体にセットす
るとともに、リターン値として同音意義語数を返します。
.sp
ポインタ \fByomi\fP によって読みとして与えられる文字列は、
シフト JIS または EUC の 2 バイトコードで構成されていることが原則ですが、
1 バイトコードが混じっていてもかまいません。
ただしその際には、1 バイトコードは漢字に変換されることはありません。
.br
読み文字列はナルで終了していなければならず、
最大でも 64 文字を越えてはなりません。
.sp
配列 \fBstruct douon dou[]\fP には同音意義語に関する情報がセットされます。
構造体 \fBstruct douon\fP は \fBsj3lib.h\fP で宣言されている
以下のような構造体です。
.sp
.RS
.DS
struct douon {
unsigned char ddata[512]; /* 同音意義語のデータ */
int dlen; /* 同音意義語の長さ */
struct studyrec dcid; /* 学習のためのデータ */
};
.DE
.RE
.sp
配列 \fBstruct douon dou[]\fP の実体はユーザプログラム側で
取らなければなりません。
.sp
構造体 \fBstruct douon\fP の \fBddata\fP は、ナルで終了する文字列です。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
読みがナル文字列だった、あるいは読みが長すぎた、または与えられた
読みで 1 文節が構成されなかったときには 0 が返されます。
.br
正常終了したときには、配列 \fBstruct douon dou[]\fP に
セットされた同音語数が返されます。
.RE
.NH
文節学習
.RS
.LP
.DS
sj_gakusyuu(dcid)
struct studyrec *dcid; /* 学習データへのポインタ */
.DE
.sp
学習データへのポインタ \fBdcid\fP の示す、
\fIsj3_getkan\fP や \fIsj_getdouon\fP により得られた学習データ
を使用して、文節学習を行います。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
正常に学習できたときには 0 が、学習できなかったときにはそれ以外の値が
返されます。
.RE
.NH
文節長学習
.RS
.LP
.DS
sj_gakusyuu2(yomi1, yomi2, dcid)
sj_gakusyuu2_euc(yomi1, yomi2, dcid)
sj_gakusyuu2_mb(yomi1, yomi2, dcid)
unsigned char *yomi1; /* 第1文節の読み文字列へのポインタ */
unsigned char *yomi2; /* 第2文節の読み文字列へのポインタ */
struct studyrec *dcid; /* 第2文節の学習データへのポインタ */
.DE
.sp
文節長学習を行います。
.sp
1文節として変換された文字列が2文節に分けられたような場合、
あるいは2文節の間でその境界が変更されたようなときには、
\fByomi1\fP に新たな第1文節の読みへのポインタを、
\fByomi2\fP に新たな第2文節の読みへのポインタを、
\fBdcid\fP に新たな第2文節の学習データを与えることにより、
文節長学習を行います。
.sp
2文節として変換された文字列が1文節になった場合には、
\fByomi1\fP に新たにできた1文節の読みへのポインタを、
\fByomi2\fP にはナルポインタまたはナル文字列へのポインタを与えることにより、
文節長学習を行います。このとき、\fBdcid\fP には設定すべきデータは
特にありません。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
正常に学習できたときには 0 が、学習できなかったときにはそれ以外の値が
返されます。
.RE
.NH
単語登録
.RS
.LP
.DS
sj3_touroku(yomi, kanji, hinsi)
sj3_touroku_euc(yomi, kanji, hinsi)
sj3_touroku_mb(yomi, kanji, hinsi)
unsigned char *yomi; /* 読み文字列へのポインタ */
unsigned char *kanji; /* 漢字文字列へのポインタ */
int hinsi; /* 品詞コード */
.DE
.sp
読み文字列へのポインタ \fByomi\fP、
漢字文字列へのポインタ \fBkanji\fP、
品詞コード \fBhinsi\fP で指定された語をユーザ辞書に登録します。
.sp
読みは以下のシフト JIS または EUC コードで構成され、
かつナルで終了していなければなりません。
またその長さは、最大でも 31 文字を越えてはなりません。
.sp
.RS
.DS
ー#@〒
01234 56789
ABCDE FGHIJ KLMNO PQRST UVWXY Z
abcde fghij klmno pqrst uvwxy z
あいうえお かきくけこ さしすせそ たちつてと なにぬねの
はひふへほ まみむめも や ゆ よ らりるれろ わゐ ゑを ん
がぎぐげご ざじずぜぞ だぢづでど ばびぶべぼ ぱぴぷぺぽ
ぁぃぅぇぉ   っ   ゃ ゅ ょ ゎ
ヴヵヶ
.DE
.RE
.sp
ただし以下の文字は読みの先頭になることが出来ません。
.sp
.RS
.DS
ー を ぁぃぅぇぉ っ ゃゅょ ゎ ヵヶ
.DE
.RE
.sp
漢字はシフト JIS または EUC コードで構成され、かつナルで終了していなければ
なりません。
またその長さは、最大でも 32 文字を越えてはなりません。
.sp
品詞コードはヘッダファイル \fB/usr/include/sj3lib.h\fP で
定義される以下の品詞のうちの一つです。
.sp
.RS
.DS
SJ3_H_NRMNOUN 普通名詞 SJ3_H_ADJVERB 形容動詞
SJ3_H_PRONOUN 代名詞 SJ3_H_SILVERB サ変動詞
SJ3_H_LNAME 苗字 SJ3_H_ZILVERB ザ変動詞
SJ3_H_FNAME 名前 SJ3_H_ONEVERB 一段動詞
SJ3_H_LOCNAME 地名 SJ3_H_KAVERB カ行五段動詞
SJ3_H_PREFIC 県/区名 SJ3_H_GAVERB ガ行五段動詞
SJ3_H_RENTAI 連体詞 SJ3_H_SAVERB サ行五段動詞
SJ3_H_CONJUNC 接続詞 SJ3_H_TAVERB タ行五段動詞
SJ3_H_SUBNUM 助数詞 SJ3_H_NAVERB ナ行五段動詞
SJ3_H_NUMERAL 数詞 SJ3_H_BAVERB バ行五段動詞
SJ3_H_PREFIX 接頭語 SJ3_H_MAVERB マ行五段動詞
SJ3_H_POSTFIX 接尾語 SJ3_H_RAVERB ラ行五段動詞
SJ3_H_ADVERB 副詞 SJ3_H_WAVERB ワ行五段動詞
SJ3_H_ADJECT 形容詞 SJ3_H_SINGLE 単漢字
.DE
.RE
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
登録できたときには 0 が、登録できなかったときにはそれ以外の
エラーステータスが返されます。
.sp
エラーステータスはヘッダファイル \fB/usr/include/sj3lib.h\fP で
定義され、詳細は以下のとおりです。
.sp
.IP "\fBSJ3_DICT_ERROR\fP
辞書が存在しない、あるいは登録できない辞書です。
.IP "\fBSJ3_DICT_LOCKED\fP
辞書が読み出しのためにロックされています。
.IP "\fBSJ3_BAD_YOMI_STR\fP
読み文字列が不正です。
.IP "\fBSJ3_BAD_KANJI_STR\fP
漢字文字列が不正です。
.IP "\fBSJ3_BAD_HINSI_CODE\fP
品詞コードが不正です。
.IP "\fBSJ3_WORD_EXIST\fP
すでに登録済です。
.IP "\fBSJ3_DOUON_FULL\fP
これ以上同音語を登録できません。
.IP "\fBSJ3_DICT_FULL\fP
これ以上辞書に登録できません。
.IP "\fBSJ3_INDEX_FULL\fP
これ以上インデックスに登録できません。
.IP "\fBSJ3_TOUROKU_FAILED\fP
他の原因で辞書への登録を失敗しました。
.RE
.RE
.NH
単語削除
.RS
.LP
.DS
sj3_syoukyo(yomi, kanji, hinsi)
sj3_syoukyo_euc(yomi, kanji, hinsi)
sj3_syoukyo_mb(yomi, kanji, hinsi)
unsigned char *yomi; /* 読み文字列へのポインタ */
unsigned char *kanji; /* 漢字文字列へのポインタ */
int hinsi; /* 品詞コード */
.DE
.sp
ユーザ辞書に登録されている
読み文字列へのポインタ \fByomi\fP、
漢字文字列へのポインタ \fBkanji\fP、
品詞コード \fBhinsi\fP で指定された語を消去します。
.sp
読みは以下のシフト JIS または EUC コードで構成され、
かつナルで終了していなければなりません。
またその長さは、最大でも 31 文字を越えてはなりません。
.sp
.RS
.DS
ー#@〒
01234 56789
ABCDE FGHIJ KLMNO PQRST UVWXY Z
abcde fghij klmno pqrst uvwxy z
あいうえお かきくけこ さしすせそ たちつてと なにぬねの
はひふへほ まみむめも や ゆ よ らりるれろ わゐ ゑを ん
がぎぐげご ざじずぜぞ だぢづでど ばびぶべぼ ぱぴぷぺぽ
ぁぃぅぇぉ   っ   ゃ ゅ ょ ゎ
ヴヵヶ
.DE
.RE
.sp
ただし以下の文字は読みの先頭になることが出来ません。
.sp
.RS
.DS
ー を ぁぃぅぇぉ っ ゃゅょ ゎ ヵヶ
.DE
.RE
.sp
漢字はシフト JIS または EUC コードで構成され、かつナルで終了していなければ
なりません。
またその長さは、最大でも 32 文字を越えてはなりません。
.sp
品詞コードは \fB/usr/include/sj3lib.h\fP で定義される以下の品詞の
うちの一つです。
.sp
.RS
.DS
SJ3_H_NRMNOUN 普通名詞 SJ3_H_ADJVERB 形容動詞
SJ3_H_PRONOUN 代名詞 SJ3_H_SILVERB サ変動詞
SJ3_H_LNAME 苗字 SJ3_H_ZILVERB ザ変動詞
SJ3_H_FNAME 名前 SJ3_H_ONEVERB 一段動詞
SJ3_H_LOCNAME 地名 SJ3_H_KAVERB カ行五段動詞
SJ3_H_PREFIC 県/区名 SJ3_H_GAVERB ガ行五段動詞
SJ3_H_RENTAI 連体詞 SJ3_H_SAVERB サ行五段動詞
SJ3_H_CONJUNC 接続詞 SJ3_H_TAVERB タ行五段動詞
SJ3_H_SUBNUM 助数詞 SJ3_H_NAVERB ナ行五段動詞
SJ3_H_NUMERAL 数詞 SJ3_H_BAVERB バ行五段動詞
SJ3_H_PREFIX 接頭語 SJ3_H_MAVERB マ行五段動詞
SJ3_H_POSTFIX 接尾語 SJ3_H_RAVERB ラ行五段動詞
SJ3_H_ADVERB 副詞 SJ3_H_WAVERB ワ行五段動詞
SJ3_H_ADJECT 形容詞 SJ3_H_SINGLE 単漢字
.DE
.RE
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
削除できたときには 0 が、削除できなかったときにはそれ以外の
エラーステータスが返されます。
.sp
エラーステータスは \fB/usr/include/sj3lib.h\fP で定義され、
詳細は以下のとおりです。
.sp
.IP "\fBSJ3_DICT_ERROR\fP
辞書が存在しない、あるいは登録できない辞書です。
.IP "\fBSJ3_DICT_LOCKED\fP
辞書が読み出しのためにロックされています。
.IP "\fBSJ3_BAD_YOMI_STR\fP
読み文字列が不正です。
.IP "\fBSJ3_BAD_KANJI_STR\fP
漢字文字列が不正です。
.IP "\fBSJ3_BAD_HINSI_CODE\fP
品詞コードが不正です。
.IP "\fBSJ3_WORD_NOT_EXIST\fP
指定された語は登録されていません。
.IP "\fBSJ3_SYOUKYO_FAILED\fP
他の原因で辞書からの消去を失敗しました。
.RE
.RE
.NH
辞書のロック
.RS
.LP
.DS
sj3_lockserv()
.DE
.sp
現在オープンされている辞書に単語を登録/削除できないようにロックします。
.sp
学習IDは単語の辞書内での位置を示しています。このため、クライアントが
学習IDを保持している間に辞書登録/削除が行われると、クライアントの
保持している学習IDと辞書の間で不整合を起こす可能性があります。
それを避けるために、クライアントが学習IDを保持している間は辞書ファイルを
ロックする必要があります。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
ロックできたときには 0 が、
ロックできなかったときにはそれ以外の値が返されます。
.RE
.NH
辞書のアンロック
.RS
.LP
.DS
sj3_unlockserv()
.DE
.sp
sj3_lockserv 関数でロックされている辞書に単語を登録/削除できるように
アンロックします。
.sp
学習IDは単語の辞書内での位置を示しています。このため、クライアントが
学習IDを保持している間に辞書登録/削除が行われると、クライアントの
保持している学習IDと辞書の間で不整合を起こす可能性があります。
それを避けるために、クライアントが学習IDを保持している間は辞書ファイルを
ロックする必要があります。
.br
クライアントが辞書をロックしている間は、辞書登録/削除することができません。
クライアントは学習IDを保持する必要がなくなったときには、ただちに辞書を
アンロックするべきです。
.sp
サーバと接続されていないとき、あるいはサーバがダウンしたときには \-1 が
返されます。
.br
アンロックできたときには 0 が、
アンロックできなかったときにはそれ以外の値が返されます。
.RE

170
doc/doc/sj3serv.ms Normal file
View file

@ -0,0 +1,170 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"Modifier: Nobuyuki Tanaka, Sony Corporation
.\"
.\"$SonyRCSfile: sj3serv.ms,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:49 $
.\"
.TL
仮名漢字変換サーバ sj3serv
.SH
はじめに
.RS
\fBsj3serv\fP は、ソニー(株)で開発された仮名漢字変換サーバです。
.br
クライアントはこのサーバと通信することにより、仮名漢字変換を行うことが
可能となります。
.RE
.NH
使用するポート
.RS
.LP
sj3serv は \fB/etc/servives\fP のエントリ sj3serv を参照して、通信で使用する
ポート番号を取得します。
.RE
.NH
セットアップファイル
.NH 2
フォーマット
.RS
.LP
セットアップファイルの設定は、設定する機能毎のキーワードとその値により
行います。
キーワードと値、値と値の区切りにはスペースあるいはタブを使用します。
キーワードを構成するアルファベットは、大文字と小文字の区別を行いません。
.br
各行の '#' 以降はコメントとして無視されます。'#' をコメントの開始記号としないためには '\\' を先行させます。
.sp
.RS
.IP 例:
.DS
MaxClient 32 # 最大クライアント数
DictDir /var/dict/\e#dict
.DE
.RE
.RE
.RE
.sp
.NH 2
再設定可能な機能
.RS
.LP
セットアップファイルでは、以下の動作を指定できます。
.RE
.NH 3
最大クライアント数の設定
.RS
.LP
.RS
MaxClient \fInumber_of_client\fP
.RE
.sp
サーバーに接続してよいクライアントの数を10進数で指定します。
ただし、いくら大きな値を設定しても、64を越えるクライアントから
接続されることはありません。
また、システムで許される最大数を越えてファイルがオープンされることも
ありませんから、指定された最大数のクライアントが接続できないこともあります。
.br
デフォルトは64です。
.RE
.sp
.NH 3
辞書ディレクトリの設定
.RS
.LP
.RS
DictDir \fIdirectory_name\fP
.RE
.sp
辞書の存在するディレクトリを指定します。
.br
クライアントから指定される辞書ファイル名が\'/\'で始まるときには、
そのファイル名を絶対パスとして辞書にアクセスしますが、\'/\'以外のときには、
ここで指定されるディレクトリからの相対パスとして辞書にアクセスします。
.br
デフォルトは /usr/dict/sj3 です。
.RE
.sp
.NH 3
辞書の事前リード
.RS
.LP
.RS
ReadDict \fIdictionary_name\fP
.RE
.sp
サーバの立ち上がり時に読み込む辞書を指定します。
.br
巨大な辞書は事前に読み込んでおくことにより、クライアントの立ち上がる時間を短縮することが出来ます。
.br
事前に読み込んでおく辞書は、複数指定することが出来ますが、
1行で指定できるのは1つの辞書名です。
.br
デフォルトで読み込まれる辞書はありません。
.RE
.sp
.NH 3
エラー出力ファイルの指定
.RS
.LP
.RS
ErrorOut \fIerror_out_filename\fP
.RE
.sp
エラーやワーニングを出力するファイルを指定します。
.br
デフォルトは /dev/null です。
.RE
.sp
.NH 3
接続可能なユーザの指定
.RS
.LP
.RS
AllowUser \fIusername\fP \fIhostname\fP
.RE
.sp
サーバに接続できるユーザを制限します。
.br
この行を指定することにより、サーバに接続できるのはホスト \fIhostname\fP 上の
ユーザ \fIusername\fP だけに制限されます。
.br
\fIhostname\fP は省略できますが、その場合にはユーザ名が \fIusername\fP であれば
どのホストからでも無条件で接続できることになります。
\fIusername\fP、\fIhostname\fP を記述するときには、複数文字とマッチングする
\'*\'と1文字とマッチングする\'.\'を使うことが出来ます。
.br
AllowUser は複数行書くことが出来ます。
.br
デフォルトでは全てのユーザを許可しています。
.RE
.sp

58
doc/man/Imakefile Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright (c) 1997 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1997/01/23 11:20:52 $
*/
#include "../../sj3.tmpl"
/*
* Add make rules to install manpages.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#ifndef JapaneseManLocale
#define JapaneseManLocale ja_JP.EUC
#endif
JMANLOCALE = JapaneseManLocale
#ifndef JapaneseManDir
#define JapaneseManDir $(SJ3TOP)/man/$(JMANLOCALE)/man1
#endif
JMANDIR = JapaneseManDir
MANLIST = sj3.1 sj3dic.1 sj3mkdic.1 sj3serv.1
all::
depend::
InstallMultipleFlags($(MANLIST),$(JMANDIR),$(INSTMANFLAGS))

121
doc/man/sj3.1 Normal file
View file

@ -0,0 +1,121 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"$SonyRCSfile: sj3.1,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:50 $
.\"
.\" Japanese input frontend processor
.TH SJ3 1 "October 1990"
.SH 名称
sj3 \- 日本語入力フロントエンドプロセッサ
.SH 形式
.B sj3
[ \fB\-f\fP shell ] [ \fB\-h\fP ] [ \fB\-H\fP hostname ...] [ \fB\-L\fP ]
[ \fB-o\fP ] [ \fB\-e\fP program [ arguments ...]]
.SH 解説
.I sj3
は、仮名漢字変換サーバ
.IR " sj3serv" (1)
とソケットを使用したプロセス間通信により仮名漢字変換を
行う日本語入力フロントエンドプロセッサです。
.PP
.I sj3
はターミナル上で起動し、ターミナルから入力されたローマ字もしくは
半角カタカナを仮名漢字変換します。そして変換結果を、
.I sj3
上で動かしているアプリケーションに渡します。
.PP
.I sj3
は起動時にホームディレクトリ内の‘.sjrc’というセットアップ
ファイルを読み込み、その設定に従って動作をします。このファイルがなければ
デフォルトの動作をします。
また
.I " sj3
のローマ字仮名変換は、ホームディレクトリ内の‘.sjrk’ファイルで定義されて
いる規則に従います。このファイルがなければ、デフォルトの定義ファイル
の規則に従います。
.SH オプション
.TP
.BI \-f " shell"
このオプションは、
.I sj3
起動時に実行されるシェルを指定します。デフォルトは
.I " /bin/csh
です。
.TP
.BI \-h
オプションの説明を表示し、
.I sj3
は起動しません。
.TP
.BI \-H " hostname \.\.\."
このオプションは、接続するサーバとなるホスト名リストを指定します。
サーバとなるホストを複数指定した場合、その順番に接続を試みます。
このオプションが省略され、環境変数
.B " SJ3SERV
もしくはセットアップファイル
でもサーバの指定がなければ、localhost 上のサーバとの接続を試みます。
すべてのサーバとの接続が出来なかった場合でも
.I " sj3
は起動しますが、仮名漢字変換はできません。
.TP
.BI \-L
このオプションは、起動されるシェルをログインシェルとすることを示します。
.TP
.BI \-o
このオプションは、使用しているキーボードが NWP-410 であることを示します。
.TP
.BI \-e " program \[arguments \.\.\.\]"
このオプションは、
.I sj3
起動時に実行されるプログラム及びその引数を指定します。
.ft B
これは、コマンド行上の最後のオプションでなければなりません。
.SH 環境変数
.TP 15
.B SJ3SERV
接続するサーバとなるホスト名リストを取得します。
.TP 15
.B SJRC
セットアップファイルのファイル名を取得します。
.TP 15
.B SJRK
ローマ字仮名変換規則定義ファイルのファイル名を取得します。
.SH 関連ファイル
.PD 0
.TP 15
/usr/dict/sj3/user/$USER/private.dic
仮名漢字変換ユーザ辞書
.TP
/usr/dict/sj3/user/$USER/study.dat
仮名漢字変換学習ファイル
.TP
/usr/lib/sj3/sjrk
デフォルトローマ字仮名変換規則定義ファイル
.SH 関連事項
sj3serv(1), sj3lib(3)

141
doc/man/sj3dic.1 Normal file
View file

@ -0,0 +1,141 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"
.\"$SonyRCSfile: sj3dic.1,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:51 $
.\"
.TH SJ3DIC 1
.SH 名称
sj3dic \- sj3 ユーザ辞書メンテナンスツール
.SH 形式
\fBsj3dic\fP \fB\-text\fP [ \fB\-H\fP host_name ] [ output_file ]
.br
\fBsj3dic\fP \fB\-dict\fP [ \fB\-H\fP host_name ] [ input_file ]
.SH 解説
\fIsj3dic\fP は、仮名漢字変換サーバ \fIsj3serv(1)\fP とソケットを
使用したプロセス間通信をすることにより、サーバの動作しているマシン上の
ユーザ辞書をメンテナンスするツールです。
.sp
接続するホストは \fIhost_name\fP で指定します。このオプションが
省略され、環境変数 \fBSJ3SERV\fP もしくは \fIsj3(1)\fP のセットアップ
ファイルでもサーバの指定がないときには、localhost 上のサーバとの接続を
試みます。
.sp
.in
.B 1)ビジュアル辞書ファイルの作成
.sp
.in +0.2i
\fBsj3dic\fP \fB\-text\fP [ \fB\-H\fP host_name ] [ output_file ]
.sp
サーバマシン上のユーザ辞書の内容を編集可能なテキストに変換し
\fIoutput_file\fP に出力します。\fIoutput_file\fP が指定されないときには
標準出力に出力されます。
.sp
ビジュアルファイルは以下のようなものです。
.sp
うぃんどう ウィンドウ       名詞:
.br
そにー ソニー(株)      名詞:
.br
ゆーびん 〒           名詞:
.br
わーく ワークステーション   名詞:
.sp
各フィールドは以下のようになっています。
.sp
第一フィールド  読み(全角ひらがな)
.br
第二フィールド  目的の出力
.br
第三フィールド  品詞
.sp
ここで、フィールド間は、1個以上の半角スペースまたはタブで区切られます。
また各フィールドには、半角スペースおよびタブを記述することは許されません。
品詞のフィールド(第三フィールド)には、以下の品詞を記述します。
.sp
  名詞:   苗字:   地名:   代名詞:  名前:
.br
  県/区名: 数詞:   接頭語:  接尾語:  助数詞:
.br
  副詞:   接続詞:  連体詞:  形容詞:  形容動詞:
.br
  動・サ変: 動・ザ変: 動・一段: 動・カ五: 動・ガ五:
.br
  動・サ五: 動・タ五: 動・ナ五: 動・バ五: 動・マ五:
.br
  動・ラ五: 動・ワ五: 単漢字:
.sp
.in
.B 2)ユーザ辞書ファイルへの追加登録
.in +0.2i
.sp
\fBsj3dic\fP \fB\-dict\fP [ \fB\-H\fP host_name ] [ input_file ]
.sp
ビジュアル辞書ファイルである \fIinput_file\fP の内容をサーバマシン上の
ユーザ辞書に追加登録します。\fIinput_file\fP が指定されないときには
標準入力が読み込まれます。
.in
.SH 関連ファイル
.PD 0
.TP \w'\ \ \ \ user/\fIusername\fP/private.dic'u+2n
/usr/bin/sj3serv
かな漢字変換サーバ
.TP
/usr/lib/sj3/serverrc
かな漢字変換サーバ セットアップファイル
.TP
/usr/bin/sj3
日本語入力フロントエンドプロセッサ
.TP
/usr/dict/sj3/
かな漢字変換サーバ デフォルト辞書ディレクトリ
.TP
sj3main.dic
かな漢字変換メイン辞書
.TP
user/\fIusername\fP/private.dic
かな漢字変換ユーザ辞書
.TP
user/\fIusername\fP/study.dat
かな漢字変換学習ファイル
.TP
/usr/include/sj3lib.h
かな漢字変換ライブラリ用インクルードファイル
.TP
/usr/lib/libsj3lib.a
かな漢字変換ライブラリ
.\".TP
.\"/usr/sony/demo/sj3/*
.\"かな漢字変換ライブラリ 使用法サンプル
.SH 関連事項
sj3(1), sj3serv(1), sj3lib(3)
.SH バグ

576
doc/man/sj3mkdic.1 Normal file
View file

@ -0,0 +1,576 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"$SonyRCSfile: sj3mkdic.1,v $
.\"$SonyRevision: 1.2 $
.\"$SonyDate: 1996/09/05 12:08:20 $
.\"
.TH SJ3MKDIC 1
.SH 名前
\f4sj3mkdic\f1 \- sj3 辞書変換ツール
.SH 形式
.B sj3mkdic
.I word_dict_text
.I output.dic
.SH 機能説明
.B sj3mkdic
は、EUC のテキスト単語辞書ファイルから
.BR "sj3serv" (1)
で使用できるバイナリ形式の辞書ファイルに変換するツールです。
変換された辞書のファイル名は必ず ".dic" で終わるようにしてください。
.sp
このツールを使用することにより、エディタで編集された辞書を \fBsj3serv\fP で
使用可能な形態に変換することが出来ます。
.PP
単語辞書のテキストファイルのフォーマットは以下のようになっています。
.sp
.nf
あーかんそー アーカンソー 地名:[州]:[都市]:[所]:
あいらし 愛らし 形3:
あお あお ガ五5:ラ五5:
あがた 県 単漢:
.fi
.sp
各フィールドは以下のようになっています。
.sp
.nf
第一フィールド  読み(全角ひらがな)
第二フィールド  目的の出力
第三フィールド  品詞の並び
.fi
.sp
ここで、フィールド間は、1 個以上の半角スペースまたはタブで区切られます。
また各フィールドには、半角スペースおよびタブを記述することは許されません。
また各行は、読みでソートされていなければなりません。
なおこの辞書では、体言(名詞・副詞・連体詞など非活用のもの)については
熟語そのままを、用言(動詞・形容詞・形容動詞など活用するもの)に
関しては語幹のみを登録しなければなりません。
品詞のフィールド(第三フィールド)には、以下の品詞を記述します。
.sp
.nf
カ五1: カ五2: カ五3: カ五4: カ五5:
カ五6: カ五7: カ五8: カ五音便: カ変仮:
カ変終体: カ変未: カ変命: カ変用: ガ五1:
ガ五2: ガ五3: ガ五4: ガ五5: ガ五6:
ガ五7: ガ五8: サ五1: サ五2: サ五3:
サ五4: サ五5: サ五6: サ五7: サ五8:
サ変: サ変仮: サ変終体: サ変未1: サ変未2:
サ変未用: サ変命1: サ変命2: ザ変: タ五1:
タ五2: タ五3: タ五4: タ五5: タ五6:
タ五7: タ五8: ナ五: バ五1: バ五2:
バ五3: バ五4: バ五5: バ五6: バ五7:
バ五8: マ五1: マ五2: マ五3: マ五4:
マ五5: マ五6: マ五7: マ五8: ラ五1:
ラ五2: ラ五3: ラ五4: ラ五5: ラ五6:
ラ五7: ラ五8: ワ五1: ワ五2: ワ五3:
ワ五4: ワ五5: ワ五6: ワ五7: ワ五8:
挨拶: 一括: 一段1: 一段2: 一段3:
一段4: 感動: 企業: 形1: 形10:
形11: 形2: 形3: 形4: 形5:
形6: 形7: 形8: 形9: 形動1:
形動2: 形動3: 形動4: 形動5: 形動6:
形動7: 形動8: 形動9: 県区: 助数:
助数2: 数詞: 数詞2: 接続: 接頭1:
接頭2: 接頭3: 接頭4: 接頭5: 接尾1:
接尾2: 接尾3: 接尾4: 接尾5: 接尾6:
接尾7: 接尾8: 接尾9: 代1: 代2:
代3: 代4: 代5: 代6: 単漢:
地名: 丁寧1: 丁寧2: 特殊形容: 特殊副:
苗字: 副1: 副2: 副3: 副4:
副5: 副6: 副7: 副8: 副9:
名1: 名10: 名11: 名2: 名20:
名3: 名4: 名5: 名6: 名7:
名8: 名9: 名前: 連体:
.fi
.sp
\f3品詞について\f1
.SH
**注意点**
.RS
.SH
上一段・下一段動詞の扱い
.RS
例えば、カ行上一段動詞 "起きる" の場合、
.RS
語幹は     "お"
.br
活用語尾は   "き、きる、きれ、きろ、きよ"
.RE
となります。
.br
活用語尾の1字目に注目すると、いずれの活用形においても共通なので、
便宜的に "おき" までを語幹として扱うことにします。
これによって "行" 及び "上下"の区別は必要なくなり、
ただ "一段動詞" だけの分類分けで済ませています。
.RE
.RE
名詞
.RS
.LP
固有名詞を除いた名詞です。
.br
これらは複合名詞を作りやすいか否かによって2つに分けられます。
.br
複合名詞を作りやすいか否かは、主観によって判断しています。
.RE
複合名詞を作りやすい名詞
.RS
.IP 名1(MEISI_1) \w'            'u
他の分類に含まれない、複合名詞を作りやすい名詞
.IP 名2(MEISI_2)
接頭語 "お"
.IP 名3(MEISI_3)
接頭語 "ご"
.IP 名4(MEISI_4)
接尾語 "的" "化" のどちらか
.IP 名5(MEISI_5)
名詞+サ変動詞、接頭語 "お"
.IP 名6(MEISI_6)
名詞+サ変動詞
.IP 名7(MEISI_7)
名詞+サ変動詞、接頭語 "ご"
.IP 名8(MEISI_8)
名詞+形容動詞
.IP 名9(MEISI_9)
名詞+形容動詞、接頭語 "お"
.IP 名10(MEISI_10)
名詞+形容動詞、接頭語 "ご"
.IP 名11(MEISI_11)
名詞+副詞
.RE
複合名詞を作りにくい名詞
.RS
.IP 代1(D_MEISI_1) \w'            'u
他の分類に含まれない、複合名詞を作りにくい名詞
.IP 代2(D_MEISI_2)
接尾語 "さん"
.IP 代3(D_MEISI_3)
"~をする"
.IP 代4(D_MEISI_4)
名詞+サ変動詞
.IP 代5(D_MEISI_5)
名詞+形容動詞
.IP 代6(D_MEISI_6)
名詞+副詞
.RE
固有名詞
.RS
.IP 苗字(MYOUJI) \w'            'u
人名の姓
.IP 名前(NAMAE)
人名の名
.IP 企業(KIGYOU)
企業名
.IP 地名(TIMEI)
都道府県・区郡・市町村 および主要都市の駅名
.IP 県区(KEN_KU)
都道府県・区の・・県(都,府,区)付き
.RE
その他体言
.RS
.IP 連体(RENTAISI) \w'            'u
連体詞
.IP 接続(SETUZOKU)
接続詞
.IP 感動(KANDOUSI)
感動詞
.IP 助数(JOSUUSI1)
"第~" が接続できる
.IP 助数2(JOSUUSI2)
"第~”が接続できない
.IP 数詞(SUUSI)
数詞
.RE
接頭語
.RS
.IP 接頭1(SETTOU_1) \w'            'u
名詞(サ変名詞・刑動名詞含む)に接続
.IP 接頭2(SETTOU_2)
地名に接続(北、南、西、東 等)
.IP 接頭3(SETTOU_3)
人名に接続(故 など)
.IP 接頭4(SETTOU_4)
数詞に接続(第、計 等)
.IP 接頭5(SETTOU_5)
接頭1 より接続が強い
.RE
接尾語
.RS
.IP 接尾1(SETUBI_1) \w'            'u
名詞に接続、名詞扱い
.IP 接尾2(SETUBI_2)
名詞に接続、名詞扱い。ただし連濁形
.IP 接尾3(SETUBI_3)
接尾1 より接続が強い
.IP 接尾4(SETUBI_4)
地名に接続、名詞扱い
.IP 接尾5(SETUBI_5)
名詞に接続、形容詞扱い
.IP 接尾6(SETUBI_6)
名詞に接続、形容動詞扱い
.IP 接尾7(SETUBI_7)
名詞に接続、サ変名詞扱い
.IP 接尾8(SETUBI_8)
名詞に接続、一段動詞扱い
.IP 接尾9(SETUBI_9)
接尾語+副詞
.RE
副詞
.RS
.IP 副1(FUKUSI_1) \w'            'u
接続なし
.IP 副2(FUKUSI_2)
"~と" 接続
.IP 副3(FUKUSI_3)
"~と", サ変動詞語尾が接続
.IP 副4(FUKUSI_4)
サ変動詞語尾が接続
.IP 副5(FUKUSI_5)
"~に" 接続
.IP 副6(FUKUSI_6)
"~も" 接続
.IP 副7(FUKUSI_7)
"~の" 接続
.IP 副8(FUKUSI_8)
"~と", "~です、~だ" 接続
.IP 副9(FUKUSI_9)
"~と", サ変動詞語尾, "~です、~だ" 接続
.RE
形容詞
.RS
.RS
.DS
[さ]  "さ" が接続して名詞化する
[げ]  "げ" が接続して形容動詞化する
[め]  "め" が接続して形容動詞化する
[み]  "み" が接続して名詞化する
[がる] "がる" が接続して動詞化する
.DE
.RE
.sp
.IP 形1(KEIYOUSI_1) \w'            'u
上記付属語接続なし
.IP 形2(KEIYOUSI_2)
[さ]
.IP 形3(KEIYOUSI_3)
[さ、げ]
.IP 形4(KEIYOUSI_4)
[さ、がる]
.IP 形5(KEIYOUSI_5)
[さ、げ、がる]
.IP 形6(KEIYOUSI_6)
[さ、め、げ]
.IP 形7(KEIYOUSI_7)
[さ、め、げ、がる]
.IP 形8(KEIYOUSI_8)
[さ、み、め、げ、がる]
.IP 形9(KEIYOUSI_9)
接頭語 "お", [さ、げ、がる]
.IP 形10(KEIYOUSI_10)
接頭語 "お", [さ、め、げ、がる]
.IP 形11(KEIYOUSI_11)
[さ、み、め]
.RE
形容動詞
.RS
.IP 形動1(KE_DOUSI_1) \w'            'u
ダ活用
.IP 形動2(KE_DOUSI_2)
タリ活用
.IP 形動3(KE_DOUSI_3)
ダ活用、語幹で連体修飾
.IP 形動4(KE_DOUSI_4)
ダ活用、"~さ"
.IP 形動5(KE_DOUSI_5)
ダ活用、"~さ"、語幹で連体修飾
.IP 形動6(KE_DOUSI_6)
ダ活用、接頭語 "お" が接続
.IP 形動7(KE_DOUSI_7)
ダ活用、"~さ"、接頭語 "お" が接続
.IP 形動8(KE_DOUSI_8)
ダ活用、接頭語 "ご" が接続
.IP 形動9(KE_DOUSI_9)
ダ活用、"~の"
.RE
動詞
.RS
.IP サ変(DO_SAHEN) \w'            'u
サ変動詞、連用名詞扱いできない
.IP ザ変(DO_ZAHEN)
ザ変動詞。連用名詞扱いできない
.IP 一段1(DO_1DAN_1) \w'            'u
連用名詞扱いできない
.IP 一段2(DO_1DAN_2)
連用名詞扱いできない、接頭語 "お"
.IP 一段3(DO_1DAN_3)
連用名詞扱いできる
.IP 一段4(DO_1DAN_4)
連用名詞扱いできる、接頭語 "お"
.IP カ五1(DO_KAGO_1) \w'            'u
連用名詞扱いできない、
.IP カ五2(DO_KAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP カ五3(DO_KAGO_3)
連用名詞扱いできる
.IP カ五4(DO_KAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP カ五5(DO_KAGO_5)
連用名詞扱いできない、[け、ける、けれ]
.IP カ五6(DO_KAGO_6)
連用名詞扱いできない、[け、ける、けれ]、接頭語 "お"
.IP カ五7(DO_KAGO_7)
連用名詞扱いできる、[け、ける、けれ]
.IP カ五8(DO_KAGO_8)
連用名詞扱いできる、[け、ける、けれ]、接頭語 "お"
.IP ガ五1(DO_GAGO_1) \w'            'u
連用名詞扱いできない
.IP ガ五2(DO_GAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP ガ五3(DO_GAGO_3)
連用名詞扱いできる
.IP ガ五4(DO_GAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP ガ五5(DO_GAGO_5)
連用名詞扱いできない、[げ、げる、げれ]
.IP ガ五6(DO_GAGO_6)
連用名詞扱いできない、[げ、げる、げれ]、接頭語 "お"
.IP ガ五7(DO_GAGO_7)
連用名詞扱いできる、[げ、げる、げれ]
.IP ガ五8(DO_GAGO_8)
連用名詞扱いできる、[げ、げる、げれ]、接頭語 "お"
.IP サ五1(DO_SAGO_1) \w'            'u
連用名詞扱いできない
.IP サ五2(DO_SAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP サ五3(DO_SAGO_3)
連用名詞扱いできる
.IP サ五4(DO_SAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP サ五5(DO_SAGO_5)
連用名詞扱いできない、[せ、せる、せれ]
.IP サ五6(DO_SAGO_6)
連用名詞扱いできない、[せ、せる、せれ]、接頭語 "お"
.IP サ五7(DO_SAGO_7)
連用名詞扱いできる、[せ、せる、せれ]
.IP サ五8(DO_SAGO_8)
連用名詞扱いできる、[せ、せる、せれ]、接頭語 "お"
.IP タ五1(DO_TAGO_1) \w'            'u
連用名詞扱いできない
.IP タ五2(DO_TAGO_2)
連用名詞扱いできない、接頭語 "お"
.IP タ五3(DO_TAGO_3)
連用名詞扱いできる
.IP タ五4(DO_TAGO_4)
連用名詞扱いできる、接頭語"お"
.IP タ五5(DO_TAGO_5)
連用名詞扱いできない、[て、てる、てれ]
.IP タ五6(DO_TAGO_6)
連用名詞扱いできない、[て、てる、てれ]、接頭語 "お"
.IP タ五7(DO_TAGO_7)
連用名詞扱いできる、[て、てる、てれ]
.IP タ五8(DO_TAGO_8)
連用名詞扱いできる、[て、てる、てれ]、接頭語 "お"
.IP ナ五(DO_NAGO) \w'            'u
連用名詞扱いできない
.IP バ五1(DO_BAGO_1) \w'            'u
連用名詞扱いできない
.IP バ五2(DO_BAGO_2)
連用名詞扱いできない、"お"
.IP バ五3(DO_BAGO_3)
連用名詞扱いできる
.IP バ五4(DO_BAGO_4)
連用名詞扱いできる、"お"
.IP バ五5(DO_BAGO_5)
連用名詞扱いできない、[べ、べる、べれ]
.IP バ五6(DO_BAGO_6)
連用名詞扱いできない、[べ、べる、べれ]、接頭語 "お"
.IP バ五7(DO_BAGO_7)
連用名詞扱いできる、[べ、べる、べれ]
.IP バ五8(DO_BAGO_8)
連用名詞扱いできる、[べ、べる、べれ]、接頭語 "お"
.IP マ五1(DO_MAGO_1) \w'            'u
連用名詞扱いできない、
.IP マ五2(DO_MAGO_2)
連用名詞扱いできない、"お"
.IP マ五3(DO_MAGO_3)
連用名詞扱いできる
.IP マ五4(DO_MAGO_4)
連用名詞扱いできる、"お"
.IP マ五5(DO_MAGO_5)
連用名詞扱いできない、[め、める、めれ]
.IP マ五6(DO_MAGO_6)
連用名詞扱いできない、[め、める、めれ]、接頭語 "お"
.IP マ五7(DO_MAGO_7)
連用名詞扱いできる、[め、める、めれ]
.IP マ五8(DO_MAGO_8)
連用名詞扱いできる、[め、める、めれ]、接頭語 "お"
.IP ラ五1(DO_RAGO_1) \w'            'u
連用名詞扱いできない
.IP ラ五2(DO_RAGO_2)
連用名詞扱いできない、"お"
.IP ラ五3(DO_RAGO_3)
連用名詞扱いできる
.IP ラ五4(DO_RAGO_4)
連用名詞扱いできる、接頭語 "お"
.IP ラ五5(DO_RAGO_5)
連用名詞扱いできない、[れ、れる、れれ]
.IP ラ五6(DO_RAGO_6)
連用名詞扱いできない、[れ、れる、れれ]、接頭語 "お"
.IP ラ五7(DO_RAGO_7)
連用名詞扱いできる、[れ、れる、れれ]
.IP ラ五8(DO_RAGO_8)
連用名詞扱いできる、[れ、れる、れれ]、接頭語 "お"
.IP ワ五1(DO_WAGO_1) \w'            'u
連用名詞扱いできない
.IP ワ五2(DO_WAGO_1)
連用名詞扱いできない、"お"
.IP ワ五3(DO_WAGO_1)
連用名詞扱いできる
.IP ワ五4(DO_WAGO_1)
連用名詞扱いできる、接頭語 "お"
.IP ワ五5(DO_WAGO_1)
連用名詞扱いできない、[え、える、えれ]
.IP ワ五6(DO_WAGO_1)
連用名詞扱いできない、[え、える、えれ]、接頭語 "お"
.IP ワ五7(DO_WAGO_1)
連用名詞扱いできる、[え、える、えれ]
.IP ワ五8(DO_WAGO_1)
連用名詞扱いできる、[え、える、えれ]、接頭語 "お"
.RE
特殊品詞
.RS
分類不可能な語、特殊な活用をする語句など
.sp
.IP 単漢(TANKANJI) \w'            'u
単漢字
.sp
.IP サ変未1(SP_SA_MI1) \w'            'u
さ
.IP サ変未2(SP_SA_MI2)
せ
.IP サ変未用(SP_SA_YOU)
し
.IP サ変終体(SP_SA_SYU)
する
.IP サ変仮(SP_SA_KAT)
すれ
.IP サ変命1(SP_SA_ME1)
しろ
.IP サ変命2(SP_SA_ME2)
せよ
.sp
.IP カ変未(SP_KA_MIZ)
こ
.IP カ変用(SP_KA_YOU)
き
.IP カ変終体(SP_KA_SYU)
くる
.IP カ変仮(SP_KA_KAT)
くれ
.IP カ変命(SP_KA_ME1)
こい
.sp
.IP 丁寧1(TEINEI1)
いらっしゃい、おっしゃい、ください、なさい
.IP 丁寧2(TEINEI2)
ござい
.sp
.IP カ五音便(SP_KA_ONB)
いっ
.sp
.IP 特殊副(SP_FUKUSI)
こう、そう、どう
.sp
.IP 挨拶(AISATU)
ありがとう、おめでとう、おはよう
.sp
.IP 特殊形容(SP_KEIYOUSI)
いい
.sp
.IP 一括(IKKATU) \w'            'u
文節変換では参照されない語。"関連辞書" で関連を定義するために存在する語。
.RE
.SH ファイル
.PD 0
.TP \w'\ \ \ \ user/\f2username\f1/private.dic'u+2n
.B /usr/bin/sj3serv
かな漢字変換サーバ
.TP
.B /usr/lib/sj3/serverrc
かな漢字変換サーバ セットアップファイル
.TP
.B /usr/bin/sj3
日本語入力フロントエンドプロセッサ
.TP
.B /usr/dict/sj3/
かな漢字変換サーバ デフォルト辞書ディレクトリ
.TP
.B " sj3main.dic
かな漢字変換メイン辞書
.TP
.B " user/\f2username\f1/private.dic
かな漢字変換ユーザ辞書
.TP
.B " user/\f2username\f1/study.dat
かな漢字変換学習ファイル
.TP
.B /usr/include/sj3lib.h
かな漢字変換ライブラリ用インクルードファイル
.TP
.B /usr/lib/libsj3lib.a
かな漢字変換ライブラリ
.TP
\f3/usr/demo/sj3/ *\f1
かな漢字変換ライブラリ 使用法サンプル
.PD
.SH 関連項目
\f4sj3\f1 (1),
\f4sj3serv\f1 (1),
\f4sj3dic\f1 (1),
\f4sj3lib\f1 (3)

78
doc/man/sj3serv.1 Normal file
View file

@ -0,0 +1,78 @@
.\"
.\"Copyright (c) 1991-1994 Sony Corporation
.\"
.\"Permission is hereby granted, free of charge, to any person obtaining
.\"a copy of this software and associated documentation files (the
.\""Software"), to deal in the Software without restriction, including
.\"without limitation the rights to use, copy, modify, merge, publish,
.\"distribute, sublicense, and/or sell copies of the Software, and to
.\"permit persons to whom the Software is furnished to do so, subject to
.\"the following conditions:
.\"
.\"The above copyright notice and this permission notice shall be
.\"included in all copies or substantial portions of the Software.
.\"
.\"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
.\"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\"IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
.\"DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
.\"OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
.\"THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.\"
.\"Except as contained in this notice, the name of Sony Corporation
.\"shall not be used in advertising or otherwise to promote the sale, use
.\"or other dealings in this Software without prior written authorization
.\"from Sony Corporation.
.\"
.\"Author: Noriyuki Hosoe, Sony Corporation
.\"
.\"$SonyRCSfile: sj3serv.1,v $
.\"$SonyRevision: 1.1 $
.\"$SonyDate: 1994/06/03 08:00:52 $
.\"
.\" Server of Japanese input frontent processor
.TH SJ3SERV 1 "October 1990"
.SH 名称
sj3serv \- 仮名漢字変換サーバ
.SH 形式
.B sj3serv
[ \fB\-f\fP filename ]
.SH 解説
\fIsj3serv\fP は、ソケットを使用したプロセス間通信により仮名漢字変換を
行なう、仮名漢字変換サーバです。
.SH オプション
.TP
.BI \-f " filename"
このオプションは、\fIsj3serv\fP の読み込むセットアップファイルを指定します。
.br
\fIsj3serv\fP はデフォルトではセットアップファイル
‘/usr/lib/sj3/serverrc’を読み込みますが、
このオプションが指定されたときにはかわりに
コマンドラインで指定されたセットアップファイルを読み込みます。
.br
.SH 関連ファイル
.PD 0
.TP \w'\ \ \ \ user/\fIusername\fP/private.dic'u+2n
/usr/lib/sj3/serverrc
デフォルト仮名変換サーバ セットアップファイル
.TP
/usr/sony/dict/sj3/
かな漢字変換サーバ デフォルト辞書ディレクトリ
.TP
sj3main.dic
仮名漢字変換メイン辞書
.TP
user/\fIusername\fP/private.dic
仮名漢字変換ユーザ辞書
.TP
user/\fIusername\fP/study.dat
仮名漢字変換学習ファイル
.SH 関連事項
sj3(1), sj3lib(3)
.SH バグ
変換ルーチン内での辞書の識別には、辞書ファイルの inode 番号を
使用しています。コピーなどにより辞書ファイルの inode 番号が
変更されると、文節学習データは失われます。

94
include/Const.h Normal file
View file

@ -0,0 +1,94 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: Const.h,v $
* $SonyRevision: 1.4 $
* $SonyDate: 1997/01/23 11:20:52 $
*/
/*
* Change some default values.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*/
#include "Paths.h"
#define HostNameLen 128
#define UserNameLen 128
#define ProgNameLen 128
#define PathNameLen 1024
#define PassWordLen 16
#define YomiBufSize 1024
#define KanjiBufSize 2048
#define MinIdxLen 512
#define MinSegLen 512
#define MinSegNum 1
#define MinStyNum 512
#define MaxStyNum 0x7fff
#define MinClStep 1
#define MaxClStep 256
#define MinClLen 512
#define MaxClLen 0x7fff
#define DebugOutFile NULL
#define DebugLevel 0
#define ForkFlag 1
#define MaxClientNum 512
#define LogOutFile NULL
#define PortName "sj3"
#ifdef TLI
#define LocalHost "localhost"
#define ProtoName "tcp"
#define PortNumber "3000"
#else
#define PortNumber 3000
#endif
#define DirectryMode 0755
#define DictFileMode 0644
#define MODE_MASK 0777
#define DefIdxLen 2048
#define DefSegLen 2048
#define DefSegNum 256
#define DefStyNum 2048
#define DefClStep 1
#define DefClLen 2048
#define NotLocked -1
#define ERROR -1
#ifndef FALSE
# define TRUE -1
# define FALSE (!TRUE)
#endif

82
include/Dict.h Normal file
View file

@ -0,0 +1,82 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: Dict.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:55 $
*/
#define VersionPos 0
#define PasswdPos 16
#define PasswdLen 16
#define StdyNormPos 32
#define StdyNormLen 36
#define StdyNormNum 40
#define StdyNormCnt 44
#define StdyClIdxPos 48
#define StdyClIdxLen 52
#define StdyClIdxStep 56
#define StdyClSegPos 64
#define StdyClSegLen 68
#define DictIdxPos 32
#define DictIdxLen 36
#define DictSegPos 48
#define DictSegLen 52
#define DictSegNum 56
#define DictSegMax 60
#define DictAIdxPos 64
#define DictAIdxLen 68
#define DictASegPos 80
#define DictASegLen 84
#define HeaderPos 0
#define HeaderLength 128
#define CommentPos 128
#define CommentLength 128
#define Byte2Long(c3,c2,c1,c0) (((c3) << (8*3)) | ((c2) << (8*2)) | \
((c1) << (8*1)) | ((c0) << (8*0)))
#define StdyVersion Byte2Long('S', 2, 0, 0)
#define DictVersion Byte2Long('D', 2, 0, 0)

43
include/Paths.h.in Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 1997 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: Paths.h.in,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1997/01/23 11:20:55 $
*/
#define ErrorOutFile "/dev/console"
#define SocketName "/tmp/sj3sock"
#define LockFile "/tmp/SJ3SERV.EXIST"
#define MainDictionary "sj3main.dic"
#define UserDictionary "private.dic"
#define StudyFile "study.dat"

219
include/Struct.h Normal file
View file

@ -0,0 +1,219 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: Struct.h,v $
* $SonyRevision: 1.3 $
* $SonyDate: 1994/10/21 05:13:34 $
*/
typedef struct global {
JREC *Jmaxjptr;
CLREC *Jmaxclptr;
JREC *Jjrt1st;
CLREC *Jclt1st;
JREC *Jjrt2nd;
CLREC *Jclt2nd;
CLREC *Jselcl;
Short Jselectid;
Short Jtrank;
Short Jnrank;
Uchar *Jinputyomi;
Uchar *Jcnvstart;
Short Jcnvlen;
Uchar *Jystart;
Uchar Jhyomi[MaxPhInputLen+1];
Uchar Jorgyomi[MaxClInputLen*2+1];
Uchar Jkanjibuf[MinPhOutputLen];
Uchar *Jkanjipos;
Uchar *Jkanjitmp;
Short Jkanjilen;
Uchar Jdicinl;
Uchar Jdicsaml;
TypeDicSeg Jprevseg;
Uchar Jfzkcount;
Uchar Jfzk_ka_flg;
FREC Jfzktbl[MAXFREC];
Uchar Jheadcode;
Uchar Jheadlen;
Uchar Jgobilen;
TypeGram Jprevclgrm;
TypeCnct Jprevclrow;
Uchar Jnextcllen;
Short Jkhcount;
Short Jnkhcount;
KHREC Jkouhotbl[MaxKouhoNumber];
STDYIN *Jstdytop;
DICT *Jcurdict;
DICTL *Jdictlist;
Uchar *Jdicbuf;
Uchar *Jidxbuf;
TypeIdxOfs *Jidxofs;
Uchar *Jaskknj[MaxKnjAskNumber];
Uchar *Jaskknj_k[MaxKnjAskNumber];
STDY *Jcurstdy;
Ushort Jsuuji_wbuf[NumWordBuf];
Uchar Jsuuji_ubuf[NumKetaLength];
TypeClass Jsuuji_class;
Uchar Jsuuji_comma;
Uchar Jsuuji_keta;
Uchar *Jsuuji_yptr;
Uchar Jsuuji_len;
Uchar Jsuuji_exit;
Ushort *Jsuuji_wkeep;
Uchar *Jsuuji_ukeep;
Uchar Jpeepyomi[MaxWdYomiLen * 2 + 1];
Uchar Jpeepknj[MaxWdKanjiLen + 1];
TypeGram Jpeepgrm;
Uchar *Jpeepdptr;
Uchar *Jpeephptr;
Uchar *Jpeepkptr;
TypeDicSeg Jpeepidx;
} Global;
typedef struct dictfile {
DICT dict;
int refcnt;
fd_set lock;
FILE *fp;
int fd;
Uchar *buffer;
long bufsiz;
long idxstrt;
long segstrt;
TypeIdxOfs *ofsptr;
struct dictfile *link;
} DictFile;
typedef struct stdyfile {
STDY stdy;
int refcnt;
ino_t inode;
FILE *fp;
int fd;
Uchar *header;
struct stdyfile *link;
} StdyFile;
typedef struct workarea {
int refcnt;
int lock;
struct workarea *link;
Global global;
} WorkArea;
typedef struct client {
int fd;
char host[HostNameLen];
char user[UserNameLen];
char prog[ProgNameLen];
WorkArea *work;
StdyFile *stdy;
short version;
unsigned char def_char[2];
#if (defined(TLI) && defined(SOCK_UNIX))
int unix_flag;
#endif
uid_t uid;
struct client *next;
} Client;

107
include/sj3cmd.h Normal file
View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj3cmd.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:57 $
*/
#define SJ3SERV_VERSION_NO 2
#define SJ3_CONNECT 1
#define SJ3_DISCONNECT 2
#define SJ3_OPENDICT 11
#define SJ3_CLOSEDICT 12
#define SJ3_OPENSTDY 21
#define SJ3_CLOSESTDY 22
#define SJ3_STDYSIZE 23
#define SJ3_LOCK 31
#define SJ3_UNLOCK 32
#define SJ3_PH2KNJ 41
#define SJ3_CL2KNJ 51
#define SJ3_NEXTCL 52
#define SJ3_PREVCL 53
#define SJ3_CL2KNJ_ALL 54
#define SJ3_CL2KNJ_CNT 55
#define SJ3_STUDY 61
#define SJ3_CLSTUDY 62
#define SJ3_ADDDICT 71
#define SJ3_DELDICT 72
#define SJ3_MAKEDICT 81
#define SJ3_MAKESTDY 82
#define SJ3_MAKEDIR 83
#define SJ3_ACCESS 84
#define SJ3_GETDICT 91
#define SJ3_NEXTDICT 92
#define SJ3_PREVDICT 93
#define SJ3_WHO 100
#define SJ3_QUIT 101
#define SJ3_KILL 102
#define SJ3_VERSION 103
#define SJ3_DICTPASS 104
#define SJ3_DICTCMNT 105
#define SJ3_STDYPASS 106
#define SJ3_STDYCMNT 107
#define SJ3_SETCVER 110
#define SJ3_PH2KNJ_EUC 111
#define SJ3_CL2KNJ_EUC 112
#define SJ3_NEXTCL_EUC 113
#define SJ3_PREVCL_EUC 114
#define SJ3_CL2KNJ_ALL_EUC 115
#define SJ3_CL2KNJ_CNT_EUC 116
#define SJ3_CLSTUDY_EUC 117
#define SJ3_ADDDICT_EUC 118
#define SJ3_DELDICT_EUC 119
#define SJ3_GETDICT_EUC 120
#define SJ3_NEXTDICT_EUC 121
#define SJ3_PREVDICT_EUC 122

107
include/sj3err.h Normal file
View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj3err.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:58 $
*/
#define SJ3_InternalError -1
#define SJ3_NormalEnd 0
#define SJ3_ServerDown 1
#define SJ3_OpenSocket 2
#define SJ3_ConnectSocket 3
#define SJ3_GetHostByName 4
#define SJ3_NotOpened 5
#define SJ3_NotEnoughMemory 6
#define SJ3_IllegalCommand 7
#define SJ3_DifferentVersion 11
#define SJ3_NoHostName 12
#define SJ3_NoUserName 13
#define SJ3_NotAllowedUser 14
#define SJ3_AlreadyConnected 15
#define SJ3_NotConnected 16
#define SJ3_TooLongParameter 21
#define SJ3_IllegalParameter 22
#define SJ3_BadDictID 31
#define SJ3_IllegalDictFile 32
#define SJ3_IllegalStdyFile 33
#define SJ3_IncorrectPasswd 34
#define SJ3_FileNotExist 35
#define SJ3_CannotAccessFile 36
#define SJ3_CannotOpenFile 37
#define SJ3_CannotCreateFile 38
#define SJ3_FileReadError 39
#define SJ3_FileWriteError 40
#define SJ3_FileSeekError 41
#define SJ3_StdyAlreadyOpened 51
#define SJ3_StdyFileNotOpened 52
#define SJ3_TooSmallStdyArea 53
#define SJ3_LockedByOther 61
#define SJ3_NotLocked 62
#define SJ3_NoSuchDict 71
#define SJ3_ReadOnlyDict 72
#define SJ3_DictLocked 73
#define SJ3_BadYomiString 74
#define SJ3_BadKanjiString 75
#define SJ3_BadHinsiCode 76
#define SJ3_AddDictFailed 81
#define SJ3_AlreadyExistWord 82
#define SJ3_NoMoreDouonWord 83
#define SJ3_NoMoreUserDict 84
#define SJ3_NoMoreIndexBlock 85
#define SJ3_DelDictFailed 91
#define SJ3_NoSuchWord 92
#define SJ3_DirAlreadyExist 101
#define SJ3_CannotCreateDir 102
#define SJ3_NoMoreDictData 111
#define SJ3_UserConnected 121
#define SJ3_TooLongPasswd 131
#define SJ3_TooLongComment 132
#define SJ3_CannotCodeConvert 133

66
include/sj3lowlib.h Normal file
View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj3lowlib.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:00:59 $
*/
typedef struct sj3_client_env {
int fd;
int serv_dead_flg;
int stdy_size;
short svr_version;
short cli_version;
char default_char[2];
} SJ3_CLIENT_ENV;
#ifndef SJ3_NAME_LENGTH
# define SJ3_NAME_LENGTH 128
#endif
typedef struct sj3_who_struct {
int fd;
char hostname[SJ3_NAME_LENGTH];
char username[SJ3_NAME_LENGTH];
char progname[SJ3_NAME_LENGTH];
} SJ3_WHO_STRUCT;
#define MBCODE_SJIS 1
#define MBCODE_EUC 2

524
include/sj_connect.h Normal file
View file

@ -0,0 +1,524 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_connect.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:00 $
*/
#ifndef _SJ_CONNECT
#define _SJ_CONNECT
#define wo_x 0
#define ttatte_x 0
#define ttara_x 0
#define tte1_x 0
#define tte2_x 0
#define ppanasi_x 0
#define ppoi_x 0
#define ue_x 0
#define uti_x 0
#define oite_x 0
#define okeru_x 0
#define ori_x 0
#define ka1_x 0
#define ka2_x 0
#define kai_x 0
#define kasira_x 0
#define katagata_x 0
#define kadouka_x 0
#define kana_x 0
#define kane_x 0
#define kamo_x 0
#define kara1_x 0
#define kara2_x 0
#define ga1_x 0
#define ga2_x 0
#define gatera_x 0
#define kiri_x 0
#define kuseni_x 0
#define kurai_x 0
#define gurumi_x 0
#define kedo_x 0
#define koso_x 0
#define koto_x 0
#define sa2_x 0
#define sae_x 0
#define si2_x 0
#define sika_x 0
#define sura_x 0
#define zutu_x 0
#define zo_x 0
#define tame_x 0
#define dake_x 0
#define dano_x 0
#define darake_x 0
#define tuite_x 0
#define tuki_x 0
#define tutu_x 0
#define tumori_x 0
#define te1_x 0
#define te2_x 0
#define teru_x 0
#define dearou_x 0
#define deru_x 0
#define to1_x 0
#define to2_x 0
#define totte_x 0
#define toiu_x 0
#define toori_x 0
#define toki_x 0
#define tokoro_x 0
#define tote_x 0
#define tohaie_x 0
#define tomo_x 0
#define do_x 0
#define doori_x 0
#define dokoro_x 0
#define dokoroka_x 0
#define domo_x 0
#define na1_x 0
#define naa_x 0
#define nagara_x 0
#define nazo_x 0
#define nado_x 0
#define nari_x 0
#define nanka_x 0
#define nanzo_x 0
#define nante_x 0
#define ni1_x 0
#define ni2_x 0
#define ni3_x 0
#define nite_x 0
#define nimo_x 0
#define ne1_x 0
#define nee_x 0
#define no1_x 0
#define no2_x 0
#define node_x 0
#define noni_x 0
#define nomi_x 0
#define nominrz_x 0
#define ha_x 0
#define hazu_x 0
#define ba_x 0
#define bakari_x 0
#define he_x 0
#define hou_x 0
#define hoka_x 0
#define hodo_x 0
#define made_x 0
#define mama_x 0
#define mo1_x 0
#define mo2_x 0
#define motte_x 0
#define mono_x 0
#define ya1_x 0
#define ya2_x 0
#define yara_x 0
#define yue_x 0
#define yo_x 0
#define yori_x 0
#define wa_x 0
#define wake_x 0
#define wane_x 0
#define wayo_x 0
#define nn1_x 0
#define jya_x 0
#define tya_x 0
#define nagara2_x 0
#define wo_s_x 0
#define ze_x 0
#define kke_x 0
#define n_si_x 0
#define deha_x 0
#define gotosi_x 0
#define saseru_x 0
#define zaru_x 0
#define zu_x 0
#define zunba_x 0
#define seru_x 0
#define souda_x 0
#define youtai_x 0
#define denbun_x 0
#define ta_x 0
#define tai_x 0
#define tagaru_x 0
#define taru_x 0
#define da1_x 0
#define da2_x 0
#define daxtu_x 0
#define darou_x 0
#define de_x 0
#define desi_x 0
#define desho_x 0
#define desu_x 0
#define na2_x 0
#define nara_x 0
#define nai_x 0
#define nu_x 0
#define ne2_x 0
#define nn2_x 0
#define fuuda_x 0
#define besi_x 0
#define mai_x 0
#define masu_x 0
#define masure_x 0
#define mase_x 0
#define mitaida_x 0
#define you_x 0
#define youda_x 0
#define rasii_x 0
#define rareru_x 0
#define reru_x 0
#define site_x 0
#define yougen_x 0
#define aru_x 0
#define ara_x 0
#define ari1_x 0
#define ari2_x 0
#define ari3_x 0
#define are1_x 0
#define are2_x 0
#define arou_x 0
#define ii_x 0
#define itasi_x 0
#define itadaku_x 0
#define iru_x 0
#define eru_x 0
#define kakeru_x 0
#define kaneru_x 0
#define karazu_x 0
#define gatai_x 0
#define gatida_x 0
#define kudasaru_x 0
#define gozai_x 0
#define sa1_x 0
#define si1_x 0
#define siro_x 0
#define jyau_x 0
#define jimau_x 0
#define sugiru_x 0
#define subesi_x 0
#define suru_x 0
#define sure_x 0
#define se_x 0
#define seyo_x 0
#define tamau_x 0
#define tayu_x 0
#define timau_x 0
#define dekiru_x 0
#define naru_x 0
#define nasai_x 0
#define nasaru_x 0
#define nikui_x 0
#define yasui_x 0
#define yoi_x 0
#define yaru_x 0
#ifdef HORI
\244\303\244\277\244\351\244\267\244\244\244\316 \244\316\276\360\312\363\244\362\304\311\262\303 1/31
#endif
#define ttarasii_x 0
#define wo_o 0x80
#define ttatte_o 0x40
#define ttara_o 0x20
#define tte1_o 0x10
#define tte2_o 0x08
#define ppanasi_o 0x04
#define ppoi_o 0x02
#define ue_o 0x01
#define uti_o 0x80
#define oite_o 0x40
#define okeru_o 0x20
#define ori_o 0x10
#define ka1_o 0x08
#define ka2_o 0x04
#define kai_o 0x02
#define kasira_o 0x01
#define katagata_o 0x80
#define kadouka_o 0x40
#define kana_o 0x20
#define kane_o 0x10
#define kamo_o 0x08
#define kara1_o 0x04
#define kara2_o 0x02
#define ga1_o 0x01
#define ga2_o 0x80
#define gatera_o 0x40
#define kiri_o 0x20
#define kuseni_o 0x10
#define kurai_o 0x08
#define gurumi_o 0x04
#define kedo_o 0x02
#define koso_o 0x01
#define koto_o 0x80
#define sa2_o 0x40
#define sae_o 0x20
#define si2_o 0x10
#define sika_o 0x08
#define sura_o 0x04
#define zutu_o 0x02
#define zo_o 0x01
#define tame_o 0x80
#define dake_o 0x40
#define dano_o 0x20
#define darake_o 0x10
#define tuite_o 0x08
#define tuki_o 0x04
#define tutu_o 0x02
#define tumori_o 0x01
#define te1_o 0x80
#define te2_o 0x40
#define teru_o 0x20
#define dearou_o 0x10
#define deru_o 0x08
#define to1_o 0x04
#define to2_o 0x02
#define totte_o 0x01
#define toiu_o 0x80
#define toori_o 0x40
#define toki_o 0x20
#define tokoro_o 0x10
#define tote_o 0x08
#define tohaie_o 0x04
#define tomo_o 0x02
#define do_o 0x01
#define doori_o 0x80
#define dokoro_o 0x40
#define dokoroka_o 0x20
#define domo_o 0x10
#define na1_o 0x08
#define naa_o 0x04
#define nagara_o 0x02
#define nazo_o 0x01
#define nado_o 0x80
#define nari_o 0x40
#define nanka_o 0x20
#define nanzo_o 0x10
#define nante_o 0x08
#define ni1_o 0x04
#define ni2_o 0x02
#define ni3_o 0x01
#define nite_o 0x80
#define nimo_o 0x40
#define ne1_o 0x20
#define nee_o 0x10
#define no1_o 0x08
#define no2_o 0x04
#define node_o 0x02
#define noni_o 0x01
#define nomi_o 0x80
#define nominrz_o 0x40
#define ha_o 0x20
#define hazu_o 0x10
#define ba_o 0x08
#define bakari_o 0x04
#define he_o 0x02
#define hou_o 0x01
#define hoka_o 0x80
#define hodo_o 0x40
#define made_o 0x20
#define mama_o 0x10
#define mo1_o 0x08
#define mo2_o 0x04
#define motte_o 0x02
#define mono_o 0x01
#define ya1_o 0x80
#define ya2_o 0x40
#define yara_o 0x20
#define yue_o 0x10
#define yo_o 0x08
#define yori_o 0x04
#define wa_o 0x02
#define wake_o 0x01
#define wane_o 0x80
#define wayo_o 0x40
#define nn1_o 0x20
#define jya_o 0x10
#define tya_o 0x08
#define nagara2_o 0x04
#define wo_s_o 0x02
#define ze_o 0x80
#define kke_o 0x40
#define n_si_o 0x20
#define deha_o 0x10
#define gotosi_o 0x80
#define saseru_o 0x40
#define zaru_o 0x20
#define zu_o 0x10
#define zunba_o 0x08
#define seru_o 0x04
#define souda_o 0x02
#define youtai_o 0x01
#define denbun_o 0x80
#define ta_o 0x40
#define tai_o 0x20
#define tagaru_o 0x10
#define taru_o 0x08
#define da1_o 0x04
#define da2_o 0x02
#define daxtu_o 0x01
#define darou_o 0x80
#define de_o 0x40
#define desi_o 0x20
#define desho_o 0x10
#define desu_o 0x08
#define na2_o 0x04
#define nara_o 0x02
#define nai_o 0x01
#define nu_o 0x80
#define ne2_o 0x40
#define nn2_o 0x20
#define fuuda_o 0x10
#define besi_o 0x08
#define mai_o 0x04
#define masu_o 0x02
#define masure_o 0x01
#define mase_o 0x80
#define mitaida_o 0x40
#define you_o 0x20
#define youda_o 0x10
#define rasii_o 0x08
#define rareru_o 0x04
#define reru_o 0x02
#define site_o 0x01
#define yougen_o 0x80
#define aru_o 0x40
#define ara_o 0x20
#define ari1_o 0x10
#define ari2_o 0x08
#define ari3_o 0x04
#define are1_o 0x02
#define are2_o 0x01
#define arou_o 0x80
#define ii_o 0x40
#define itasi_o 0x20
#define itadaku_o 0x10
#define iru_o 0x08
#define eru_o 0x04
#define kakeru_o 0x02
#define kaneru_o 0x01
#define karazu_o 0x80
#define gatai_o 0x40
#define gatida_o 0x20
#define kudasaru_o 0x10
#define gozai_o 0x08
#define sa1_o 0x04
#define si1_o 0x02
#define siro_o 0x01
#define jyau_o 0x80
#define jimau_o 0x40
#define sugiru_o 0x20
#define subesi_o 0x10
#define suru_o 0x08
#define sure_o 0x04
#define se_o 0x02
#define seyo_o 0x01
#define tamau_o 0x80
#define tayu_o 0x40
#define timau_o 0x20
#define dekiru_o 0x10
#define naru_o 0x08
#define nasai_o 0x04
#define nasaru_o 0x02
#define nikui_o 0x01
#define yasui_o 0x80
#define yoi_o 0x40
#define yaru_o 0x20
#ifdef HORI
\244\303\244\277\244\351\244\267\244\244\244\316 \244\316\276\360\312\363\244\362\304\311\262\303 1/31
#endif
#define ttarasii_o 0x10
#endif

199
include/sj_const.h Normal file
View file

@ -0,0 +1,199 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_const.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:01 $
*/
#ifndef _SJ_CONST
#define _SJ_CONST
#include "sj_euc.h"
#define MATCH 0
#define OVER 1
#define PARTLY 2
#define CONT 3
#define UNDER 4
#define FALSE 0
#define TRUE -1
#define AD_Done 0x0000
#define AD_NotUserDict 0x0001
#define AD_BadYomi 0x0002
#define AD_BadKanji 0x0004
#define AD_BadHinsi 0x0008
#define AD_ArExist 0x0010
#define AD_OvflwDouBlk 0x0020
#define AD_OvflwDouNum 0x0040
#define AD_OvflwUsrDic 0x0080
#define AD_OvflwIndex 0x0100
#define AD_NoMidasi 0x0010
#define AD_NoHinsi 0x0020
#define AD_NoKanji 0x0040
#define C_WAKACHI 0x00
#define C_MINASI 0x01
#define C_BUNSETU 0x02
#define C_DICT 0x03
#define C_N_ARABIA 0x04
#define C_N_ARACMA 0x05
#define C_N_KAZU 0x06
#define C_N_SUUJI 0x07
#define C_N_NANSUU 0x08
#define C_N_KANKURA 0x09
#define C_N_ARAKURA 0x0a
#define C_N_KAZULONG 0x0b
#define C_N_KAZULCMA 0x0c
#define C_N_SUUJILONG 0x0d
#define JFLAG_N10 (1 << 15)
#define JFLAG_N_1 (1 << 14)
#define JFLAG_NS1 (1 << 13)
#define JFLAG_N01 (1 << 12)
#define JFLAG_N23 (1 << 11)
#define JFLAG_NK2 (1 << 10)
#define JFLAG_NK4 (1 << 9)
#define JFLAG_NN0 (1 << 8)
#define JFLAG_NSN (1 << 7)
#define JFLAG_KA (1 << 0)
#define DO_CLSTUDY 0x01
#define DO_IKKATU 0x02
#define K_DOUSHI 1
#define K_YOUGEN 2
#define K_TAIGEN 3
#define K_FUKUSI 4
#define K_RENTAISI 5
#define K_SONOTA 6
#define EUC_a1 (Uchar)0xa1
#define EUC_a2 (Uchar)0xa2
#define EUC_a3 (Uchar)0xa3
#define EUC_a4 (Uchar)0xa4
#define EUC_a5 (Uchar)0xa5
#define EUC_START (Uchar)0xa1
#define EUC_END (Uchar)0xfe
#define EUC_END_KIGOU (Uchar)0xae
#define EUC_0 (Uchar)0xb0
#define EUC_END_0 (Uchar)0xb9
#define EUC_A (Uchar)0xc1
#define EUC_END_A (Uchar)0xda
#define EUC_a (Uchar)0xe1
#define EUC_END_a (Uchar)0xfa
#define EUC_END_HIRA (Uchar)0xf3
#define EUC_VU (Uchar)0xf4
#define EUC_XKA (Uchar)0xf5
#define EUC_XKE (Uchar)0xf6
#define isknj1(c) (((c) == SS2) || (((c) & 0x80) && ((c) != SS3)))
#define SHU 0x01
#define T_KANOU 0x80
#define T_SHUUJO 0x40
#define DICTOP 0x01
#define FZKTOP 0x02
#define DEPEND 0x04
#define NUMBER 0x08
#define FZK_KGU 0x10
#define TAI_KGU 0x20
#define BEFORNUM 0x40
#define MIDNUM 0x80
#define NOTNRM 0xFE
#define CNJEND 0xff
#define TYOUONFLG 0x80
#define MAXFREC 32
#define MAXFLVL 10
#define FZKEND 0xff
#define SETTOU_O 1
#define SETTOU_GO 2
#define SETTOU_DAI 3
#define SETTOU_KIGOU 4
#define NumKetaLength 16
#define NumWordBuf ((NumKetaLength+3)/4)
#endif

48
include/sj_define.h Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_define.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:02 $
*/
#ifndef _SJ_DEFINE
#define _SJ_DEFINE
#ifndef Static
# define Static static
#endif
#endif

113
include/sj_dict.h Normal file
View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_dict.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:03 $
*/
#ifndef _SJ_DICT
#define _SJ_DICT
#define DIC_MAIN 0
#define DIC_USER 1
#define DicSegBase 0
#define MaxDouonBlk 0xfff
#define DouonBlkSizeNumber 3
#define DicSegTerm 0xff
#define DouonBlkTerm 0xff
#define HinsiBlkTerm 0xff
#define MaxSegmentNumber 0xffff
#define NormalKanjiMask 0x7f
#define SS3Kanji 0x0080
#define ZenHiraAssyuku 0x80
#define OffsetAssyuku 0x90
#define ZenKataAssyuku 0xa0
#define AiAttribute 0xb0
#define KanjiAssyuku 0xc0
#define LeadingHankaku 0xd0
#define KanjiStrEnd 0x00
#define IsAssyuku 0x80
#define AssukuUse2byte 0x90
#define KnjAssyukuMask 0x0f
#define KanjiCodeMask 0x0f
#define KanjiModeMask 0xf0
#define AtrMsKanjiOfs 0xc0c0
#define MaxKnjAskNumber 16
#define MaxYomiAskNumber 16
#define MaxWdYomiLen 31
#define MaxWdKanjiLen 64
#define AssyukuYomiTop 0x80
#define NokoriYomiTop 0x40
#define getsize(p) (((Int)(*(p) & 0x0f) * 0x100) + *((p) + 1))
#define getntag(p) ((*(p) == DicSegTerm) ? (p) : (p) + getsize(p))
#define getplen(p) (((*(p) & AssyukuYomiTop)?0x10:0) + (*((p)+2) >> 4))
#define getnlen(p) (((*(p) & NokoriYomiTop)?0x10:0) + (*((p)+2) & 0x0f))
#define segtop() (dicbuf + *dicbuf + 1)
#define segend(p) (*(p) == DicSegTerm || (p) >= dicbuf + curdict->seglen)
#endif

55
include/sj_euc.h Normal file
View file

@ -0,0 +1,55 @@
/*
* 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
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_euc.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:05 $
*/
#ifndef _SJ_EUC
#define _SJ_EUC
#include "sj_sysvdef.h"
#ifdef SVR4
#include <sys/euc.h>
#else
#ifndef SS2
#define SS2 0x8e
#endif
#ifndef SS3
#define SS3 0x8f
#endif
#endif
#endif

46
include/sj_global.h Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_global.h,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/12/09 11:27:06 $
*/
extern Global *global_work_base;
extern Global *work_base;
extern STDY *stdy_base;

231
include/sj_hinsi.h Normal file
View file

@ -0,0 +1,231 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_hinsi.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:07 $
*/
#ifndef _SJ_HINSHI
#define _SJ_HINSHI
#define MEISI_1 1
#define MEISI_2 2
#define MEISI_3 3
#define MEISI_4 4
#define MEISI_5 5
#define MEISI_6 6
#define MEISI_7 7
#define MEISI_8 8
#define MEISI_9 9
#define MEISI_10 10
#define MEISI_11 11
#define D_MEISI_1 12
#define D_MEISI_2 13
#define D_MEISI_3 14
#define D_MEISI_4 15
#define D_MEISI_5 16
#define D_MEISI_6 17
#define MEISI_20 18
#define MYOUJI 21
#define NAMAE 22
#define KIGYOU 23
#define TIMEI 24
#define KEN_KU 25
#define RENTAISI 26
#define SETUZOKU 27
#define KANDOUSI 28
#define JOSUUSI 29
#define SUUSI 30
#define SETTOU_1 31
#define SETTOU_2 32
#define SETTOU_3 33
#define SETTOU_4 34
#define SETTOU_5 35
#define SETUBI_1 36
#define SETUBI_2 37
#define SETUBI_3 38
#define SETUBI_4 39
#define SETUBI_5 40
#define SETUBI_6 41
#define SETUBI_7 42
#define SETUBI_8 43
#define SETUBI_9 44
#define FUKUSI_1 45
#define FUKUSI_2 46
#define FUKUSI_3 47
#define FUKUSI_4 48
#define FUKUSI_5 49
#define FUKUSI_6 50
#define FUKUSI_7 51
#define FUKUSI_8 52
#define FUKUSI_9 53
#define JOSUUSI2 54
#define KEIYOUSI_1 60
#define KEIYOUSI_2 61
#define KEIYOUSI_3 62
#define KEIYOUSI_4 63
#define KEIYOUSI_5 64
#define KEIYOUSI_6 65
#define KEIYOUSI_7 66
#define KEIYOUSI_8 67
#define KEIYOUSI_9 68
#define KEIYOUSI_10 69
#define KEIYOUSI_11 70
#define KE_DOUSI_1 71
#define KE_DOUSI_2 72
#define KE_DOUSI_3 73
#define KE_DOUSI_4 74
#define KE_DOUSI_5 75
#define KE_DOUSI_6 76
#define KE_DOUSI_7 77
#define KE_DOUSI_8 78
#define KE_DOUSI_9 79
#define DO_SAHEN 80
#define DO_ZAHEN 81
#define DO_1DAN_1 90
#define DO_KAGO_1 91
#define DO_GAGO_1 92
#define DO_SAGO_1 93
#define DO_TAGO_1 94
#define DO_NAGO_1 95
#define DO_BAGO_1 96
#define DO_MAGO_1 97
#define DO_RAGO_1 98
#define DO_WAGO_1 99
#define DO_1DAN_2 100
#define DO_KAGO_2 101
#define DO_GAGO_2 102
#define DO_SAGO_2 103
#define DO_TAGO_2 104
#define DO_BAGO_2 105
#define DO_MAGO_2 106
#define DO_RAGO_2 107
#define DO_WAGO_2 108
#define DO_KAGO_5 111
#define DO_GAGO_5 112
#define DO_SAGO_5 113
#define DO_TAGO_5 114
#define DO_BAGO_5 115
#define DO_MAGO_5 116
#define DO_RAGO_5 117
#define DO_WAGO_5 118
#define DO_KAGO_6 121
#define DO_GAGO_6 122
#define DO_SAGO_6 123
#define DO_TAGO_6 124
#define DO_BAGO_6 125
#define DO_MAGO_6 126
#define DO_RAGO_6 127
#define DO_WAGO_6 128
#define DO_1DAN_3 130
#define DO_KAGO_3 131
#define DO_GAGO_3 132
#define DO_SAGO_3 133
#define DO_TAGO_3 134
#define DO_BAGO_3 135
#define DO_MAGO_3 136
#define DO_RAGO_3 137
#define DO_WAGO_3 138
#define DO_1DAN_4 140
#define DO_KAGO_4 141
#define DO_GAGO_4 142
#define DO_SAGO_4 143
#define DO_TAGO_4 144
#define DO_BAGO_4 145
#define DO_MAGO_4 146
#define DO_RAGO_4 147
#define DO_WAGO_4 148
#define DO_KAGO_7 151
#define DO_GAGO_7 152
#define DO_SAGO_7 153
#define DO_TAGO_7 154
#define DO_BAGO_7 155
#define DO_MAGO_7 156
#define DO_RAGO_7 157
#define DO_WAGO_7 158
#define DO_KAGO_8 161
#define DO_GAGO_8 162
#define DO_SAGO_8 163
#define DO_TAGO_8 164
#define DO_BAGO_8 165
#define DO_MAGO_8 166
#define DO_RAGO_8 167
#define DO_WAGO_8 168
#define SP_SA_MI1 171
#define SP_SA_MI2 172
#define SP_SA_YOU 173
#define SP_SA_SYU 174
#define SP_SA_KAT 175
#define SP_SA_ME1 176
#define SP_SA_ME2 177
#define SP_KA_MIZ 178
#define SP_KA_YOU 179
#define SP_KA_SYU 180
#define SP_KA_KAT 181
#define SP_KA_MEI 182
#define TEINEI1 183
#define TEINEI2 184
#define SP_KA_ONB 185
#define SP_FUKUSI 186
#define AISATU 187
#define SP_KEIYOUSI 188
#define TANKANJI 189
#define IKKATU 200
#endif

53
include/sj_kcnv.h Normal file
View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_kcnv.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:10 $
*/
#include <stdio.h>
#include <sys/param.h>
#include "sj_typedef.h"
#include "sj_rename.h"
#include "sj_const.h"
#include "sj_var.h"
#include "sj_dict.h"
#include "sj_study.h"
#include "sj_table.h"
#include "sj_struct.h"
#include "Const.h"
#include "Struct.h"
#include "sj_global.h"
#include "sj_define.h"

286
include/sj_left.h Normal file
View file

@ -0,0 +1,286 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_left.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:12 $
*/
#ifndef _SJ_LEFT
#define _SJ_LEFT
#define L_WO 0x01
#define L_TTATTE 0x02
#define L_TTARA 0x03
#define L_TTE1 0x04
#define L_TTE2 0x05
#define L_PPANASI 0x06
#define L_PPOI 0x07
#define L_UE 0x08
#define L_UTI 0x09
#define L_OITE 0x0a
#define L_OKERU 0x0b
#define L_ORI 0x0c
#define L_KA1 0x0d
#define L_KA2 0x0e
#define L_KAI 0x0f
#define L_KASIRA 0x10
#define L_KATAGATA 0x11
#define L_KADOUKA 0x12
#define L_KANA 0x13
#define L_KANE 0x14
#define L_KAMO 0x15
#define L_KARA1 0x16
#define L_KARA2 0x17
#define L_GA1 0x18
#define L_GA2 0x19
#define L_GATERA 0x1a
#define L_KIRI 0x1b
#define L_KUSENI 0x1c
#define L_KURAI 0x1d
#define L_GURUMI 0x1e
#define L_KEDO 0x1f
#define L_KOSO 0x20
#define L_KOTO 0x21
#define L_SA2 0x22
#define L_SAE 0x23
#define L_SI2 0x24
#define L_SIKA 0x25
#define L_SURA 0x26
#define L_ZUTU 0x27
#define L_ZO 0x28
#define L_TAME 0x29
#define L_DAKE 0x2a
#define L_DANO 0x2b
#define L_DARAKE 0x2c
#define L_TUITE 0x2d
#define L_TUKI 0x2e
#define L_TUTU 0x2f
#define L_TUMORI 0x30
#define L_TE1 0x31
#define L_TE2 0x32
#define L_TERU 0x33
#define L_DEAROU 0x34
#define L_DERU 0x35
#define L_TO1 0x36
#define L_TO2 0x37
#define L_TOTTE 0x38
#define L_TOIU 0x39
#define L_TOORI 0x3a
#define L_TOKI 0x3b
#define L_TOKORO 0x3c
#define L_TOTE 0x3d
#define L_TOHAIE 0x3e
#define L_TOMO 0x3f
#define L_DO 0x40
#define L_DOORI 0x41
#define L_DOKORO 0x42
#define L_DOKOROKA 0x43
#define L_DOMO 0x44
#define L_NA1 0x45
#define L_NAA 0x46
#define L_NAGARA 0x47
#define L_NAZO 0x48
#define L_NADO 0x49
#define L_NARI 0x4a
#define L_NANKA 0x4b
#define L_NANZO 0x4c
#define L_NANTE 0x4d
#define L_NI1 0x4e
#define L_NI2 0x4f
#define L_NI3 0x50
#define L_NITE 0x51
#define L_NIMO 0x52
#define L_NE1 0x53
#define L_NEE 0x54
#define L_NO1 0x55
#define L_NO2 0x56
#define L_NODE 0x57
#define L_NONI 0x58
#define L_NOMI 0x59
#define L_NOMINRZ 0x5a
#define L_HA 0x5b
#define L_HAZU 0x5c
#define L_BA 0x5d
#define L_BAKARI 0x5e
#define L_HE 0x5f
#define L_HOU 0x60
#define L_HOKA 0x61
#define L_HODO 0x62
#define L_MADE 0x63
#define L_MAMA 0x64
#define L_MO1 0x65
#define L_MO2 0x66
#define L_MOTTE 0x67
#define L_MONO 0x68
#define L_YA1 0x69
#define L_YA2 0x6a
#define L_YARA 0x6b
#define L_YUE 0x6c
#define L_YO 0x6d
#define L_YORI 0x6e
#define L_WA 0x6f
#define L_WAKE 0x70
#define L_WANE 0x71
#define L_WAYO 0x72
#define L_NN1 0x73
#define L_JYA 0x74
#define L_TYA 0x75
#define L_NAGARA2 0x76
#define L_WO_S 0x77
#define L_ZE 0x79
#define L_KKE 0x7a
#define L_N_SI 0x7b
#define L_DEHA 0x7c
#define L_GOTOSI 0x81
#define L_SASERU 0x82
#define L_ZARU 0x83
#define L_ZU 0x84
#define L_ZUNBA 0x85
#define L_SERU 0x86
#define L_SOUDA 0x87
#define L_YOUTAI 0x88
#define L_DENBUN 0x89
#define L_TA 0x8a
#define L_TAI 0x8b
#define L_TAGARU 0x8c
#define L_TARU 0x8d
#define L_DA1 0x8e
#define L_DA2 0x8f
#define L_DAXTU 0x90
#define L_DAROU 0x91
#define L_DE 0x92
#define L_DESI 0x93
#define L_DESHO 0x94
#define L_DESU 0x95
#define L_NA2 0x96
#define L_NARA 0x97
#define L_NAI 0x98
#define L_NU 0x99
#define L_NE2 0x9a
#define L_NN2 0x9b
#define L_FUUDA 0x9c
#define L_BESI 0x9d
#define L_MAI 0x9e
#define L_MASU 0x9f
#define L_MASURE 0xa0
#define L_MASE 0xa1
#define L_MITAIDA 0xa2
#define L_YOU 0xa3
#define L_YOUDA 0xa4
#define L_RASII 0xa5
#define L_RARERU 0xa6
#define L_RERU 0xa7
#define L_SITE 0xa8
#define L_YOUGEN 0xa9
#define L_ARU 0xaa
#define L_ARA 0xab
#define L_ARI1 0xac
#define L_ARI2 0xad
#define L_ARI3 0xae
#define L_ARE1 0xaf
#define L_ARE2 0xb0
#define L_AROU 0xb1
#define L_II 0xb2
#define L_ITASI 0xb3
#define L_ITADAKU 0xb4
#define L_IRU 0xb5
#define L_ERU 0xb6
#define L_KAKERU 0xb7
#define L_KANERU 0xb8
#define L_KARAZU 0xb9
#define L_GATAI 0xba
#define L_GATIDA 0xbb
#define L_KUDASARU 0xbc
#define L_GOZAI 0xbd
#define L_SA1 0xbe
#define L_SI1 0xbf
#define L_SIRO 0xc0
#define L_JYAU 0xc1
#define L_JIMAU 0xc2
#define L_SUGIRU 0xc3
#define L_SUBESI 0xc4
#define L_SURU 0xc5
#define L_SURE 0xc6
#define L_SE 0xc7
#define L_SEYO 0xc8
#define L_TAMAU 0xc9
#define L_TYAU 0xca
#define L_TIMAU 0xcb
#define L_DEKIRU 0xcc
#define L_NARU 0xcd
#define L_NASAI 0xce
#define L_NASARU 0xcf
#define L_NIKUI 0xd0
#define L_YASUI 0xd1
#define L_YOI 0xd2
#define L_YORU 0xd3
#define L_TTARASII 0xd4
#endif

81
include/sj_prty.h Normal file
View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_prty.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:13 $
*/
#ifndef _SJ_PRIORITY
#define _SJ_PRIORITY
#define RENTAI 0x10
#define GETPRI 0x0f
#define P_FUKA 1
#define P_TANKAN 1
#define P_SHUUSI 2
#define P_MEIREI 2
#define P_KATEI 2
#define P_KAMEI 2
#define P_DAIMEISI 4
#define P_MEISI 6
#define P_KEISIKI 4
#define P_RENYOU_F 3
#define P_RENYOU_J 11
#define P_RENYOU_M 12
#define P_JOSHI_F 3
#define P_JOSHI_E 4
#define P_JOSHI_D 6
#define P_JOSHI_C 7
#define P_JOSHI_B 8
#define P_JOSHI_A 9
#define P_SETTOU 6
#define P_SETUBI 6
#define P_SUUSI 4
#define P_FUKUSI 13
#define P_F_FUKUSI 10
#define P_RENTAISI 10
#define P_KANDOU 6
#define P_SETUZOKU 14
#define P_FZKKGU 9
#define P_JOSUUSI 10
#endif

573
include/sj_rename.h Normal file
View file

@ -0,0 +1,573 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_rename.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:14 $
*/
#ifndef _SJ_RENAME
#define _SJ_RENAME
#define adddic Jadddic
#define checksub Jchecksub
#define checkdict Jcheckdict
#define cal_nextym Jcal_nextym
#define cmpknj Jcmpknj
#define usr_freelen Jusr_freelen
#define sprt_seg Jsprt_seg
#define apnd_uidx Japnd_uidx
#define set_size Jset_size
#define isvyomi Jisvyomi
#define isvknj Jisvknj
#define isgrm Jisgrm
#define addel_arg Jaddel_arg
#define yomi2kata Jyomi2kata
#define top_strcmp Jtop_strcmp
#define last_strcmp Jlast_strcmp
#define cvtknj Jcvtknj
#define srchkana Jsrchkana
#define srchgram Jsrchgram
#define srchkanji Jsrchkanji
#define count_uidx Jcount_uidx
#define chg_uidx Jchg_uidx
#define cl2knj Jcl2knj
#define nextcl Jnextcl
#define nextrecblk Jnextrecblk
#define prevcl Jprevcl
#define prevrecblk Jprevrecblk
#define initkbuf Jinitkbuf
#define selectnum Jselectnum
#define kouhonum Jkouhonum
#define clstudy Jclstudy
#define delcldata Jdelcldata
#define delclsub Jdelclsub
#define delclold Jdelclold
#define srchclpos Jsrchclpos
#define mkclidx Jmkclidx
#define cvtclknj Jcvtclknj
#define cvtdict Jcvtdict
#define cvtminasi Jcvtminasi
#define cvtwakachi Jcvtwakachi
#define cvtphknj Jcvtphknj
#define cvtkouho Jcvtkouho
#define setstyrec Jsetstyrec
#define deldic Jdeldic
#define del_douon Jdel_douon
#define del_segment Jdel_segment
#define del_uidx Jdel_uidx
#define del_stdy Jdel_stdy
#define get_askknj Jget_askknj
#define seldict Jseldict
#define sel_udict Jsel_udict
#define get_idxofs Jget_idxofs
#define get_idxptr Jget_idxptr
#define fzkstrcmp Jfzkstrcmp
#define setclrec Jsetclrec
#define fzkcnct Jfzkcnct
#define srchfzk Jsrchfzk
#define getkan_none Jgetkan_none
#define getkan_hira Jgetkan_hira
#define getkan_kata Jgetkan_kata
#define getkan_knj Jgetkan_knj
#define getkan_ofs Jgetkan_ofs
#define getkan_norm Jgetkan_norm
#define code2kanji Jcode2kanji
#define getkanji Jgetkanji
#define getrank Jgetrank
#define setstynum Jsetstynum
#define setnspr Jsetnspr
#define regetrank Jregetrank
#define work_base Jwork_base
#define stdy_base Jstdy_base
#define maxjptr (work_base -> Jmaxjptr)
#define maxclptr (work_base -> Jmaxclptr)
#define jrt1st (work_base -> Jjrt1st)
#define clt1st (work_base -> Jclt1st)
#define jrt2nd (work_base -> Jjrt2nd)
#define clt2nd (work_base -> Jclt2nd)
#define selcl (work_base -> Jselcl)
#define selectid (work_base -> Jselectid)
#define trank (work_base -> Jtrank)
#define nrank (work_base -> Jnrank)
#define buninf (work_base -> Jbuninf)
#define buncnt (work_base -> Jbuncnt)
#define knjnew (work_base -> Jknjnew)
#define knjidx (work_base -> Jknjidx)
#define knjmax (work_base -> Jknjmax)
#define score (work_base -> Jscore)
#define pathnum (work_base -> Jpathnum)
#define usedpath (work_base -> Jusedpath)
#define inputyomi (work_base -> Jinputyomi)
#define cnvstart (work_base -> Jcnvstart)
#define cnvlen (work_base -> Jcnvlen)
#define ystart (work_base -> Jystart)
#define hyomi (work_base -> Jhyomi)
#define orgyomi (work_base -> Jorgyomi)
#define kanjibuf (work_base -> Jkanjibuf)
#define kanjipos (work_base -> Jkanjipos)
#define kanjitmp (work_base -> Jkanjitmp)
#define kanjilen (work_base -> Jkanjilen)
#define dicinl (work_base -> Jdicinl)
#define dicsaml (work_base -> Jdicsaml)
#define prevseg (work_base -> Jprevseg)
#define fzkcount (work_base -> Jfzkcount)
#define fzk_ka_flg (work_base -> Jfzk_ka_flg)
#define fzktbl (work_base -> Jfzktbl)
#define headcode (work_base -> Jheadcode)
#define headlen (work_base -> Jheadlen)
#define gobilen (work_base -> Jgobilen)
#define prevclgrm (work_base -> Jprevclgrm)
#define prevclrow (work_base -> Jprevclrow)
#define nextcllen (work_base -> Jnextcllen)
#define khcount (work_base -> Jkhcount)
#define nkhcount (work_base -> Jnkhcount)
#define kouhotbl (work_base -> Jkouhotbl)
#define stdytop (work_base -> Jstdytop)
#define curdict (work_base -> Jcurdict)
#define dictlist (work_base -> Jdictlist)
#define dicbuf (work_base -> Jdicbuf)
#define idxbuf (work_base -> Jidxbuf)
#define idxofs (work_base -> Jidxofs)
#define askknj (work_base -> Jaskknj)
#define askknj_k (work_base -> Jaskknj_k)
#define grp_ptr (work_base -> Jgrp_ptr)
#define grp_seg (work_base -> Jgrp_seg)
#define grp_grp (work_base -> Jgrp_grp)
#define suuji_wbuf (work_base -> Jsuuji_wbuf)
#define suuji_ubuf (work_base -> Jsuuji_ubuf)
#define suuji_class (work_base -> Jsuuji_class)
#define suuji_comma (work_base -> Jsuuji_comma)
#define suuji_keta (work_base -> Jsuuji_keta)
#define suuji_yptr (work_base -> Jsuuji_yptr)
#define suuji_len (work_base -> Jsuuji_len)
#define suuji_exit (work_base -> Jsuuji_exit)
#define suuji_wkeep (work_base -> Jsuuji_wkeep)
#define suuji_ukeep (work_base -> Jsuuji_ukeep)
#define peepyomi (work_base -> Jpeepyomi)
#define peepknj (work_base -> Jpeepknj)
#define peepgrm (work_base -> Jpeepgrm)
#define peepdptr (work_base -> Jpeepdptr)
#define peephptr (work_base -> Jpeephptr)
#define peepkptr (work_base -> Jpeepkptr)
#define peepidx (work_base -> Jpeepidx)
#define seg_count Jseg_count
#define mkidxtbl Jmkidxtbl
#define initwork Jinitwork
#define free_jlst Jfree_jlst
#define free_clst Jfree_clst
#define free_clall Jfree_clall
#define free_jall Jfree_jall
#define freework Jfreework
#define free_kjall Jfree_kjall
#define set2nd Jset2nd
#define mk2claus Jmk2claus
#define mkbunsetu Jmkbunsetu
#define argclrec Jargclrec
#define mkjiritu Jmkjiritu
#define dic_mu Jdic_mu
#define argjrec Jargjrec
#define dic_cl Jdic_cl
#define mkkouho Jmkkouho
#define getkhtbl Jgetkhtbl
#define cl_kanji Jcl_kanji
#define sameknj Jsameknj
#define skipatr Jskipatr
#define diffknj Jdiffknj
#define chrck_numtbl Jchrck_numtbl
#define sel_sjmode Jsel_sjmode
#define cl_numcmn Jcl_numcmn
#define word2char Jword2char
#define words2num Jwords2num
#define num_type00 Jnum_type00
#define num_type01 Jnum_type01
#define num_type02 Jnum_type02
#define num_type03 Jnum_type03
#define num_type04 Jnum_type04
#define num_type05 Jnum_type05
#define num_type06 Jnum_type06
#define num_type07 Jnum_type07
#define kan_num Jkan_num
#define num_type08 Jnum_type08
#define num_type09 Jnum_type09
#define num_type10 Jnum_type10
#define num_type11 Jnum_type11
#define num_type12 Jnum_type12
#define num_kurai Jnum_kurai
#define num_type13 Jnum_type13
#define num_type14 Jnum_type14
#define getusr Jgetusr
#define nextusr Jnextusr
#define prevusr Jprevusr
#define set_kanji Jset_kanji
#define set_buf Jset_buf
#define prev_kanji Jprev_kanji
#define prev_hinsi Jprev_hinsi
#define prev_douon Jprev_douon
#define next_kanji Jnext_kanji
#define next_hinsi Jnext_hinsi
#define next_douon Jnext_douon
#define add_yomi Jadd_yomi
#define cd2sjh_chr Jcd2sjh_chr
#define ph2knj Jph2knj
#define ph_setsty Jph_setsty
#define nextkptr Jnextkptr
#define maxpset Jmaxpset
#define mkknjmax Jmkknjmax
#define ph_khtbl Jph_khtbl
#define isfukusi Jisfukusi
#define istaigen Jistaigen
#define taicnt Jtaicnt
#define sttcnt Jsttcnt
#define priority Jpriority
#define pritiny Jpritiny
#define selclrec Jselclrec
#define initknjall Jinitknjall
#define knjtouroku Jknjtouroku
#define knjitti Jknjitti
#define hikakusub Jhikakusub
#define knjhikaku Jknjhikaku
#define setgroupai Jsetgroupai
#define select_dsub Jselect_dsub
#define select_tsub Jselect_tsub
#define select_ysub Jselect_ysub
#define selectknj Jselectknj
#define selknj Jselknj
#define cnjstrcmp Jcnjstrcmp
#define cnvrow Jcnvrow
#define setconj Jsetconj
#define setj_atrb Jsetj_atrb
#define setj_ofs Jsetj_ofs
#define setj_knj Jsetj_knj
#define setj_norm1 Jsetj_norm1
#define setj_norm2 Jsetj_norm2
#define chkhead Jchkhead
#define setjrec Jsetjrec
#define setnumrec Jsetnumrec
#define setcrec Jsetcrec
#define setkouho Jsetkouho
#define ph_setkouho Jph_setkouho
#define hiraknj Jhiraknj
#define hiraknj_atrb Jhiraknj_atrb
#define hiraknj_ofs Jhiraknj_ofs
#define hiraknj_knj Jhiraknj_knj
#define hiraknj_hask Jhiraknj_hask
#define hiraknj_kask Jhiraknj_kask
#define hiraknj_norm Jhiraknj_norm
#define hiraknj_hira Jhiraknj_hira
#define getstb Jgetstb
#define setubi Jsetubi
#define sj2cd_chr Jsj2cd_chr
#define sj2cd_str Jsj2cd_str
#define retaiofs Jretaiofs
#define srchai2nd Jsrchai2nd
#define srchai1st Jsrchai1st
#define srchai4th Jsrchai4th
#define srchai3rd Jsrchai3rd
#define srchai6th Jsrchai6th
#define srchai5th Jsrchai5th
#define yomicmp_sub Jyomicmp_sub
#define yomicmp Jyomicmp
#define srchdict Jsrchdict
#define srchg_atrb Jsrchg_atrb
#define srchg_ofs Jsrchg_ofs
#define srchg_knj Jsrchg_knj
#define srchg_norm1 Jsrchg_norm1
#define srchg_norm2 Jsrchg_norm2
#define srchgrp2nd Jsrchgrp2nd
#define srchgrp1st Jsrchgrp1st
#define srchhead Jsrchhead
#define srchidx Jsrchidx
#define srch_josuu_sub Jsrch_josuu_sub
#define srch_josuu Jsrch_josuu
#define setnrec_sub Jsetnrec_sub
#define setnrec Jsetnrec
#define srchtbl Jsrchtbl
#define isconnect Jisconnect
#define string_cmp Jstring_cmp
#define check_num Jcheck_num
#define srch_number1 Jsrch_number1
#define srch_kurai1 Jsrch_kurai1
#define srch_kurai2 Jsrch_kurai2
#define srch_number2 Jsrch_number2
#define srchnum_sub Jsrchnum_sub
#define srchnum Jsrchnum
#define setwdnum Jsetwdnum
#define setucnum Jsetucnum
#define study Jstudy
#define srchstdy Jsrchstdy
#define terminate Jterminate
#define wakachi Jwakachi
#define cmpstr Jcmpstr
#define hzstrlen Jhzstrlen
#define istrcmp Jistrcmp
#define memcpy Jmemcpy
#define sstrncpy Jsstrncpy
#define memset Jmemset
#define mvmemd Jmvmemd
#define mvmemi Jmvmemi
#define skiphblk Jskiphblk
#define skipkstr Jskipkstr
#define sstrcmp Jsstrcmp
#define sstrlen Jsstrlen
#define sstrncmp Jsstrncmp
#define charsize Jcharsize
#define chrtbl Jchrtbl
#define conjadr Jconjadr
#define connadr Jconnadr
#define rigtadr Jrigtadr
#define cvtnum_func Jcvtnum_func
#define getkan_func Jgetkan_func
#define setjrec_func Jsetjrec_func
#define srchg_func Jsrchg_func
#define hiraknj_func Jhiraknj_func
#define fzkadr Jfzkadr
#define taipri Jtaipri
#define sttpri Jsttpri
#define kigou Jkigou
#define selsjadrs Jselsjadrs
#define stbadr Jstbadr
#define settou_ptr Jsettou_ptr
#define scncttbl Jscncttbl
#define suuji_tbl Jsuuji_tbl
#define kurai1_tbl Jkurai1_tbl
#define kurai2_tbl Jkurai2_tbl
#define num1tbl Jnum1tbl
#define num2tbl Jnum2tbl
#define num3tbl Jnum3tbl
#define num4tbl Jnum4tbl
#define num5tbl Jnum5tbl
#define num6tbl Jnum6tbl
#define termtbl Jtermtbl
#endif

373
include/sj_right.h Normal file
View file

@ -0,0 +1,373 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_right.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:15 $
*/
#ifndef _SJ_RIGHT
#define _SJ_RIGHT
#define R_DE 1
#define R_WO 2
#define R_KARA1 3
#define R_GA1 4
#define R_TO1 5
#define R_NI1 6
#define R_NO1 7
#define R_HA 8
#define R_HE 9
#define R_MO1 10
#define R_YA1 11
#define R_YORI1 12
#define R_SAE 13
#define R_SIKA 14
#define R_DAKE 15
#define R_I 16
#define R_E 17
#define R_KAKE 18
#define R_KANE2 19
#define R_SUGI 20
#define R_DEKI 21
#define R_MI 22
#define R_SASE 23
#define R_RARE 24
#define R_ITADAKE 25
#define R_EXP 26
#define R_RENYOU1 27
#define R_RENYOU5 28
#define R_SA5RENYOU1 29
#define R_RENYOU3 30
#define R_RENYOU7 31
#define R_SA5RENYOU3 32
#define R_RENYOU4 33
#define R_RENYOU8 34
#define R_SA5RENYOU4 35
#define R_KRENYOU 39
#define R_DRENYOU1 40
#define R_DRENYOU2 41
#define R_DRENYOU3 42
#define R_ONBIN1 43
#define R_ONBIN2 44
#define R_ONBIN3 45
#define R_DESHI 46
#define R_AXTU 47
#define R_ONBIN6 48
#define R_ONBIN8 49
#define R_ARI1 50
#define R_ARI2 51
#define R_ARI3 52
#define R_IKI 53
#define R_ITASI 54
#define R_ITADAKI 55
#define R_ORI2 56
#define R_GATAKU 57
#define R_KI 58
#define R_KUDASAI 59
#define R_GOZAI 60
#define R_GOTOKU 61
#define R_BEKU 62
#define R_SOUDE 63
#define R_SOUNI 64
#define R_TAGARI 65
#define R_TAKU 66
#define R_MIZEN1 67
#define R_NAIDE 68
#define R_NAKU 69
#define R_NASAI 70
#define R_FUUNI 71
#define R_YORI2 72
#define R_RASHUU 73
#define R_DSHUUSI1 74
#define R_DSHUUSI2 75
#define R_GOTOSI 76
#define R_BESI 77
#define R_ZU 78
#define R_SOUDA 79
#define R_MAI 80
#define R_MITAIDA 81
#define R_SHUUSI 82
#define R_KSHUUSI 83
#define R_ZARU 84
#define R_SOUDESU 85
#define R_TA 86
#define R_TAI 87
#define R_DESU 88
#define R_NAI 89
#define R_NU 90
#define R_MASU 91
#define R_NN2 92
#define R_RASII 93
#define R_DRENTAI1 94
#define R_DRENTAI2 95
#define R_DRENTAI3 96
#define R_KRENTAI 97
#define R_GOTOKI 98
#define R_BEKI 99
#define R_SOUNA1 100
#define R_SOUNA2 101
#define R_NA2 102
#define R_KATEI1 103
#define R_KATEI2 104
#define R_KATEI3 105
#define R_KAMEI 106
#define R_IKE 107
#define R_KURE 108
#define R_MEIREI1 109
#define R_MEIREI2 110
#define R_DGOKAN 111
#define R_KGOKAN 112
#define R_SGOKAN 113
#define R_GATI 114
#define R_JYA 115
#define R_SOU 116
#define R_MITAI 117
#define R_YOTTE 118
#define R_YOU2 119
#define R_SHO 120
#define R_FZKMEISI 121
#define R_AISATU 122
#define R_KOSODO 123
#define R_YOU1 124
#define R_HASI 125
#define R_DAIMEISI 126
#define R_DAIMEISI6 127
#define R_FZKKI 128
#define R_DEHA 129
#define R_NAGARA2 130
#define R_WO_S 131
#define R_WO_MEISI 132
#define R_SITE 133
#define R_N_SI 134
#define R_F_FUKUSI 135
#define R_CUT 137
#define R_MIZEN2 140
#define R_MIZEN3 141
#define R_MIZEN4 142
#define R_SI1 143
#define R_JI 144
#define R_AGE 145
#define R_MIZEN5 146
#define R_AROU 147
#define R_KAROU 148
#define R_DAROU 149
#define R_DESHOU 150
#define R_KO 151
#define R_BEKARA 152
#define R_TAGARA 153
#define R_SHUUJO 154
#define R_TTATTE 155
#define R_TTARA 156
#define R_TTE1 157
#define R_TTE2 158
#define R_PPANASI 159
#define R_PPOI 160
#define R_UE 161
#define R_UTI 162
#define R_OITE 163
#define R_OKERU 164
#define R_ORI1 165
#define R_KA1 166
#define R_KA2 167
#define R_KATAGATA 168
#define R_KADOUKA 169
#define R_KAMO 170
#define R_KARA2 171
#define R_GA2 172
#define R_GATERA 173
#define R_KIRI 174
#define R_KUSENI 175
#define R_KURAI 176
#define R_GURUMI 177
#define R_KEDO 178
#define R_KOSO 179
#define R_KOTO 180
#define R_SI2 181
#define R_SURA 182
#define R_ZUTU 183
#define R_TAME 184
#define R_TARI 185
#define R_DANO 186
#define R_DARAKE 187
#define R_TUITE 188
#define R_TUKI 189
#define R_TUTU 190
#define R_TUMORI 191
#define R_TE1 192
#define R_TE2 193
#define R_TERU 194
#define R_TO2 195
#define R_TOTTE 196
#define R_TOIU 197
#define R_TOORI 198
#define R_TOKI 199
#define R_TOKORO 200
#define R_TOTE 201
#define R_TOHAIE 202
#define R_TOMO 203
#define R_DO 204
#define R_DOORI 205
#define R_DOKORO 206
#define R_DOKOROKA 207
#define R_DOMO 208
#define R_NAGARA 209
#define R_NAZO 210
#define R_NADO 211
#define R_NARI 212
#define R_NANKA 213
#define R_NANZO 214
#define R_NANTE 215
#define R_NI2 216
#define R_NI3 217
#define R_NITE 218
#define R_NIMO 219
#define R_NO2 220
#define R_NODE 221
#define R_NONI 222
#define R_NOMI 223
#define R_NOMINRZ 224
#define R_HAZU 225
#define R_BA 226
#define R_BAKARI 227
#define R_HOU 228
#define R_HOKA 229
#define R_HODO 230
#define R_MADE 231
#define R_MAMA 232
#define R_MO2 233
#define R_MOTTE 234
#define R_MONO 235
#define R_YA2 236
#define R_YARA 237
#define R_YUE 238
#define R_WAKE 239
#define R_NN1 240
#define R_SUUSI 241
#define R_SETUZOKU 242
#define R_KANDOU 243
#define R_SETTOU 244
#define R_FUKUSI 245
#define R_FZKKGU 246
#define R_MEISI 247
#define R_DMEISI 248
#define R_SMEISI1 249
#define R_SMEISI2 250
#define R_KSTB 251
#define R_ICHISETUBI 252
#define R_JOSUUSI 253
#define R_RENTAISI 254
#define R_TANKAN 255
#endif

200
include/sj_struct.h Normal file
View file

@ -0,0 +1,200 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_struct.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:16 $
*/
#ifndef _SJ_STRUCT
#define _SJ_STRUCT
typedef struct jiritu {
struct jiritu *jsort;
TypeDicSeg jseg;
TypeDicOfs jofsst;
TypeDicOfs jofsed;
Ushort flags;
TypeClass class;
TypeDicID dicid;
Uchar jlen;
TypeGram hinsi;
Uchar sttofs;
Uchar stbofs;
Uchar count;
Uchar numlen;
} JREC;
typedef struct bunsetu {
JREC *jnode;
struct bunsetu *clsort;
Uchar gobiln;
Uchar cllen;
TypeCnct right;
Uchar cl2len;
Uchar kubun;
#if __STDC__
unsigned fzk_ka : 1;
#else
Uchar fzk_ka : 1;
#endif
} CLREC;
typedef struct kouho {
CLREC *clrec;
TypeDicOfs offs;
TypeStyNum styno;
Uchar rank;
#if __STDC__
unsigned sttfg : 1;
unsigned sttkj : 1;
unsigned ka_fg : 1;
unsigned ka_kj : 1;
unsigned mode : 4;
#else
Uchar sttfg : 1;
Uchar sttkj : 1;
Uchar ka_fg : 1;
Uchar ka_kj : 1;
Uchar mode : 4;
#endif
} KHREC;
typedef struct conj {
Uchar len;
TypeCnct right;
} CREC;
typedef struct fuzoku {
Uchar *yomip;
Uchar TFar *fzkp;
} FREC;
typedef struct study_in {
TypeDicOfs offset;
TypeDicSeg seg;
TypeStyNum styno;
TypeDicID dicid;
#if __STDC__
unsigned sttkj : 1;
unsigned ka_kj : 1;
unsigned nmflg : 1;
#else
Uchar sttkj : 1;
Uchar ka_kj : 1;
Uchar nmflg : 1;
#endif
} STDYIN;
typedef struct study_out {
STDYIN stdy1;
TypeGram hinshi;
Uchar len;
#if __STDC__
unsigned sttlen : 2;
unsigned sttfg : 1;
unsigned ka_fg : 1;
#else
Uchar sttlen : 2;
Uchar sttfg : 1;
Uchar ka_fg : 1;
#endif
} STDYOUT;
typedef struct dict {
TypeDicID dicid;
TypeIdxOfs idxlen;
TypeDicOfs seglen;
TypeDicSeg segunit;
TypeDicSeg maxunit;
IFunc getofs;
IFunc getidx;
IFunc getdic;
IFunc putidx;
IFunc putdic;
IFunc rszdic;
} DICT;
typedef struct dictl {
DICT *dict;
struct dictl *next;
} DICTL;
typedef struct stdy {
Short stdycnt;
Short stdymax;
STDYIN *stdydic;
Short clstdystep;
Ushort *clstdyidx;
Short clstdylen;
Uchar *clstdydic;
} STDY;
#endif

121
include/sj_study.h Normal file
View file

@ -0,0 +1,121 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_study.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:18 $
*/
#ifndef _SJ_STUDY
#define _SJ_STUDY
#define StudyExist() (stdy_base)
#define StudyCount (stdy_base -> stdycnt)
#define StudyMax (stdy_base -> stdymax)
#define StudyDict (stdy_base -> stdydic)
#define ClStudyIdx (stdy_base -> clstdyidx)
#define ClStudyStep (stdy_base -> clstdystep)
#define ClStudyLen (stdy_base -> clstdylen)
#define ClStudyDict (stdy_base -> clstdydic)
#define StudyTail (StudyDict + StudyMax)
#define StudyRecSize (sizeof(STDYIN))
#define ClStudyTail (ClStudyDict + ClStudyLen)
#define StudyNormEnd 0
#define StudyNoDict 1
#define StudyFullArea 2
#define StudyNotStudy 3
#define StudyError 4
#define CLSTDY_TMPLEN 256
#define ClstudyNormEnd 0
#define ClstudyNoDict 1
#define ClstudyParaErr 2
#define ClstudyYomiErr 3
#define ClstudyNoArea 4
#define CL_YLEN 0
#define CL_GRAM2 1
#define CL_Y1LEN 2
#define CL_NUMH 3
#define CL_NUML 4
#define CL_YDATA 5
#define CL_HDLEN 5
#define iseocl(p) ( !ClYomiLen(p) || (Uchar *)(p) >= ClStudyTail )
#define ClGramCode(p) *((p) + CL_GRAM2)
#define ClYomiLen(p) *((p) + CL_YLEN)
#define ClYomi1Len(p) *((p) + CL_Y1LEN)
#define ClHighNum(p) *(p + CL_NUMH)
#define ClLowNum(p) *(p + CL_NUML)
#define ClGetNum(p) (ClHighNum(p) * 0x100 + ClLowNum(p))
#define ClSetNum(p, n) (ClHighNum(p)=(Uchar)((n) >> 8), ClLowNum(p)=(Uchar)(n))
#define ClYomiPos(p) ((p) + CL_YDATA)
#define ClBlkLen(p) (ClYomiLen(p) + CL_HDLEN)
#define ClNextTag(p) ((p) + ClBlkLen(p))
#endif

146
include/sj_suuji.h Normal file
View file

@ -0,0 +1,146 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_suuji.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:19 $
*/
#ifndef _SJ_SUUJI
#define _SJ_SUUJI
#define SjTblRecLen 6
#define SjTblRecNum 34
#define SjTblYPos(p) (p)
#define SjTblYLen 3
#define SjTblModeP(p) (p + 3)
#define SjTblNumber(md) ((md) & 0x0f)
#define SjTblNArabiaF 0x80
#define SjTblNYomiF 0x40
#define SjTblNNarabiF 0x20
#define SjTblNNanSuuF 0x10
#define SjTblNCont(md) (md & SjTblNContF)
#define SjTblCnctP(p) (p + 4)
#define Kr1TblRecLen 5
#define Kr1TblRecNum 10
#define Kr1TblYPos(p) (p)
#define Kr1TblYLen 3
#define Kr1TblModeP(p) (p + 3)
#define Kr1TblTopF 0x80
#define Kr1TblTop(md) (md & Kr1TblTopF)
#define Kr1TblKeta(md) (((md) >> 4) & 7)
#define Kr1TblCnct(md) ((md) & 0x0f)
#define Kr1TblCnctP(p) (p + 3)
#define Kr2TblRecLen 4
#define Kr2TblRecNum 3
#define Kr2TblYPos(p) (p)
#define Kr2TblYLen 3
#define Kr2TblModeP(p) (p + 3)
#define Kr2TblCnct(md) ((md) & 0x0f)
#define Kr2TblKeta(md) (((md) >> 4) & 0x0f)
#define _Num0 0x01
#define _Num1 0x02
#define _Num2 0x03
#define _Num3 0x04
#define _Num4 0x05
#define _Num5 0x06
#define _Num6 0x07
#define _Num7 0x08
#define _Num8 0x09
#define _Num9 0x0a
#define _Num1S 0x0b
#define _NumS 0x0c
#define _NumN 0x0d
#define CommaHigh 0xa1
#define CommaLow 0xa4
#define SelArb 1
#define SelArb0 2
#define SelArbCma 3
#define SelKanSj0 5
#define SelKanSj20 8
#define SelKanSjYm 9
#define SelKanSjYm2 10
#define SelLongArb 11
#define SelLongArbCma 12
#define SelLongSj 13
#define SelArbKr 14
#define SelKanSjKr 15
#define SelNumTerm 0xffff
#define SelKanSj 4
#define SelKanSj2 7
#define SelKanSjCma 6
#define SelNum0123 (JFLAG_N01 | JFLAG_N23)
#define SelNum1_23_10_1 (JFLAG_N_1 | JFLAG_N23 | JFLAG_N10 | JFLAG_NS1)
#define SelNumMust (JFLAG_NK2 | JFLAG_NK4 | JFLAG_NN0 | JFLAG_NSN)
#define SelNumALL (JFLAG_N10 | JFLAG_N_1 | JFLAG_NS1 | JFLAG_N01 \
| JFLAG_N23 | JFLAG_NK2 | JFLAG_NK4 \
| JFLAG_NN0 | JFLAG_NSN)
#define SelNumFunc(c) ((c) & (~SelNumALL))
#define SelNumCond(c) ((c) & SelNumALL)
#define Number123456789NS ((1<<_Num1)|(1<<_Num2)|(1<<_Num3)|(1<<_Num4) \
|(1<<_Num5)|(1<<_Num6)|(1<<_Num7)|(1<<_Num8) \
|(1<<_Num9)|(1<<_Num1S)\
|(1<<_NumN)|(1<<_NumS))
#define Number0 (1<<_Num0)
#define Number1 ((1<<_Num1)|(1<<_Num1S))
#define NumberS1 (1<<_Num1S)
#define Number01 (Number0|Number1)
#define Number23 ((1<<_Num2)|(1<<_Num3))
#endif

67
include/sj_sysvdef.h Normal file
View file

@ -0,0 +1,67 @@
/*
* 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
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_sysvdef.h,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1995/02/10 06:02:25 $
*/
#ifndef _SJ_SYSVDEF
#define _SJ_SYSVDEF
#ifdef SYSV
#ifndef SVR4
#define SVR4
#endif
#endif
#ifdef SYSTYPE_SYSV
#ifndef SVR4
#define SVR4
#endif
#endif
#ifdef SVR4
#define SYSV_TERMIOS
#define SIGTYPE_VOID
#endif /* SVR4 */
#ifdef linux
#if !(defined (__GLIBC__) && (__GLIBC__ >= 2))
#define LACKOF_SETLOCALE
#endif
#define SYSV_TERMIOS
#define SYSV_UTMP
#define SIGTYPE_VOID
#endif /* linux */
#endif

138
include/sj_table.h Normal file
View file

@ -0,0 +1,138 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_table.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:21 $
*/
#ifndef _SJ_TABLE
#define _SJ_TABLE
#define isdpnd(c) (Chrtbl[c] & DEPEND)
#define CnjAskLen(p) (((unsigned int) *(p) & 0x70) >> 4)
#define CnjNkrLen(p) (*(p) & 0x0f)
#define CnjRight(p) *(p + CnjNkrLen(p) + 1)
#define CnjRecLen(p) (CnjNkrLen(p) + 2)
#define FzkAskLen(p) ((unsigned int) *(p) >> 5)
#define FzkNkrLen(p) (*(p) & 0x07)
#define FzkStrKa(p) (((unsigned int) *(p) >> 3) & 1)
#define FzkHasCode(p) (*(p) & 0x10)
#define FzkLeft(p) (*((p) + nlen + 1))
#define FzkRight(p) (*((p) + nlen + 2))
#define SttYomiLen(p) (*(p) & 0x0f)
#define SttHiraKnj(p) (*(p) & 0x80)
#define StbKnjLen(p) (*(p) & 0x07)
#define StbYomiLen(p) (*(p) >> 4)
#define StbYomiTop(p) ((p) + 2)
#define StbBakeru(p) (*(p) & 0x08)
#define StbHinsi(p) (*((p) + 1))
extern Uchar charsize[], chrtbl[], *conjadr[], connadr[];
extern Uchar *fzkadr[], kigou[], kurai1_tbl[], kurai2_tbl[];
extern Uchar num1tbl[], num2tbl[], num3tbl[], num4tbl[];
extern Uchar num5tbl[], num6tbl[], *rigtadr[], scncttbl[2][24];
extern Uchar *settou_ptr[], *stbadr[], sttpri[5][31];
extern Uchar suuji_tbl[], taipri[7][45], termtbl[];
extern Ushort *selsjadrs[];
extern UCPFunc getkan_func[], makekan_func[];
extern VFunc cvtnum_func[];
extern IFunc hiraknj_func[], setjrec_func[], srchg_func[];
#define Charsize charsize
#define Chrtbl chrtbl
#define Conjadr(i) conjadr[i]
#define Connadr connadr
#define Cvtnum_func cvtnum_func
#define Fzkadr(i) fzkadr[i]
#define Getkan_func getkan_func
#define Hiraknj_func hiraknj_func
#define Kigou kigou
#define Kurai1_tbl kurai1_tbl
#define Kurai2_tbl kurai2_tbl
#define Makekan_func makekan_func
#define Num1tbl num1tbl
#define Num2tbl num2tbl
#define Num3tbl num3tbl
#define Num4tbl num4tbl
#define Num5tbl num5tbl
#define Num6tbl num6tbl
#define Rigtadr(i) rigtadr[i]
#define Scncttbl(i, j) scncttbl[i][j]
#define Selsjadrs(i) selsjadrs[i]
#define Setjrec_func setjrec_func
#define Settou_ptr(i) settou_ptr[i]
#define Srchg_func srchg_func
#define Stbadr(i) stbadr[i]
#define Sttpri(i, j) sttpri[i][j]
#define Suuji_tbl suuji_tbl
#define Taipri(i, j) taipri[i][j]
#define Termtbl termtbl
#endif

88
include/sj_typedef.h Normal file
View file

@ -0,0 +1,88 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_typedef.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:22 $
*/
#ifndef _SJ_TYPEDEF
#define _SJ_TYPEDEF
#define RECURS
#define TFar
#define Far
#define Reg1 register
#define Reg2 register
#define Reg3 register
#define Reg4 register
#define Reg5 register
#define Reg6 register
#define Reg7 register
#define Reg8 register
#define Void void
#define Char char
#define Uchar unsigned char
#define Short short
#define Ushort unsigned short
#define Int int
#define Uint unsigned int
#define Long long
#define Ulong unsigned long
typedef Void (*VFunc)();
typedef Uchar *(*UCPFunc)();
typedef Int (*IFunc)();
#include <sys/types.h>
typedef Uchar TypeGroup;
typedef Uchar TypeGram;
typedef Ushort TypeIdxOfs;
typedef Short TypeDicSeg;
typedef Ushort TypeDicOfs;
typedef ino_t TypeDicID;
typedef Uchar TypeCnct;
typedef Ushort TypeStyNum;
typedef Uchar TypeClass;
typedef Uchar TypeBunNum;
#ifndef NULL
# define NULL 0
#endif
#endif

64
include/sj_var.h Normal file
View file

@ -0,0 +1,64 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_var.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:23 $
*/
#ifndef _SJ_VAR
#define _SJ_VAR
#define MaxKouhoNumber 255
#define MaxPhInputLen 256
#define MaxClInputLen 64
#define MinClOutputLen 512
#define MinPhOutputLen 288
#endif

217
include/sj_yomi.h Normal file
View file

@ -0,0 +1,217 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: sj_yomi.h,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:24 $
*/
#ifndef _SJ_YOMICODE
#define _SJ_YOMICODE
#define _TYOUON 0x01
#define _IGETA 0x02
#define _ATTO 0x03
#define _YUUBIN 0x04
#define N_0 0x10
#define N_1 0x11
#define N_2 0x12
#define N_3 0x13
#define N_4 0x14
#define N_5 0x15
#define N_6 0x16
#define N_7 0x17
#define N_8 0x18
#define N_9 0x19
#define A_A 0x1A
#define A_B 0x1B
#define A_C 0x1C
#define A_D 0x1D
#define A_E 0x1E
#define A_F 0x1F
#define A_G 0x20
#define A_H 0x21
#define A_I 0x22
#define A_J 0x23
#define A_K 0x24
#define A_L 0x25
#define A_M 0x26
#define A_N 0x27
#define A_O 0x28
#define A_P 0x29
#define A_Q 0x2A
#define A_R 0x2B
#define A_S 0x2C
#define A_T 0x2D
#define A_U 0x2E
#define A_V 0x2F
#define A_W 0x30
#define A_X 0x31
#define A_Y 0x32
#define A_Z 0x33
#define A_a 0x34
#define A_b 0x35
#define A_c 0x36
#define A_d 0x37
#define A_e 0x38
#define A_f 0x39
#define A_g 0x3A
#define A_h 0x3B
#define A_i 0x3C
#define A_j 0x3D
#define A_k 0x3E
#define A_l 0x3F
#define A_m 0x40
#define A_n 0x41
#define A_o 0x42
#define A_p 0x43
#define A_q 0x44
#define A_r 0x45
#define A_s 0x46
#define A_t 0x47
#define A_u 0x48
#define A_v 0x49
#define A_w 0x4A
#define A_x 0x4B
#define A_y 0x4C
#define A_z 0x4D
#define _XA 0x4E
#define _A 0x4F
#define _XI 0x50
#define _I 0x51
#define _XU 0x52
#define _U 0x53
#define _XE 0x54
#define _E 0x55
#define _XO 0x56
#define _O 0x57
#define _KA 0x58
#define _GA 0x59
#define _KI 0x5A
#define _GI 0x5B
#define _KU 0x5C
#define _GU 0x5D
#define _KE 0x5E
#define _GE 0x5F
#define _KO 0x60
#define _GO 0x61
#define _SA 0x62
#define _ZA 0x63
#define _SI 0x64
#define _ZI 0x65
#define _SU 0x66
#define _ZU 0x67
#define _SE 0x68
#define _ZE 0x69
#define _SO 0x6A
#define _ZO 0x6B
#define _TA 0x6C
#define _DA 0x6D
#define _TI 0x6E
#define _DI 0x6F
#define _XTU 0x70
#define _TU 0x71
#define _DU 0x72
#define _TE 0x73
#define _DE 0x74
#define _TO 0x75
#define _DO 0x76
#define _NA 0x77
#define _NI 0x78
#define _NU 0x79
#define _NE 0x7A
#define _NO 0x7B
#define _HA 0x7C
#define _BA 0x7D
#define _PA 0x7E
#define _HI 0x7F
#define _BI 0x80
#define _PI 0x81
#define _HU 0x82
#define _BU 0x83
#define _PU 0x84
#define _HE 0x85
#define _BE 0x86
#define _PE 0x87
#define _HO 0x88
#define _BO 0x89
#define _PO 0x8A
#define _MA 0x8B
#define _MI 0x8C
#define _MU 0x8D
#define _ME 0x8E
#define _MO 0x8F
#define _XYA 0x90
#define _YA 0x91
#define _XYU 0x92
#define _YU 0x93
#define _XYO 0x94
#define _YO 0x95
#define _RA 0x96
#define _RI 0x97
#define _RU 0x98
#define _RE 0x99
#define _RO 0x9A
#define _XWA 0x9B
#define _WA 0x9C
#define _WI 0x9D
#define _WE 0x9E
#define _WO 0x9F
#define _NN 0xA0
#define _VU 0xA1
#define _XKA 0xA2
#define _XKE 0xA3
#define Y_KUTEN 0xF2
#define Y_TOUTEN 0xF3
#define Y_COMMA 0xF4
#define Y_PERIOD 0xF5
#define Y_QUOTA 0xF6
#define Y_BIKKURI 0xF7
#define Y_S_KIGOU1 0xF8
#define Y_S_KIGOU2 0xF9
#define Y_L_KAKKO 0xFA
#define Y_R_KAKKO 0xFB
#define Y_KIGOU 0xFC
#define Y_HANKAKU 0xFD
#define Y_ZENKAKU 0xFE
#define _NIL 0
#endif

172
kanakan/Imakefile Normal file
View file

@ -0,0 +1,172 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*/
/*
* $SonyRCSfile: Imakefile,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:25 $
*/
INCLUDES = -I../include
SRCS = \
adddic.c \
addelcmn.c \
alloc.c \
charsize.c \
chrtbl.c \
cl2knj.c \
clstudy.c \
cmpstr.c \
conjunc.c \
connect.c \
cvtclknj.c \
cvtdict.c \
cvtkanji.c \
deldic.c \
depend.c \
dict.c \
functbl.c \
fuzoku.c \
fzkyomi.c \
getkanji.c \
getrank.c \
global.c \
hzstrlen.c \
init.c \
istrcmp.c \
memcpy.c \
memory.c \
memset.c \
mk2claus.c \
mkbunset.c \
mkjiritu.c \
mkkouho.c \
mknumber.c \
mvmemd.c \
mvmemi.c \
peepdic.c \
ph2knj.c \
ph_khtbl.c \
priority.c \
prtytbl.c \
s2ctbl.c \
selclrec.c \
selsuuji.c \
setconj.c \
setjrec.c \
setkouho.c \
setubi.c \
sj2code.c \
skiphblk.c \
skipkstr.c \
srchdict.c \
srchhead.c \
srchidx.c \
srchnum.c \
sstrcmp.c \
sstrlen.c \
sstrncmp.c \
stbtbl.c \
stttbl.c \
study.c \
suujitbl.c \
terminat.c \
termtbl.c \
wakachi.c
OBJS = \
adddic.o \
addelcmn.o \
alloc.o \
charsize.o \
chrtbl.o \
cl2knj.o \
clstudy.o \
cmpstr.o \
conjunc.o \
connect.o \
cvtclknj.o \
cvtdict.o \
cvtkanji.o \
deldic.o \
depend.o \
dict.o \
functbl.o \
fuzoku.o \
fzkyomi.o \
getkanji.o \
getrank.o \
global.o \
hzstrlen.o \
init.o \
istrcmp.o \
memcpy.o \
memory.o \
memset.o \
mk2claus.o \
mkbunset.o \
mkjiritu.o \
mkkouho.o \
mknumber.o \
mvmemd.o \
mvmemi.o \
peepdic.o \
ph2knj.o \
ph_khtbl.o \
priority.o \
prtytbl.o \
s2ctbl.o \
selclrec.o \
selsuuji.o \
setconj.o \
setjrec.o \
setkouho.o \
setubi.o \
sj2code.o \
skiphblk.o \
skipkstr.o \
srchdict.o \
srchhead.o \
srchidx.o \
srchnum.o \
sstrcmp.o \
sstrlen.o \
sstrncmp.o \
stbtbl.o \
stttbl.o \
study.o \
suujitbl.o \
terminat.o \
termtbl.o \
wakachi.o
NormalLibraryObjectRule()
NormalLibraryTarget(kanakan,$(OBJS))
DependTarget()

616
kanakan/adddic.c Normal file
View file

@ -0,0 +1,616 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: adddic.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:26 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
Uchar *srchdict(), *skipkstr(), *get_idxptr();
Int sstrncmp(), study(), cmpstr();
Int cvtknj();
Int srchkana(), srchgram(), getkanji();
Int sstrlen(), srchkanji();
Uint addel_arg();
Void memset(), mvmemi(), mkclidx(), mkidxtbl();
Void mvmemd(), set_size(), delclsub();
TypeDicSeg srchidx();
TypeIdxOfs count_uidx();
Void chg_uidx();
Static Void sprt_seg(), apnd_uidx();
Static Int cal_nextym(), usr_freelen();
Static Uint checkdict();
Uint adddic(yomi, kanji, hinsi)
Uchar *yomi;
Uchar *kanji;
TypeGram hinsi;
{
Uint err;
Uchar yptr[MaxWdYomiLen+1];
Uchar 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;
Uchar *douptr;
Uchar *dstptr;
TypeDicOfs pos;
Uchar *p1;
Int i;
Int nlen, plen;
Int size;
STDYIN *stdy;
STDYOUT stdydat;
if (err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr)))
return err;
inputyomi = yomi;
cnvstart = ystart = yptr;
cnvlen = sstrlen(yptr);
if (err = checkdict(kanji, hinsi)) return err;
if (!curdict -> maxunit) return AD_NotUserDict;
klen = cvtknj(yomi, kanji, kptr);
newsiz = DouonBlkSizeNumber + cnvlen + (klen !=0 ? klen+1 : 0) + 2;
if (newsiz > MaxDouonBlk) return AD_OvflwDouBlk;
if (newsiz > curdict->seglen) return AD_OvflwDouBlk;
segnum = srchidx((TypeDicSeg)DicSegBase, cnvlen);
for ( ; ; ) {
(*curdict->getdic)(curdict, segnum);
i = srchkana(&p1, &saml);
dstofs = douofs = p1 - dicbuf;
hnsofs = knjofs = 0;
if (i) {
i = srchgram(p1, &p1, hinsi);
dstofs = hnsofs = p1 - dicbuf;
if (i) {
srchkanji(&p1, kptr, klen);
if (*p1 != HinsiBlkTerm) return AD_ArExist;
dstofs = knjofs = p1 - dicbuf;
}
}
p1 = dicbuf + douofs;
if (!hnsofs) {
oldsiz = 0;
nlen = cnvlen - saml;
newsiz = DouonBlkSizeNumber + nlen;
nxtask = cal_nextym(p1);
}
else {
oldsiz = newsiz = getsize(p1);
nxtask = 0;
}
if (!knjofs) newsiz += 2;
newsiz += (klen != 0 ? klen+1 : 0);
fresiz = usr_freelen();
if ((unsigned int) (newsiz - oldsiz - nxtask) <=
(unsigned int) fresiz) break;
if (segend(p1) && (segnum + 1 < curdict->segunit)) {
segnum++;
continue;
}
if (curdict->segunit >= curdict->maxunit)
return AD_OvflwUsrDic;
freidx = count_uidx();
if ((unsigned int) (douofs + newsiz) <= curdict->seglen) {
if (hnsofs) p1 = getntag(p1);
pos = p1 - dicbuf;
nlen = getnlen(p1);
if ((unsigned int) freidx < getplen(p1) + nlen + 1)
return AD_OvflwIndex;
if ((*curdict->putdic)(curdict, curdict->segunit))
return AD_OvflwUsrDic;
sprt_seg(segnum, pos);
nxtask = 0;
break;
}
if (segend(p1)) {
if ((unsigned int) freidx < cnvlen + 1) return AD_OvflwIndex;
if ((*curdict->putdic)(curdict, curdict->segunit))
return AD_OvflwUsrDic;
curdict->segunit++;
(*curdict->getdic)(curdict, curdict->segunit - 1);
memset(dicbuf, DicSegTerm, (Int)curdict->seglen);
dicbuf[0] = 0;
(*curdict->putdic)(curdict, curdict->segunit - 1);
(*curdict->rszdic)(curdict, curdict->segunit);
mkidxtbl(curdict);
segnum++;
}
else {
nlen = getnlen(p1);
if ((unsigned int) freidx < getplen(p1) + nlen + 1)
return AD_OvflwIndex;
if ((*curdict->putdic)(curdict, curdict->segunit))
return AD_OvflwUsrDic;
sprt_seg(segnum, douofs);
segnum++;
}
}
douptr = dicbuf + douofs;
if (nxtask) {
Uchar *tp;
size = getsize(douptr) - nxtask;
plen = getplen(douptr) + nxtask;
nlen = getnlen(douptr) - nxtask;
*douptr = (size >> 8);
if (nlen & 0x10) *douptr |= NokoriYomiTop;
if (plen & 0x10) *douptr |= AssyukuYomiTop;
*(douptr + 1) = size;
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
p1 = douptr + DouonBlkSizeNumber;
tp = p1 + nxtask;
mvmemi(tp, p1, dicbuf + curdict->seglen - tp);
}
dstptr = dicbuf + dstofs;
size = newsiz - oldsiz;
p1 = dicbuf + curdict->seglen;
mvmemd(p1 - size, p1, p1 - dstptr - size);
if (!hnsofs) {
if (douofs == segtop() - dicbuf) {
chg_uidx(segnum, yptr, cnvlen);
}
*dstptr = 0;
nlen = cnvlen - saml;
if (nlen & 0x10) *dstptr |= NokoriYomiTop;
if (saml & 0x10) *dstptr |= AssyukuYomiTop;
*dstptr++ |= (size >> 8);
*dstptr++ = size;
*dstptr++ = ((nlen&0x0f)|((saml&0x0f)<<4));
while (saml < cnvlen) *dstptr++ = yptr[saml++];
}
else {
plen = getplen(douptr);
nlen = getnlen(douptr);
*douptr = (newsiz >> 8);
if (nlen & 0x10) *douptr |= NokoriYomiTop;
if (plen & 0x10) *douptr |= AssyukuYomiTop;
*(douptr + 1) = newsiz;
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
}
if (!knjofs) *dstptr++ = hinsi;
stdydat.stdy1.offset = dstptr - dicbuf;
for (saml = 0 ; saml < klen ; ) *dstptr++ = kptr[saml++];
if (klen > 0) *dstptr++ = KanjiStrEnd;
if (!knjofs) *dstptr++ = HinsiBlkTerm;
(*curdict->putdic)(curdict, segnum);
if (StudyExist()) {
size -= nxtask;
for (i = StudyCount, stdy = StudyDict ; i-- ; stdy++) {
if (stdy -> dicid != curdict->dicid) continue;
if (stdy -> seg != segnum) continue;
if (stdy -> offset >= dstofs) stdy -> offset += size;
}
for (p1 = ClStudyDict ; !iseocl(p1) ; p1 = ClNextTag(p1)) {
err = sstrncmp(yptr, (Uchar TFar *)ClYomiPos(p1),
(Int)ClYomiLen(p1));
if (err == MATCH) {
delclsub(p1);
mkclidx();
putcldic();
break;
}
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;
(Void)study(&stdydat);
return AD_Done;
}
Static Int checksub(kanji, grm)
Uchar *kanji;
TypeGram grm;
{
Reg1 Uchar *tagp;
Reg2 Uchar *ptr;
Reg3 Uchar *endp;
Int flg, nlen;
Int dounum;
Uchar buf[MaxWdKanjiLen + 1];
dicinl = cnvlen;
dicsaml = 0;
prevseg = (TypeDicSeg)-1;
for (;;) {
if (!(tagp = srchdict(tagp))) return 0;
if (cnvlen == getnlen(tagp) + getplen(tagp))
break;
}
dounum = 0;
nlen = getnlen(tagp);
ptr = tagp + DouonBlkSizeNumber + nlen;
endp = tagp + getsize(tagp);
while (ptr < endp) {
flg = (grm == *ptr++);
while (*ptr != HinsiBlkTerm) {
if (flg) {
buf[getkanji(inputyomi, cnvlen, ptr, buf)] = 0;
if (cmpstr(kanji, buf)) return -1;
}
dounum++;
ptr = skipkstr(ptr);
}
ptr++;
}
return dounum;
}
Static Uint checkdict(kanji, grm)
Uchar *kanji;
TypeGram grm;
{
Reg1 DICTL *dp;
Reg2 Int dounum = 0;
Reg3 Int tmp;
DICT *tmpdict;
tmpdict = curdict;
for (dp = dictlist ; dp ; dp = dp -> next) {
curdict = dp -> dict;
if ((tmp = checksub(kanji, grm)) < 0) {
curdict = tmpdict;
return AD_ArExist;
}
dounum += tmp;
}
curdict = tmpdict;
if (MaxKouhoNumber <= dounum) return AD_OvflwDouNum;
return 0;
}
Static Int cal_nextym(ptr)
Reg1 Uchar *ptr;
{
Reg2 Int count = 0;
Reg3 Uchar *src;
Reg4 Int len;
if (!segend(ptr)) {
src = cnvstart + getplen(ptr);
len = getnlen(ptr);
ptr += DouonBlkSizeNumber;
while (len--) {
if (*ptr++ == *src++)
count++;
else
break;
}
}
return count;
}
Static Int usr_freelen()
{
Reg1 Uchar *ptr;
ptr = segtop();
while (!segend(ptr)) ptr += getsize(ptr);
return(curdict->seglen - (ptr - dicbuf));
}
Static Void sprt_seg(seg, ofs)
TypeDicSeg seg;
TypeDicOfs ofs;
{
Reg3 TypeDicSeg s;
Uchar *pos;
Reg1 Uchar *p;
Reg2 Uchar *q;
Int i;
Int j;
Int ylen, nlen;
TypeDicID dicid;
Uchar yomi[MaxWdYomiLen];
STDYIN *stdy;
for (s = curdict->segunit - 1 ; s >= seg ; s--) {
(*curdict->getdic)(curdict, s);
(*curdict->putdic)(curdict, s + 1);
}
curdict->segunit++;
(*curdict->rszdic)(curdict, curdict->segunit);
(*curdict->getdic)(curdict, seg + 1);
pos = dicbuf + ofs;
for (p = segtop() ; (p <= pos) && !segend(p) ; p = q) {
q = getntag(p);
i = getplen(p);
nlen = getnlen(p);
j = (nlen != 0) ? nlen+1: 0;
p += DouonBlkSizeNumber;
while (j-- > 0) yomi[i++] = *p++;
}
nlen = getnlen(pos);
ylen = (i = getplen(pos)) + (j = nlen);
apnd_uidx(seg, yomi, ylen);
set_size(segtop(), getsize(pos) + i, 0, ylen);
mvmemi(yomi, (p = segtop() + DouonBlkSizeNumber), ylen);
q = pos + DouonBlkSizeNumber + j;
i = dicbuf + curdict->seglen - q;
mvmemi(q, p += ylen, i);
j = q - p;
p += i;
memset(p, DicSegTerm, (dicbuf + curdict->seglen - p));
(*curdict->putdic)(curdict, seg + 1);
if (StudyExist()) {
dicid = curdict -> dicid;
for (i = StudyCount, stdy = StudyDict ; i-- > 0 ; stdy++) {
if (stdy -> dicid != dicid)
continue;
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;
}
}
}
(*curdict->getdic)(curdict, seg);
memset(dicbuf + ofs, DicSegTerm, (Int)(curdict->seglen - ofs));
(*curdict->putdic)(curdict, seg);
}
Static Void apnd_uidx(seg, yomi, len)
TypeDicSeg seg;
Uchar *yomi;
Int len;
{
Reg1 Uchar *p;
Reg1 Uchar *q;
p = get_idxptr(seg);
while (*p++) ;
q = idxbuf + curdict->idxlen;
mvmemd(q - (len + 1), q, (Int)(q - (len + 1) - p));
while (len--) *p++ = *yomi++;
*p = 0;
(*curdict->putidx)(curdict, 0);
mkidxtbl(curdict);
}

502
kanakan/addelcmn.c Normal file
View file

@ -0,0 +1,502 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
#include "sj_yomi.h"
Uchar *get_idxptr();
Int sj2cd_str(), yomicmp(), codesize();
Int sstrlen(), sstrcmp();
Void mvmemi(), mvmemd(), mkidxtbl();
Void set_size(p, size, plen, nlen)
Reg1 Uchar *p;
Int size;
Int plen;
Int nlen;
{
*p = (Uchar)(size >> 8);
if (nlen & 0x10) *p |= NokoriYomiTop;
if (plen & 0x10) *p |= AssyukuYomiTop;
*(p + 1) = (Uchar)size;
*(p + 2) = (Uchar)((nlen & 0x0f) | ((plen & 0x0f) << 4));
}
Static Int isvyomi(yp)
Reg1 Uchar *yp;
{
Reg2 Int len;
if (!*yp) return FALSE;
if (!(Chrtbl[*yp] & DICTOP)) return FALSE;
for (len = 0 ; *yp ; yp++) {
if (!(Chrtbl[*yp]) || (*yp >= Y_KUTEN)) return FALSE;
if (++len > MaxWdYomiLen) return FALSE;
}
return TRUE;
}
Static Int isvknj(kanji)
Reg1 Uchar *kanji;
{
Reg2 Int len;
if (!*kanji) return FALSE;
for (len = 0 ; *kanji ; ) {
if (*kanji == SS3) {
kanji += 3;
len += 2;
} else
if (isknj1(*kanji)) {
kanji += 2;
len += 2;
}
else {
kanji++;
len += 2;
}
if (len > MaxWdKanjiLen) return FALSE;
}
return TRUE;
}
Static Int isgrm(gram)
TypeGram gram;
{
Reg1 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;
return FALSE;
}
Uint addel_arg(yp, kp, grm, nyp, len)
Uchar *yp;
Uchar *kp;
TypeGram grm;
Uchar *nyp;
Int len;
{
Reg1 Ushort err = 0;
if (!sj2cd_str(yp, nyp, len)) err |= AD_BadYomi;
if (!isvyomi(nyp)) err |= AD_BadYomi;
if (!isvknj(kp)) err |= AD_BadKanji;
if (!isgrm(grm)) err |= AD_BadHinsi;
return err;
}
Static Void yomi2kata(src, dst)
Reg2 Uchar *src;
Reg1 Uchar *dst;
{
Reg3 Int first;
Reg4 Int second;
while (first = *src++) {
second = *src++;
if (first != 0xa4) {
*dst++ = first;
*dst++ = second;
}
else {
*dst++ = 0xa5;
*dst++ = second;
}
}
*dst = 0;
}
Static Int top_strcmp(src, dst)
Reg1 Uchar *src;
Reg3 Uchar *dst;
{
Reg2 Int i;
for (i = 0 ; *src && (*src == *dst) ; src++, dst++) i++;
i /= 2;
return (i > MaxYomiAskNumber) ? MaxYomiAskNumber : i;
}
Static Int last_strcmp(src, dst)
Uchar *src;
Uchar *dst;
{
Int slen;
Reg1 Int dlen;
slen = sstrlen(src);
dlen = sstrlen(dst);
if (dlen > MaxYomiAskNumber * 2) return 0;
if (sstrcmp(src + (slen - dlen), dst)) return 0;
return (dlen / 2);
}
Int cvtknj(yomi, knj, dst)
Uchar *yomi;
Uchar *knj;
Reg1 Uchar *dst;
{
Uchar kana[MaxWdYomiLen * 2 + 1];
Reg2 Int len;
Uchar *keep;
keep = dst;
yomi2kata(yomi, kana);
if (len = top_strcmp(yomi, knj)) {
*dst = (Uchar)(ZenHiraAssyuku | (len - 1));
}
else if (len = top_strcmp(kana, knj)) {
*dst = (Uchar)(ZenKataAssyuku | (len - 1));
}
if (len) {
knj += len * 2;
dst++;
}
if (*knj) {
for ( ; ; ) {
if (len = last_strcmp(yomi, knj)) {
*dst++ = (Uchar)(ZenHiraAssyuku | (len - 1));
break;
}
else if (len = last_strcmp(kana, knj)) {
*dst++ = (Uchar)(ZenKataAssyuku | (len - 1));
break;
}
else if (*knj == SS2) {
knj++;
*dst++ = (Uchar)LeadingHankaku;
*dst++ = *knj++;
} else if (*knj == SS3) {
knj++;
*dst++ = (*knj & NormalKanjiMask); knj++;
*dst++ = *knj++;
} else if (*knj & 0x80) {
*dst++ = (*knj & NormalKanjiMask); knj++;
*dst++ = (*knj & NormalKanjiMask); knj++;
}
else {
*dst++ = (Uchar)LeadingHankaku;
*dst++ = *knj++;
}
if (!*knj) {
break;
}
}
}
*dst = 0;
return (dst - keep);
}
Int srchkana(ptr, saml)
Uchar **ptr;
Int *saml;
{
Uchar *p;
Int cmp;
Int cnt = 0;
Uchar same;
Reg1 Int flg = 0;
same = 0;
p = segtop();
while (!segend(p)) {
if (flg == 0) {
cmp = yomicmp(cnvstart, p, &same);
if (cmp == OVER) break;
if (cmp == MATCH && *(cnvstart + same) == 0) {
*ptr = p;
*saml = same;
flg = 1;
}
}
p = getntag(p);
cnt++;
}
if (flg != 0) return cnt;
*ptr = p;
*saml = same;
return 0;
}
Int srchgram(ptr, dst, hinsi)
Reg1 Uchar *ptr;
Uchar **dst;
TypeGram hinsi;
{
Uchar *endp;
Int cnt = 0, nlen;
Int flg = FALSE;
endp = getntag(ptr);
nlen = getnlen(ptr);
ptr += DouonBlkSizeNumber + nlen;
while (ptr < endp) {
if (*ptr == hinsi) {
*dst = ptr;
flg = TRUE;
}
do {
ptr += codesize(*ptr);
} while (*ptr != HinsiBlkTerm);
ptr++;
cnt++;
}
if (flg) return cnt;
*dst = ptr;
return 0;
}
Int srchkanji(dst, knj, klen)
Uchar **dst;
Uchar *knj;
Int klen;
{
Reg1 Uchar *ptr;
Uchar *p, *q;
Int len;
Int flg = FALSE;
Int cnt = 0;
ptr = *dst + 1;
while (*ptr != HinsiBlkTerm) {
for (p = ptr, q = knj, len = klen ; len ; len--)
if (*p++ != *q++) break;
if (!len) {
*dst = ptr;
flg = TRUE;
}
while (!(*ptr == KanjiStrEnd)) {
ptr += codesize(*ptr);
}
ptr++;
cnt++;
}
if (!flg) *dst = ptr;
return cnt;
}
TypeIdxOfs count_uidx()
{
Uchar *p;
p = get_idxptr(curdict->segunit - 1);
while (*p++) ;
return (curdict->idxlen - (p - idxbuf));
}
Void chg_uidx(seg, yomi, len)
TypeDicSeg seg;
Uchar *yomi;
Int len;
{
Uchar *p, *q;
Int olen;
p = get_idxptr(seg);
olen = sstrlen(p);
q = idxbuf + curdict->idxlen;
if (len > olen) {
mvmemd(q - (len-olen), q, (Int)(q - (len-olen) - p));
}
else {
mvmemi(p + (olen-len), p, (Int)(q - (p + (olen-len))));
}
while (len--) *p++ = *yomi++;
(*curdict->putidx)(curdict, 0);
mkidxtbl(curdict);
}

103
kanakan/alloc.c Normal file
View file

@ -0,0 +1,103 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: alloc.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:28 $
*/
#include <sys/types.h>
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_const.h"
#include "sj_var.h"
#include "sj_struct.h"
#define JREC_NUM 128
#define CLREC_NUM 128
static JREC *jrec = NULL;
static CLREC *clrec = NULL;
JREC *alloc_jrec()
{
register JREC *p;
register 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;
}
p = jrec;
jrec = jrec -> jsort;
return p;
}
Void free_jrec(p)
JREC *p;
{
if (p != NULL) {
p -> jsort = jrec;
jrec = p;
}
}
CLREC *alloc_clrec()
{
register CLREC *p;
register 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;
}
p = clrec;
clrec = clrec -> clsort;
return p;
}
Void free_clrec(p)
CLREC *p;
{
if (p != NULL) {
p -> clsort = clrec;
clrec = p;
}
}

62
kanakan/charsize.c Normal file
View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
#include "sj_dict.h"
codesize(code)
u_char code;
{
switch (code & KanjiModeMask) {
case ZenHiraAssyuku:
case ZenKataAssyuku:
case KanjiAssyuku:
case KanjiStrEnd:
return 1;
case LeadingHankaku:
case OffsetAssyuku:
case AiAttribute:
return 2;
default:
return 2;
}
}

303
kanakan/chrtbl.c Normal file
View file

@ -0,0 +1,303 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
Uchar 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
};

279
kanakan/cl2knj.c Normal file
View file

@ -0,0 +1,279 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: cl2knj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:31 $
*/
#include "sj_kcnv.h"
Int sj2cd_chr(), hzstrlen(), sstrlen();
Void sstrncpy(), mkjiritu(), mkbunsetu(), wakachi();
Void mkkouho(), getrank(), cvtclknj(), freework();
Void memset();
Static CLREC *nextrecblk(), *prevrecblk();
Static Void initkbuf();
Int cl2knj(yomi, len, kouho)
Uchar *yomi;
Reg4 Int len;
Uchar *kouho;
{
Reg1 Uchar *ptr1;
Reg2 Uchar *ptr2;
Reg3 Int i;
khcount = nkhcount = 0;
initkbuf(kouho);
if (len > MaxClInputLen * 2) len = MaxClInputLen * 2;
ptr1 = yomi; ptr2 = hyomi;
for (i = 0 ; i < len ; i++) {
if (isknj1(*ptr1)) {
if (++i >= len) break;
}
ptr1 += sj2cd_chr(ptr1, ptr2++);
}
*ptr2 = 0;
sstrncpy(yomi, orgyomi, (Int)(ptr1 - yomi));
if (!hyomi[0]) return 0;
freework();
inputyomi = orgyomi;
cnvstart = ystart = hyomi;
cnvlen = sstrlen(hyomi);
mkjiritu(0);
mkbunsetu();
if (!maxclptr) wakachi();
jrt1st = maxjptr;
clt1st = maxclptr;
mkkouho();
getrank();
selectid = 1;
cvtclknj();
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
}
Int nextcl(kouho, mode)
Uchar *kouho;
Int mode;
{
CLREC *clptr;
initkbuf(kouho);
if (!khcount) return 0;
if (!mode && (selectid < khcount))
selectid++;
else if((mode < 2) && (clptr = nextrecblk())) {
selectid = 1;
clt1st = clptr;
mkkouho();
getrank();
}
else {
cvtclknj();
return 0;
}
cvtclknj();
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
}
Static CLREC *nextrecblk()
{
Reg1 CLREC *clptr;
Reg2 Int keeplen;
keeplen = clt1st -> cllen;
clptr = clt1st -> clsort;
while (clptr && (Int)clptr -> cllen == keeplen)
clptr = clptr -> clsort;
return clptr;
}
Int prevcl(kouho, mode)
Uchar *kouho;
Int mode;
{
CLREC *clptr;
initkbuf(kouho);
if (!khcount) return 0;
if (!mode && (selectid > 1))
selectid--;
else if ((mode < 2) && (clptr = prevrecblk())) {
clt1st = clptr;
mkkouho();
getrank();
selectid = khcount;
}
else {
cvtclknj();
return 0;
}
cvtclknj();
return hzstrlen(inputyomi, (Int)clt1st -> cllen);
}
Static CLREC *prevrecblk()
{
Reg1 CLREC *clptr;
CLREC *keepptr;
Reg2 Int keeplen;
Int cllen;
clptr = maxclptr;
if ((cllen = clt1st -> cllen) == clptr -> cllen)
return NULL;
while ((Int)clptr -> cllen > cllen) {
keeplen = clptr -> cllen;
keepptr = clptr;
while ((Int)clptr -> cllen == keeplen)
clptr = clptr -> clsort;
}
return keepptr;
}
Static Void initkbuf(kouho)
Uchar *kouho;
{
kanjitmp = kouho;
memset(kanjitmp, 0, sizeof(STDYOUT) + 1);
}
Int selectnum()
{
return selectid;
}

361
kanakan/clstudy.c Normal file
View file

@ -0,0 +1,361 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: clstudy.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:32 $
*/
#include "sj_kcnv.h"
Int sj2cd_str(), sstrlen();
Void memcpy(), memset(), mvmemd(), mvmemi();
Static Uchar *delcldata(), *srchclpos();
Void delclsub(), mkclidx();
Static Int delclold();
Int clstudy(yomi1, yomi2, stdy)
Uchar *yomi1;
Uchar *yomi2;
STDYOUT *stdy;
{
Uchar ytmp[CLSTDY_TMPLEN];
Uchar *dst, *ptr;
Int ret;
Int len1, len2;
Int alen, blen;
Int i;
if (!StudyExist()) return ClstudyNoDict;
if (!yomi1 || !*yomi1) return ClstudyParaErr;
if (!yomi2 || !*yomi2) {
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
return ClstudyYomiErr;
(Void)delcldata(ytmp);
ret = ClstudyNormEnd;
}
else if (!stdy)
return ClstudyParaErr;
else {
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
return ClstudyYomiErr;
len1 = sstrlen(ytmp);
if (!sj2cd_str(yomi2, ytmp + len1, CLSTDY_TMPLEN - len1))
return ClstudyYomiErr;
len2 = len1 + stdy -> len;
ytmp[len2] = 0;
alen = len2 + CL_HDLEN;
if (alen + 1 >= ClStudyLen) return ClstudyNoArea;
blen = ClStudyTail - delcldata(ytmp) - 1;
while (blen < alen) {
if (!(i = delclold())) break;
blen += i;
}
if (blen >= alen) {
dst = srchclpos(ytmp);
ptr = ClStudyTail - alen;
mvmemd(ptr, ClStudyTail, (ptr - dst));
ClYomiLen(dst) = (Uchar)len2;
ClGramCode(dst) = stdy -> hinshi;
ClYomi1Len(dst) = (Uchar)len1;
ClSetNum(dst, 1);
memcpy(ytmp, ClYomiPos(dst), len2);
ret = ClstudyNormEnd;
}
else
ret = ClstudyNoArea;
}
mkclidx();
putcldic();
return ret;
}
Static Uchar *delcldata(ycode)
Uchar *ycode;
{
Reg1 Uchar *tagptr;
Reg2 Uchar *ptr1;
Reg3 Uchar *ptr2;
Int len1;
tagptr = ClStudyDict;
while (!iseocl(tagptr)) {
ptr1 = ycode;
ptr2 = ClYomiPos(tagptr);
len1 = ClYomiLen(tagptr);
while (*ptr1 && len1) {
if (*ptr1 != *ptr2) break;
ptr1++;
ptr2++;
len1--;
}
if (!*ptr1 || !len1) {
delclsub(tagptr);
}
else {
tagptr = ClNextTag(tagptr);
}
}
return tagptr;
}
Void delclsub(target)
Uchar *target;
{
Reg1 Uchar *src;
Int num;
Int tmp;
Int len;
num = ClGetNum(target);
len = ClBlkLen(target);
src = target + len;
mvmemi(src, target, (ClStudyTail - src));
memset(ClStudyTail - len, 0, len);
src = ClStudyDict;
while (!iseocl(src)) {
tmp = ClGetNum(src);
if (tmp > num) {
tmp -= 1;
ClSetNum(src, tmp);
}
src = ClNextTag(src);
}
}
Static Int delclold()
{
Reg1 Uchar *tagptr;
Reg2 Uchar *target;
Int num;
Int tmp;
target = NULL;
num = 0;
tagptr = ClStudyDict;
while (!iseocl(tagptr)) {
tmp = ClGetNum(tagptr);
if (tmp >= num) {
num = tmp;
target = tagptr;
}
tagptr = ClNextTag(tagptr);
}
if (target) {
num = ClBlkLen(tagptr);
delclsub(target);
}
return num;
}
Static Uchar *srchclpos(ycode)
Uchar *ycode;
{
Reg1 Uchar *tagptr;
Reg3 Uchar *target;
Reg2 Uchar *ptr1;
Reg4 Uchar *ptr2;
Reg5 Int len;
Int tmp;
target = NULL;
tagptr = ClStudyDict;
while (!iseocl(tagptr)) {
tmp = ClGetNum(tagptr);
tmp++;
ClSetNum(tagptr, tmp);
ptr1 = ycode;
ptr2 = ClYomiPos(tagptr);
len = ClYomiLen(tagptr);
while (*ptr1 && len) {
if (*ptr1 != *ptr2) break;
ptr1++;
ptr2++;
len--;
}
if (!target) {
if (!len)
;
else if (!*ptr1)
target = tagptr;
else if (*ptr1 < *ptr2)
target = tagptr;
}
tagptr = ClNextTag(tagptr);
}
return target ? target : tagptr;
}
Void mkclidx()
{
Reg1 Uchar *ptr;
Reg2 Int num;
Int st, ed;
if (!StudyExist()) return;
ptr = ClStudyDict;
for (num = st = 0 ; st < 0x100 ; num++, st = ed) {
ed = st + ClStudyStep;
while (!iseocl(ptr)) {
if ((unsigned int) *ClYomiPos(ptr) >= st) break;
ptr = ClNextTag(ptr);
}
if (ClYomiLen(ptr) && ((Int)*ClYomiPos(ptr) < ed))
ClStudyIdx[num] = ptr - ClStudyDict;
else
ClStudyIdx[num] = (Ushort)-1;
}
}

57
kanakan/cmpstr.c Normal file
View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
Int cmpstr(src, dst)
Reg1 Uchar *src;
Reg2 Uchar *dst;
{
while (*src) {
if (*src != *dst) return FALSE;
src++;
dst++;
}
if (*dst) return FALSE;
return TRUE;
}

1245
kanakan/conjunc.c Normal file

File diff suppressed because it is too large Load diff

8113
kanakan/connect.c Normal file

File diff suppressed because it is too large Load diff

71
kanakan/cvtclknj.c Normal file
View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: cvtclknj.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:38 $
*/
#include "sj_kcnv.h"
Void cvtkouho(), setstyrec();
Void cvtclknj()
{
Reg1 KHREC *krec;
Int i;
if (!selectid) selectid = khcount;
i = khcount;
krec = kouhotbl;
while (i--) {
if ((Int)krec -> rank == (Int)selectid) break;
krec++;
}
setstyrec(krec);
cvtkouho(krec);
}

254
kanakan/cvtdict.c Normal file
View file

@ -0,0 +1,254 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: cvtdict.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:40 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
Int getkanji(), seldict();
Uchar TFar *getstb();
Void get_askknj();
Void cvtdict(krec, clrec, flg)
KHREC *krec;
CLREC *clrec;
Int flg;
{
TypeDicOfs ofs;
Uchar *yptr;
Int jlen;
Int stblen;
Int sttlen;
Uchar TFar *fptr;
Int cllen;
JREC *jrec;
Int i, j;
ofs = krec -> offs;
jrec = clrec -> jnode;
cllen = clrec -> cllen;
yptr = inputyomi;
jlen = jrec -> jlen;
if (i = jrec -> sttofs) {
if (i == SETTOU_KIGOU) {
sttlen = 1;
fptr = yptr;
}
else {
fptr = Settou_ptr(i);
sttlen = SttYomiLen(fptr);
fptr++;
if (!krec -> sttkj) fptr += 2;
}
*kanjitmp++ = *fptr++;
*kanjitmp++ = *fptr++;
jlen -= sttlen;
yptr += sttlen * 2;
}
else
sttlen = 0;
if (flg) {
(*Cvtnum_func[krec->mode - 1])(ystart + sttlen, yptr, jrec);
yptr += (i = jrec -> numlen) * 2;
jlen -= i;
if (jrec -> stbofs) {
*kanjitmp++ = *yptr++;
*kanjitmp++ = *yptr++;
jlen--;
}
stblen = 0;
}
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);
get_askknj();
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];
yptr += euc_codesize(*yptr);
}
}
}
if (stblen) {
i = StbKnjLen(fptr);
fptr += stblen + 2;
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];
yptr += euc_codesize(*yptr);
}
}
Void cvtminasi(len)
Int len;
{
Uchar *ptr;
ptr = inputyomi;
while (len-- > 0) {
if (isknj1(*ptr)) {
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
}
else if (*ptr == SS3) {
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
*kanjitmp++ = *ptr++;
} else {
*kanjitmp++ = *ptr++;
}
}
}
Void cvtwakachi(clrec)
CLREC *clrec;
{
Int jlen;
Uchar *ym;
Int cnt;
Uchar ch;
ym = inputyomi;
cnt = jlen = clrec -> jnode -> jlen;
while (cnt-- > 0) {
if (isknj1(*ym)) {
if (*ym == 0xa4) {
ch = *++ym;
if (0xa1 <= ch && ch <= 0xf3) {
*kanjitmp++ = 0xa5;
}
else {
*kanjitmp++ = 0xa4;
}
*kanjitmp++ = ch;
ym++;
}
else {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
}
}
else if (*ym == SS3) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
} else {
*kanjitmp++ = *ym++;
}
}
cnt = clrec -> cllen - jlen;
while (cnt-- > 0) {
if (isknj1(*ym)) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
}
else if (*ym == SS3) {
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
*kanjitmp++ = *ym++;
} else {
*kanjitmp++ = *ym++;
}
}
}

216
kanakan/cvtkanji.c Normal file
View file

@ -0,0 +1,216 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: cvtkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:41 $
*/
#include "sj_kcnv.h"
Int hzstrlen(), ph_khtbl();
Void cvtdict(), cvtminasi();
Void cvtwakachi(), setstyrec(), cvtkouho(), mkknjmax();
Void ph_setkouho(), mvmemi(), free_clall();
Void free_jall(), memcpy(), cvtphknj();
Uchar TFar *getstb();
STDYIN *srchstdy();
Void cvtphknj(num)
Int num;
{
Int i, j;
CLREC *clrec;
CLREC *clkp;
if (!kanjilen) goto not_enough_memory;
khcount = 0;
clkp = NULL;
stdytop = NULL;
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);
}
kouhotbl[0].rank = 1;
kanjitmp = kanjibuf + 1;
setstyrec(kouhotbl);
cvtkouho(kouhotbl);
i = kanjitmp - kanjibuf;
if (i < kanjilen) {
kanjilen -= i;
ystart += clt1st -> cllen;
j = hzstrlen(inputyomi, (Int)clt1st -> cllen);
kanjibuf[0] = (Uchar)j;
inputyomi += j;
memcpy(kanjibuf, kanjipos, i);
kanjipos += i;
}
else
kanjilen = 0;
not_enough_memory:
free_clall(clt1st);
free_jall (jrt1st);
}
Void cvtkouho(krec)
KHREC *krec;
{
CLREC *clrec;
clrec = krec -> clrec;
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:
cvtdict(krec, clrec, TRUE);
break;
case C_BUNSETU :
case C_MINASI :
cvtminasi((Int)clrec -> cllen);
break;
case C_WAKACHI :
cvtwakachi(clrec);
break;
}
*kanjitmp++ = 0;
}
Void setstyrec(krec)
KHREC *krec;
{
JREC *jrec;
KHREC *kptr;
Int ii;
Uchar TFar *fptr;
STDYOUT stdy;
jrec = krec -> clrec -> jnode;
if (krec -> mode && !krec -> offs) {
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.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;
if (jrec -> stbofs && (fptr = getstb(jrec -> hinsi)))
stdy.len -= StbYomiLen(fptr + jrec -> stbofs - 1);
if (fptr = Settou_ptr(jrec -> sttofs))
stdy.sttlen = SttYomiLen(fptr);
else
stdy.sttlen = 0;
memcpy((Uchar *)&stdy, kanjitmp, sizeof(STDYOUT));
kanjitmp += sizeof(STDYOUT);
}

364
kanakan/deldic.c Normal file
View file

@ -0,0 +1,364 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: deldic.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:42 $
*/
#include "sj_kcnv.h"
Uchar *skipkstr(), *get_idxptr();
Int sstrlen(), srchkana(), srchgram();
Int srchkanji(), cvtknj();
Uint addel_arg();
Void mvmemi(), memset(), set_size(), chg_uidx();
Void mkidxtbl();
TypeDicSeg srchidx();
TypeIdxOfs count_uidx();
Static Int del_douon(), del_segment();
Static Void del_uidx(), del_stdy();
Uint deldic(yomi, kanji, hinsi)
Uchar *yomi;
Uchar *kanji;
TypeGram hinsi;
{
Uchar yptr[MaxWdYomiLen + 1];
Uchar kptr[MaxWdKanjiLen + 1];
Ushort err;
Int knjlen;
TypeDicSeg useg;
TypeDicOfs ofs;
Uchar *p1, *p2, *p3;
Int dblknum;
Int hblknum;
Int kblknum;
Int samlen;
Uchar *stp, *edp;
Int size, len;
if (err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr)))
return err;
if (!curdict -> maxunit) return AD_NotUserDict;
knjlen = cvtknj(yomi, kanji, kptr);
cnvstart = yptr;
cnvlen = sstrlen(yptr);
useg = srchidx((TypeDicSeg)DicSegBase, cnvlen);
(*curdict->getdic)(curdict, useg);
if (!(dblknum = srchkana(&p1, &samlen))) return AD_NoMidasi;
if (!(hblknum = srchgram(p1, &p2, hinsi))) return AD_NoHinsi;
p3 = p2;
kblknum = srchkanji(&p3, kptr, knjlen);
if (*p3 == HinsiBlkTerm) return AD_NoKanji;
ofs = p3 - dicbuf;
edp = skipkstr(p3);
if (kblknum == 1) {
if (hblknum == 1) {
if (dblknum == 1) {
return del_segment(useg);
}
else {
return del_douon(useg, p1, ofs);
}
}
else {
stp = p2;
edp++;
}
}
else {
stp = p3;
}
size = edp - stp;
len = dicbuf + (curdict->seglen) - edp;
mvmemi(edp, stp, len);
edp += len;
memset(edp, DicSegTerm, dicbuf + curdict->seglen - edp);
set_size(p1, (Int)(getsize(p1) - size),
(Int)getplen(p1), (Int)getnlen(p1));
(*curdict->putdic)(curdict, useg);
del_stdy(useg, ofs, size);
return AD_Done;
}
Static Int del_douon(seg, ptr, ofs)
TypeDicSeg seg;
Uchar *ptr;
TypeDicOfs ofs;
{
Uchar *nxt, *p1, *p2;
Int size;
Int nlen, plen, len;
nxt = getntag(ptr);
if (segend(nxt)) {
size = nxt - ptr;
memset(ptr, DicSegTerm, dicbuf + curdict->seglen - nxt);
}
else {
size = getsize(nxt);
nlen = getnlen(nxt);
plen = getplen(nxt);
if (ptr == segtop()) {
if (nlen + plen > (unsigned int) count_uidx()
+ sstrlen(get_idxptr(seg)))
return AD_OvflwIndex;
}
len = ((len = getplen(ptr)) < plen) ? plen - len : 0;
set_size(ptr, size + len, plen - len, nlen + len);
p1 = nxt + DouonBlkSizeNumber;
p2 = ptr + DouonBlkSizeNumber + len;
mvmemi(p1, p2, dicbuf + curdict->seglen - p1);
size = p1 - p2;
memset(dicbuf + curdict->seglen - size, DicSegTerm, size);
if (ptr == segtop()) {
chg_uidx(seg, ptr + DouonBlkSizeNumber, nlen + len);
}
}
(*curdict->putdic)(curdict, seg);
del_stdy(seg, ofs, size);
return AD_Done;
}
Static Int del_segment(seg)
TypeDicSeg seg;
{
Int i;
STDYIN *styp;
TypeDicID dicid;
TypeStyNum stdynum;
TypeDicSeg sg;
if (curdict->segunit > 1) {
for (sg = seg + 1 ; sg < curdict->segunit ; sg++) {
(*curdict->getdic)(curdict, sg);
(*curdict->putdic)(curdict, sg - 1);
}
curdict->segunit--;
}
else {
memset(dicbuf, DicSegTerm, (Int)curdict->seglen);
dicbuf[0] = 0;
(*curdict->putdic)(curdict, DicSegBase);
}
(*curdict->rszdic)(curdict, curdict->segunit);
del_uidx(seg);
if (StudyExist()) {
dicid = curdict->dicid;
for (i = 0, styp = StudyDict ; i < StudyCount ; ) {
if (styp -> dicid != dicid)
;
else if (styp -> seg > seg)
styp -> seg -= 1;
else if (styp -> seg < seg)
;
else {
stdynum = styp -> styno;
StudyCount--;
mvmemi((Uchar *)(styp + 1), (Uchar *)styp,
sizeof(*styp) * (StudyCount - i));
continue;
}
i++;
styp++;
}
for (i = 0, styp = StudyDict ; i < StudyCount ; i++, styp++)
if (styp -> styno > stdynum) styp -> styno -= 1;
putstydic();
}
return AD_Done;
}
Static Void del_uidx(seg)
TypeDicSeg seg;
{
Uchar *p, *q;
Int len;
p = get_idxptr(seg);
for (q = p ; *q++; )
;
mvmemi(q, p, idxbuf + curdict->idxlen - q);
len = q - p;
memset(idxbuf + curdict->idxlen - len, 0, len);
(*curdict->putidx)(curdict, 0);
mkidxtbl(curdict);
}
Static Void del_stdy(seg, ofs, size)
TypeDicSeg seg;
TypeDicOfs ofs;
Int size;
{
Int i;
TypeStyNum stdynum;
STDYIN *stdy;
TypeDicID dicid;
if (StudyExist()) {
stdynum = 0;
dicid = curdict->dicid;
for (i = 0, stdy = StudyDict ; i < StudyCount ; ) {
if (stdy -> dicid != dicid)
;
else if (stdy -> seg != seg)
;
else if (stdy -> offset > ofs)
stdy -> offset -= size;
else if (stdy -> offset == ofs) {
stdynum = stdy -> styno;
StudyCount--;
mvmemi((Uchar *)(stdy + 1), (Uchar *)stdy,
sizeof(*stdy) * (StudyCount - i));
continue;
}
i++;
stdy++;
}
for (i = 0, stdy = StudyDict ; i < StudyCount ; i++, stdy++)
if (stdy -> styno > stdynum) (stdy -> styno)--;
putstydic();
}
}

856
kanakan/depend.c Normal file
View file

@ -0,0 +1,856 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: depend.c,v $
* $SonyRevision: 1.4 $
* $SonyDate: 1997/10/07 07:39:45 $
*/
#include <sys/types.h>
#include "sj_kcnv.h"
#include <errno.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "Dict.h"
#include "sj3err.h"
#if defined(__FD_SET) && !defined(FD_SET)
# define FD_SET __FD_SET
# define FD_CLR __FD_CLR
#endif
extern int errno;
extern int serv_errno;
extern Global *work_base;
char *malloc();
DictFile *dictlink = NULL;
StdyFile *stdylink = NULL;
static long get4byte(p)
Uchar *p;
{
long i;
i = *p;
i = (i << 8) + *++p;
i = (i << 8) + *++p;
return ((i << 8) + *++p);
}
static void Put4byte(p, n)
Uchar *p;
long n;
{
p += 3;
*p-- = n; n >>= 8;
*p-- = n; n >>= 8;
*p-- = n; n >>= 8;
*p = n;
}
#define put4byte(p, n) Put4byte((p), (long)(n))
static int fgetfile(fp, pos, len, p)
FILE *fp;
long pos;
int len;
Uchar *p;
{
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; return ERROR;
}
if (fread(p, len, 1, fp) != 1) {
serv_errno = SJ3_FileReadError; return ERROR;
}
return SJ3_NormalEnd;
}
static int fputfile(fp, pos, len, p)
FILE *fp;
long pos;
int len;
Uchar *p;
{
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; return ERROR;
}
if (fwrite(p, len, 1, fp) != 1) {
serv_errno = SJ3_FileWriteError; return ERROR;
}
return SJ3_NormalEnd;
}
static int getfile(fd, pos, len, p)
int fd;
int pos;
int len;
Uchar *p;
{
if (lseek(fd, pos, L_SET) == ERROR) {
serv_errno = SJ3_FileSeekError; return ERROR;
}
if (read(fd, p, len) != len) {
serv_errno = SJ3_FileReadError; return ERROR;
}
return SJ3_NormalEnd;
}
static int putfile(fd, pos, len, p)
int fd;
int pos;
int len;
Uchar *p;
{
if (lseek(fd, pos, L_SET) == ERROR) {
serv_errno = SJ3_FileSeekError; return ERROR;
}
if (write(fd, p, len) != len) {
serv_errno = SJ3_FileWriteError; return ERROR;
}
return SJ3_NormalEnd;
}
static int check_passwd(buf, passwd)
Uchar *buf;
char *passwd;
{
buf += PasswdPos;
return (*buf && strncmp(passwd, buf, PasswdLen)) ? FALSE : TRUE;
}
static void set_passwd(buf, passwd)
Uchar *buf;
char *passwd;
{
strncpy(buf + PasswdPos, passwd, PasswdLen);
}
static int check_dictfile(buf)
Uchar *buf;
{
return (DictVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
}
static DictFile *search_same_dict(ino)
ino_t ino;
{
DictFile *p;
for (p = dictlink ; p != NULL ; p = p -> link)
if (p->dict.dicid == ino) return p;
return NULL;
}
static Int getofs(dp)
register DictFile *dp;
{
idxofs = dp -> ofsptr;
return 0;
}
static Int getidx(dp)
register DictFile *dp;
{
idxbuf = dp -> buffer + dp -> idxstrt;
return 0;
}
static Int getdic(dp, seg)
register DictFile *dp;
TypeDicSeg seg;
{
if (seg >= dp->dict.segunit) return -1;
dicbuf = dp->buffer + dp->segstrt + dp->dict.seglen * seg;
return 0;
}
static Int putidx(dp)
register DictFile *dp;
{
return putfile(dp->fd, dp->idxstrt, dp->dict.idxlen, idxbuf);
}
static Int putdic(dp, seg)
register DictFile *dp;
TypeDicSeg seg;
{
Uchar *p;
long i, j;
if (seg >= dp->dict.maxunit) return -1;
i = dp->segstrt + dp->dict.seglen * (seg + 1);
if (i > dp->bufsiz) {
if (!(p = (Uchar *)malloc(i))) return -1;
memcpy(dp->buffer, p, dp->bufsiz);
if (idxbuf - dp->buffer == dp->idxstrt)
idxbuf = p + dp->idxstrt;
if ((dicbuf >= dp->buffer) &&
((j = dicbuf - dp->buffer) < dp->bufsiz))
dicbuf = p + j;
free((char *)(dp -> buffer));
dp -> buffer = p;
dp -> bufsiz = i;
}
i = dp->segstrt + dp->dict.seglen * seg;
if ((p = dp->buffer + i) != dicbuf) memcpy(dicbuf, p, dp->dict.seglen);
return putfile(dp->fd, i, dp->dict.seglen, p);
}
static Int rszdic(dp, seg)
register DictFile *dp;
TypeDicSeg seg;
{
long i;
Uchar *p;
i = dp->segstrt + dp->dict.seglen * seg;
if (dp->bufsiz != i) {
if (!(p = (Uchar *)malloc(i))) return -1;
memcpy(dp->buffer, p, ((i > dp->bufsiz) ? dp->bufsiz : i));
if (idxbuf - dp->buffer == dp->idxstrt)
idxbuf = p + dp->idxstrt;
if ((dicbuf >= dp->buffer) &&
((i = dicbuf - dp->buffer) < dp->bufsiz))
dicbuf = p + i;
free((char *)(dp -> buffer));
dp -> buffer = p;
dp -> bufsiz = i;
if (ftruncate(dp->fd, i) == -1) return -1;
}
put4byte(dp->buffer + DictSegNum, seg);
return putfile(dp->fd, 0, HeaderLength, dp->buffer);
}
DictFile *opendict(name, passwd)
char *name;
char *passwd;
{
FILE *fp;
struct stat sbuf;
DictFile *dfp;
Uchar tmp[HeaderLength];
int i;
Uchar *dp;
if (stat(name, &sbuf) == ERROR) {
if (errno == ENOENT)
serv_errno = SJ3_FileNotExist;
else
serv_errno = SJ3_CannotAccessFile;
return NULL;
}
if ((dfp = search_same_dict(sbuf.st_ino)) != NULL) {
dfp -> refcnt++; return dfp;
}
if ((fp = fopen(name, "r+")) == NULL) {
if ((fp = fopen(name, "r")) == NULL) {
serv_errno = SJ3_CannotOpenFile; return NULL;
}
i = FALSE;
}
else
i = TRUE;
if (fgetfile(fp, 0L, sizeof(tmp), tmp) == ERROR) goto error1;
if (!check_dictfile(tmp)) {
serv_errno = SJ3_IllegalDictFile; goto error1;
}
if (!check_passwd(tmp, passwd)) {
serv_errno = SJ3_IncorrectPasswd; goto error1;
}
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
if ((dp = (Uchar *)malloc((long)sbuf.st_size)) == NULL) {
#else
if ((dp = (Uchar *)malloc(sbuf.st_size)) == NULL) {
#endif
serv_errno = SJ3_NotEnoughMemory; goto error1;
}
if ((dfp = (DictFile *)malloc(sizeof(*dfp))) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error2;
}
memset(dfp, '\0', sizeof(*dfp));
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
if (fgetfile(fp, 0L, (long)sbuf.st_size, dp) == ERROR) goto error3;
#else
if (fgetfile(fp, 0L, sbuf.st_size, dp) == ERROR) goto error3;
#endif
dfp -> dict.dicid = sbuf.st_ino;
dfp -> dict.idxlen = get4byte(dp + DictIdxLen);
dfp -> dict.seglen = get4byte(dp + DictSegLen);
dfp -> dict.segunit = get4byte(dp + DictSegNum);
dfp -> dict.maxunit = i ? get4byte(dp + DictSegMax) : 0 ;
dfp -> dict.getofs = getofs;
dfp -> dict.getidx = getidx;
dfp -> dict.getdic = getdic;
dfp -> dict.putidx = putidx;
dfp -> dict.putdic = putdic;
dfp -> dict.rszdic = rszdic;
dfp -> refcnt = 1;
dfp -> fp = fp;
dfp -> fd = fileno(fp);
dfp -> buffer = dp;
dfp -> bufsiz = sbuf.st_size;
dfp -> idxstrt = get4byte(dp + DictIdxPos);
dfp -> segstrt = get4byte(dp + DictSegPos);
i = dfp -> dict.segunit;
if (i < dfp -> dict.maxunit) i = dfp -> dict.maxunit;
i *= sizeof(TypeIdxOfs);
if ((dfp -> ofsptr = (TypeIdxOfs *)malloc(i)) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error3;
}
mkidxtbl(&(dfp -> dict));
dfp -> link = dictlink;
dictlink = dfp;
return dfp;
error3: free((char *)dfp);
error2: free((char *)dp);
error1: fclose(fp);
return NULL;
}
int closedict(dfp)
DictFile *dfp;
{
DictFile *df;
if (--dfp->refcnt > 0) return 0;
if (dictlink == dfp)
dictlink = dfp -> link;
else {
for (df = dictlink ; df ; df = df -> link)
if (df -> link == dfp) {
df -> link = dfp -> link;
break;
}
}
if (dfp -> fp) fclose(dfp ->fp);
free((char *)(dfp -> ofsptr));
free((char *)(dfp -> buffer));
free((char *)dfp);
return 0;
}
static fd_set zero_fd_set = { 0 };
void lock_dict(p, fd)
DictFile *p;
int fd;
{
FD_SET(fd, &(p -> lock));
}
void unlock_dict(p, fd)
DictFile *p;
int fd;
{
FD_CLR(fd, &(p -> lock));
}
int is_dict_locked(p)
DictFile *p;
{
return memcmp(&(p -> lock), &zero_fd_set, sizeof(zero_fd_set));
}
static int check_stdyfile(buf)
Uchar *buf;
{
return (StdyVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
}
static StdyFile *search_same_stdy(ino)
ino_t ino;
{
StdyFile *p;
for (p = stdylink ; p != NULL ; p = p -> link)
if (p -> inode == ino) return p;
return NULL;
}
StdyFile *openstdy(name, passwd)
char *name;
char *passwd;
{
FILE *fp;
struct stat sbuf;
StdyFile *sfp;
Uchar *hd;
STDYIN *sp;
Ushort *cip;
Uchar *clp;
long stdycnt, stdypos, stdylen, stdymax;
long clidxpos, clidxlen;
long clstdypos, clstdylen, clstdystep;
long len;
if (stat(name, &sbuf) == ERROR) {
if (errno == ENOENT)
serv_errno = SJ3_FileNotExist;
else
serv_errno = SJ3_CannotAccessFile;
return NULL;
}
if ((sfp = search_same_stdy(sbuf.st_ino)) != NULL) {
sfp -> refcnt++; return sfp;
}
if ((hd = (Uchar *)malloc(HeaderLength+CommentLength)) == NULL) {
serv_errno = SJ3_NotEnoughMemory; return NULL;
}
if ((fp = fopen(name, "r+")) == NULL) {
serv_errno = SJ3_CannotOpenFile; goto error0;
}
if (fgetfile(fp, 0L, HeaderLength+CommentLength, hd) == ERROR)
goto error1;
if (!check_stdyfile(hd)) {
serv_errno = SJ3_IllegalStdyFile; goto error1;
}
if (!check_passwd(hd, passwd)) {
serv_errno = SJ3_IncorrectPasswd; goto error1;
}
stdycnt = get4byte(hd + StdyNormCnt);
stdypos = get4byte(hd + StdyNormPos);
stdylen = get4byte(hd + StdyNormLen);
stdymax = get4byte(hd + StdyNormNum);
clidxpos = get4byte(hd + StdyClIdxPos);
clidxlen = get4byte(hd + StdyClIdxLen);
clstdypos = get4byte(hd + StdyClSegPos);
clstdylen = get4byte(hd + StdyClSegLen);
clstdystep = get4byte(hd + StdyClIdxStep);
len = sizeof(STDYIN) * stdymax;
if ((sfp = (StdyFile *)malloc(sizeof(*sfp))) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error1;
}
memset(sfp, '\0', sizeof(*sfp));
if ((sp = (STDYIN *)malloc(len)) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error2;
}
if ((cip = (Ushort *)malloc(clidxlen)) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error3;
}
if ((clp = (Uchar *)malloc(clstdylen)) == NULL) {
serv_errno = SJ3_NotEnoughMemory; goto error4;
}
if (fgetfile(fp, clidxpos, clidxlen, cip) == ERROR) goto error5;
if (fgetfile(fp, clstdypos, clstdylen, clp) == ERROR) goto error5;
if (fgetfile(fp, stdypos, len, sp) == ERROR) stdycnt = 0;
sfp -> stdy.stdycnt = stdycnt;
sfp -> stdy.stdymax = stdymax;
sfp -> stdy.stdydic = sp;
sfp -> stdy.clstdystep = clstdystep;
sfp -> stdy.clstdyidx = cip;
sfp -> stdy.clstdylen = clstdylen;
sfp -> stdy.clstdydic = clp;
sfp -> refcnt = 1;
sfp -> inode = sbuf.st_ino;
sfp -> fp = fp;
sfp -> fd = fileno(fp);
sfp -> header = hd;
sfp -> link = stdylink;
stdylink = sfp;
return sfp;
error5: free((char *)clp);
error4: free((char *)cip);
error3: free((char *)sp);
error2: free((char *)sfp);
error1: fclose(fp);
error0: free((char *)hd);
return NULL;
}
int closestdy(sfp)
StdyFile *sfp;
{
StdyFile *sf;
if (--sfp->refcnt > 0) return 0;
if (stdylink == sfp)
stdylink = sfp -> link;
else {
for (sf = stdylink ; sf ; sf = sf -> link)
if (sf -> link == sfp) {
sf -> link = sfp -> link;
break;
}
}
if (sfp -> fp) fclose(sfp ->fp);
free((char *)sfp -> stdy.stdydic);
free((char *)sfp -> stdy.clstdyidx);
free((char *)sfp -> stdy.clstdydic);
free((char *)sfp -> header);
free((char *)sfp);
return 0;
}
int putstydic()
{
int fd;
Uchar *hd;
StdyFile *sf;
long len;
sf = (StdyFile *)stdy_base;
fd = sf -> fd;
hd = sf -> header;
put4byte(hd + StdyNormCnt, sf -> stdy.stdycnt);
len = sizeof(STDYIN) * sf -> stdy.stdymax;
put4byte(hd + StdyNormLen, len);
if (putfile(fd, 0, HeaderLength+CommentLength, hd)) return ERROR;
return putfile(fd, get4byte(hd + StdyNormPos), len, sf -> stdy.stdydic);
}
int putcldic()
{
int fd;
Uchar *hd;
StdyFile *sf;
sf = (StdyFile *)stdy_base;
fd = sf -> fd;
hd = sf -> header;
if (putfile(fd, get4byte(hd + StdyClIdxPos),
get4byte(hd + StdyClIdxLen), sf -> stdy.clstdyidx))
return ERROR;
return putfile(fd, get4byte(hd + StdyClSegPos),
get4byte(hd + StdyClSegLen), sf -> stdy.clstdydic);
}
makedict(path, idxlen, seglen, segnum)
char *path;
int idxlen;
int seglen;
int segnum;
{
FILE *fp;
Uchar tmp[HeaderLength + CommentLength];
long pos = HeaderLength + CommentLength;
int ret = ERROR;
int i;
if (idxlen < MinIdxLen || seglen < MinSegLen || segnum < MinSegNum) {
serv_errno = SJ3_IllegalParameter; return ret;
}
if (!(fp = fopen(path, "w"))) {
serv_errno = SJ3_CannotCreateFile; return ret;
}
memset(tmp, '\0', sizeof(tmp));
put4byte(tmp + VersionPos, DictVersion);
put4byte(tmp + DictIdxPos, pos);
put4byte(tmp + DictIdxLen, idxlen);
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; goto error;
}
for (i = 0 ; i < idxlen ; i++)
if (putc(0, fp)) {
serv_errno = SJ3_FileWriteError; goto error;
}
pos += idxlen;
put4byte(tmp + DictSegPos, pos);
put4byte(tmp + DictSegLen, seglen);
put4byte(tmp + DictSegNum, 1);
put4byte(tmp + DictSegMax, segnum);
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; goto error;
}
if (putc(0, fp)) {
serv_errno = SJ3_FileWriteError; goto error;
}
for (i = 1 ; i < seglen ; i++)
if (putc(0xff, fp) != 0xff) {
serv_errno = SJ3_FileWriteError; goto error;
}
if (fputfile(fp, 0L, sizeof(tmp), tmp) == SJ3_NormalEnd)
ret = SJ3_NormalEnd;
error:
fclose(fp);
if (ret != SJ3_NormalEnd) unlink(path);
return ret;
}
makestdy(path, stynum, clstep, cllen)
char *path;
int stynum;
int clstep;
int cllen;
{
FILE *fp;
Uchar tmp[HeaderLength + CommentLength];
long pos = HeaderLength + CommentLength;
int ret = ERROR;
int i, j;
if (stynum == 0) stynum = MinStyNum;
if (clstep == 0) clstep = MinClStep;
if (cllen == 0) cllen = MinClLen;
if (stynum < MinStyNum || clstep < MinClStep || cllen < MinClLen) {
serv_errno = SJ3_IllegalParameter; return ret;
}
if (stynum > MaxStyNum || clstep > MaxClStep || cllen > MaxClLen) {
serv_errno = SJ3_IllegalParameter; return ret;
}
if (!(fp = fopen(path, "w"))) {
serv_errno = SJ3_CannotCreateFile; return ret;
}
memset(tmp, '\0', sizeof(tmp));
put4byte(tmp + VersionPos, StdyVersion);
j = 256 * sizeof(Ushort);
put4byte(tmp + StdyClIdxPos, pos);
put4byte(tmp + StdyClIdxLen, j);
put4byte(tmp + StdyClIdxStep, clstep);
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; goto error;
}
for (i = 0 ; i < j ; i++)
if (putc(0, fp)) {
serv_errno = SJ3_FileWriteError; goto error;
}
pos += j;
put4byte(tmp + StdyClSegPos, pos);
put4byte(tmp + StdyClSegLen, cllen);
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; goto error;
}
for (i = 0 ; i < cllen ; i++)
if (putc(0, fp)) {
serv_errno = SJ3_FileWriteError; goto error;
}
pos += cllen;
j = sizeof(STDYIN) * stynum;
put4byte(tmp + StdyNormPos, pos);
put4byte(tmp + StdyNormLen, j);
put4byte(tmp + StdyNormNum, stynum);
put4byte(tmp + StdyNormCnt, 0);
if (fseek(fp, pos, 0) == ERROR) {
serv_errno = SJ3_FileSeekError; goto error;
}
for (i = 0 ; i < j ; i++) {
if (putc(0, fp)) {
serv_errno = SJ3_FileWriteError; goto error;
}
}
pos += j;
if (fputfile(fp, 0L, sizeof(tmp), tmp) == SJ3_NormalEnd)
ret = SJ3_NormalEnd;
error:
fclose(fp);
if (ret != SJ3_NormalEnd) unlink(path);
return ret;
}
void sj_closeall()
{
while (dictlink) closedict(dictlink);
while (stdylink) closestdy(stdylink);
}
set_dictpass(dp, pass)
DictFile *dp;
char *pass;
{
set_passwd(dp -> buffer, pass);
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
}
set_stdypass(pass)
char *pass;
{
StdyFile *sp;
sp = (StdyFile *)stdy_base;
set_passwd(sp -> header, pass);
return putfile(sp->fd, 0, HeaderLength+CommentLength, sp->header);
}
static set_comment(buf, comment)
Uchar *buf;
char *comment;
{
strncpy(buf + HeaderLength, comment, CommentLength);
}
set_dictcmnt(dp, cmnt)
DictFile *dp;
char *cmnt;
{
set_comment(dp -> buffer, cmnt);
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
}
set_stdycmnt(cmnt)
char *cmnt;
{
StdyFile *sp;
sp = (StdyFile *)stdy_base;
set_comment(sp -> header, cmnt);
return putfile(sp->fd, 0, HeaderLength+CommentLength, sp->header);
}
get_stdysize(stynum, clstep, cllen)
int *stynum, *clstep, *cllen;
{
*stynum = StudyMax;
*clstep = ClStudyStep;
*cllen = ClStudyLen;
}

109
kanakan/dict.c Normal file
View file

@ -0,0 +1,109 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: dict.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:45 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
Int codesize();
Void get_askknj()
{
Reg1 Uchar *p;
Reg3 Uchar *q;
Reg2 Uchar *r;
Int i = 0, csize;
Int flg;
p = q = dicbuf;
q += *p++;
while (p < q) {
askknj[i] = p;
r = NULL;
flg = TRUE;
do {
csize = codesize(*p);
if (p[csize] == KanjiStrEnd) flg = FALSE;
if (!r && (*p != AiAttribute))
r = p;
p += csize;
} while (flg);
p++;
askknj_k[i++] = r;
}
}
Int seldict(id)
TypeDicID id;
{
DICTL *dp;
for (dp = dictlist ; dp ; dp = dp -> next) {
if ((curdict = dp -> dict) -> dicid == id)
return TRUE;
}
curdict = NULL;
return FALSE;
}
Uchar *get_idxptr(seg)
TypeDicSeg seg;
{
(*curdict->getofs)(curdict);
(*curdict->getidx)(curdict);
return idxbuf + idxofs[seg];
}

96
kanakan/functbl.c Normal file
View file

@ -0,0 +1,96 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: functbl.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:46 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
Void num_type00(), num_type01(), num_type02(), num_type03();
Void num_type04(), num_type05(), num_type06(), num_type07();
Void num_type08(), num_type09(), num_type10(), num_type11();
Void num_type12(), num_type13(), num_type14();
VFunc cvtnum_func[] = {
num_type00, num_type01, num_type02, num_type03,
num_type04, num_type05, num_type06, num_type07,
num_type08, num_type09, num_type10, num_type11,
num_type12, num_type13, num_type14
};
Uchar *getkan_hira(), *getkan_kata(), *getkan_knj(), *getkan_ofs();
Uchar *getkan_norm(), *getkan_none();
UCPFunc getkan_func[] = {
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
getkan_knj, getkan_ofs, getkan_norm, getkan_none,
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
getkan_knj, getkan_ofs, getkan_norm, getkan_none
};
Int setj_norm1(), setj_norm2(), setj_knj(), setj_ofs(), setj_atrb();
IFunc setjrec_func[] = {
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
setj_knj, setj_ofs, setj_norm2, setj_atrb,
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
setj_knj, setj_ofs, setj_norm2, setj_atrb
};
Int hiraknj_atrb(), hiraknj_ofs(), hiraknj_knj(), hiraknj_hask();
Int hiraknj_kask(), hiraknj_norm(), hiraknj_hira();
IFunc hiraknj_func[] = {
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
};
Uchar *makekan_1byte(), *makekan_knj(), *makekan_ofs();
Uchar *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
};

295
kanakan/fuzoku.c Normal file
View file

@ -0,0 +1,295 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
#include "sj_yomi.h"
CLREC *argclrec();
Int terminate();
Static Int fzkstrcmp(yptr, fzkp, saml)
Uchar *yptr;
Uchar TFar *fzkp;
Int *saml;
{
Int asklen, nkrlen;
asklen = FzkAskLen(fzkp);
if (*saml < asklen) return CONT;
if (*saml > asklen) return OVER;
nkrlen = FzkNkrLen(fzkp);
yptr += asklen;
fzkp ++;
while (nkrlen--) {
if (*yptr > *fzkp)
return CONT;
else if (*yptr < *fzkp) {
if (!*yptr) return PARTLY;
return OVER;
}
else{
yptr++;
fzkp++;
(*saml)++;
}
}
return MATCH;
}
Void setclrec(jrec, yptr, right)
JREC *jrec;
Uchar *yptr;
TypeCnct right;
{
CLREC *new;
TypeGram hinsi;
Int len;
if (!(len = yptr - cnvstart)) return;
if (len > MaxClInputLen) return;
if (!(new = argclrec(len))) return;
new -> jnode = jrec;
new -> gobiln = gobilen;
new -> right = right;
new -> fzk_ka = fzk_ka_flg;
(jrec -> count)++;
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)){
if(right == R_FZKMEISI)
new -> kubun = K_TAIGEN;
else
new -> kubun = K_YOUGEN;
}
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 == 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 (hinsi == D_MEISI_4)
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 == 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;
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_TE2 || right == R_TERU)
new -> kubun = K_DOUSHI;
else
new -> kubun = K_TAIGEN;
}
else
new -> kubun = K_TAIGEN;
}
Static Int fzkcnct(right, left)
TypeCnct right;
TypeCnct left;
{
Uchar TFar *cncttbl;
if (right && left) {
cncttbl = Rigtadr(right);
left--;
if (cncttbl[left >> 3] << (left & 0x07) & 0x80)
return TRUE;
}
return FALSE;
}
RECURS
Void srchfzk(jrec, yptr, right, level)
JREC *jrec;
Reg1 Uchar *yptr;
TypeCnct right;
Int level;
{
Uchar TFar *fzk;
Int len = 0;
Int cmp;
Uchar *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;
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;
fzkrec = fzktbl;
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);
next = yptr + len;
if (terminate(rt = FzkRight(fzk), next)) {
setclrec(jrec, next, rt);
}
srchfzk(jrec, next, rt, level + 1);
}
if (len) return;
if (!(fzk = Fzkadr(*yptr - _XA))) return;
yptr++;
for ( ; *fzk != FZKEND ; fzk += nlen + (i ? 4 : 3)) {
nlen = FzkNkrLen(fzk);
i = FzkHasCode(fzk);
cmp = fzkstrcmp(yptr, fzk, &len);
if (cmp == OVER)
break;
else if (cmp == PARTLY)
break;
else if ((cmp != MATCH) || isdpnd(*(yptr + len)))
continue;
fzktbl[fzkcount].yomip = yptr - 1;
fzktbl[fzkcount].fzkp = fzk;
fzkcount++;
if (!fzkcnct(right, (TypeCnct)FzkLeft(fzk))) continue;
if (!level) fzk_ka_flg = FzkStrKa(fzk);
next = yptr + len;
if (terminate(rt = FzkRight(fzk), next)) {
setclrec(jrec, next, rt);
}
srchfzk(jrec, next, rt, level + 1);
}
}

774
kanakan/fzkyomi.c Normal file
View file

@ -0,0 +1,774 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: fzkyomi.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:48 $
*/
#include "sj_const.h"
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_yomi.h"
#include "sj_right.h"
#include "sj_left.h"
static Uchar fzk_wo[] = {
(0<<5)+0, L_WO, R_WO,
(0<<5)+0, L_WO_S, R_WO_S,
0xff
};
static Uchar fzk_xtu[] = {
(0<<5) + 1, _KE, L_KKE, R_SHUUJO,
(0<<5) + 3, _TA,_XTU,_TE, L_TTATTE, R_TTATTE,
(1<<5) + 1, _RA, L_TTARA, R_TTARA,
(2<<5) + 2, _SI, _I, L_TTARASII, R_KSHUUSI,
(3<<5) + 2, _KA, _XTU, L_TTARASII, R_ONBIN1,
(4<<5) + 2, _RO, _U, L_TTARASII, R_KAROU,
(3<<5) + 1, _KU, L_TTARASII, R_KRENYOU,
(3<<5) + 2, _KE, _RE, L_TTARASII, R_KATEI1,
(3<<5) + 1, _SA, L_TTARASII, R_FZKMEISI,
(0<<5) + 1, _TE, L_TTE1, R_TTE1,
(1<<5) + 0, L_TTE2, R_TTE2,
(0<<5) + 3, _PA,_NA,_SI, L_PPANASI, R_PPANASI,
(0<<5) + 2, _PO,_I, L_PPOI, R_PPOI,
(1<<5) + 2, _KA,_XTU, L_PPOI, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_PPOI, R_KAROU,
(1<<5) + 1, _KU, L_PPOI, R_KRENYOU,
(1<<5) + 2, _KE,_RE, L_PPOI, R_KATEI1,
0xff
};
static Uchar fzk_a[] = {
(0<<5) + 1, _GE, L_YOUGEN, R_AGE,
(1<<5) + 1, _YO, L_YOUGEN, R_MEIREI2,
(1<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
(1<<5) + 1, _RE, L_YOUGEN, R_KATEI3,
(1<<5) + 1, _RO, L_YOUGEN, R_MEIREI1,
(0<<5) + 1, _XTU, L_ARU, R_AXTU,
(0<<5) + 1, _RA, L_ARA, R_MIZEN2,
(0<<5) + 1, _RI, L_ARI1, R_ARI1,
(1<<5) + 0, L_ARI2, R_ARI2,
(1<<5) + 0, L_ARI3, R_ARI3,
(0<<5) + 1, _RU, L_ARU, R_SHUUSI,
(0<<5) + 1, _RE, L_ARE1, R_KAMEI,
(1<<5) + 0, L_ARE2, R_KATEI2,
(1<<5) + 3, _BA,_KO,_SO, L_ARE1, R_CUT,
(0<<5) + 2, _RO,_U, L_AROU, R_AROU,
0xff
};
static Uchar fzk_i[] = {
(0<<5) + 0, L_IRU, R_I,
(0<<5) + 1, _I, L_II, R_SHUUSI,
(0<<5) + 1, _KA, L_YOUGEN, R_MIZEN5,
(0<<5) + 1, _KI, L_YOUGEN, R_IKI,
(0<<5) + 1, _KU, L_YOUGEN, R_SHUUSI,
(0<<5) + 1, _KE, L_YOUGEN, R_IKE,
(0<<5) + 2, _KO,_U, L_YOUGEN, R_AROU,
(0<<5) + 2, _TA,_SI, L_ITASI, R_ITASI,
(1<<5) + 2, _DA,_I, L_ITADAKU, R_ONBIN2,
(2<<5) + 1, _KA, L_ITADAKU, R_MIZEN4,
(2<<5) + 1, _KI, L_ITADAKU, R_ITADAKI,
(2<<5) + 1, _KU, L_ITADAKU, R_SHUUSI,
(2<<5) + 1, _KE, L_ITADAKU, R_ITADAKE,
(2<<5) + 2, _KO,_U, L_ITADAKU, R_AROU,
(0<<5) + 1, _XTU, L_YOUGEN, R_ONBIN8,
(0<<5) + 1, _YO, L_IRU, R_MEIREI2,
(0<<5) + 1, _RU, L_IRU, R_SHUUSI,
(0<<5) + 1, _RE, L_IRU, R_KATEI2,
(0<<5) + 1, _RO, L_IRU, R_MEIREI1,
0xff
};
static Uchar fzk_u[] = {
(0<<5) + 1, _E, L_UE, R_UE,
(0<<5) + 1, _TI, L_UTI, R_UTI,
(0<<5) + 1, _RU, L_ERU, R_SHUUSI,
0xff
};
static Uchar fzk_e[] = {
(0<<5) + 0, L_ERU, R_E,
(0<<5) + 1, _RU, L_ERU, R_SHUUSI,
(0<<5) + 1, _RE, L_ERU, R_KATEI3,
0xff
};
static Uchar fzk_o[] = {
(0<<5) + 1, _I, L_YOUGEN, R_ONBIN8,
(1<<5) + 1, _TE, L_OITE, R_OITE,
(0<<5) + 1, _KA, L_YOUGEN, R_MIZEN5,
(0<<5) + 1, _KI, L_YOUGEN, R_IKI,
(0<<5) + 1, _KU, L_YOUGEN, R_SHUUSI,
(0<<5) + 1, _KE, L_YOUGEN, R_IKE,
(1<<5) + 1, _RU, L_OKERU, R_OKERU,
(0<<5) + 2, _KO,_U, L_YOUGEN, R_AROU,
(0<<5) + 1, _RA, L_YOUGEN, R_MIZEN2,
(0<<5) + 1, _RI, L_ORI, R_ORI1,
(1<<5) + 0, L_YOUGEN, R_ORI2,
(0<<5) + 1, _RE, L_YOUGEN, R_KAMEI,
0xff
};
static Uchar fzk_ka[] = {
(0<<5) + 0 + 8, L_KA1, R_KA1,
(0<<5) + 0 + 8, L_KA2, R_KA2,
(0<<5) + 1, _I, L_KAI, R_SHUUJO,
(0<<5) + 1, _KE, L_KAKERU, R_KAKE,
(1<<5) + 1, _RU, L_KAKERU, R_SHUUSI,
(1<<5) + 1, _RE, L_KAKERU, R_KATEI3,
(0<<5) + 2, _SI,_RA, L_KASIRA, R_SHUUJO,
(2<<5) + 1, _NE, L_KASIRA, R_SHUUJO,
(0<<5) + 3, _TA,_GA,_TA, L_KATAGATA,R_KATAGATA,
(0<<5) + 3, _DO,_U,_KA, L_KADOUKA, R_KADOUKA,
(0<<5) + 1, _NA, L_KANA, R_SHUUJO,
(0<<5) + 1, _NE, L_KANE, R_SHUUJO,
(1<<5) + 0, L_KANERU, R_KANE2,
(1<<5) + 1, _RU, L_KANERU, R_SHUUSI,
(1<<5) + 1, _RE, L_KANERU, R_KATEI3,
(0<<5) + 3, _MA,_TA,_HA, L_KA1, R_CUT,
(0<<5) + 1, _MO, L_KAMO, R_KAMO,
(0<<5) + 1, _RA, L_KARA1, R_KARA1,
(1<<5) + 0, L_KARA2, R_KARA2,
(1<<5) + 1, _ZU, L_KARAZU, R_ZU,
(1<<5) + 1, _NU, L_KARAZU, R_NU,
0xff
};
static Uchar fzk_ga[] = {
(0<<5) + 0, L_GA1, R_GA1,
(0<<5) + 0, L_GA2, R_GA2,
(0<<5) + 2, _TA,_I, L_GATAI, R_KSHUUSI,
(1<<5) + 2, _KA,_XTU, L_GATAI, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_GATAI, R_KAROU,
(1<<5) + 1, _KU, L_GATAI, R_GATAKU,
(1<<5) + 2, _KE,_RE, L_GATAI, R_KATEI2,
(0<<5) + 1, _TI, L_GATIDA, R_GATI,
(1<<5) + 1, _DA, L_GATIDA, R_DSHUUSI1,
(2<<5) + 1, _XTU, L_GATIDA, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_GATIDA, R_DAROU,
(1<<5) + 1, _DE, L_GATIDA, R_DRENYOU1,
(1<<5) + 1, _NA, L_GATIDA, R_DRENTAI1,
(2<<5) + 1, _RA, L_GATIDA, R_KATEI1,
(1<<5) + 1, _NI, L_GATIDA, R_DRENYOU2,
(0<<5) + 2, _TE,_RA, L_GATERA, R_GATERA,
0xff
};
static Uchar fzk_ki[] = {
(0<<5) + 0, L_YOUGEN, R_FZKKI,
(0<<5) + 1, _RI, L_KIRI, R_KIRI,
0xff
};
static Uchar fzk_ku[] = {
(0<<5) + 2, _SE,_NI, L_KUSENI, R_KUSENI,
(0<<5) + 3, _DA,_SA,_I, L_KUDASARU, R_KUDASAI,
(2<<5) + 1, _XTU, L_KUDASARU, R_ONBIN6,
(2<<5) + 1, _RA, L_KUDASARU, R_MIZEN4,
(2<<5) + 1, _RI, L_KUDASARU, R_ITADAKI,
(2<<5) + 1, _RU, L_KUDASARU, R_SHUUSI,
(2<<5) + 1, _RE, L_KUDASARU, R_KATEI3,
(0<<5) + 2, _RA,_I, L_KURAI, R_KURAI,
(0<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
(0<<5) + 1, _RE, L_YOUGEN, R_KURE,
(1<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
(1<<5) + 1, _RE, L_YOUGEN, R_KATEI3,
0xff
};
static Uchar fzk_gu[] = {
(0<<5) + 2, _RA,_I, L_KURAI, R_KURAI,
(0<<5) + 2, _RU,_MI, L_GURUMI, R_GURUMI,
0xff
};
static Uchar fzk_ke[] = {
(0<<5) + 1, _DO, L_KEDO, R_KEDO,
(1<<5) + 1, _MO, L_KEDO, R_KEDO,
(0<<5) + 2, _RE,_DO, L_KEDO, R_KEDO,
(2<<5) + 1, _MO, L_KEDO, R_KEDO,
0xff
};
static Uchar fzk_ko[] = {
(0<<5) + 0, L_YOUGEN, R_KO,
(0<<5) + 1, _I, L_YOUGEN, R_MEIREI1,
(0<<5) + 1, _SO, L_KOSO, R_KOSO,
(0<<5) + 1, _TO, L_KOTO, R_KOTO,
0xff
};
static Uchar fzk_go[] = {
(0<<5) + 2, _ZA,_I, L_GOZAI, R_GOZAI,
(0<<5) + 2, _TO,_KI, L_GOTOSI, R_GOTOKI,
(1<<5) + 1, _KU, L_GOTOSI, R_GOTOKU,
(1<<5) + 1, _SI, L_GOTOSI, R_GOTOSI,
0xff
};
static Uchar fzk_sa[] = {
(0<<5) + 0, L_SA1, R_MIZEN1,
(0<<5) + 0, L_SA2, R_SHUUJO,
(0<<5) + 1, _E, L_SAE, R_SAE,
(0<<5) + 1, _SE, L_SASERU, R_SASE,
(1<<5) + 1, _YO, L_SASERU, R_MEIREI2,
(1<<5) + 1, _RU, L_SASERU, R_SHUUSI,
(1<<5) + 1, _RE, L_SASERU, R_KATEI2,
(1<<5) + 1, _RO, L_SASERU, R_MEIREI1,
0xff
};
static Uchar fzk_za[] = {
(0<<5) + 1, _RU, L_ZARU, R_ZARU,
(0<<5) + 1, _RE, L_ZARU, R_KATEI2,
0xff
};
static Uchar fzk_si[] = {
(0<<5) + 0, L_SI1, R_SI1,
(0<<5) + 0, L_SI2, R_SI2,
(0<<5) + 0, L_N_SI, R_N_SI,
(0<<5) + 1, _KA, L_SIKA, R_SIKA,
(0<<5) + 1, _TE, L_SITE, R_SITE,
(0<<5) + 2, _MA,_I, L_YOUGEN, R_IKI,
(1<<5) + 1, _U, L_YOUGEN, R_SHUUSI,
(1<<5) + 1, _E, L_YOUGEN, R_IKE,
(1<<5) + 2, _O,_U, L_YOUGEN, R_AROU,
(1<<5) + 1, _XTU, L_YOUGEN, R_ONBIN6,
(1<<5) + 1, _WA, L_YOUGEN, R_MIZEN5,
(0<<5) + 1, _RO, L_SIRO, R_MEIREI1,
0xff
};
static Uchar fzk_ji[] = {
(0<<5) + 2, _MA,_I, L_JIMAU, R_IKI,
(1<<5) + 1, _U, L_JIMAU, R_SHUUSI,
(1<<5) + 1, _E, L_JIMAU, R_IKE,
(1<<5) + 2, _O,_U, L_JIMAU, R_AROU,
(1<<5) + 1, _XTU, L_JIMAU, R_ONBIN6,
(1<<5) + 1, _WA, L_JIMAU, R_MIZEN5,
(0<<5) + 1, _XYA, L_JYA, R_JYA,
(1<<5) + 1, _I, L_JYAU, R_IKI,
(1<<5) + 1, _U, L_JYAU, R_SHUUSI,
(1<<5) + 1, _E, L_JYAU, R_IKE,
(1<<5) + 2, _O,_U, L_JYAU, R_AROU,
(1<<5) + 1, _XTU, L_JYAU, R_ONBIN6,
(1<<5) + 1, _WA, L_JYAU, R_MIZEN5,
0xff
};
static Uchar fzk_su[] = {
(0<<5) + 1, _GI, L_SUGIRU, R_SUGI,
(1<<5) + 1, _RU, L_SUGIRU, R_SHUUSI,
(1<<5) + 1, _RE, L_SUGIRU, R_KATEI2,
(0<<5) + 3, _BE,_KA,_RA, L_SUBESI, R_BEKARA,
(1<<5) + 1, _KI, L_SUBESI, R_BEKI,
(1<<5) + 1, _KU, L_SUBESI, R_BEKU,
(1<<5) + 1, _SI, L_SUBESI, R_BESI,
(0<<5) + 1, _RA, L_SURA, R_SURA,
(0<<5) + 1, _RU, L_SURU, R_SHUUSI,
(0<<5) + 1, _RE, L_SURE, R_KATEI2,
0xff
};
static Uchar fzk_zu[] = {
(0<<5) + 0, L_ZU, R_ZU,
(0<<5) + 1, _TU, L_ZUTU, R_ZUTU,
(0<<5) + 2, _NI,_I, L_ZU, R_I,
(2<<5) + 1, _RU, L_ZU, R_SHUUSI,
(0<<5) + 2, _NN,_BA, L_ZUNBA, R_CUT,
0xff
};
static Uchar fzk_se[] = {
(0<<5) + 0, L_SE, R_MIZEN2,
(0<<5) + 0, L_SERU, R_SASE,
(0<<5) + 1, _YO, L_SEYO, R_MEIREI2,
(1<<5) + 0, L_SERU, R_MEIREI2,
(0<<5) + 1, _RU, L_SERU, R_SHUUSI,
(0<<5) + 1, _RE, L_SERU, R_KATEI2,
(0<<5) + 1, _RO, L_SERU, R_MEIREI1,
0xff
};
static Uchar fzk_ze[] = {
(0<<5) + 0, L_ZE, R_SHUUJO,
0xff
};
static Uchar fzk_so[] = {
(0<<5) + 1, _U, L_SOUDA, R_SOU,
(1<<5) + 1, _DA, L_SOUDA, R_SOUDA,
(2<<5) + 1, _XTU, L_YOUTAI, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_YOUTAI, R_DAROU,
(1<<5) + 1, _DE, L_SOUDA, R_SOUDE,
(2<<5) + 1, _SI, L_SOUDA, R_DESHI,
(3<<5) + 1, _XYO, L_YOUTAI, R_SHO,
(4<<5) + 1, _U, L_YOUTAI, R_DESHOU,
(2<<5) + 1, _SU, L_SOUDA, R_SOUDESU,
(1<<5) + 1, _NA, L_DENBUN, R_SOUNA1,
(2<<5) + 0, L_YOUTAI, R_SOUNA2,
(2<<5) + 1, _RA, L_SOUDA, R_KATEI1,
(1<<5) + 1, _NI, L_YOUTAI, R_SOUNI,
0xff
};
static Uchar fzk_zo[] = {
(0<<5) + 0, L_ZO, R_SHUUJO,
0xff
};
static Uchar fzk_ta[] = {
(0<<5) + 0, L_TA, R_TA,
(0<<5) + 1, _I, L_TAI, R_TAI,
(0<<5) + 2, _KA,_XTU, L_TAI, R_ONBIN1,
(1<<5) + 2, _RO,_U, L_TAI, R_KAROU,
(0<<5) + 2, _GA,_XTU, L_TAGARU, R_ONBIN6,
(1<<5) + 1, _RA, L_TAGARU, R_TAGARA,
(1<<5) + 1, _RI, L_TAGARU, R_TAGARI,
(1<<5) + 1, _RU, L_TAGARU, R_SHUUSI,
(1<<5) + 1, _RE, L_TAGARU, R_KATEI3,
(1<<5) + 2, _RO,_U, L_TAGARU, R_KAROU,
(0<<5) + 1, _KU, L_TAI, R_TAKU,
(0<<5) + 2, _KE,_RE, L_TAI, R_KATEI3,
(0<<5) + 2, _MA,_I, L_TAMAU, R_IKI,
(1<<5) + 1, _U, L_TAMAU, R_SHUUSI,
(1<<5) + 1, _E, L_TAMAU, R_KAMEI,
(1<<5) + 1, _XTU, L_TAMAU, R_ONBIN6,
(1<<5) + 1, _WA, L_TAMAU, R_MIZEN5,
(0<<5) + 1, _ME, L_TAME, R_TAME,
(0<<5) + 1, _RA, L_TA, R_KATEI1,
(0<<5) + 1, _RI, L_TA, R_TARI,
(0<<5) + 1, _RU, L_TARU, R_CUT,
(0<<5) + 2, _RO,_U, L_TA, R_KAROU,
0xff
};
static Uchar fzk_da[] = {
(0<<5) + 0, L_DA1, R_TA,
(0<<5) + 0, L_DA2, R_DSHUUSI1,
(0<<5) + 1, _KE, L_DAKE, R_DAKE,
(0<<5) + 1, _XTU, L_DAXTU, R_ONBIN1,
(0<<5) + 1, _NO, L_DANO, R_DANO,
(0<<5) + 1, _RA, L_DA1, R_KATEI1,
(1<<5) + 1, _KE, L_DARAKE, R_DARAKE,
(0<<5) + 1, _RI, L_DA1, R_TARI,
(0<<5) + 2, _RO,_U, L_DAROU, R_DAROU,
0xff
};
static Uchar fzk_ti[] = {
(0<<5) + 2, _MA,_I, L_TIMAU, R_IKI,
(1<<5) + 1, _U, L_TIMAU, R_SHUUSI,
(1<<5) + 1, _E, L_TIMAU, R_IKE,
(1<<5) + 2, _O,_U, L_TIMAU, R_AROU,
(1<<5) + 1, _XTU, L_TIMAU, R_ONBIN6,
(1<<5) + 1, _WA, L_TIMAU, R_MIZEN5,
(0<<5) + 1, _XYA, L_TYA, R_CUT,
(1<<5) + 1, _I, L_TYAU, R_IKI,
(1<<5) + 1, _U, L_TYAU, R_SHUUSI,
(1<<5) + 1, _E, L_TYAU, R_IKE,
(1<<5) + 2, _O,_U, L_TYAU, R_AROU,
(1<<5) + 1, _XTU, L_TYAU, R_ONBIN6,
(1<<5) + 1, _WA, L_TYAU, R_MIZEN5,
0xff
};
static Uchar fzk_di[] = {
(0<<5) + 1, _XYA, L_JYA, R_JYA,
0xff
};
static Uchar fzk_tu[] = {
(0<<5) + 2, _I,_TE, L_TUITE, R_TUITE,
(0<<5) + 1, _KI, L_TUKI, R_TUKI,
(0<<5) + 1, _TU, L_TUTU, R_TUTU,
(0<<5) + 2, _MO,_RI, L_TUMORI, R_TUMORI,
0xff
};
static Uchar fzk_te[] = {
(0<<5) + 0, L_TE1, R_TE1,
(0<<5) + 0, L_TE2, R_TE2,
(0<<5) + 1, _RU, L_TERU, R_TERU,
0xff
};
static Uchar fzk_de[] = {
(0<<5) + 0, L_DE, R_DE,
(0<<5) + 0, L_DA1, R_TE2,
(0<<5) + 3, _A,_RO,_U, L_DEAROU, R_AROU,
(0<<5) + 1, _KI, L_DEKIRU, R_DEKI,
(1<<5) + 1, _RU, L_DEKIRU, R_SHUUSI,
(1<<5) + 1, _RE, L_DEKIRU, R_KATEI3,
(0<<5) + 1, _SI, L_DESI, R_DESHI,
(1<<5) + 1, _XYO, L_DESHO, R_SHO,
(2<<5) + 1, _U, L_DESHO, R_DESHOU,
(0<<5) + 1, _SU, L_DESU, R_DESU,
(0<<5) + 1, _HA, L_DEHA, R_DEHA,
(0<<5) + 1, _RU, L_DERU, R_TERU,
0xff
};
static Uchar fzk_to[] = {
(0<<5) + 0, L_TO1, R_TO1,
(0<<5) + 0, L_TO2, R_TO2,
(0<<5) + 1, _I, L_TE2, R_ONBIN8,
(1<<5) + 1, _U, L_TOIU, R_TOIU,
(0<<5) + 2, _O,_RI, L_TOORI, R_TOORI,
(0<<5) + 1, _KA, L_TE2, R_MIZEN5,
(0<<5) + 1, _KI, L_TOKI, R_TOKI,
(1<<5) + 0, L_TE2, R_IKI,
(0<<5) + 1, _KU, L_TE2, R_SHUUSI,
(0<<5) + 1, _KE, L_TE2, R_IKE,
(0<<5) + 1, _KO, L_TOKORO, R_TOKORO,
(1<<5) + 1, _U, L_TE2, R_AROU,
(1<<5) + 1, _RO, L_TOKORO, R_TOKORO,
(0<<5) + 2, _XTU,_TE, L_TOTTE, R_TOTTE,
(0<<5) + 1, _TE, L_TOTE, R_TOTE,
(0<<5) + 3, _HA,_I,_E, L_TOHAIE, R_TOHAIE,
(0<<5) + 1, _MO, L_TOMO, R_TOMO,
0xff
};
static Uchar fzk_do[] = {
(0<<5) + 0, L_DO, R_DO,
(0<<5) + 1, _I, L_DA1, R_ONBIN8,
(0<<5) + 2, _O,_RI, L_DOORI, R_DOORI,
(0<<5) + 1, _KA, L_DA1, R_MIZEN5,
(0<<5) + 1, _KI, L_DA1, R_IKI,
(0<<5) + 1, _KU, L_DA1, R_SHUUSI,
(0<<5) + 1, _KE, L_DA1, R_IKE,
(0<<5) + 2, _KO,_U, L_DA1, R_AROU,
(1<<5) + 1, _RO, L_DOKORO, R_DOKORO,
(2<<5) + 1, _KA, L_DOKOROKA, R_DOKOROKA,
(0<<5) + 1, _MO, L_DOMO, R_DOMO,
0xff
};
static Uchar fzk_na[] = {
(0<<5) + 0, L_NA1, R_SHUUJO,
(0<<5) + 0, L_NA2, R_NA2,
(0<<5) + 1, _XA, L_NAA, R_SHUUJO,
(0<<5) + 1, _A, L_NAA, R_SHUUJO,
(0<<5) + 1, _I, L_NAI, R_NAI,
(1<<5) + 1, _DE, L_NAI, R_NAIDE,
(0<<5) + 2, _KA,_XTU, L_NAI, R_ONBIN1,
(1<<5) + 2, _RO,_U, L_NAI, R_KAROU,
(0<<5) + 2, _GA,_RA, L_NAGARA, R_NAGARA,
(2<<5) + 0, L_NAGARA2, R_NAGARA2,
(0<<5) + 2, _KI,_XYA, L_NAI, R_CUT,
(0<<5) + 1, _KU, L_NAI, R_NAKU,
(0<<5) + 2, _KE,_RE, L_NAI, R_KATEI3,
(0<<5) + 2, _SA,_I, L_NASAI, R_NASAI,
(1<<5) + 1, _RA, L_NASARU, R_MIZEN4,
(1<<5) + 1, _RI, L_NASARU, R_ITADAKI,
(1<<5) + 1, _RU, L_NASARU, R_SHUUSI,
(1<<5) + 1, _RE, L_NASARU, R_KATEI3,
(2<<5) + 1, _RU, L_NASARU, R_SHUUSI,
(0<<5) + 1, _ZO, L_NAZO, R_NAZO,
(0<<5) + 1, _XTU, L_NARU, R_ONBIN2,
(0<<5) + 1, _DO, L_NADO, R_NADO,
(0<<5) + 1, _YO, L_NA1, R_SHUUJO,
(0<<5) + 1, _RA, L_NARA, R_KATEI1,
(1<<5) + 0, L_NARU, R_MIZEN5,
(0<<5) + 1, _RI, L_NARI, R_NARI,
(1<<5) + 0, L_NARU, R_IKI,
(0<<5) + 1, _RU, L_NARU, R_SHUUSI,
(0<<5) + 1, _RE, L_NARU, R_IKE,
(0<<5) + 2, _RO,_U, L_NARU, R_AROU,
(0<<5) + 2, _NN,_KA, L_NANKA, R_NANKA,
(1<<5) + 1, _ZO, L_NANZO, R_NANZO,
(1<<5) + 1, _TE, L_NANTE, R_NANTE,
0xff
};
static Uchar fzk_ni[] = {
(0<<5) + 0, L_NI1, R_NI1,
(0<<5) + 0, L_NI2, R_NI2,
(0<<5) + 0, L_NI3, R_NI3,
(0<<5) + 2, _KU,_I, L_NIKUI, R_KSHUUSI,
(1<<5) + 2, _KA,_XTU, L_NIKUI, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_NIKUI, R_KAROU,
(1<<5) + 1, _KU, L_NIKUI, R_TAKU,
(1<<5) + 2, _KE,_RE, L_NIKUI, R_KATEI3,
(1<<5) + 1, _SA, L_NIKUI, R_FZKMEISI,
(0<<5) + 1, _TE, L_NITE, R_NITE,
(0<<5) + 2, _DE,_MO, L_NI1, R_MO1,
(0<<5) + 1, _MO, L_NIMO, R_NIMO,
0xff
};
static Uchar fzk_nu[] = {
(0<<5) + 0, L_NU, R_NU,
0xff
};
static Uchar fzk_ne[] = {
(0<<5) + 0, L_NE1, R_SHUUJO,
(0<<5) + 0, L_NE2, R_KATEI2,
(0<<5) + 1, _E, L_NEE, R_SHUUJO,
0xff
};
static Uchar fzk_no[] = {
(0<<5) + 0, L_NO1, R_NO1,
(0<<5) + 0, L_NO2, R_NO2,
(0<<5) + 1, _DE, L_NODE, R_NODE,
(0<<5) + 1, _NI, L_NONI, R_NONI,
(0<<5) + 1, _MI, L_NOMI, R_NOMI,
(1<<5) + 3, _NA,_RA,_ZU, L_NOMINRZ, R_NOMINRZ,
0xff
};
static Uchar fzk_ha[] = {
(0<<5) + 0, L_HA, R_HA,
(0<<5) + 1, _SI, L_HA, R_HASI,
(0<<5) + 1, _ZU, L_HAZU, R_HAZU,
0xff
};
static Uchar fzk_ba[] = {
(0<<5) + 0, L_BA, R_BA,
(0<<5) + 2, _KA,_SI, L_BAKARI, R_BAKARI,
(1<<5) + 1, _RI, L_BAKARI, R_BAKARI,
(0<<5) + 3, _XTU,_KA,_SI, L_BAKARI, R_BAKARI,
(2<<5) + 1, _RI, L_BAKARI, R_BAKARI,
0xff
};
static Uchar fzk_hu[] = {
(0<<5) + 2, _U,_DA, L_FUUDA, R_SOUDA,
(2<<5) + 1, _XTU, L_FUUDA, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_FUUDA, R_DAROU,
(1<<5) + 1, _DE, L_FUUDA, R_SOUDE,
(2<<5) + 1, _SI, L_FUUDA, R_DESHI,
(3<<5) + 1, _XYO, L_FUUDA, R_SHO,
(4<<5) + 1, _U, L_FUUDA, R_DESHOU,
(2<<5) + 1, _SU, L_FUUDA, R_SOUDESU,
(1<<5) + 1, _NA, L_FUUDA, R_SOUNA2,
(2<<5) + 1, _RA, L_FUUDA, R_KATEI1,
(1<<5) + 1, _NI, L_FUUDA, R_FUUNI,
0xff
};
static Uchar fzk_he[] = {
(0<<5)+0, L_HE, R_HE,
0xff
};
static Uchar fzk_be[] = {
(0<<5) + 2, _KA,_RA, L_BESI, R_BEKARA,
(0<<5) + 1, _KI, L_BESI, R_BEKI,
(0<<5) + 1, _KU, L_BESI, R_BEKU,
(0<<5) + 1, _SI, L_BESI, R_BESI,
0xff
};
static Uchar fzk_ho[] = {
(0<<5) + 1, _U, L_HOU, R_HOU,
(0<<5) + 1, _KA, L_HOKA, R_HOKA,
(0<<5) + 1, _DO, L_HODO, R_HODO,
0xff
};
static Uchar fzk_ma[] = {
(0<<5) + 1, _I, L_MAI, R_MAI,
(0<<5) + 1, _SI, L_MASU, R_DESHI,
(1<<5) + 0, L_MASU, R_MEIREI2,
(1<<5) + 1, _XYO, L_MASU, R_SHO,
(2<<5) + 1, _U, L_MASU, R_DESHOU,
(0<<5) + 1, _SU, L_MASU, R_MASU,
(1<<5) + 1, _RE, L_MASURE, R_KATEI2,
(0<<5) + 1, _SE, L_MASE, R_MEIREI1,
(1<<5) + 1, _NU, L_MASU, R_NU,
(1<<5) + 1, _NN, L_MASU, R_NN2,
(0<<5) + 1, _DE, L_MADE, R_MADE,
(0<<5) + 1, _MA, L_MAMA, R_MAMA,
0xff
};
static Uchar fzk_mi[] = {
(0<<5) + 0, L_YOUGEN, R_MI,
(0<<5) + 2, _TA,_I, L_MITAIDA, R_MITAI,
(2<<5) + 1, _DA, L_MITAIDA, R_MITAIDA,
(3<<5) + 1, _XTU, L_MITAIDA, R_ONBIN1,
(3<<5) + 2, _RO,_U, L_MITAIDA, R_DAROU,
(2<<5) + 1, _DE, L_MITAIDA, R_SOUDE,
(3<<5) + 1, _SI, L_MITAIDA, R_DESHI,
(4<<5) + 1, _XYO, L_MITAIDA, R_SHO,
(5<<5) + 1, _U, L_MITAIDA, R_DESHOU,
(3<<5) + 1, _SU, L_MITAIDA, R_SOUDESU,
(2<<5) + 1, _NA, L_MITAIDA, R_SOUNA2,
(3<<5) + 1, _RA, L_MITAIDA, R_KATEI1,
(2<<5) + 1, _NI, L_MITAIDA, R_FUUNI,
(0<<5) + 1, _YO, L_YOUGEN, R_MEIREI2,
(0<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
(0<<5) + 1, _RE, L_YOUGEN, R_KATEI2,
(0<<5) + 1, _RO, L_YOUGEN, R_MEIREI1,
0xff
};
static Uchar fzk_mo[] = {
(0<<5) + 0, L_MO1, R_MO1,
(0<<5) + 0, L_MO2, R_MO2,
(0<<5) + 2, _XTU,_TE, L_MOTTE, R_MOTTE,
(0<<5) + 1, _NO, L_MONO, R_MONO,
(0<<5) + 2, _RA,_I, L_YOUGEN, R_IKI,
(1<<5) + 1, _U, L_YOUGEN, R_SHUUSI,
(1<<5) + 1, _E, L_YOUGEN, R_IKE,
(1<<5) + 2, _O,_U, L_YOUGEN, R_AROU,
(1<<5) + 1, _XTU, L_YOUGEN, R_ONBIN2,
(1<<5) + 1, _WA, L_YOUGEN, R_MIZEN5,
(0<<5) + 1, _NN, L_WAYO, R_SHUUJO,
(1<<5) + 1, _KA, L_WAYO, R_SHUUJO,
0xff
};
static Uchar fzk_ya[] = {
(0<<5) + 0, L_YA1, R_YA1,
(0<<5) + 0, L_YA2, R_YA2,
(0<<5) + 2, _SU,_I, L_YASUI, R_KSHUUSI,
(1<<5) + 2, _KA,_XTU, L_YASUI, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_YASUI, R_KAROU,
(1<<5) + 1, _KU, L_YASUI, R_TAKU,
(1<<5) + 2, _KE,_RE, L_YASUI, R_KATEI3,
(1<<5) + 1, _SA, L_YASUI, R_FZKMEISI,
(0<<5) + 1, _XTU, L_YOUGEN, R_ONBIN2,
(0<<5) + 1, _RA, L_YARA, R_YARA,
(1<<5) + 0, L_YOUGEN, R_MIZEN5,
(0<<5) + 1, _RI, L_YOUGEN, R_IKI,
(0<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
(0<<5) + 1, _RE, L_YOUGEN, R_KATEI2,
(0<<5) + 2, _RO,_U, L_YOUGEN, R_AROU,
0xff
};
static Uchar fzk_yu[] = {
(0<<5) + 1, _E, L_YUE, R_YUE,
0xff
};
static Uchar fzk_yo[] = {
(0<<5) + 0, L_YO, R_SHUUJO,
(0<<5) + 1, _I, L_YOI, R_KSHUUSI,
(0<<5) + 1, _U, L_YOU, R_YOU1,
(1<<5) + 0, L_YOUDA, R_YOU2,
(1<<5) + 1, _DA, L_YOUDA, R_SOUDA,
(2<<5) + 1, _XTU, L_YOUDA, R_ONBIN1,
(2<<5) + 2, _RO,_U, L_YOUDA, R_DAROU,
(1<<5) + 1, _DE, L_YOUDA, R_SOUDE,
(2<<5) + 1, _SI, L_YOUDA, R_DESHI,
(3<<5) + 1, _XYO, L_YOUDA, R_SHO,
(4<<5) + 1, _U, L_YOUDA, R_DESHOU,
(2<<5) + 1, _SU, L_YOUDA, R_SOUDESU,
(1<<5) + 1, _NA, L_YOUDA, R_SOUNA2,
(2<<5) + 1, _RA, L_YOUDA, R_KATEI1,
(1<<5) + 1, _NI, L_YOUDA, R_FUUNI,
(0<<5) + 2, _KA,_XTU, L_YOI, R_ONBIN1,
(1<<5) + 2, _RO,_U, L_YOI, R_KAROU,
(0<<5) + 1, _KU, L_YOI, R_TAKU,
(0<<5) + 2, _KE,_RE, L_YOI, R_KATEI3,
(0<<5) + 1, _SA, L_YOI, R_FZKMEISI,
(0<<5) + 2, _XTU,_TE, L_YORU, R_YOTTE,
(0<<5) + 2, _NA,_XA, L_YO, R_SHUUJO,
(1<<5) + 1, _A, L_YO, R_SHUUJO,
(0<<5) + 1, _NE, L_YO, R_SHUUJO,
(0<<5) + 1, _RA, L_YORU, R_MIZEN4,
(0<<5) + 1, _RI, L_YORI, R_YORI1,
(1<<5) + 0, L_YORU, R_YORI2,
(0<<5) + 1, _RU, L_YORU, R_SHUUSI,
(0<<5) + 1, _RE, L_YORU, R_KATEI3,
0xff
};
static Uchar fzk_ra[] = {
(0<<5) + 2, _SI,_I, L_RASII, R_RASII,
(1<<5) + 2, _KA,_XTU, L_RASII, R_ONBIN1,
(1<<5) + 1, _KI, L_RASII, R_GOTOKI,
(1<<5) + 1, _KU, L_RASII, R_TAKU,
(1<<5) + 2, _XYU,_U, L_RASII, R_RASHUU,
(0<<5) + 1, _RE, L_RARERU, R_RARE,
(1<<5) + 1, _YO, L_RARERU, R_MEIREI2,
(1<<5) + 1, _RU, L_RARERU, R_SHUUSI,
(1<<5) + 1, _RE, L_RARERU, R_KATEI2,
(1<<5) + 1, _RO, L_RARERU, R_MEIREI1,
0xff
};
static Uchar fzk_re[] = {
(0<<5) + 0, L_RERU, R_RARE,
(0<<5) + 1, _YO, L_RERU, R_MEIREI2,
(0<<5) + 1, _RU, L_RERU, R_SHUUSI,
(0<<5) + 1, _RE, L_RERU, R_KATEI2,
(0<<5) + 1, _RO, L_RERU, R_MEIREI1,
0xff
};
static Uchar fzk_wa[] = {
(0<<5) + 0, L_WA, R_SHUUJO,
(0<<5) + 1, _KE, L_WAKE, R_WAKE,
(0<<5) + 1, _NE, L_WANE, R_SHUUJO,
(0<<5) + 1, _YO, L_WAYO, R_SHUUJO,
0xff
};
static Uchar fzk_nn[] = {
(0<<5) + 0, L_NN1, R_NN1,
(0<<5) + 0, L_NN2, R_NN2,
0xff
};
Uchar *fzkadr[] = {
0, fzk_a, 0, fzk_i, 0,
fzk_u, 0, fzk_e, 0, fzk_o,
fzk_ka, fzk_ga, fzk_ki, 0, fzk_ku,
fzk_gu, fzk_ke, 0, fzk_ko, fzk_go,
fzk_sa, fzk_za, fzk_si, fzk_ji, fzk_su,
fzk_zu, fzk_se, fzk_ze, fzk_so, fzk_zo,
fzk_ta, fzk_da, fzk_ti, fzk_di, fzk_xtu,
fzk_tu, 0, fzk_te, fzk_de, fzk_to,
fzk_do, fzk_na, fzk_ni, fzk_nu, fzk_ne,
fzk_no, fzk_ha, fzk_ba, 0, 0,
0, 0, fzk_hu, 0, 0,
fzk_he, fzk_be, 0, fzk_ho, 0,
0, fzk_ma, fzk_mi, 0, 0,
fzk_mo, 0, fzk_ya, 0, fzk_yu,
0, fzk_yo, fzk_ra, 0, 0,
fzk_re, 0, 0, fzk_wa, 0,
0, fzk_wo, fzk_nn
};

279
kanakan/getkanji.c Normal file
View file

@ -0,0 +1,279 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: getkanji.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:49 $
*/
#include "sj_euc.h"
#include "sj_kcnv.h"
Static Uchar *code2kanji();
Int codesize();
Uchar *getkan_none(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
return d;
}
Uchar *getkan_hira(s, d, ym, yl, flg)
Uchar *d;
Reg2 Uchar *ym;
Uchar *s;
Int yl;
Int flg;
{
Reg1 Int cnt, csize;
csize = codesize(*s);
cnt = (*s & KanjiCodeMask) + 1;
if (flg && (s[csize] == KanjiStrEnd)) ym += (yl - cnt) * 2;
cnt *= 2;
while (cnt-- > 0) *d++ = *ym++;
return d;
}
Uchar *getkan_kata(s, d, ym, yl, flg)
Reg1 Uchar *d;
Reg2 Uchar *ym;
Uchar *s;
Int flg;
{
Reg3 Int cnt, csize;
Reg4 Uchar ch;
csize = codesize(*s);
cnt = (*s & KanjiCodeMask) + 1;
if (flg && (s[csize] == KanjiStrEnd)) ym += (yl - cnt) * 2;
while (cnt-- > 0) {
if (*ym == 0xa4) {
ch = *++ym;
if (0xa1 <= ch && ch <= 0xf3) {
*d++ = 0xa5;
}
else {
*d++ = 0xa4;
}
*d++ = ch;
ym++;
}
else {
*d++ = *ym++;
*d++ = *ym++;
}
}
return d;
}
Uchar *getkan_knj(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
return code2kanji(askknj[*s & KnjAssyukuMask], d, ym, yl, flg);
}
Uchar *getkan_ofs(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
return code2kanji(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
d, ym, yl, flg);
}
Uchar *getkan_norm(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
Reg2 Int i, csize;
Reg2 Uchar c;
if (*s != 0) {
c = s[1];
if (c & 0x80)
*d++ = SS3;
*d++ = *s | 0x80;
*d++ = c | 0x80;
} else {
*d++ = *s;
}
return d;
}
Uchar *getkan_ascii(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
Reg2 Uchar c;
c = s[1];
if (c & 0x80)
*d++ = SS2;
*d++ = c;
return d;
}
Static Uchar *code2kanji(s, d, ym, yl, flg)
Uchar *s;
Uchar *d;
Uchar *ym;
Int yl;
Int flg;
{
Reg2 Int csize;
for ( ; ; ) {
csize = codesize(*s);
if (s[csize] == KanjiStrEnd) {
switch(*s & KanjiModeMask) {
case ZenHiraAssyuku:
d = getkan_hira(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 AiAttribute:
d = getkan_none(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;
default:
d = getkan_norm(s, d, ym, yl, flg);
}
break;
}
else
switch(*s & KanjiModeMask) {
case ZenHiraAssyuku:
d = getkan_hira(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 AiAttribute:
d = getkan_none(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;
default:
d = getkan_norm(s, d, ym, yl, FALSE);
}
s += codesize(*s);
}
return d;
}
Int getkanji(ym, yl, ptr, buf)
Uchar *ym;
Int yl;
Uchar *ptr;
Uchar *buf;
{
Uchar *q;
q = code2kanji(ptr, buf, ym, yl, TRUE);
return q - buf;
}

195
kanakan/getrank.c Normal file
View file

@ -0,0 +1,195 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: getrank.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:50 $
*/
#include "sj_kcnv.h"
STDYIN *srchstdy();
Static Void setstynum(), setnspr(), regetrank();
Void getrank()
{
trank = nrank = 1;
setstynum();
regetrank();
}
Static Void 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);
if (!sptr) continue;
setnspr(kptr, sptr);
}
}
Static Void setnspr(kptr, sptr)
KHREC *kptr;
STDYIN *sptr;
{
KHREC *ptr;
Int keepnm;
TypeStyNum styno;
styno = kptr -> styno = sptr -> styno;
keepnm = trank;
for (ptr = kouhotbl ; ptr < kptr ; ptr++) {
if (styno < ptr -> styno) {
ptr -> rank++;
keepnm--;
}
else if (styno == ptr -> styno) {
if (kptr -> sttfg && kptr -> ka_fg) {
if ((sptr -> sttkj == kptr -> sttkj) &&
(sptr -> ka_kj == kptr -> ka_kj)) {
ptr -> rank++;
keepnm--;
}
}
else if (kptr -> sttfg) {
if (sptr -> sttkj == kptr -> sttkj) {
ptr -> rank++;
keepnm--;
}
}
else if (kptr -> ka_fg) {
if (sptr -> ka_kj == kptr -> ka_kj) {
ptr -> rank++;
keepnm--;
}
}
}
}
kptr -> rank = (Uchar)keepnm;
trank++;
if (keepnm <= nrank) nrank++;
if (sptr -> nmflg && (nrank > keepnm)) nrank = keepnm;
}
Static Void regetrank()
{
KHREC *kptr;
Int count;
Int tmp;
if (nrank < trank) {
tmp = nrank;
trank += nkhcount;
}
else {
nkhcount = tmp = 0;
}
for (count = khcount, kptr = kouhotbl ; count-- ; kptr++) {
if (!(kptr -> rank)) {
if (tmp && kptr -> mode && !(kptr -> offs)) {
kptr -> rank = (Uchar)tmp++;
}
else
kptr -> rank = (Uchar)trank++;
}
else if ((Short)kptr -> rank >= nrank)
kptr -> rank += (Uchar)nkhcount;
}
}

56
kanakan/global.c Normal file
View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: global.c,v $
* $SonyRevision: 1.2 $
* $SonyDate: 1994/12/09 11:27:06 $
*/
#include <stdio.h>
#include <sys/types.h>
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_const.h"
#include "sj_var.h"
#include "sj_struct.h"
#include "sj_dict.h"
#include "Const.h"
#include "Struct.h"
Global *global_work_base;
Global *work_base;
STDY *stdy_base;
int serv_errno;

72
kanakan/hzstrlen.c Normal file
View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: hzstrlen.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:52 $
*/
#include "sj_euc.h"
#include "sj_rename.h"
#include "sj_typedef.h"
#include "sj_const.h"
#include "sj_dict.h"
Int euc_codesize(c)
Reg1 Uchar c;
{
if ((c & KanjiModeMask) == 0x90) {
return 1;
} else if (isknj1(c)) {
return 2;
} else if (c == SS3) {
return 3;
} else {
return 1;
}
}
Int hzstrlen(ptr, len)
Reg1 Uchar *ptr;
Reg2 Int len;
{
Uchar *head;
head = ptr;
while (len-- > 0) ptr += euc_codesize(*ptr);
return (ptr - head);
}

86
kanakan/init.c Normal file
View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: init.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:54 $
*/
#include "sj_kcnv.h"
Void seg_count(dict)
DICT *dict;
{
Uchar *p;
Uchar *q;
TypeDicSeg segcnt = 0;
if (dict-> getidx) {
(*dict->getidx)(dict);
p = idxbuf;
q = p + dict->idxlen;
while (p < q && *p) {
segcnt++;
while (*p++) ;
}
}
dict->segunit = (segcnt == 0) ? 1 : segcnt;
}
Void mkidxtbl(dict)
DICT *dict;
{
Uchar *p;
TypeDicSeg seg;
if (!dict->getidx || !dict->getofs) return;
seg = 0;
(*dict->getidx)(dict);
(*dict->getofs)(dict);
idxofs[0] = 0;
for (p = idxbuf ; p < idxbuf + dict->idxlen && seg < dict->segunit ; ) {
idxofs[seg++] = p - idxbuf;
while (*p++) ;
}
}
Void initwork()
{
jrt1st = jrt2nd = maxjptr = (JREC *)0;
clt1st = clt2nd = maxclptr = (CLREC *)0;
}

64
kanakan/istrcmp.c Normal file
View file

@ -0,0 +1,64 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
Int istrcmp(yomip, idxp, ylen, ilen)
Reg1 Uchar *yomip;
Reg2 Uchar *idxp;
Reg3 Int ylen;
Reg4 Int ilen;
{
for (;;) {
if ((ilen | ylen) == 0) return MATCH;
if (ilen == 0) return UNDER;
if ((ylen == 0) || (*yomip < *idxp)) return OVER;
if (*yomip > *idxp) return UNDER;
yomip++;
idxp++;
ylen--;
ilen--;
}
}

57
kanakan/memcpy.c Normal file
View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: memcpy.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:56 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
Void memcpy (src, dst, n)
Reg1 Uchar *src;
Reg2 Uchar *dst;
Reg3 Int n;
{
while (n-- > 0) *dst++ = *src++;
}
Void sstrncpy(src, dst, n)
Reg2 Uchar *src;
Reg1 Uchar *dst;
Reg3 Int n;
{
while (n-- > 0) *dst++ = *src++;
*dst = 0;
}

151
kanakan/memory.c Normal file
View file

@ -0,0 +1,151 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: memory.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:58 $
*/
#include "sj_kcnv.h"
Void free_jrec(), free_clrec();
JREC *free_jlst(p)
Reg1 JREC *p;
{
JREC *jpk;
JREC *jp;
JREC *jn;
jp = NULL;
for ( ; p ; p = jn) {
jn = p -> jsort;
if (p -> count) {
if (jp)
jp -> jsort = p;
else
jpk = p;
jp = p;
}
else {
free_jrec(p);
}
}
if (jp) jp -> jsort = NULL;
return jpk;
}
CLREC *free_clst(p, l)
Reg1 CLREC *p;
Int l;
{
CLREC *cpk;
CLREC *cp;
CLREC *cn;
Int i = FALSE;
cp = cpk = NULL;
for ( ; p ; p = cn) {
cn = p -> clsort;
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
cpk = p;
cp = p;
}
}
else {
(p -> jnode -> count)--;
free_clrec(p);
}
}
if (cp) cp -> clsort = NULL;
return cpk;
}
Void free_clall(p)
Reg1 CLREC *p;
{
CLREC *next;
while (p) {
(p -> jnode -> count)--;
next = p -> clsort;
free_clrec(p);
p = next;
}
}
Void free_jall(p)
Reg1 JREC *p;
{
JREC *next;
while (p) {
next = p -> jsort;
free_jrec(p);
p = next;
}
}
Void freework()
{
free_clall(maxclptr);
clt1st = maxclptr = NULL;
free_jall(maxjptr);
jrt1st = maxjptr = NULL;
}

48
kanakan/memset.c Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: memset.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:01:59 $
*/
#include "sj_rename.h"
#include "sj_typedef.h"
Void memset(p, c, n)
Reg1 Uchar *p;
Reg3 Uchar c;
Reg2 Int n;
{
while (n-- > 0) *p++ = c;
}

163
kanakan/mk2claus.c Normal file
View file

@ -0,0 +1,163 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: mk2claus.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:00 $
*/
#include "sj_kcnv.h"
#include "sj_right.h"
Int terminate(), priority();
Void mkjiritu(), mkbunsetu(), wakachi(), pritiny();
Void free_clall(), free_jall();
Static Int set2nd(clrec)
CLREC *clrec;
{
CLREC *rec2;
mkjiritu(DO_IKKATU | DO_CLSTUDY);
mkbunsetu();
if (!maxclptr) {
wakachi();
return clrec -> cllen;
}
for (rec2 = maxclptr ; rec2 ; rec2 = rec2 -> clsort) {
if (terminate(rec2->right, cnvstart+rec2->cllen) != SHU)
break;
}
return rec2 ? (clrec -> cllen + rec2 -> cllen) : (clrec -> cllen);
}
Void mk2claus()
{
Uchar *keepptr;
Int keeplen;
CLREC *clrec;
Int len;
Int save2ln;
Int prty;
Int maxprty;
Int count;
Int prty2;
prty = maxprty = prty2 = 0;
clt2nd = maxclptr = NULL;
jrt2nd = maxjptr = NULL;
selcl = clt1st;
if (selcl -> right == R_FZKKGU) {
pritiny();
return;
}
if (cnvlen == selcl -> cllen) {
pritiny();
return;
}
keepptr = cnvstart;
keeplen = cnvlen;
len = count = 0;
for (clrec = selcl ; clrec && count < 5 ; clrec = clrec -> clsort) {
cnvstart = keepptr + clrec -> cllen;
cnvlen = keeplen - clrec -> cllen;
if (len != clrec -> cllen) {
if (clt2nd != maxclptr) {
free_clall(maxclptr);
free_jall(maxjptr);
}
save2ln = set2nd(clrec);
count++;
len = clrec -> cllen;
prty2 = 0;
}
if (Termtbl[clrec -> right] & T_SHUUJO)
clrec -> cl2len = (Uchar)len;
else
clrec -> cl2len = (Uchar)save2ln;
if (selcl -> cl2len > clrec -> cl2len) continue;
prty = priority(clrec) - prty2;
prty2++;
if (selcl -> cl2len == clrec -> cl2len) {
if (clrec -> cllen == nextcllen) {
if (selcl -> cllen != nextcllen)
;
else if (prty <= maxprty)
continue;
}
else if (prty <= maxprty)
continue;
}
selcl = clrec;
maxprty = prty;
if (clt2nd == maxclptr) continue;
free_clall(clt2nd);
free_jall(jrt2nd);
jrt2nd = maxjptr;
clt2nd = maxclptr;
}
if (clt2nd != maxclptr) {
free_clall(maxclptr);
maxclptr = NULL;
free_jall(maxjptr);
maxjptr = NULL;
}
cnvstart = keepptr;
cnvlen = keeplen;
}

166
kanakan/mkbunset.c Normal file
View file

@ -0,0 +1,166 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: mkbunset.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:02 $
*/
#include "sj_kcnv.h"
#include "sj_hinsi.h"
CLREC *alloc_clrec();
Uchar TFar *getstb();
Int terminate(), setconj();
Void setclrec(), srchfzk(), memset();
Void mkbunsetu()
{
Reg1 JREC *jrec;
TypeGram hinsi;
Uchar TFar *cnj;
CREC crec[4];
Int count;
TypeCnct right;
Uchar *next;
int i;
fzkcount = 0;
maxclptr = NULL;
jrec = maxjptr;
while (jrec) {
if (jrec -> stbofs && (cnj = getstb(jrec -> hinsi)))
hinsi = StbHinsi(cnj + jrec -> stbofs - 1);
else
hinsi = jrec -> hinsi;
if (right = Connadr[hinsi]) {
gobilen = 0;
next = cnvstart + jrec->jlen;
if (terminate(right, next)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
}
srchfzk(jrec, next, right, 0);
}
else if (count = setconj(hinsi, jrec, crec)) {
for (i = count ; i-- > 0 ; ) {
right = crec[i].right;
gobilen = crec[i].len;
next = cnvstart + jrec->jlen + gobilen;
if (terminate(right, next)) {
fzk_ka_flg = 0;
setclrec(jrec, next, right);
}
srchfzk(jrec, next, right, 0);
}
}
jrec = jrec -> jsort;
}
}
CLREC *argclrec(len)
Int len;
{
Reg1 CLREC *ptr;
Reg2 CLREC *rec;
Reg3 CLREC *child;
rec = alloc_clrec();
if (!rec) {
if (!maxclptr) return NULL;
ptr = NULL;
rec = maxclptr;
while (child = rec -> clsort) {
ptr = rec;
rec = child;
}
if (len <= (Int) rec -> cllen) return NULL;
if (ptr)
ptr -> clsort = NULL;
else
maxclptr = NULL;
if (rec -> jnode) (rec -> jnode)--;
}
memset((Uchar *)rec, 0, sizeof(*rec));
rec -> cllen = rec -> cl2len = (Uchar)len;
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;
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;
return rec;
}
else
ptr = child;
}
ptr -> clsort = rec;
return rec;
}

196
kanakan/mkjiritu.c Normal file
View file

@ -0,0 +1,196 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: mkjiritu.c,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1994/06/03 08:02:03 $
*/
#include "sj_kcnv.h"
Uchar *srchdict();
Uchar TFar *getstb();
Int srchhead(), sstrncmp();
JREC *alloc_jrec();
Void srchnum(), setubi(), setjrec();
Void setcrec(), memcpy(), memset();
Static Void dic_mu(), dic_cl();
Void mkjiritu(mode)
Int mode;
{
Uchar chkind1;
Uchar chkind2;
JREC *jrec;
Uchar TFar *stb;
headcode = headlen = 0;
maxjptr = NULL;
chkind1 = Chrtbl[*cnvstart];
if (chkind1 & DICTOP) {
dic_mu(mode);
}
if (mode & DO_CLSTUDY) dic_cl();
srchnum();
if (srchhead() && cnvlen != headlen) {
cnvstart += headlen;
cnvlen -= headlen;
chkind2 = Chrtbl[*cnvstart];
if (chkind2 & DICTOP) {
dic_mu(mode);
}
if (headcode == SETTOU_DAI) {
srchnum();
}
cnvstart -= headlen;
cnvlen += headlen;
}
for (jrec = maxjptr ; jrec ; jrec = jrec -> jsort) {
if (stb = getstb(jrec -> hinsi))
setubi(jrec, stb);
}
}
Static Void dic_mu(mode)
Int mode;
{
Uchar *tagp;
DICTL *dp;
for (dp = dictlist ; dp ; dp = dp -> next) {
curdict = dp -> dict;
dicinl = 1;
dicsaml = 0;
prevseg = -1;
while (tagp = srchdict(tagp)) setjrec(tagp, mode);
}
}
JREC *argjrec(len, rec)
Int len;
JREC *rec;
{
Reg1 JREC *ptr;
Reg2 JREC *jrec;
Reg3 JREC *child;
jrec = alloc_jrec();
if (!jrec) {
if (!maxjptr) return NULL;
ptr = NULL;
jrec = maxjptr;
while (child = jrec -> jsort) {
ptr = jrec;
jrec = child;
}
if (len <= (Int) jrec -> jlen) return NULL;
if (ptr)
ptr -> jsort = NULL;
else
maxjptr = NULL;
}
if (rec)
memcpy((Uchar *)rec, (Uchar *)jrec, sizeof(JREC));
else
memset((Uchar *)jrec, 0, sizeof(*jrec));
jrec -> jlen = (Uchar)len;
if (!maxjptr) {
maxjptr = jrec;
jrec -> jsort = NULL;
return jrec;
}
ptr = maxjptr;
if ((Int)ptr -> jlen < len) {
jrec -> jsort = maxjptr;
maxjptr = jrec;
return jrec;
}
while (child = ptr -> jsort) {
if ((Int)child -> jlen < len) break;
ptr = child;
}
ptr -> jsort = jrec;
jrec -> jsort = child;
return jrec;
}
Static Void dic_cl()
{
Uchar *p;
Ushort pos;
Int len;
Int cmp;
if (!StudyExist()) return;
if ((pos = ClStudyIdx[(Short) *cnvstart / ClStudyStep]) != (Ushort)-1) {
for (p = ClStudyDict + pos ; !iseocl(p) ; p = ClNextTag(p)) {
cmp = sstrncmp(cnvstart, (Uchar TFar *)ClYomiPos(p),
len = ClYomiLen(p));
if (cmp == MATCH) {
if (!isdpnd(*(cnvstart + len))) {
setcrec(p);
}
}
else if (cmp == OVER)
break;
}
}
}

562
kanakan/mkkouho.c Normal file
View file

@ -0,0 +1,562 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
#include "sj_suuji.h"
#include "sj_dict.h"
Uchar *skipkstr();
Void setkouho(), setwdnum(), get_askknj();
Int seldict(), codesize();
Static Void getkhtbl(), cl_kanji();
Static Int diffknj();
Static Void cl_numcmn();
Static Uchar *makekan();
Void mkkouho()
{
CLREC *clrec;
Int keeplen;
khcount = nkhcount = 0;
keeplen = clt1st -> cllen;
clrec = clt1st;
do {
getkhtbl(clrec);
clrec = clrec -> clsort;
} while (clrec && (keeplen == clrec -> cllen));
}
Static Void getkhtbl(clrec)
CLREC *clrec;
{
JREC *jrec;
jrec = clrec -> jnode;
switch (jrec -> class) {
case C_DICT:
cl_kanji(jrec, clrec);
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:
cl_numcmn(jrec, clrec);
break;
case C_BUNSETU:
break;
case C_MINASI:
case C_WAKACHI:
setkouho(clrec, (TypeDicOfs)0, 0);
break;
}
}
Static Void cl_kanji(jrec, clrec)
JREC *jrec;
CLREC *clrec;
{
Uchar *ptr;
Int kcount = khcount;
if (seldict(jrec -> dicid)) {
(*curdict->getdic)(curdict, jrec -> jseg);
ptr = dicbuf + jrec->jofsst + 1;
get_askknj();
while (*ptr != HinsiBlkTerm) {
if (diffknj(jrec, ptr, kcount)) {
setkouho(clrec, (TypeDicOfs)(ptr - dicbuf), 0);
}
ptr = skipkstr(ptr);
}
}
else {
setkouho(clrec, (TypeDicOfs)1, 0);
}
}
Uchar *makekan_none(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
return d;
}
Uchar *makekan_1byte(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
if ((*s & KanjiModeMask) == ZenHiraAssyuku)
*d++ = 0x10 | (*s & KnjAssyukuMask);
else
*d++ = 0x90 | (*s & KnjAssyukuMask);
if (flg) *d++ = KanjiStrEnd;
return d;
}
Uchar *makekan_knj(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
return makekan(askknj[*s & KnjAssyukuMask], d, flg);
}
Uchar *makekan_ofs(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
return makekan(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
d, flg);
}
Uchar *makekan_norm(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
Reg1 Int i, csize;
Reg1 Uchar c;
if (*s != 0) {
c = s[1];
if (c & 0x80)
*d++ = SS3;
*d++ = *s | 0x80;
*d++ = c | 0x80;
} else {
*d++ = *s;
}
if (flg) *d++ = KanjiStrEnd;
return d;
}
Uchar *makekan_ascii(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
Reg1 Uchar c;
c = s[1];
if (c & 0x80)
*d++ = SS2;
*d++ = c;
if (flg) *d++ = KanjiStrEnd;
return d;
}
Static Uchar *makekan(s, d, flg)
Uchar *s;
Uchar *d;
Int flg;
{
Reg1 Int csize;
for ( ; ; ) {
csize = codesize(*s);
if (s[csize] == KanjiStrEnd) {
switch(*s & KanjiModeMask) {
case ZenHiraAssyuku:
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 AiAttribute:
d = makekan_none(s, d, flg); break;
case LeadingHankaku:
d = makekan_ascii(s, d, flg); break;
case KanjiAssyuku:
d = makekan_knj(s, d, flg); break;
default:
d = makekan_norm(s, d, flg);
}
break;
}
else
switch(*s & KanjiModeMask) {
case ZenHiraAssyuku:
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 AiAttribute:
d = makekan_none(s, d, FALSE); break;
case LeadingHankaku:
d = makekan_ascii(s, d, FALSE); break;
case KanjiAssyuku:
d = makekan_knj(s, d, FALSE); break;
default:
d = makekan_norm(s, d, FALSE);
}
s += codesize(*s);
}
return d;
}
#define PEND 2
#define QEND 1
Static Int sameknj(p, plen, q, qlen)
Reg1 Uchar *p;
Uchar plen;
Reg2 Uchar *q;
Uchar qlen;
{
Int i;
Int j;
Int endf = 0;
Int brkf;
extern Int euc_codesize();
do {
if ((i = euc_codesize(*p)) != euc_codesize(*q)) return FALSE;
brkf = 0;
for (j = 0; j < i; j++) {
if (p[j] != q[j] ) {
brkf = 1;
break;
}
}
if (brkf) break;
if (p[i] == KanjiStrEnd) endf += PEND;
if (q[i] == KanjiStrEnd) endf += QEND;
p += i;
q += i;
} while (!endf);
switch (endf) {
case (PEND | QEND):
if (plen == qlen) return TRUE;
break;
case PEND:
i = plen;
plen = qlen;
qlen = i;
p = q;
case QEND:
if (p[euc_codesize(*p)] != KanjiStrEnd) break;
if ((*p & KanjiModeMask) != 0x10 ) break;
if (qlen != plen - (*p & KanjiCodeMask) - 1) break;
return TRUE;
default:
if (q[euc_codesize(*q)] != KanjiStrEnd) break;
if (p[euc_codesize(*p)] != KanjiStrEnd) break;
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
Static Int diffknj(jrec, ptr, num)
JREC *jrec;
Uchar *ptr;
Int num;
{
KHREC *kptr;
JREC *jptr;
Int i;
Uchar kbuf1[MaxWdKanjiLen];
Uchar kbuf2[MaxWdKanjiLen];
if (jrec -> hinsi == TANKANJI) return TRUE;
makekan(ptr, kbuf1, TRUE);
for (i = 0, kptr = kouhotbl ; i < num ; i++, kptr++) {
if ((jptr = kptr -> clrec -> jnode) == jrec)
return FALSE;
if (jptr -> hinsi == TANKANJI) continue;
if (jptr -> class != jrec -> class) continue;
if (jptr -> dicid != jrec -> dicid) continue;
if (jptr -> jseg != jrec -> jseg) continue;
if (jptr -> sttofs != jrec -> sttofs) continue;
if (jptr -> stbofs != jrec -> stbofs) continue;
makekan(dicbuf + kptr -> offs, kbuf2, TRUE);
if (sameknj(kbuf1, jrec -> jlen, kbuf2, jptr -> jlen))
return FALSE;
}
return TRUE;
}
Static Int chrck_numtbl(flg, cond)
Ushort flg;
Ushort cond;
{
Ushort must;
if (cond = SelNumCond(cond)) {
if (must = (cond & SelNumMust)) {
if ((flg & must) != must) return FALSE;
cond &= ~must;
}
if (cond && !(cond & flg)) return FALSE;
}
return TRUE;
}
Int sel_sjmode(jrec)
JREC *jrec;
{
Ushort i;
Ushort TFar *p;
Ushort TFar *q;
switch (jrec -> class) {
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:
p = q = Selsjadrs(jrec->class - C_N_ARABIA);
break;
default:
return SelArb;
}
while ((i = *p++) != SelNumTerm) {
if (chrck_numtbl(jrec -> flags, i)) break;
}
if (i == SelNumTerm) i = *q;
return SelNumFunc(i);
}
Static Void cl_numcmn(jrec, clrec)
JREC *jrec;
CLREC *clrec;
{
Uchar *p;
Int i;
Ushort j;
Ushort TFar *tbl;
p = cnvstart;
if ((i = jrec -> sttofs) == SETTOU_DAI)
p += SttYomiLen(Settou_ptr(i));
else if (i == SETTOU_KIGOU)
p++;
if (jrec -> jofsst) {
i = sel_sjmode(jrec);
if (seldict(jrec -> dicid)) {
(*curdict->getdic)(curdict, jrec -> jseg);
p = dicbuf + jrec->jofsst + 1;
while (*p != HinsiBlkTerm) {
setkouho(clrec, (TypeDicOfs)(p - dicbuf), i);
p = skipkstr(p);
}
}
else {
setkouho(clrec, (TypeDicOfs)1, i);
}
}
else {
tbl = Selsjadrs(jrec->class - C_N_ARABIA);
while ((j = *tbl++) != SelNumTerm) {
if (!chrck_numtbl(jrec -> flags, j)) continue;
setkouho(clrec, (TypeDicOfs)0, (Int)SelNumFunc(j));
}
}
}

494
kanakan/mknumber.c Normal file
View file

@ -0,0 +1,494 @@
/*
* Copyright (c) 1991-1994 Sony Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: 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"
Void setwdnum();
Int setucnum();
Static Int word2char(wd, tbl, keta, flg)
Ushort wd;
Uchar TFar *tbl;
Int keta;
Int flg;
{
Int mask;
Int num;
Uchar TFar *src;
for (mask = 0x1000 ; mask ; mask >>= 4) {
switch (num = (unsigned int)wd / mask) {
case 0:
break;
case _Num0:
if (!flg) break;
default:
src = tbl + (num - _Num0) * 2;
*kanjitmp++ = *src++;
*kanjitmp++ = *src;
flg = TRUE;
if (keta && !(keta % 3)) {
*kanjitmp++ = CommaHigh;
*kanjitmp++ = CommaLow;
}
}
if (keta) keta--;
wd &= (mask - 1);
}
return flg;
}
Static Void words2num(wd, tbl, flgc)
Ushort *wd;
Uchar TFar *tbl;
Int flgc;
{
Int i;
Int keta;
Int flg;
Uchar *kp = kanjitmp;
if (flgc) {
keta = NumKetaLength - 1;
flg = FALSE;
}
else {
keta = 0;
flg = TRUE;
}
for (i = NumWordBuf ; i-- > 0 ; ) {
flg = word2char(*(wd + i), tbl, keta, flg);
if (keta) keta -= 4;
}
if (kp == kanjitmp) {
*kanjitmp++ = *tbl++;
*kanjitmp++ = *tbl;
}
}
Void num_type00(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num1tbl, FALSE);
}
Void num_type01(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num1tbl, FALSE);
}
Void num_type02(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num1tbl, TRUE);
}
Void num_type03(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num2tbl, FALSE);
}
Void num_type04(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num2tbl, FALSE);
}
Void num_type05(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num2tbl, TRUE);
}
Void num_type06(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num3tbl, FALSE);
}
Void num_type07(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
words2num(num, Num3tbl, FALSE);
}
Static Void kan_num(wd, tbl1, tbl2)
Ushort *wd;
Uchar TFar *tbl1;
Uchar TFar *tbl2;
{
Int ii;
Ushort tmp;
Int mask;
Int num;
Int flg;
Uchar TFar *kurai1;
Uchar TFar *kurai2;
Uchar TFar *src;
Uchar *keep = kanjitmp;
kurai2 = Num6tbl - 2;
mask = 0;
wd += NumWordBuf - 1;
flg = FALSE;
for (ii = NumKetaLength ; ii-- > 0 ; ) {
if (!mask) {
if (flg) {
*kanjitmp++ = *kurai2++;
*kanjitmp++ = *kurai2++;
}
else
kurai2 += 2;
mask = 0x1000;
tmp = *wd--;
flg = FALSE;
kurai1 = tbl2;
}
if ((num = (unsigned int)tmp / mask) > _Num0) {
if ((num != _Num1) || !*kurai1) {
src = tbl1 + (num - _Num0) * 2;
*kanjitmp++ = *src++;
*kanjitmp++ = *src;
}
if (*kurai1) {
*kanjitmp++ = *kurai1++;
*kanjitmp++ = *kurai1++;
}
flg = TRUE;
}
else
kurai1 += 2;
tmp &= (mask - 1);
mask >>= 4;
}
if (kanjitmp == keep) {
*kanjitmp++ = *tbl1++;
*kanjitmp++ = *tbl1;
}
}
Void num_type08(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
kan_num(num, Num2tbl, Num4tbl);
}
Void num_type09(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Ushort num[NumWordBuf];
setwdnum(s1, (Int)jrec -> numlen, num);
kan_num(num, Num3tbl, Num5tbl);
}
Void num_type10(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Int i;
for (i = jrec -> numlen ; i > 0 ; i--) {
if (Chrtbl[*s1++] & NUMBER) {
*kanjitmp++ = *s2++;
*kanjitmp++ = *s2++;
}
else
s2 += euc_codesize(*s2);
}
}
Void num_type11(s1, s2, jrec)
Uchar *s1;
Uchar *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) {
*kanjitmp++ = *s2++;
*kanjitmp++ = *s2++;
if (--j > 0) {
if ((j % 3) == 0) {
*kanjitmp++ = CommaHigh;
*kanjitmp++ = CommaLow;
}
}
}
else
s2 += euc_codesize(*s2);
}
}
Void num_type12(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Int i;
Int j;
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(p, len, tbl)
Uchar *p;
Int len;
Uchar TFar *tbl;
{
Int i;
Int j;
Uchar tmp;
for (i = 0 ; i < len ; i++) {
tmp = *p++;
*kanjitmp++ = tbl[j = ((tmp & 0x0f) - _Num0) * 2];
*kanjitmp++ = tbl[j + 1];
if (j = ((tmp >> 4) & 3)) {
*kanjitmp++ = Num4tbl[j = (3 - j) * 2];
*kanjitmp++ = Num4tbl[j + 1];
}
if (j = ((tmp >> 6) & 3)) {
*kanjitmp++ = Num6tbl[j = (3 - j) * 2];
*kanjitmp++ = Num6tbl[j + 1];
}
}
}
Void num_type13(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Uchar num[NumKetaLength];
Int len;
len = setucnum(s1, (Int)jrec -> numlen, num);
num_kurai(num, len, Num1tbl);
}
Void num_type14(s1, s2, jrec)
Uchar *s1;
Uchar *s2;
JREC *jrec;
{
Uchar num[NumKetaLength];
Int len;
len = setucnum(s1, (Int)jrec -> numlen, num);
num_kurai(num, len, Num2tbl);
}

Some files were not shown because too many files have changed in this diff Show more