import
This commit is contained in:
commit
c5d964c617
284 changed files with 125357 additions and 0 deletions
284
CHANGES.eucJP
Normal file
284
CHANGES.eucJP
Normal 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
|
||||
18
Makefile.am
Normal file
18
Makefile.am
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I config
|
||||
|
||||
EXTRA_DIST = \
|
||||
CHANGES.eucJP \
|
||||
README \
|
||||
README.eucJP \
|
||||
sj3.spec.in
|
||||
|
||||
SUBDIRS = \
|
||||
include \
|
||||
doc \
|
||||
lib \
|
||||
src \
|
||||
dict
|
||||
|
||||
install-data-local:
|
||||
$(mkdir_p) $(SJ3VARDIR)
|
||||
77
README
Normal file
77
README
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
* 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).
|
||||
|
||||
* How to make
|
||||
In this directory,
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
# make install
|
||||
|
||||
Following files are installed after make install:
|
||||
|
||||
$(prefix)/var/sj3/spool/sj3/sj3main.dic
|
||||
Main dictionary(used by sj3serv)
|
||||
$(prefix)/sbin/sj3serv Kana-Kanji conversion server
|
||||
$(prefix)/bin/sj3demo Demonstration program
|
||||
$(prefix)/bin/sj3dic User dictionary utility
|
||||
$(prefix)/bin/sj3mkdic Dictionary converter
|
||||
$(prefix)/bin/sj3stat Utility to show status of sj3serv
|
||||
$(prefix)/include/sj3lib.h Header file for sj3lib
|
||||
$(prefix)/lib/libsj3core.a Kana-Kanji conversion server library
|
||||
$(prefix)/lib/libsj3core.so.x.x Kana-Kanji conversion server library
|
||||
$(prefix)/lib/libsj3lib.a Kana-Kanji conversion library
|
||||
$(prefix)/lib/libsj3lib.so.x.x Kana-Kanji conversion library
|
||||
$(prefix)/share/examples/sj3/sj3serv.lua.example
|
||||
Config example file of sj3serv
|
||||
$(prefix)/share/examples/sj3/freebsd-sj3.sh.in
|
||||
Config rc file for FreeBSD
|
||||
|
||||
* Source tree
|
||||
include Header files
|
||||
|
||||
lib/lua lua
|
||||
|
||||
lib/sj3core Kana-Kanji conversion library of server
|
||||
|
||||
lib/sj3rkcv Roma-Kana conversion library of client
|
||||
|
||||
lib/sj3lib Kana-Kanji conversion library of client
|
||||
|
||||
dict Main dictionary(text file)
|
||||
|
||||
src/sj3mkdic Tool for converting main dictionary from text file
|
||||
to binary file
|
||||
|
||||
src/sj3serv Kana-Kanji conversion server
|
||||
|
||||
src/sj3dic User dictionary utility
|
||||
src/sj3stat Utility to show status of sj3serv
|
||||
|
||||
src/sj3demo Demonstration program for Kana-Kanji conversion
|
||||
|
||||
doc/man Online manual(Japanese)
|
||||
doc/doc Operation guide for SJ3 and other documents(Japanese)
|
||||
|
||||
* Tested machine
|
||||
PC OpenBSD 4.2
|
||||
FreeBSD 7.0-current
|
||||
|
||||
* Bug report
|
||||
If some bugs are found, please send bug report(Japanese or English)
|
||||
http://code.google.com/p/sj3/issues/list
|
||||
|
||||
* 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
|
||||
72
README.eucJP
Normal file
72
README.eucJP
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
・SJ3 とは
|
||||
SJ3 は、ソニー(株)で開発された日本語入力システムです。
|
||||
SJ3 は、仮名漢字変換サーバ(sj3serv)と、
|
||||
仮名漢字変換ライブラリ(sj3lib)で構成されています。
|
||||
|
||||
・make の手順
|
||||
このディレクトリにおいて以下のようにしてください。
|
||||
|
||||
Makefile を作成する
|
||||
$ ./configure
|
||||
|
||||
make する
|
||||
$ make
|
||||
|
||||
インストールする
|
||||
# make install
|
||||
|
||||
この操作によりインストールされるファイルを以下に示します。
|
||||
|
||||
$(prefix)/var/sj3/spool/sj3/sj3main.dic
|
||||
sj3serv が使用するメイン辞書
|
||||
$(prefix)/sbin/sj3serv 仮名漢字変換サーバ
|
||||
$(prefix)/bin/sj3demo デモプログラム
|
||||
$(prefix)/bin/sj3dic ユーザ辞書ユーティリティ
|
||||
$(prefix)/bin/sj3mkdic 辞書生成ツール
|
||||
$(prefix)/bin/sj3stat sj3serv への接続状況表示ユーティリティ
|
||||
$(prefix)/include/sj3lib.h 仮名漢字変換ライブラリのヘッダファイル
|
||||
$(prefix)/lib/libsj3core.a 仮名漢字変換サーバのライブラリ
|
||||
$(prefix)/lib/libsj3core.so.x.x
|
||||
$(prefix)/lib/libsj3lib.a 仮名漢字変換クライアントのライブラリ
|
||||
$(prefix)/lib/libsj3lib.so.x.x
|
||||
$(prefix)/share/examples/sj3/sj3serv.lua.example
|
||||
sj3serv の設定ファイル
|
||||
$(prefix)/share/examples/sj3/freebsd-sj3.sh.in
|
||||
FreeBSDの起動スクリプト
|
||||
|
||||
・ディレクトリ構成
|
||||
include ヘッダファイル
|
||||
|
||||
lib/lua lua
|
||||
|
||||
lib/sj3core 仮名漢字変換サーバのライブラリ
|
||||
|
||||
lib/sj3rkcv 端末用仮名漢字変換クライアントのライブラリ
|
||||
|
||||
lib/sj3lib 仮名漢字変換クライアントのライブラリ
|
||||
|
||||
dict メイン辞書のテキストファイル
|
||||
|
||||
src/sj3mkdic 辞書のテキストファイルをバイナリファイルに
|
||||
変換するツール
|
||||
|
||||
src/sj3serv 仮名漢字変換サーバ
|
||||
|
||||
src/sj3dic ユーザ辞書ユーティリティ
|
||||
src/sj3stat sj3serv への接続状況表示ユーティリティ
|
||||
|
||||
src/sj3demo 仮名漢字変換ライブラリのデモプログラム
|
||||
|
||||
doc/man オンラインマニュアル
|
||||
doc/doc SJ3 日本語入力ガイドとその他ドキュメント
|
||||
|
||||
|
||||
・テスト機種
|
||||
PC OpenBSD 4.2
|
||||
FreeBSD 7.0-current
|
||||
|
||||
・バグレポート
|
||||
SJ3 のバグを見つけた方は以下のURLに報告していただけると助かります。
|
||||
レポートは日本語又は英語でお願いします。
|
||||
|
||||
http://code.google.com/p/sj3/issues/list
|
||||
157
config/pkg.m4
Normal file
157
config/pkg.m4
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
# ----------------------------------
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
|
||||
fi[]dnl
|
||||
])# PKG_PROG_PKG_CONFIG
|
||||
|
||||
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# Check to see whether a particular set of modules exists. Similar
|
||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
#
|
||||
#
|
||||
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
|
||||
# this or PKG_CHECK_MODULES is called, or make sure to call
|
||||
# PKG_CHECK_EXISTS manually
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
||||
m4_ifval([$2], [$2], [:])
|
||||
m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
|
||||
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
# ---------------------------------------------
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
else
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
||||
[pkg_failed=yes])
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])# _PKG_CONFIG
|
||||
|
||||
# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
# -----------------------------
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
# [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
#
|
||||
# Note that if there is a possibility the first call to
|
||||
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
#
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
ifelse([$4], , [AC_MSG_ERROR(dnl
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT
|
||||
])],
|
||||
[AC_MSG_RESULT([no])
|
||||
$4])
|
||||
elif test $pkg_failed = untried; then
|
||||
ifelse([$4], , [AC_MSG_FAILURE(dnl
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
|
||||
[$4])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
ifelse([$3], , :, [$3])
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MODULES
|
||||
900
configure.in
Normal file
900
configure.in
Normal file
|
|
@ -0,0 +1,900 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT([sj3], [2.0.1.21], [iwata@quasiquote.org])
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_SRCDIR([src/sj3serv/main.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AM_INIT_AUTOMAKE([1.9.6])
|
||||
|
||||
# Enable GNU extensions such as asprintf(3), BSD-originated functions,
|
||||
# POSIX features and more on glibc (and some other
|
||||
# implementations). See features.h. This macro should be placed here.
|
||||
AC_GNU_SOURCE
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Checks for libraries.
|
||||
LIBSJ3CORE_MAJOR_VERSION=2
|
||||
LIBSJ3CORE_MINOR_VERSION=0
|
||||
LIBSJ3CORE_MICRO_VERSION=121
|
||||
LIBSJ3CORE_MICRO_VERSION_SUFFIX=
|
||||
|
||||
LIBSJ3CORE_VERSION=$LIBSJ3CORE_MAJOR_VERSION.$LIBSJ3CORE_MINOR_VERSION.$LIBSJ3CORE_MICRO_VERSION$LIBSJ3CORE_MICRO_VERSION_SUFFIX
|
||||
LIBSJ3CORE_VERSION_INFO=`expr $LIBSJ3CORE_MAJOR_VERSION + $LIBSJ3CORE_MINOR_VERSION`:$LIBSJ3CORE_MICRO_VERSION:$LIBSJ3CORE_MINOR_VERSION
|
||||
LIBSJ3CORE_VERSION_NUMBER=`expr $LIBSJ3CORE_MAJOR_VERSION \* 10000 + $LIBSJ3CORE_MINOR_VERSION \* 100 + $LIBSJ3CORE_MICRO_VERSION`
|
||||
|
||||
AC_SUBST(LIBSJ3CORE_MAJOR_VERSION)
|
||||
AC_SUBST(LIBSJ3CORE_MINOR_VERSION)
|
||||
AC_SUBST(LIBSJ3CORE_MICRO_VERSION)
|
||||
AC_SUBST(LIBSJ3CORE_MICRO_VERSION_SUFFIX)
|
||||
AC_SUBST(LIBSJ3CORE_VERSION)
|
||||
AC_SUBST(LIBSJ3CORE_VERSION_INFO)
|
||||
AC_SUBST(LIBSJ3CORE_VERSION_NUMBER)
|
||||
AC_SUBST(LIBSJ3CORE_VERSION_EXTRA)
|
||||
|
||||
LIBSJ3LIB_MAJOR_VERSION=2
|
||||
LIBSJ3LIB_MINOR_VERSION=0
|
||||
LIBSJ3LIB_MICRO_VERSION=121
|
||||
LIBSJ3LIB_MICRO_VERSION_SUFFIX=
|
||||
|
||||
LIBSJ3LIB_VERSION=$LIBSJ3LIB_MAJOR_VERSION.$LIBSJ3LIB_MINOR_VERSION.$LIBSJ3LIB_MICRO_VERSION$LIBSJ3LIB_MICRO_VERSION_SUFFIX
|
||||
LIBSJ3LIB_VERSION_INFO=`expr $LIBSJ3LIB_MAJOR_VERSION + $LIBSJ3LIB_MINOR_VERSION`:$LIBSJ3LIB_MICRO_VERSION:$LIBSJ3LIB_MINOR_VERSION
|
||||
LIBSJ3LIB_VERSION_NUMBER=`expr $LIBSJ3LIB_MAJOR_VERSION \* 10000 + $LIBSJ3LIB_MINOR_VERSION \* 100 + $LIBSJ3LIB_MICRO_VERSION`
|
||||
|
||||
AC_SUBST(LIBSJ3LIB_MAJOR_VERSION)
|
||||
AC_SUBST(LIBSJ3LIB_MINOR_VERSION)
|
||||
AC_SUBST(LIBSJ3LIB_MICRO_VERSION)
|
||||
AC_SUBST(LIBSJ3LIB_MICRO_VERSION_SUFFIX)
|
||||
AC_SUBST(LIBSJ3LIB_VERSION)
|
||||
AC_SUBST(LIBSJ3LIB_VERSION_INFO)
|
||||
AC_SUBST(LIBSJ3LIB_VERSION_NUMBER)
|
||||
AC_SUBST(LIBSJ3LIB_VERSION_EXTRA)
|
||||
|
||||
LIBSJ3RKCV_MAJOR_VERSION=2
|
||||
LIBSJ3RKCV_MINOR_VERSION=0
|
||||
LIBSJ3RKCV_MICRO_VERSION=121
|
||||
LIBSJ3RKCV_MICRO_VERSION_SUFFIX=
|
||||
|
||||
LIBSJ3RKCV_VERSION=$LIBSJ3RKCV_MAJOR_VERSION.$LIBSJ3RKCV_MINOR_VERSION.$LIBSJ3RKCV_MICRO_VERSION$LIBSJ3RKCV_MICRO_VERSION_SUFFIX
|
||||
LIBSJ3RKCV_VERSION_INFO=`expr $LIBSJ3RKCV_MAJOR_VERSION + $LIBSJ3RKCV_MINOR_VERSION`:$LIBSJ3RKCV_MICRO_VERSION:$LIBSJ3RKCV_MINOR_VERSION
|
||||
LIBSJ3RKCV_VERSION_NUMBER=`expr $LIBSJ3RKCV_MAJOR_VERSION \* 10000 + $LIBSJ3RKCV_MINOR_VERSION \* 100 + $LIBSJ3RKCV_MICRO_VERSION`
|
||||
|
||||
AC_SUBST(LIBSJ3RKCV_MAJOR_VERSION)
|
||||
AC_SUBST(LIBSJ3RKCV_MINOR_VERSION)
|
||||
AC_SUBST(LIBSJ3RKCV_MICRO_VERSION)
|
||||
AC_SUBST(LIBSJ3RKCV_MICRO_VERSION_SUFFIX)
|
||||
AC_SUBST(LIBSJ3RKCV_VERSION)
|
||||
AC_SUBST(LIBSJ3RKCV_VERSION_INFO)
|
||||
AC_SUBST(LIBSJ3RKCV_VERSION_NUMBER)
|
||||
AC_SUBST(LIBSJ3RKCV_VERSION_EXTRA)
|
||||
|
||||
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([ \
|
||||
arpa/inet.h \
|
||||
fcntl.h \
|
||||
getopt.h \
|
||||
locale.h \
|
||||
netdb.h \
|
||||
syslog.h \
|
||||
netinet/in.h \
|
||||
stdlib.h \
|
||||
string.h \
|
||||
strings.h \
|
||||
sys/file.h \
|
||||
sys/ioctl.h \
|
||||
sys/param.h \
|
||||
sys/socket.h \
|
||||
sys/time.h \
|
||||
termio.h \
|
||||
termios.h \
|
||||
unistd.h \
|
||||
utmp.h \
|
||||
utmpx.h \
|
||||
wctype.h \
|
||||
])
|
||||
|
||||
case "$host" in
|
||||
*-*-aix*)
|
||||
# Some versions of VAC won't allow macro redefinitions at
|
||||
# -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
|
||||
# particularly with older versions of vac or xlc.
|
||||
# It also throws errors about null macro argments, but these are
|
||||
# not fatal.
|
||||
AC_MSG_CHECKING(if compiler allows macro redefinitions)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#define testmacro foo
|
||||
#define testmacro bar
|
||||
int main(void) { exit(0); }
|
||||
]])],
|
||||
[ AC_MSG_RESULT(yes) ],
|
||||
[ AC_MSG_RESULT(no)
|
||||
CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
|
||||
LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
|
||||
CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
|
||||
CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
|
||||
if (test -z "$blibpath"); then
|
||||
blibpath="/usr/lib:/lib"
|
||||
fi
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
if test "$GCC" = "yes"; then
|
||||
flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
|
||||
else
|
||||
flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
|
||||
fi
|
||||
for tryflags in $flags ;do
|
||||
if (test -z "$blibflags"); then
|
||||
LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
|
||||
AC_TRY_LINK([], [], [blibflags=$tryflags])
|
||||
fi
|
||||
done
|
||||
if (test -z "$blibflags"); then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
|
||||
else
|
||||
AC_MSG_RESULT($blibflags)
|
||||
fi
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
;;
|
||||
*-*-cygwin*)
|
||||
AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
|
||||
;;
|
||||
*-*-dgux*)
|
||||
;;
|
||||
*-*-darwin*)
|
||||
AC_MSG_CHECKING(if we have working getaddrinfo)
|
||||
AC_TRY_RUN([#include <mach-o/dyld.h>
|
||||
main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||
exit(0);
|
||||
else
|
||||
exit(1);
|
||||
}], [AC_MSG_RESULT(working)],
|
||||
[AC_MSG_RESULT(buggy)
|
||||
AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
|
||||
[AC_MSG_RESULT(assume it is working)])
|
||||
;;
|
||||
*-*-dragonfly*)
|
||||
;;
|
||||
*-*-hpux*)
|
||||
# first we define all of the options common to all HP-UX releases
|
||||
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
|
||||
LIBS="$LIBS -lsec"
|
||||
AC_CHECK_LIB(xnet, t_error, ,
|
||||
AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
|
||||
|
||||
# next, we define all of the options specific to major releases
|
||||
case "$host" in
|
||||
*-*-hpux10*)
|
||||
if test -z "$GCC"; then
|
||||
CFLAGS="$CFLAGS -Ae"
|
||||
fi
|
||||
;;
|
||||
*-*-hpux11*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# lastly, we define options specific to minor releases
|
||||
case "$host" in
|
||||
*-*-hpux10.26)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*-*-irix5*)
|
||||
PATH="$PATH:/usr/etc"
|
||||
AC_DEFINE(BROKEN_INET_NTOA, 1,
|
||||
[Define if you system's inet_ntoa is busted
|
||||
(e.g. Irix gcc issue)])
|
||||
;;
|
||||
*-*-irix6*)
|
||||
PATH="$PATH:/usr/etc"
|
||||
AC_DEFINE(BROKEN_INET_NTOA)
|
||||
;;
|
||||
*-*-linux*)
|
||||
AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
|
||||
inet6_default_4in6=yes
|
||||
;;
|
||||
mips-sony-bsd|mips-sony-newsos4)
|
||||
SONY=1
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
;;
|
||||
*-*-bsdi*)
|
||||
;;
|
||||
*-next-*)
|
||||
;;
|
||||
*-*-openbsd*)
|
||||
AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
|
||||
AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
|
||||
;;
|
||||
*-*-solaris*)
|
||||
;;
|
||||
*-*-sunos4*)
|
||||
CPPFLAGS="$CPPFLAGS -DSUNOS4"
|
||||
;;
|
||||
*-ncr-sysv*)
|
||||
LIBS="$LIBS -lc89"
|
||||
;;
|
||||
*-sni-sysv*)
|
||||
# /usr/ucblib MUST NOT be searched on ReliantUNIX
|
||||
AC_CHECK_LIB(dl, dlsym, ,)
|
||||
# -lresolv needs to be at the end of LIBS or DNS lookups break
|
||||
AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
|
||||
# /usr/ucblib/libucb.a no longer needed on ReliantUNIX
|
||||
# Attention: always take care to bind libsocket and libnsl before libc,
|
||||
# otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
|
||||
;;
|
||||
# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
|
||||
*-*-sysv4.2*)
|
||||
;;
|
||||
# UnixWare 7.x, OpenUNIX 8
|
||||
*-*-sysv5*)
|
||||
;;
|
||||
*-*-sysv*)
|
||||
;;
|
||||
# SCO UNIX and OEM versions of SCO UNIX
|
||||
*-*-sco3.2v4*)
|
||||
AC_MSG_ERROR("This Platform is no longer supported.")
|
||||
;;
|
||||
# SCO OpenServer 5.x
|
||||
*-*-sco3.2v5*)
|
||||
if test -z "$GCC"; then
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
fi
|
||||
LIBS="$LIBS -lprot -lx -ltinfo -lm"
|
||||
no_dev_ptmx=1
|
||||
MANTYPE=man
|
||||
TEST_SHELL=ksh
|
||||
;;
|
||||
*-*-unicosmk*)
|
||||
LDFLAGS="$LDFLAGS"
|
||||
LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
|
||||
MANTYPE=cat
|
||||
;;
|
||||
*-*-unicosmp*)
|
||||
LDFLAGS="$LDFLAGS"
|
||||
LIBS="$LIBS -lgen -lacid -ldb"
|
||||
MANTYPE=cat
|
||||
;;
|
||||
*-*-unicos*)
|
||||
LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
|
||||
LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
|
||||
MANTYPE=cat
|
||||
;;
|
||||
*-dec-osf*)
|
||||
AC_DEFINE(BROKEN_GETADDRINFO)
|
||||
;;
|
||||
*-*-nto-qnx*)
|
||||
;;
|
||||
*-*-ultrix*)
|
||||
AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
|
||||
AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
|
||||
;;
|
||||
*-*-lynxos)
|
||||
CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_HEADER_STDBOOL
|
||||
AC_TYPE_UID_T
|
||||
|
||||
AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
],
|
||||
[ ssize_t foo; foo = 1235; ],
|
||||
[ ac_cv_have_ssize_t="yes" ],
|
||||
[ ac_cv_have_ssize_t="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_ssize_t" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
|
||||
fi
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_FORK
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_FUNC_SETPGRP
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_STAT
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_WAIT3
|
||||
AC_CHECK_FUNCS([ \
|
||||
alarm \
|
||||
arc4random \
|
||||
asprintf \
|
||||
dup2 \
|
||||
endpwent \
|
||||
freeaddrinfo \
|
||||
ftruncate \
|
||||
inet_ntoa \
|
||||
getaddrinfo \
|
||||
gethostbyaddr \
|
||||
gethostbyname \
|
||||
gethostname \
|
||||
getnameinfo \
|
||||
getopt \
|
||||
getpeereid \
|
||||
memset \
|
||||
mkdir \
|
||||
select \
|
||||
setlocale \
|
||||
setproctitle \
|
||||
setsid \
|
||||
socket \
|
||||
snprintf \
|
||||
strchr \
|
||||
strdup \
|
||||
strerror \
|
||||
strlcat \
|
||||
strlcpy \
|
||||
strrchr \
|
||||
strstr \
|
||||
strtol \
|
||||
vsnprintf \
|
||||
vasprintf \
|
||||
])
|
||||
|
||||
AC_CHECK_LIBM
|
||||
AC_SUBST(LIBM)
|
||||
|
||||
# IRIX has a const char return value for gai_strerror()
|
||||
AC_CHECK_FUNCS(gai_strerror,[
|
||||
AC_DEFINE(HAVE_GAI_STRERROR)
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
const char *gai_strerror(int);],[
|
||||
char *str;
|
||||
|
||||
str = gai_strerror(0);],[
|
||||
AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
|
||||
[Define if gai_strerror() returns const char *])])])
|
||||
|
||||
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
],
|
||||
[ struct sockaddr_storage s; ],
|
||||
[ ac_cv_have_struct_sockaddr_storage="yes" ],
|
||||
[ ac_cv_have_struct_sockaddr_storage="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
|
||||
[define if you have struct sockaddr_storage data type])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
],
|
||||
[ struct sockaddr_in6 s; s.sin6_family = 0; ],
|
||||
[ ac_cv_have_struct_sockaddr_in6="yes" ],
|
||||
[ ac_cv_have_struct_sockaddr_in6="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
|
||||
[define if you have struct sockaddr_in6 data type])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
],
|
||||
[ struct in6_addr s; s.s6_addr[0] = 0; ],
|
||||
[ ac_cv_have_struct_in6_addr="yes" ],
|
||||
[ ac_cv_have_struct_in6_addr="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
|
||||
[define if you have struct in6_addr data type])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
],
|
||||
[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
|
||||
[ ac_cv_have_struct_addrinfo="yes" ],
|
||||
[ ac_cv_have_struct_addrinfo="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
|
||||
[define if you have struct addrinfo data type])
|
||||
fi
|
||||
|
||||
|
||||
# Check for broken snprintf
|
||||
if test "x$ac_cv_func_snprintf" = "xyes" ; then
|
||||
AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BROKEN_SNPRINTF, 1,
|
||||
[Define if your snprintf is busted])
|
||||
AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
|
||||
],
|
||||
[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
|
||||
)
|
||||
fi
|
||||
|
||||
# If we don't have a working asprintf, then we strongly depend on vsnprintf
|
||||
# returning the right thing on overflow: the number of characters it tried to
|
||||
# create (as per SUSv3)
|
||||
if test "x$ac_cv_func_asprintf" != "xyes" && \
|
||||
test "x$ac_cv_func_vsnprintf" = "xyes" ; then
|
||||
AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int x_snprintf(char *str,size_t count,const char *fmt,...)
|
||||
{
|
||||
size_t ret; va_list ap;
|
||||
va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
char x[1];
|
||||
exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
|
||||
} ]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BROKEN_SNPRINTF, 1,
|
||||
[Define if your snprintf is busted])
|
||||
AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
|
||||
],
|
||||
[ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
|
||||
)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
|
||||
AC_TRY_LINK(
|
||||
[#include <stdarg.h>
|
||||
va_list x,y;],
|
||||
[va_copy(x,y);],
|
||||
[ ac_cv_have_va_copy="yes" ],
|
||||
[ ac_cv_have_va_copy="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_va_copy" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
|
||||
AC_TRY_LINK(
|
||||
[#include <stdarg.h>
|
||||
va_list x,y;],
|
||||
[__va_copy(x,y);],
|
||||
[ ac_cv_have___va_copy="yes" ],
|
||||
[ ac_cv_have___va_copy="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have___va_copy" = "xyes" ; then
|
||||
AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether getopt has optreset support],
|
||||
ac_cv_have_getopt_optreset, [
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <getopt.h>
|
||||
],
|
||||
[ extern int optreset; optreset = 0; ],
|
||||
[ ac_cv_have_getopt_optreset="yes" ],
|
||||
[ ac_cv_have_getopt_optreset="no" ]
|
||||
)
|
||||
])
|
||||
if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
|
||||
[Define if your getopt(3) defines and uses optreset])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(setresuid, [
|
||||
dnl Some platorms have setresuid that isn't implemented, test for this
|
||||
AC_MSG_CHECKING(if setresuid seems to work)
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_DEFINE(BROKEN_SETRESUID, 1,
|
||||
[Define if your setresuid() is broken])
|
||||
AC_MSG_RESULT(not implemented)],
|
||||
[AC_MSG_WARN([cross compiling: not checking setresuid])]
|
||||
)
|
||||
])
|
||||
|
||||
AC_CHECK_FUNCS(setresgid, [
|
||||
dnl Some platorms have setresgid that isn't implemented, test for this
|
||||
AC_MSG_CHECKING(if setresgid seems to work)
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_DEFINE(BROKEN_SETRESGID, 1,
|
||||
[Define if your setresgid() is broken])
|
||||
AC_MSG_RESULT(not implemented)],
|
||||
[AC_MSG_WARN([cross compiling: not checking setresuid])]
|
||||
)
|
||||
])
|
||||
|
||||
AC_CHECK_FUNC(daemon,
|
||||
[AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
|
||||
[AC_CHECK_LIB(bsd, daemon,
|
||||
[LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
|
||||
)
|
||||
|
||||
# On systems where [v]snprintf is broken, but is declared in stdio,
|
||||
# check that the fmt argument is const char * or just char *.
|
||||
# This is only useful for when BROKEN_SNPRINTF
|
||||
AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
|
||||
int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
|
||||
int main(void) { snprintf(0, 0, 0); }
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(SNPRINTF_CONST, [const],
|
||||
[Define as const if snprintf() can declare const char *fmt])],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
|
||||
|
||||
AC_ARG_WITH(libwrap,[ --with-libwrap use tcp wrappers [default=no]], , wrap_ok=no)
|
||||
|
||||
# Check for missing getpeereid (or equiv) support
|
||||
NO_PEERCHECK=""
|
||||
if test "x$ac_cv_func_getpeereid" != "xyes" ; then
|
||||
AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[int i = SO_PEERCRED;],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
|
||||
],
|
||||
[AC_MSG_RESULT(no)
|
||||
NO_PEERCHECK=1]
|
||||
)
|
||||
fi
|
||||
|
||||
if test ! -z "$NO_PEERCHECK" ; then
|
||||
echo "WARNING: the operating system that you are using does not "
|
||||
echo "appear to support either the getpeereid() API nor the "
|
||||
echo "SO_PEERCRED getsockopt() option. These facilities are used to "
|
||||
echo "enforce security checks to prevent unauthorised connections to "
|
||||
echo "sj3serv. Their absence increases the risk that a malicious "
|
||||
echo "user can connect to your agent. "
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
|
||||
test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
|
||||
AC_MSG_CHECKING(if getaddrinfo seems to work)
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#define TEST_PORT "2222"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int err, sock;
|
||||
struct addrinfo *gai_ai, *ai, hints;
|
||||
char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
|
||||
if (ai->ai_family != AF_INET6)
|
||||
continue;
|
||||
|
||||
err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
|
||||
sizeof(ntop), strport, sizeof(strport),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV);
|
||||
|
||||
if (err != 0) {
|
||||
if (err == EAI_SYSTEM)
|
||||
perror("getnameinfo EAI_SYSTEM");
|
||||
else
|
||||
fprintf(stderr, "getnameinfo failed: %s\n",
|
||||
gai_strerror(err));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||
if (sock < 0)
|
||||
perror("socket");
|
||||
if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
|
||||
if (errno == EBADF)
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BROKEN_GETADDRINFO)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(cross-compiling, assuming yes)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(enable server for sj3)
|
||||
AC_ARG_ENABLE(server,
|
||||
AC_HELP_STRING([--enable-server],
|
||||
[install server @<:@default=yes@:>@]),
|
||||
[],
|
||||
[
|
||||
enable_server=yes
|
||||
])
|
||||
AM_CONDITIONAL(BUILDABLE_SJ3SERV, test x$enable_server = xyes)
|
||||
AC_MSG_RESULT($enable_server)
|
||||
|
||||
AC_MSG_CHECKING(enable client for sj3)
|
||||
AC_ARG_ENABLE(client,
|
||||
AC_HELP_STRING([--enable-client],
|
||||
[install client @<:@default=yes@:>@]),
|
||||
[],
|
||||
[
|
||||
enable_client=yes
|
||||
])
|
||||
AM_CONDITIONAL(BUILDABLE_SJ3CLIENT, test x$enable_client = xyes)
|
||||
AC_MSG_RESULT($enable_client)
|
||||
|
||||
AC_MSG_CHECKING(enable dictionary for sj3)
|
||||
AC_ARG_ENABLE(dict,
|
||||
AC_HELP_STRING([--enable-dict],
|
||||
[install dictionary @<:@default=yes@:>@]),
|
||||
[],
|
||||
[
|
||||
if test ! x$enable_server = xyes; then
|
||||
AC_MSG_ERROR([*** must be set --enable-server])
|
||||
fi
|
||||
enable_dict=yes
|
||||
])
|
||||
AM_CONDITIONAL(BUILDABLE_SJ3DICT, test x$enable_dict = xyes)
|
||||
AC_MSG_RESULT($enable_dict)
|
||||
|
||||
AC_MSG_CHECKING(enable demo for sj3)
|
||||
AC_ARG_ENABLE(demo,
|
||||
AC_HELP_STRING([--enable-demo],
|
||||
[install demo @<:@default=yes@:>@]),
|
||||
[],
|
||||
[
|
||||
if test ! x$enable_client = xyes; then
|
||||
AC_MSG_ERROR([*** must be set --enable-client])
|
||||
fi
|
||||
enable_demo=yes
|
||||
])
|
||||
AM_CONDITIONAL(BUILDABLE_SJ3DEMO, test x$enable_demo = xyes)
|
||||
AC_MSG_RESULT($enable_demo)
|
||||
|
||||
WRAP_LIB=
|
||||
if test "x$with_libwrap" = "xyes"; then
|
||||
sj3_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lwrap"
|
||||
|
||||
AC_MSG_CHECKING([for tcp_wrapper library and headers])
|
||||
|
||||
wrap_ok=no
|
||||
AC_TRY_LINK(
|
||||
[#include <stdio.h>
|
||||
#include <tcpd.h>
|
||||
#include <syslog.h>
|
||||
int allow_severity = LOG_INFO;
|
||||
int deny_severity = LOG_WARNING;],
|
||||
[struct request_info *request; return hosts_access (request);],
|
||||
[AC_DEFINE(USE_LIBWRAP, 1, [Define if you have the tcp_wrapper library.])
|
||||
WRAP_LIB="-lwrap"
|
||||
wrap_ok=yes],
|
||||
[LIBS="$LIBS -lnsl"
|
||||
AC_TRY_LINK(
|
||||
[#include <stdio.h>
|
||||
#include <tcpd.h>
|
||||
#include <syslog.h>
|
||||
int allow_severity = LOG_INFO;
|
||||
int deny_severity = LOG_WARNING;],
|
||||
[struct request_info *request; return hosts_access (request);],
|
||||
|
||||
[AC_DEFINE(USE_LIBWRAP, 1, [Define if you have the tcp_wrapper library.])
|
||||
WRAP_LIB="-lwrap -lnsl"
|
||||
wrap_ok=yes])])
|
||||
|
||||
AC_MSG_RESULT($wrap_ok)
|
||||
|
||||
LIBS="$sj3_save_LIBS"
|
||||
fi
|
||||
AC_SUBST(WRAP_LIB)
|
||||
|
||||
AC_ARG_WITH(external-lua,
|
||||
AS_HELP_STRING([--with-external-lua], [Use external lua library,
|
||||
@<:@default=no@:>@]),
|
||||
[
|
||||
if test "x$with_external_lua" = "xyes"; then
|
||||
PKG_CHECK_MODULES(LUA, lua >= 5.1, with_internal_lua="no")
|
||||
else
|
||||
with_internal_lua=yes
|
||||
fi
|
||||
],
|
||||
[
|
||||
with_internal_lua=yes
|
||||
]
|
||||
)
|
||||
AM_CONDITIONAL(SJ3_INTERNAL_LUA, test x$with_internal_lua = xyes)
|
||||
|
||||
AC_ARG_WITH(user,
|
||||
[ --with-user=uid name of the sj3 user (default=_sj3)],
|
||||
sj3_user="$withval", sj3_user="_sj3")
|
||||
|
||||
SJ3OWNER=$sj3_user
|
||||
AC_DEFINE_UNQUOTED(SJ3OWNER, "$sj3_user",[name of the sj3 user])
|
||||
AC_SUBST(SJ3OWNER)
|
||||
|
||||
AC_ARG_WITH(group,
|
||||
[ --with-group=gid name of the sj3 group (default=_sj3)],
|
||||
sj3_group="$withval", sj3_group="_sj3")
|
||||
|
||||
SJ3GROUP=$sj3_group
|
||||
AC_DEFINE_UNQUOTED(SJ3GROUP, "$sj3_group",[name of the sj3 group])
|
||||
AC_SUBST(SJ3GROUP)
|
||||
|
||||
dnl configure config directory
|
||||
sj3sysconf_dir=`echo $sysconfdir | grep prefix`
|
||||
|
||||
if test -n "$sj3sysconf_dir"; then
|
||||
if test "$prefix" = "NONE"
|
||||
then
|
||||
sj3sysconf_dir="$ac_default_prefix/etc/sj3"
|
||||
else
|
||||
sj3sysconf_dir="$prefix/etc/sj3"
|
||||
fi
|
||||
else
|
||||
sj3sysconf_dir="$sysconfdir/sj3"
|
||||
fi
|
||||
|
||||
SJ3SYSCONFDIR=$sj3sysconf_dir
|
||||
AC_SUBST(SJ3SYSCONFDIR)
|
||||
AC_DEFINE_UNQUOTED(SJ3CONFDIR, "$sj3sysconf_dir", [server config dir])
|
||||
AC_DEFINE_UNQUOTED(RUNCMDFILE, "$sj3sysconf_dir/sj3serv.lua", [server config file])
|
||||
|
||||
dnl configure config directory
|
||||
sj3var_dir=`echo $localstatedir | grep prefix`
|
||||
|
||||
if test -n "$sj3var_dir"; then
|
||||
if test "$prefix" = "NONE"
|
||||
then
|
||||
sj3var_dir="$ac_default_prefix/var"
|
||||
else
|
||||
sj3var_dir="$prefix/var"
|
||||
fi
|
||||
else
|
||||
sj3var_dir="$localstatedir"
|
||||
fi
|
||||
|
||||
SJ3VARDIR="$sj3var_dir"
|
||||
AC_SUBST(SJ3VARDIR)
|
||||
AC_DEFINE_UNQUOTED(CHROOTDIR, "$sj3var_dir/spool/sj3", [chrooted dir])
|
||||
AC_DEFINE_UNQUOTED(SOCKETNAME, "$sj3var_dir/run/sj3serv.socket", [socket file])
|
||||
AC_DEFINE_UNQUOTED(PIDFILE, "$sj3var_dir/run/sj3serv.pid", [pid file])
|
||||
|
||||
SJ3DICTDIR="$sj3var_dir/spool/sj3"
|
||||
AC_SUBST(SJ3DICTDIR)
|
||||
AC_DEFINE_UNQUOTED(DICTROOTDIR, "$SJ3DICTDIR", [dict root dir])
|
||||
|
||||
AH_BOTTOM([/* Include os specific header. */
|
||||
#include "sj3compat.h"])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
sj3.spec
|
||||
include/Makefile
|
||||
include/sj3common/Makefile
|
||||
include/sj3compat/Makefile
|
||||
include/sj3core/Makefile
|
||||
include/sj3lib/Makefile
|
||||
include/sj3rkcv/Makefile
|
||||
dict/Makefile
|
||||
doc/Makefile
|
||||
doc/man/Makefile
|
||||
doc/doc/Makefile
|
||||
lib/Makefile
|
||||
lib/sj3compat/Makefile
|
||||
lib/sj3core/Makefile
|
||||
lib/sj3lib/Makefile
|
||||
lib/lua/Makefile
|
||||
lib/lua/doc/Makefile
|
||||
lib/lua/etc/Makefile
|
||||
lib/lua/src/Makefile
|
||||
lib/lua/test/Makefile
|
||||
lib/sj3lib/sj3lib.pc
|
||||
lib/sj3rkcv/Makefile
|
||||
src/Makefile
|
||||
src/sj3demo/Makefile
|
||||
src/sj3dic/Makefile
|
||||
src/sj3mkdic/Makefile
|
||||
src/sj3serv/Makefile
|
||||
src/sj3stat/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
19
dict/Makefile.am
Normal file
19
dict/Makefile.am
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
if BUILDABLE_SJ3DICT
|
||||
|
||||
EXTRA_DIST = visual.dic
|
||||
|
||||
all: sj3main.dic
|
||||
|
||||
sj3main.dic: visual.dic
|
||||
$(top_srcdir)/src/sj3mkdic/sj3mkdic ./visual.dic sj3main.dic > Moutput
|
||||
|
||||
install::
|
||||
($(mkdir_p) $(SJ3DICTDIR); \
|
||||
$(INSTALL_DATA) sj3main.dic $(SJ3DICTDIR); \
|
||||
$(mkdir_p) $(SJ3DICTDIR)/user; \
|
||||
chown $(SJ3OWNER) $(SJ3DICTDIR)/user; \
|
||||
chgrp $(SJ3GROUP) $(SJ3DICTDIR)/user;)
|
||||
|
||||
CLEANFILES = sj3main.dic Moutput
|
||||
|
||||
endif
|
||||
29803
dict/visual.dic
Normal file
29803
dict/visual.dic
Normal file
File diff suppressed because it is too large
Load diff
2
doc/Makefile.am
Normal file
2
doc/Makefile.am
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SUBDIRS = man doc
|
||||
|
||||
29
doc/doc/Makefile.am
Normal file
29
doc/doc/Makefile.am
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
EXTRA_DIST =
|
||||
doc_DATA =
|
||||
|
||||
if BUILDABLE_SJ3CLIENT
|
||||
|
||||
EXTRA_DIST += \
|
||||
Nihongo.ps \
|
||||
sj3lib.ms
|
||||
|
||||
doc_DATA += \
|
||||
Nihongo.ps \
|
||||
sj3lib.ms
|
||||
|
||||
endif
|
||||
|
||||
if BUILDABLE_SJ3SERV
|
||||
|
||||
EXTRA_DIST += \
|
||||
hinsi.ms \
|
||||
makedict.ms \
|
||||
sj3serv.ms
|
||||
|
||||
doc_DATA += \
|
||||
hinsi.ms \
|
||||
makedict.ms \
|
||||
sj3serv.ms
|
||||
|
||||
endif
|
||||
|
||||
18417
doc/doc/Nihongo.ps
Normal file
18417
doc/doc/Nihongo.ps
Normal file
File diff suppressed because it is too large
Load diff
489
doc/doc/hinsi.ms
Normal file
489
doc/doc/hinsi.ms
Normal 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
91
doc/doc/makedict.ms
Normal 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
619
doc/doc/sj3lib.ms
Normal 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/local/lib/sj3/dict\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/local/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/local/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/local/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/local/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/local/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/local/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/local/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
170
doc/doc/sj3serv.ms
Normal 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/local/lib/sj3/dict です。
|
||||
.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
|
||||
25
doc/man/Makefile.am
Normal file
25
doc/man/Makefile.am
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
EXTRA_DIST =
|
||||
man_MANS =
|
||||
|
||||
if BUILDABLE_SJ3CLIENT
|
||||
|
||||
EXTRA_DIST += \
|
||||
sj3dic.1
|
||||
|
||||
man_MANS += \
|
||||
sj3dic.1
|
||||
|
||||
endif
|
||||
|
||||
if BUILDABLE_SJ3SERV
|
||||
|
||||
EXTRA_DIST += \
|
||||
sj3mkdic.1 \
|
||||
sj3serv.1
|
||||
|
||||
man_MANS += \
|
||||
sj3mkdic.1 \
|
||||
sj3serv.1
|
||||
|
||||
endif
|
||||
|
||||
141
doc/man/sj3dic.1
Normal file
141
doc/man/sj3dic.1
Normal 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/local/bin/sj3serv
|
||||
かな漢字変換サーバ
|
||||
.TP
|
||||
/usr/local/lib/sj3/serverrc
|
||||
かな漢字変換サーバ セットアップファイル
|
||||
.TP
|
||||
/usr/local/bin/sj3
|
||||
日本語入力フロントエンドプロセッサ
|
||||
.TP
|
||||
/usr/local/lib/sj3/dict/
|
||||
かな漢字変換サーバ デフォルト辞書ディレクトリ
|
||||
.TP
|
||||
sj3main.dic
|
||||
かな漢字変換メイン辞書
|
||||
.TP
|
||||
user/\fIusername\fP/private.dic
|
||||
かな漢字変換ユーザ辞書
|
||||
.TP
|
||||
user/\fIusername\fP/study.dat
|
||||
かな漢字変換学習ファイル
|
||||
.TP
|
||||
/usr/local/include/sj3lib.h
|
||||
かな漢字変換ライブラリ用インクルードファイル
|
||||
.TP
|
||||
/usr/local/lib/libsj3lib.a
|
||||
かな漢字変換ライブラリ
|
||||
.\".TP
|
||||
.\"/usr/sony/demo/sj3/*
|
||||
.\"かな漢字変換ライブラリ 使用法サンプル
|
||||
|
||||
.SH 関連事項
|
||||
sj3(1), sj3serv(1), sj3lib(3)
|
||||
|
||||
.SH バグ
|
||||
576
doc/man/sj3mkdic.1
Normal file
576
doc/man/sj3mkdic.1
Normal 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/local/bin/sj3serv
|
||||
かな漢字変換サーバ
|
||||
.TP
|
||||
.B /usr/local/lib/sj3/serverrc
|
||||
かな漢字変換サーバ セットアップファイル
|
||||
.TP
|
||||
.B /usr/local/bin/sj3
|
||||
日本語入力フロントエンドプロセッサ
|
||||
.TP
|
||||
.B /usr/local/lib/sj3/dict/
|
||||
かな漢字変換サーバ デフォルト辞書ディレクトリ
|
||||
.TP
|
||||
.B " sj3main.dic
|
||||
かな漢字変換メイン辞書
|
||||
.TP
|
||||
.B " user/\f2username\f1/private.dic
|
||||
かな漢字変換ユーザ辞書
|
||||
.TP
|
||||
.B " user/\f2username\f1/study.dat
|
||||
かな漢字変換学習ファイル
|
||||
.TP
|
||||
.B /usr/local/include/sj3lib.h
|
||||
かな漢字変換ライブラリ用インクルードファイル
|
||||
.TP
|
||||
.B /usr/local/lib/libsj3lib.a
|
||||
かな漢字変換ライブラリ
|
||||
.\".TP
|
||||
.\"\f3/usr/local/demo/sj3/ *\f1
|
||||
.\"かな漢字変換ライブラリ 使用法サンプル
|
||||
.PD
|
||||
.SH 関連項目
|
||||
\f4sj3\f1 (1),
|
||||
\f4sj3serv\f1 (1),
|
||||
\f4sj3dic\f1 (1),
|
||||
\f4sj3lib\f1 (3)
|
||||
78
doc/man/sj3serv.1
Normal file
78
doc/man/sj3serv.1
Normal 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/local/lib/sj3/serverrc’を読み込みますが、
|
||||
このオプションが指定されたときにはかわりに
|
||||
コマンドラインで指定されたセットアップファイルを読み込みます。
|
||||
.br
|
||||
.SH 関連ファイル
|
||||
.PD 0
|
||||
.TP \w'\ \ \ \ user/\fIusername\fP/private.dic'u+2n
|
||||
/usr/local/lib/sj3/serverrc
|
||||
デフォルト仮名変換サーバ セットアップファイル
|
||||
.TP
|
||||
/usr/local/lib/sj3/dict/
|
||||
かな漢字変換サーバ デフォルト辞書ディレクトリ
|
||||
.TP
|
||||
sj3main.dic
|
||||
仮名漢字変換メイン辞書
|
||||
.TP
|
||||
user/\fIusername\fP/private.dic
|
||||
仮名漢字変換ユーザ辞書
|
||||
.TP
|
||||
user/\fIusername\fP/study.dat
|
||||
仮名漢字変換学習ファイル
|
||||
|
||||
.SH 関連事項
|
||||
sj3(1), sj3lib(3)
|
||||
|
||||
.SH バグ
|
||||
変換ルーチン内での辞書の識別には、辞書ファイルの inode 番号を
|
||||
使用しています。コピーなどにより辞書ファイルの inode 番号が
|
||||
変更されると、文節学習データは失われます。
|
||||
6
include/Makefile.am
Normal file
6
include/Makefile.am
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
SUBDIRS = \
|
||||
sj3common \
|
||||
sj3compat \
|
||||
sj3core \
|
||||
sj3lib \
|
||||
sj3rkcv
|
||||
99
include/sj3common/Const.h
Normal file
99
include/sj3common/Const.h
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
|
||||
/*
|
||||
* Change some default values.
|
||||
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
|
||||
*/
|
||||
|
||||
#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 ERROROUTFILE "/dev/null"
|
||||
#define ADDRESSFAMILY "unspec"
|
||||
#define PORTNAME "sj3"
|
||||
#define LOCALHOST "localhost"
|
||||
#define CHROOTFLAG 1
|
||||
|
||||
#define MAINDICTIONARY "sj3main.dic"
|
||||
#define USERDICTIONARY "private.dic"
|
||||
#define STUDYFILE "study.dat"
|
||||
|
||||
/*
|
||||
* Change the default Port number of sj3 for FreeBSD.
|
||||
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/20
|
||||
*/
|
||||
#define PORTNUMBER "3086"
|
||||
#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
|
||||
|
||||
#endif /* CONST_H */
|
||||
9
include/sj3common/Makefile.am
Normal file
9
include/sj3common/Makefile.am
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
EXTRA_DIST = \
|
||||
Const.h \
|
||||
sj3cmd.h \
|
||||
sj3err.h \
|
||||
sj_const.h \
|
||||
sj_euc.h \
|
||||
sj_hinsi.h \
|
||||
sj_string.h
|
||||
|
||||
107
include/sj3common/sj3cmd.h
Normal file
107
include/sj3common/sj3cmd.h
Normal 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/sj3common/sj3err.h
Normal file
107
include/sj3common/sj3err.h
Normal 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
|
||||
155
include/sj3common/sj_const.h
Normal file
155
include/sj3common/sj_const.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* 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 (u_char)0xa1
|
||||
#define EUC_a2 (u_char)0xa2
|
||||
#define EUC_a3 (u_char)0xa3
|
||||
#define EUC_a4 (u_char)0xa4
|
||||
#define EUC_a5 (u_char)0xa5
|
||||
|
||||
|
||||
#define EUC_START (u_char)0xa1
|
||||
#define EUC_END (u_char)0xfe
|
||||
#define EUC_END_KIGOU (u_char)0xae
|
||||
#define EUC_0 (u_char)0xb0
|
||||
#define EUC_END_0 (u_char)0xb9
|
||||
#define EUC_A (u_char)0xc1
|
||||
#define EUC_END_A (u_char)0xda
|
||||
#define EUC_a (u_char)0xe1
|
||||
#define EUC_END_a (u_char)0xfa
|
||||
#define EUC_END_HIRA (u_char)0xf3
|
||||
#define EUC_VU (u_char)0xf4
|
||||
#define EUC_XKA (u_char)0xf5
|
||||
#define EUC_XKE (u_char)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
|
||||
47
include/sj3common/sj_euc.h
Normal file
47
include/sj3common/sj_euc.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#ifndef SS2
|
||||
#define SS2 0x8e
|
||||
#endif
|
||||
#ifndef SS3
|
||||
#define SS3 0x8f
|
||||
#endif
|
||||
|
||||
#endif
|
||||
231
include/sj3common/sj_hinsi.h
Normal file
231
include/sj3common/sj_hinsi.h
Normal 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
|
||||
37
include/sj3common/sj_string.h
Normal file
37
include/sj3common/sj_string.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Iwata <iwata@quasiquote.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SJ_STRING_H
|
||||
#define SJ_STRING_H
|
||||
|
||||
/* string.c */
|
||||
int sj3_str_sjistoeuc(unsigned char *, int, unsigned char *, unsigned char *, int *);
|
||||
int sj3_str_euctosjis(unsigned char *, int, unsigned char *, unsigned char *, int *);
|
||||
int sj3_sjistoeuclen(unsigned char *, int);
|
||||
|
||||
int sj3_sjistoeuc(unsigned char *s, int, unsigned char *, int);
|
||||
int sj3_euctosjis(unsigned char *s, int, unsigned char *, int);
|
||||
void sj_euc2sjis(unsigned char *);
|
||||
void sj_jis2sjis(unsigned char *);
|
||||
void sj_sjis2euc(unsigned char *);
|
||||
void sj_sjis2jis(unsigned char *);
|
||||
unsigned short sj3_jis2sjis(unsigned short);
|
||||
unsigned short sj3_jis2euc(unsigned short);
|
||||
unsigned short sj3_sjis2jis(unsigned short);
|
||||
unsigned short sj3_euc2sjis(unsigned short);
|
||||
unsigned short sj3_sjis2euc(unsigned short);
|
||||
|
||||
#endif /* SJ3INTERN_H */
|
||||
2
include/sj3compat/Makefile.am
Normal file
2
include/sj3compat/Makefile.am
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
EXTRA_DIST = sj3compat.h sys-queue.h
|
||||
|
||||
128
include/sj3compat/sj3compat.h
Normal file
128
include/sj3compat/sj3compat.h
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Iwata <iwata@quasiquote.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SJ3COMPAT_H
|
||||
#define SJ3COMPAT_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 128
|
||||
#endif
|
||||
|
||||
#ifndef MAXLOGNAME
|
||||
#define MAXLOGNAME 32
|
||||
#endif
|
||||
|
||||
#ifndef FILENAME_MAX
|
||||
#define FILENAME_MAX 1024
|
||||
#endif
|
||||
|
||||
/* bsd-asprintf.c */
|
||||
#ifndef HAVE_VASPRINTF
|
||||
#define vasprintf sj3_vasprintf
|
||||
int sj3_vasprintf(char **ret, const char *format, va_list ap);
|
||||
#endif
|
||||
#ifndef HAVE_ASPRINTF
|
||||
#define asprintf sj3_asprintf
|
||||
int sj3_asprintf(char **ret, const char *format, ...);
|
||||
#endif
|
||||
|
||||
/* getopt.c */
|
||||
#ifndef HAVE_GETOPT_OPTRESET
|
||||
# undef getopt
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# undef optreset
|
||||
# undef optarg
|
||||
# define getopt(ac, av, o) BSDgetopt(ac, av, o)
|
||||
# define opterr BSDopterr
|
||||
# define optind BSDoptind
|
||||
# define optopt BSDoptopt
|
||||
# define optreset BSDoptreset
|
||||
# define optarg BSDoptarg
|
||||
#endif
|
||||
|
||||
/* bsd-getpeereid.c */
|
||||
#ifndef HAVE_GETPEEREID
|
||||
#define getpeereid sj3_getpeereid
|
||||
int sj3_getpeereid(int s, uid_t *euid, gid_t *egid);
|
||||
#endif
|
||||
|
||||
/* bsd-misc.c */
|
||||
#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
|
||||
#define strerror sj3_strerror
|
||||
const char *sj3_strerror(int e);
|
||||
#endif
|
||||
#ifndef HAVE_STRDUP
|
||||
#define strdup sj3_strdup
|
||||
char *sj3_strdup(const char *str);
|
||||
#endif
|
||||
|
||||
/* bsd-snprintf.c */
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
#define vsnprintf sj3_vsnprintf
|
||||
int sj3_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
#endif
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#define snprintf sj3_snprintf
|
||||
int sj3_snprintf(char *str, size_t size, const char *format, ...);
|
||||
#endif
|
||||
|
||||
/* daemon.c */
|
||||
#ifndef HAVE_DAEMON
|
||||
#define daemon sj3_daemon
|
||||
int sj3_daemon(int, int);
|
||||
#endif
|
||||
|
||||
/* #include "fake-rfc2553.h" */
|
||||
|
||||
/* inet_ntoa.c */
|
||||
#if defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA)
|
||||
#define inet_ntoa sj3_inet_ntoa
|
||||
char* sj3_inet_ntoa(struct in_addr in);
|
||||
#endif
|
||||
|
||||
/* setproctitle.c */
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
#define setproctitle sj3_setproctitle
|
||||
void setproctitle(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
/* strlcat.c */
|
||||
#ifndef HAVE_STRLCAT
|
||||
#define strlcat sj3_strlcat
|
||||
size_t sj3_strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
/* strlcpy.c */
|
||||
#ifndef HAVE_STRLCPY
|
||||
#define strlcpy sj3_strlcpy
|
||||
size_t sj3_strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#endif /* SJ3COMPAT_H */
|
||||
610
include/sj3compat/sys-queue.h
Normal file
610
include/sj3compat/sys-queue.h
Normal file
|
|
@ -0,0 +1,610 @@
|
|||
/* $OpenBSD: queue.h,v 1.32 2007/04/30 18:42:34 pedro Exp $ */
|
||||
/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||
*/
|
||||
|
||||
#ifndef _FAKE_QUEUE_H_
|
||||
#define _FAKE_QUEUE_H_
|
||||
|
||||
/*
|
||||
* Require for OS/X and other platforms that have old/broken/incomplete
|
||||
* <sys/queue.h>.
|
||||
*/
|
||||
#undef SLIST_HEAD
|
||||
#undef SLIST_HEAD_INITIALIZER
|
||||
#undef SLIST_ENTRY
|
||||
#undef SLIST_FOREACH_PREVPTR
|
||||
#undef SLIST_FIRST
|
||||
#undef SLIST_END
|
||||
#undef SLIST_EMPTY
|
||||
#undef SLIST_NEXT
|
||||
#undef SLIST_FOREACH
|
||||
#undef SLIST_INIT
|
||||
#undef SLIST_INSERT_AFTER
|
||||
#undef SLIST_INSERT_HEAD
|
||||
#undef SLIST_REMOVE_HEAD
|
||||
#undef SLIST_REMOVE
|
||||
#undef SLIST_REMOVE_NEXT
|
||||
#undef LIST_HEAD
|
||||
#undef LIST_HEAD_INITIALIZER
|
||||
#undef LIST_ENTRY
|
||||
#undef LIST_FIRST
|
||||
#undef LIST_END
|
||||
#undef LIST_EMPTY
|
||||
#undef LIST_NEXT
|
||||
#undef LIST_FOREACH
|
||||
#undef LIST_INIT
|
||||
#undef LIST_INSERT_AFTER
|
||||
#undef LIST_INSERT_BEFORE
|
||||
#undef LIST_INSERT_HEAD
|
||||
#undef LIST_REMOVE
|
||||
#undef LIST_REPLACE
|
||||
#undef SIMPLEQ_HEAD
|
||||
#undef SIMPLEQ_HEAD_INITIALIZER
|
||||
#undef SIMPLEQ_ENTRY
|
||||
#undef SIMPLEQ_FIRST
|
||||
#undef SIMPLEQ_END
|
||||
#undef SIMPLEQ_EMPTY
|
||||
#undef SIMPLEQ_NEXT
|
||||
#undef SIMPLEQ_FOREACH
|
||||
#undef SIMPLEQ_INIT
|
||||
#undef SIMPLEQ_INSERT_HEAD
|
||||
#undef SIMPLEQ_INSERT_TAIL
|
||||
#undef SIMPLEQ_INSERT_AFTER
|
||||
#undef SIMPLEQ_REMOVE_HEAD
|
||||
#undef TAILQ_HEAD
|
||||
#undef TAILQ_HEAD_INITIALIZER
|
||||
#undef TAILQ_ENTRY
|
||||
#undef TAILQ_FIRST
|
||||
#undef TAILQ_END
|
||||
#undef TAILQ_NEXT
|
||||
#undef TAILQ_LAST
|
||||
#undef TAILQ_PREV
|
||||
#undef TAILQ_EMPTY
|
||||
#undef TAILQ_FOREACH
|
||||
#undef TAILQ_FOREACH_REVERSE
|
||||
#undef TAILQ_INIT
|
||||
#undef TAILQ_INSERT_HEAD
|
||||
#undef TAILQ_INSERT_TAIL
|
||||
#undef TAILQ_INSERT_AFTER
|
||||
#undef TAILQ_INSERT_BEFORE
|
||||
#undef TAILQ_REMOVE
|
||||
#undef TAILQ_REPLACE
|
||||
#undef CIRCLEQ_HEAD
|
||||
#undef CIRCLEQ_HEAD_INITIALIZER
|
||||
#undef CIRCLEQ_ENTRY
|
||||
#undef CIRCLEQ_FIRST
|
||||
#undef CIRCLEQ_LAST
|
||||
#undef CIRCLEQ_END
|
||||
#undef CIRCLEQ_NEXT
|
||||
#undef CIRCLEQ_PREV
|
||||
#undef CIRCLEQ_EMPTY
|
||||
#undef CIRCLEQ_FOREACH
|
||||
#undef CIRCLEQ_FOREACH_REVERSE
|
||||
#undef CIRCLEQ_INIT
|
||||
#undef CIRCLEQ_INSERT_AFTER
|
||||
#undef CIRCLEQ_INSERT_BEFORE
|
||||
#undef CIRCLEQ_INSERT_HEAD
|
||||
#undef CIRCLEQ_INSERT_TAIL
|
||||
#undef CIRCLEQ_REMOVE
|
||||
#undef CIRCLEQ_REPLACE
|
||||
|
||||
/*
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* lists, simple queues, tail queues, and circular queues.
|
||||
*
|
||||
*
|
||||
* A singly-linked list is headed by a single forward pointer. The elements
|
||||
* are singly linked for minimum space and pointer manipulation overhead at
|
||||
* the expense of O(n) removal for arbitrary elements. New elements can be
|
||||
* added to the list after an existing element or at the head of the list.
|
||||
* Elements being removed from the head of the list should use the explicit
|
||||
* macro for this purpose for optimum efficiency. A singly-linked list may
|
||||
* only be traversed in the forward direction. Singly-linked lists are ideal
|
||||
* for applications with large datasets and few or no removals or for
|
||||
* implementing a LIFO queue.
|
||||
*
|
||||
* A list is headed by a single forward pointer (or an array of forward
|
||||
* pointers for a hash table header). The elements are doubly linked
|
||||
* so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before
|
||||
* or after an existing element or at the head of the list. A list
|
||||
* may only be traversed in the forward direction.
|
||||
*
|
||||
* A simple queue is headed by a pair of pointers, one the head of the
|
||||
* list and the other to the tail of the list. The elements are singly
|
||||
* linked to save space, so elements can only be removed from the
|
||||
* head of the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the
|
||||
* list. A simple queue may only be traversed in the forward direction.
|
||||
*
|
||||
* A tail queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or
|
||||
* after an existing element, at the head of the list, or at the end of
|
||||
* the list. A tail queue may be traversed in either direction.
|
||||
*
|
||||
* A circle queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the list.
|
||||
* A circle queue may be traversed in either direction, but has a more
|
||||
* complex end of list detection.
|
||||
*
|
||||
* For details on the use of these macros, see the queue(3) manual page.
|
||||
*/
|
||||
|
||||
#if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
|
||||
#define _Q_INVALIDATE(a) (a) = ((void *)-1)
|
||||
#else
|
||||
#define _Q_INVALIDATE(a)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_END(head) NULL
|
||||
#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for((var) = SLIST_FIRST(head); \
|
||||
(var) != SLIST_END(head); \
|
||||
(var) = SLIST_NEXT(var, field))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != SLIST_END(head); \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_INIT(head) { \
|
||||
SLIST_FIRST(head) = SLIST_END(head); \
|
||||
}
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_NEXT(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
\
|
||||
while (curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
_Q_INVALIDATE((elm)->field.sle_next); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* List definitions.
|
||||
*/
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* List access methods
|
||||
*/
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_END(head) NULL
|
||||
#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for((var) = LIST_FIRST(head); \
|
||||
(var)!= LIST_END(head); \
|
||||
(var) = LIST_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* List functions.
|
||||
*/
|
||||
#define LIST_INIT(head) do { \
|
||||
LIST_FIRST(head) = LIST_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REPLACE(elm, elm2, field) do { \
|
||||
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
|
||||
(elm2)->field.le_next->field.le_prev = \
|
||||
&(elm2)->field.le_next; \
|
||||
(elm2)->field.le_prev = (elm)->field.le_prev; \
|
||||
*(elm2)->field.le_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Simple queue definitions.
|
||||
*/
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple queue access methods.
|
||||
*/
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_END(head) NULL
|
||||
#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for((var) = SIMPLEQ_FIRST(head); \
|
||||
(var) != SIMPLEQ_END(head); \
|
||||
(var) = SIMPLEQ_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* Simple queue functions.
|
||||
*/
|
||||
#define SIMPLEQ_INIT(head) do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define TAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *tqh_first; /* first element */ \
|
||||
struct type **tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *tqe_next; /* next element */ \
|
||||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* tail queue access methods
|
||||
*/
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_END(head) NULL
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
/* XXX */
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
#define TAILQ_EMPTY(head) \
|
||||
(TAILQ_FIRST(head) == TAILQ_END(head))
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for((var) = TAILQ_FIRST(head); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_NEXT(var, field))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for((var) = TAILQ_LAST(head, headname); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_PREV(var, headname, field))
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
|
||||
(elm2)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm2)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm2)->field.tqe_next; \
|
||||
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
*(elm2)->field.tqe_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Circular queue definitions.
|
||||
*/
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
|
||||
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Circular queue access methods
|
||||
*/
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_END(head) ((void *)(head))
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
#define CIRCLEQ_EMPTY(head) \
|
||||
(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
|
||||
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for((var) = CIRCLEQ_FIRST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_NEXT(var, field))
|
||||
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for((var) = CIRCLEQ_LAST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_PREV(var, field))
|
||||
|
||||
/*
|
||||
* Circular queue functions.
|
||||
*/
|
||||
#define CIRCLEQ_INIT(head) do { \
|
||||
(head)->cqh_first = CIRCLEQ_END(head); \
|
||||
(head)->cqh_last = CIRCLEQ_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
|
||||
if ((head)->cqh_last == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = CIRCLEQ_END(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) do { \
|
||||
if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = \
|
||||
(elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = \
|
||||
(elm)->field.cqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head).cqh_last = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_next->field.cqe_prev = (elm2); \
|
||||
if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head).cqh_first = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_prev->field.cqe_next = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !_SYS_QUEUE_H_ */
|
||||
82
include/sj3core/Dict.h
Normal file
82
include/sj3core/Dict.h
Normal 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)
|
||||
21
include/sj3core/Makefile.am
Normal file
21
include/sj3core/Makefile.am
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
EXTRA_DIST = \
|
||||
Dict.h \
|
||||
Struct.h \
|
||||
sj3lowlib.h \
|
||||
sj_connect.h \
|
||||
sj_const.h \
|
||||
sj_dict.h \
|
||||
sj_global.h \
|
||||
sj_kanakan.h \
|
||||
sj_kcnv.h \
|
||||
sj_left.h \
|
||||
sj_prty.h \
|
||||
sj_rename.h \
|
||||
sj_right.h \
|
||||
sj_struct.h \
|
||||
sj_study.h \
|
||||
sj_suuji.h \
|
||||
sj_table.h \
|
||||
sj_typedef.h \
|
||||
sj_var.h \
|
||||
sj_yomi.h
|
||||
173
include/sj3core/Struct.h
Normal file
173
include/sj3core/Struct.h
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
#ifndef STRUCT_H
|
||||
#define STRUCT_H
|
||||
|
||||
typedef struct global {
|
||||
JREC *Jmaxjptr;
|
||||
CLREC *Jmaxclptr;
|
||||
JREC *Jjrt1st;
|
||||
CLREC *Jclt1st;
|
||||
JREC *Jjrt2nd;
|
||||
CLREC *Jclt2nd;
|
||||
CLREC *Jselcl;
|
||||
|
||||
short Jselectid;
|
||||
short Jtrank;
|
||||
short Jnrank;
|
||||
|
||||
u_char *Jinputyomi;
|
||||
u_char *Jcnvstart;
|
||||
short Jcnvlen;
|
||||
u_char *Jystart;
|
||||
u_char Jhyomi[MAXPHINPUTLEN + 1];
|
||||
u_char Jorgyomi[MAXCLINPUTLEN*2 + 1];
|
||||
|
||||
u_char Jkanjibuf[MINPHOUTPUTLEN];
|
||||
u_char *Jkanjipos;
|
||||
u_char *Jkanjitmp;
|
||||
short Jkanjilen;
|
||||
|
||||
u_char Jdicinl;
|
||||
u_char Jdicsaml;
|
||||
TypeDicSeg Jprevseg;
|
||||
|
||||
u_char Jfzkcount;
|
||||
u_char Jfzk_ka_flg;
|
||||
FREC Jfzktbl[MAXFREC];
|
||||
|
||||
u_char Jheadcode;
|
||||
u_char Jheadlen;
|
||||
|
||||
u_char Jgobilen;
|
||||
|
||||
TypeGram Jprevclgrm;
|
||||
TypeCnct Jprevclrow;
|
||||
u_char Jnextcllen;
|
||||
|
||||
short Jkhcount;
|
||||
short Jnkhcount;
|
||||
KHREC Jkouhotbl[MAXKOUHONUMBER];
|
||||
STDYIN *Jstdytop;
|
||||
|
||||
DICT *Jcurdict;
|
||||
DICTL *Jdictlist;
|
||||
u_char *Jdicbuf;
|
||||
u_char *Jidxbuf;
|
||||
TypeIdxOfs *Jidxofs;
|
||||
u_char *Jaskknj[MAXKNJASKNUMBER];
|
||||
u_char *Jaskknj_k[MAXKNJASKNUMBER];
|
||||
|
||||
STDY *Jcurstdy;
|
||||
|
||||
u_short Jsuuji_wbuf[NUMWORDBUF];
|
||||
u_char Jsuuji_ubuf[NUMKETALENGTH];
|
||||
TypeClass Jsuuji_class;
|
||||
u_char Jsuuji_comma;
|
||||
u_char Jsuuji_keta;
|
||||
u_char *Jsuuji_yptr;
|
||||
u_char Jsuuji_len;
|
||||
u_char Jsuuji_exit;
|
||||
u_short *Jsuuji_wkeep;
|
||||
u_char *Jsuuji_ukeep;
|
||||
|
||||
u_char Jpeepyomi[MAXWDYOMILEN * 2 + 1];
|
||||
u_char Jpeepknj[MAXWDKANJILEN + 1];
|
||||
TypeGram Jpeepgrm;
|
||||
u_char *Jpeepdptr;
|
||||
u_char *Jpeephptr;
|
||||
u_char *Jpeepkptr;
|
||||
TypeDicSeg Jpeepidx;
|
||||
} Global;
|
||||
|
||||
|
||||
typedef struct dictfile {
|
||||
DICT dict;
|
||||
int refcnt;
|
||||
fd_set lock;
|
||||
FILE *fp;
|
||||
int fd;
|
||||
|
||||
u_char *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;
|
||||
|
||||
u_char *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[MAXHOSTNAMELEN];
|
||||
char user[MAXLOGNAME];
|
||||
char prog[FILENAME_MAX];
|
||||
|
||||
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;
|
||||
|
||||
#endif
|
||||
69
include/sj3core/sj3lowlib.h
Normal file
69
include/sj3core/sj3lowlib.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
#ifndef SJ3LOWLIB_H
|
||||
#define SJ3LOWLIB_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
#endif /* SJ3LOWLIB_H */
|
||||
524
include/sj3core/sj_connect.h
Normal file
524
include/sj3core/sj_connect.h
Normal 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
|
||||
155
include/sj3core/sj_const.h
Normal file
155
include/sj3core/sj_const.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* 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 (u_char)0xa1
|
||||
#define EUC_a2 (u_char)0xa2
|
||||
#define EUC_a3 (u_char)0xa3
|
||||
#define EUC_a4 (u_char)0xa4
|
||||
#define EUC_a5 (u_char)0xa5
|
||||
|
||||
|
||||
#define EUC_START (u_char)0xa1
|
||||
#define EUC_END (u_char)0xfe
|
||||
#define EUC_END_KIGOU (u_char)0xae
|
||||
#define EUC_0 (u_char)0xb0
|
||||
#define EUC_END_0 (u_char)0xb9
|
||||
#define EUC_A (u_char)0xc1
|
||||
#define EUC_END_A (u_char)0xda
|
||||
#define EUC_a (u_char)0xe1
|
||||
#define EUC_END_a (u_char)0xfa
|
||||
#define EUC_END_HIRA (u_char)0xf3
|
||||
#define EUC_VU (u_char)0xf4
|
||||
#define EUC_XKA (u_char)0xf5
|
||||
#define EUC_XKE (u_char)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
|
||||
98
include/sj3core/sj_dict.h
Normal file
98
include/sj3core/sj_dict.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
44
include/sj3core/sj_global.h
Normal file
44
include/sj3core/sj_global.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
#ifndef SJ_GLOBAL_H
|
||||
#define SJ_GLOBAL_H
|
||||
|
||||
extern Global *global_work_base;
|
||||
extern Global *work_base;
|
||||
extern STDY *stdy_base;
|
||||
extern int serv_errno;
|
||||
|
||||
#endif
|
||||
332
include/sj3core/sj_kanakan.h
Normal file
332
include/sj3core/sj_kanakan.h
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Iwata <iwata@quasiquote.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef KANAKAN_H
|
||||
#define KANAKAN_H
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_struct.h"
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* All of these funtions calling rule are not following
|
||||
* ANSI like arguement lists, fun(dest, src, ...).
|
||||
* There are fun(src, dest, ...).
|
||||
*/
|
||||
|
||||
/* adddic.c */
|
||||
u_int adddic(u_char *, u_char *, TypeGram);
|
||||
|
||||
/* addelcmn.c */
|
||||
void set_size(u_char *, int, int, int);
|
||||
u_int addel_arg(u_char *, u_char *, TypeGram, u_char *, int);
|
||||
int cvtknj(u_char *, u_char *, u_char *);
|
||||
int srchkana(u_char **, int *);
|
||||
int srchgram(u_char *, u_char **, TypeGram);
|
||||
int srchkanji(u_char **, u_char *, int);
|
||||
TypeIdxOfs count_uidx(void);
|
||||
void chg_uidx(TypeDicSeg, u_char *, int);
|
||||
|
||||
/* alloc.c */
|
||||
JREC *alloc_jrec(void);
|
||||
void free_jrec(JREC *);
|
||||
CLREC *alloc_clrec(void);
|
||||
void free_clrec(CLREC *);
|
||||
|
||||
/* charsize.c */
|
||||
int codesize(u_char);
|
||||
|
||||
/* chrtbl.c */
|
||||
extern u_char chrtbl[256];
|
||||
|
||||
/* cl2knj.c */
|
||||
int cl2knj(u_char *, int, u_char *);
|
||||
int nextcl(u_char *, int);
|
||||
int prevcl(u_char *, int);
|
||||
int selectnum(void);
|
||||
|
||||
/* clstudy.c */
|
||||
int clstudy(u_char *, u_char *, STDYOUT *);
|
||||
void delclsub(u_char *);
|
||||
void mkclidx(void);
|
||||
|
||||
/* cmpstr.c */
|
||||
int cmpstr(u_char *, u_char *);
|
||||
|
||||
/* conjunc.c */
|
||||
extern u_char *conjadr[];
|
||||
|
||||
/* connect.c */
|
||||
extern u_char connadr[];
|
||||
extern u_char *rigtadr[];
|
||||
|
||||
/* cvtclknj.c */
|
||||
void cvtclknj(void);
|
||||
|
||||
/* cvtdict.c */
|
||||
void cvtdict(KHREC *, CLREC *, int);
|
||||
void cvtminasi(int);
|
||||
void cvtwakachi(CLREC *);
|
||||
|
||||
/* cvtkanji.c */
|
||||
void cvtphknj(void);
|
||||
void cvtkouho(KHREC *);
|
||||
void setstyrec(KHREC *);
|
||||
|
||||
/* deldic.c */
|
||||
u_int deldic(u_char *, u_char *, TypeGram);
|
||||
|
||||
/* dict.c */
|
||||
void get_askknj(void);
|
||||
int seldict(TypeDicID);
|
||||
u_char *get_idxptr(TypeDicSeg);
|
||||
|
||||
/* functbl.c */
|
||||
extern VFunc cvtnum_func[];
|
||||
extern UCPFunc getkan_func[];
|
||||
extern IFunc setjrec_func[];
|
||||
extern IFunc hiraknj_func[];
|
||||
|
||||
/* fuzoku.c */
|
||||
void setclrec(JREC *, u_char *, TypeCnct);
|
||||
RECURS void srchfzk(JREC *, u_char *, TypeCnct, int);
|
||||
|
||||
/* fzkyomi.c */
|
||||
extern u_char *fzkadr[];
|
||||
|
||||
/* getkanji.c */
|
||||
u_char *getkan_none(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_hira(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_kata(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_knj(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_ofs(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_norm(u_char *, u_char *, u_char *, int, int);
|
||||
u_char *getkan_ascii(u_char *, u_char *, u_char *, int, int);
|
||||
int getkanji(u_char *, int, u_char *, u_char *);
|
||||
|
||||
/* getrank.c */
|
||||
void getrank(void);
|
||||
|
||||
/* hzstrlen.c */
|
||||
int euc_codesize(u_char c);
|
||||
int hzstrlen(u_char *, int);
|
||||
|
||||
/* init.c */
|
||||
void seg_count(DICT *);
|
||||
void mkidxtbl(DICT *);
|
||||
void initwork(void);
|
||||
|
||||
/* istrcmp.c */
|
||||
int istrcmp(u_char *, u_char *, int, int);
|
||||
|
||||
/* memcpy.c */
|
||||
void sstrncpy(u_char *, u_char *, int);
|
||||
|
||||
/* memory.c */
|
||||
JREC *free_jlst(JREC *);
|
||||
CLREC *free_clst(CLREC *, int);
|
||||
void free_clall(CLREC *);
|
||||
void free_jall(JREC *);
|
||||
void freework(void);
|
||||
|
||||
/* mk2claus.c */
|
||||
void mk2claus(void);
|
||||
|
||||
/* mkbunset.c */
|
||||
void mkbunsetu(void);
|
||||
CLREC *argclrec(int);
|
||||
|
||||
/* mkjiritu.c */
|
||||
void mkjiritu(int);
|
||||
JREC *argjrec(int, JREC *);
|
||||
|
||||
/* mkkouho.c */
|
||||
void mkkouho(void);
|
||||
u_char *makekan_none(u_char *, u_char *, int);
|
||||
u_char *makekan_1byte(u_char *, u_char *, int);
|
||||
u_char *makekan_knj(u_char *, u_char *, int);
|
||||
u_char *makekan_ofs(u_char *, u_char *, int);
|
||||
u_char *makekan_norm(u_char *, u_char *, int);
|
||||
u_char *makekan_ascii(u_char *, u_char *, int);
|
||||
int sel_sjmode(JREC *);
|
||||
|
||||
/* mknumber.c */
|
||||
void num_type00(u_char *, u_char *, JREC *);
|
||||
void num_type01(u_char *, u_char *, JREC *);
|
||||
void num_type02(u_char *, u_char *, JREC *);
|
||||
void num_type03(u_char *, u_char *, JREC *);
|
||||
void num_type04(u_char *, u_char *, JREC *);
|
||||
void num_type05(u_char *, u_char *, JREC *);
|
||||
void num_type06(u_char *, u_char *, JREC *);
|
||||
void num_type07(u_char *, u_char *, JREC *);
|
||||
void num_type08(u_char *, u_char *, JREC *);
|
||||
void num_type09(u_char *, u_char *, JREC *);
|
||||
void num_type10(u_char *, u_char *, JREC *);
|
||||
void num_type11(u_char *, u_char *, JREC *);
|
||||
void num_type12(u_char *, u_char *, JREC *);
|
||||
void num_type13(u_char *, u_char *, JREC *);
|
||||
void num_type14(u_char *, u_char *, JREC *);
|
||||
|
||||
/* mvmemd.c */
|
||||
void mvmemd(u_char *, u_char *, int);
|
||||
|
||||
/* mvmemi.c */
|
||||
void mvmemi(u_char *, u_char *, int);
|
||||
|
||||
/* peepdic.c */
|
||||
int getusr(u_char *);
|
||||
int nextusr(u_char *);
|
||||
int prevusr(u_char *);
|
||||
|
||||
/* ph2knj.c */
|
||||
int ph2knj(u_char *, u_char *, int);
|
||||
|
||||
/* ph_khtbl.c */
|
||||
int ph_khtbl(CLREC *);
|
||||
|
||||
/* priority.c */
|
||||
int priority(CLREC *);
|
||||
void pritiny(void);
|
||||
|
||||
/* prtytbl.c */
|
||||
extern u_char taipri[7][45];
|
||||
extern u_char sttpri[5][31];
|
||||
|
||||
/* s2ctbl.c */
|
||||
extern u_char kigou[];
|
||||
|
||||
/* sdepend.c */
|
||||
DictFile *opendict(char *, char *);
|
||||
int closedict(DictFile *);
|
||||
void lock_dict(DictFile *, int);
|
||||
void unlock_dict(DictFile *, int);
|
||||
int is_dict_locked(DictFile *);
|
||||
StdyFile *openstdy(char *, char *);
|
||||
int closestdy(StdyFile *);
|
||||
int putstydic(void);
|
||||
int putcldic(void);
|
||||
int makedict(char *, int, int, int);
|
||||
int makestdy(char *, int, int, int);
|
||||
void sj_closeall(void);
|
||||
int set_dictpass(DictFile *, char *);
|
||||
int set_stdypass(char *);
|
||||
int set_dictcmnt(DictFile *, char *);
|
||||
int set_stdycmnt(char *);
|
||||
int get_stdysize(int *, int *, int *);
|
||||
|
||||
/* selclrec.c */
|
||||
void selclrec(void);
|
||||
|
||||
/* selsuuji.c */
|
||||
extern u_short *selsjadrs[];
|
||||
|
||||
/* setconj.c */
|
||||
int setconj(TypeGram, JREC *, CREC *);
|
||||
|
||||
/* setjrec.c */
|
||||
int setj_atrb(u_char *);
|
||||
int setj_ofs(u_char *);
|
||||
int setj_knj(u_char *);
|
||||
int setj_norm1(u_char *);
|
||||
int setj_norm2(u_char *);
|
||||
int setj_norm3(u_char *); /* unused??? */
|
||||
void setjrec(u_char *, int);
|
||||
void setnumrec(u_char *, JREC *, TypeGram);
|
||||
void setcrec(u_char *);
|
||||
|
||||
/* setkouho.c */
|
||||
void setkouho(CLREC *, TypeDicOfs, int);
|
||||
void ph_setkouho(CLREC *, TypeDicOfs, STDYIN *);
|
||||
int hiraknj_atrb(u_char *, int *);
|
||||
int hiraknj_ofs(u_char *, int *);
|
||||
int hiraknj_knj(u_char *, int *);
|
||||
int hiraknj_hask(u_char *, int *);
|
||||
int hiraknj_kask(u_char *, int *);
|
||||
int hiraknj_norm(u_char *, int *);
|
||||
int hiraknj_hira(u_char *, int *);
|
||||
|
||||
/* setubi.c */
|
||||
u_char *getstb(TypeGram);
|
||||
void setubi(JREC *, u_char *);
|
||||
|
||||
/* sj2code.c */
|
||||
int sj2cd_chr(u_char *, u_char *);
|
||||
int sj2cd_str(u_char *, u_char *, int);
|
||||
|
||||
/* skiphblk.c */
|
||||
u_char *skiphblk(u_char *);
|
||||
|
||||
/* skipkstr.c */
|
||||
u_char *skipkstr(u_char *);
|
||||
|
||||
/* srchdict.c */
|
||||
int yomicmp(u_char *, u_char *, u_char *);
|
||||
u_char *srchdict(u_char *);
|
||||
|
||||
/* srchhead.c */
|
||||
int srchhead(void);
|
||||
|
||||
/* srchidx.c */
|
||||
TypeDicSeg srchidx(TypeDicSeg, int);
|
||||
|
||||
/* srchnum.c*/
|
||||
void srchnum(void);
|
||||
void setwdnum(u_char *, int, u_short *);
|
||||
int setucnum(u_char *, int, u_char *);
|
||||
|
||||
/* sstrcmp.c */
|
||||
int sstrcmp(u_char *, u_char *);
|
||||
|
||||
/* sstrlen.c */
|
||||
int sstrlen(u_char *);
|
||||
|
||||
/* sstrncmp.c */
|
||||
int sstrncmp(u_char *, u_char *dst, int);
|
||||
|
||||
/* stbtbl.c */
|
||||
extern u_char *stbadr[];
|
||||
|
||||
/* stttbl.c */
|
||||
extern u_char *settou_ptr[];
|
||||
extern u_char scncttbl[2][24];
|
||||
|
||||
/* study.c */
|
||||
int study(STDYOUT *);
|
||||
STDYIN *srchstdy(TypeDicSeg, TypeDicOfs, TypeDicID);
|
||||
|
||||
/* suujitbl.c */
|
||||
extern u_char suuji_tbl[];
|
||||
extern u_char kurai1_tbl[];
|
||||
extern u_char kurai2_tbl[];
|
||||
extern u_char num1tbl[];
|
||||
extern u_char num2tbl[];
|
||||
extern u_char num3tbl[];
|
||||
extern u_char num4tbl[];
|
||||
extern u_char num5tbl[];
|
||||
extern u_char num6tbl[];
|
||||
|
||||
/* terminat.c */
|
||||
int terminate(TypeCnct, u_char *);
|
||||
|
||||
/* termtbl.c */
|
||||
extern u_char termtbl[];
|
||||
|
||||
/* wakachi.c */
|
||||
void wakachi(void);
|
||||
|
||||
|
||||
#endif /* KANAKAN_H */
|
||||
|
||||
48
include/sj3core/sj_kcnv.h
Normal file
48
include/sj3core/sj_kcnv.h
Normal 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_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"
|
||||
286
include/sj3core/sj_left.h
Normal file
286
include/sj3core/sj_left.h
Normal 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/sj3core/sj_prty.h
Normal file
81
include/sj3core/sj_prty.h
Normal 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
|
||||
563
include/sj3core/sj_rename.h
Normal file
563
include/sj3core/sj_rename.h
Normal file
|
|
@ -0,0 +1,563 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#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 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/sj3core/sj_right.h
Normal file
373
include/sj3core/sj_right.h
Normal 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/sj3core/sj_struct.h
Normal file
200
include/sj3core/sj_struct.h
Normal 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;
|
||||
u_short flags;
|
||||
TypeClass class;
|
||||
TypeDicID dicid;
|
||||
u_char jlen;
|
||||
TypeGram hinsi;
|
||||
u_char sttofs;
|
||||
u_char stbofs;
|
||||
u_char count;
|
||||
u_char numlen;
|
||||
} JREC;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct bunsetu {
|
||||
JREC *jnode;
|
||||
struct bunsetu *clsort;
|
||||
u_char gobiln;
|
||||
u_char cllen;
|
||||
|
||||
TypeCnct right;
|
||||
u_char cl2len;
|
||||
u_char kubun;
|
||||
#if __STDC__
|
||||
unsigned fzk_ka : 1;
|
||||
#else
|
||||
u_char fzk_ka : 1;
|
||||
#endif
|
||||
} CLREC;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct kouho {
|
||||
CLREC *clrec;
|
||||
TypeDicOfs offs;
|
||||
TypeStyNum styno;
|
||||
u_char rank;
|
||||
#if __STDC__
|
||||
unsigned sttfg : 1;
|
||||
unsigned sttkj : 1;
|
||||
unsigned ka_fg : 1;
|
||||
unsigned ka_kj : 1;
|
||||
unsigned mode : 4;
|
||||
#else
|
||||
u_char sttfg : 1;
|
||||
u_char sttkj : 1;
|
||||
u_char ka_fg : 1;
|
||||
u_char ka_kj : 1;
|
||||
u_char mode : 4;
|
||||
#endif
|
||||
} KHREC;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct conj {
|
||||
u_char len;
|
||||
TypeCnct right;
|
||||
} CREC;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct fuzoku {
|
||||
u_char *yomip;
|
||||
u_char *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
|
||||
u_char sttkj : 1;
|
||||
u_char ka_kj : 1;
|
||||
u_char nmflg : 1;
|
||||
#endif
|
||||
} STDYIN;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct study_out {
|
||||
STDYIN stdy1;
|
||||
TypeGram hinshi;
|
||||
u_char len;
|
||||
#if __STDC__
|
||||
unsigned sttlen : 2;
|
||||
unsigned sttfg : 1;
|
||||
unsigned ka_fg : 1;
|
||||
#else
|
||||
u_char sttlen : 2;
|
||||
u_char sttfg : 1;
|
||||
u_char 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;
|
||||
u_short *clstdyidx;
|
||||
|
||||
short clstdylen;
|
||||
u_char *clstdydic;
|
||||
} STDY;
|
||||
|
||||
#endif
|
||||
92
include/sj3core/sj_study.h
Normal file
92
include/sj3core/sj_study.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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) || (u_char *)(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)=(u_char)((n) >> 8), ClLowNum(p)=(u_char)(n))
|
||||
#define ClYomiPos(p) ((p) + CL_YDATA)
|
||||
#define ClBlkLen(p) (ClYomiLen(p) + CL_HDLEN)
|
||||
#define ClNextTag(p) ((p) + ClBlkLen(p))
|
||||
|
||||
#endif
|
||||
137
include/sj3core/sj_suuji.h
Normal file
137
include/sj3core/sj_suuji.h
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* 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
|
||||
124
include/sj3core/sj_table.h
Normal file
124
include/sj3core/sj_table.h
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* 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))
|
||||
|
||||
#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
|
||||
65
include/sj3core/sj_typedef.h
Normal file
65
include/sj3core/sj_typedef.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#define RECURS
|
||||
|
||||
|
||||
typedef void (*VFunc)();
|
||||
typedef u_char *(*UCPFunc)();
|
||||
typedef int (*IFunc)();
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef u_char TypeGroup;
|
||||
typedef u_char TypeGram;
|
||||
typedef u_short TypeIdxOfs;
|
||||
typedef short TypeDicSeg;
|
||||
typedef u_short TypeDicOfs;
|
||||
typedef ino_t TypeDicID;
|
||||
typedef u_char TypeCnct;
|
||||
typedef short TypeStyNum;
|
||||
typedef u_char TypeClass;
|
||||
typedef u_char TypeBunNum;
|
||||
|
||||
#endif
|
||||
|
||||
47
include/sj3core/sj_var.h
Normal file
47
include/sj3core/sj_var.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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/sj3core/sj_yomi.h
Normal file
217
include/sj3core/sj_yomi.h
Normal 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
|
||||
6
include/sj3lib/Makefile.am
Normal file
6
include/sj3lib/Makefile.am
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
EXTRA_DIST = \
|
||||
sj3intern.h \
|
||||
sj3lowlib.h
|
||||
|
||||
|
||||
include_HEADERS = sj3lib.h
|
||||
55
include/sj3lib/sj3intern.h
Normal file
55
include/sj3lib/sj3intern.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Iwata <iwata@quasiquote.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SJ3INTERN_H
|
||||
#define SJ3INTERN_H
|
||||
|
||||
#include "sj3lowlib.h"
|
||||
|
||||
/* level1.c */
|
||||
void sj3_set_timeout(int);
|
||||
int sj3_make_connection(SJ3_CLIENT_ENV *, char *, char *, char *);
|
||||
int sj3_erase_connection(SJ3_CLIENT_ENV *);
|
||||
long sj3_open_dictionary(SJ3_CLIENT_ENV *, char *, char *);
|
||||
int sj3_close_dictionary(SJ3_CLIENT_ENV *, long);
|
||||
int sj3_open_study_file(SJ3_CLIENT_ENV *, char *, char *);
|
||||
int sj3_close_study_file(SJ3_CLIENT_ENV *);
|
||||
int sj3_get_id_size(SJ3_CLIENT_ENV *);
|
||||
int sj3_lock_server(SJ3_CLIENT_ENV *);
|
||||
int sj3_unlock_server(SJ3_CLIENT_ENV *);
|
||||
int sj3_ikkatu_henkan(SJ3_CLIENT_ENV *, u_char *, u_char *, int, int);
|
||||
int sj3_bunsetu_henkan(SJ3_CLIENT_ENV *, u_char *, int, u_char *, int);
|
||||
int sj3_bunsetu_jikouho(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||
int sj3_bunsetu_maekouho(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||
int sj3_bunsetu_kouhosuu(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||
int sj3_bunsetu_zenkouho(SJ3_CLIENT_ENV *, u_char *, int, SJ3_DOUON *, int);
|
||||
int sj3_tango_gakusyuu(SJ3_CLIENT_ENV *, SJ3_STUDYREC *);
|
||||
int sj3_bunsetu_gakusyuu(SJ3_CLIENT_ENV *, u_char *, u_char *, SJ3_STUDYREC *, int);
|
||||
int sj3_tango_touroku(SJ3_CLIENT_ENV *, long, u_char *, u_char *, int, int);
|
||||
int sj3_tango_sakujo(SJ3_CLIENT_ENV *, long, u_char *, u_char *, int, int);
|
||||
int sj3_tango_syutoku(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||
int sj3_tango_jikouho(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||
int sj3_tango_maekouho(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||
int sj3_make_dict_file(SJ3_CLIENT_ENV *, char *, int, int, int);
|
||||
int sj3_make_study_file(SJ3_CLIENT_ENV *, char *, int, int, int);
|
||||
int sj3_make_directory(SJ3_CLIENT_ENV *, char *);
|
||||
int sj3_access(SJ3_CLIENT_ENV *, char *, int);
|
||||
int sj3_who(SJ3_CLIENT_ENV *, SJ3_WHO_STRUCT *, int);
|
||||
int sj3_quit(SJ3_CLIENT_ENV *);
|
||||
int sj3_kill(SJ3_CLIENT_ENV *);
|
||||
int sj3_version(SJ3_CLIENT_ENV *, char *, int);
|
||||
|
||||
#endif /* SJ3INTERN_H */
|
||||
207
include/sj3lib/sj3lib.h
Normal file
207
include/sj3lib/sj3lib.h
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
* 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: sj3lib.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:57 $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SJ3LIB_H
|
||||
#define SJ3LIB_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define SJ3_NORMAL_END 0
|
||||
#define SJ3_SERVER_DEAD (1 << 0)
|
||||
|
||||
|
||||
|
||||
#define SJ3_CONNECT_ERROR (1 << 1)
|
||||
#define SJ3_ALREADY_CONNECTED (1 << 2)
|
||||
#define SJ3_CANNOT_OPEN_MDICT (1 << 3)
|
||||
#define SJ3_CANNOT_OPEN_UDICT (1 << 4)
|
||||
#define SJ3_CANNOT_OPEN_STUDY (1 << 5)
|
||||
#define SJ3_CANNOT_MAKE_UDIR (1 << 6)
|
||||
#define SJ3_CANNOT_MAKE_UDICT (1 << 7)
|
||||
#define SJ3_CANNOT_MAKE_STUDY (1 << 8)
|
||||
|
||||
|
||||
|
||||
#define SJ3_DISCONNECT_ERROR (1 << 1)
|
||||
#define SJ3_NOT_CONNECTED (1 << 2)
|
||||
#define SJ3_NOT_OPENED_MDICT (1 << 3)
|
||||
#define SJ3_NOT_OPENED_UDICT (1 << 4)
|
||||
#define SJ3_NOT_OPENED_STUDY (1 << 5)
|
||||
#define SJ3_CLOSE_MDICT_ERROR (1 << 6)
|
||||
#define SJ3_CLOSE_UDICT_ERROR (1 << 7)
|
||||
#define SJ3_CLOSE_STUDY_ERROR (1 << 8)
|
||||
|
||||
|
||||
|
||||
#define SJ3_DICT_ERROR 1
|
||||
#define SJ3_DICT_LOCKED 2
|
||||
#define SJ3_BAD_YOMI_STR 3
|
||||
#define SJ3_BAD_KANJI_STR 4
|
||||
#define SJ3_BAD_HINSI_CODE 5
|
||||
|
||||
#define SJ3_WORD_EXIST 6
|
||||
#define SJ3_DOUON_FULL 7
|
||||
#define SJ3_DICT_FULL 8
|
||||
#define SJ3_INDEX_FULL 9
|
||||
#define SJ3_TOUROKU_FAILED 10
|
||||
|
||||
#define SJ3_WORD_NOT_EXIST 6
|
||||
#define SJ3_SYOUKYO_FAILED 10
|
||||
|
||||
|
||||
|
||||
|
||||
#define SJ3_IKKATU_YOMI 512
|
||||
|
||||
|
||||
|
||||
|
||||
#define SJ3_BUNSETU_YOMI 128
|
||||
#define SJ3_BUNSETU_KANJI 512
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SJ3_WORD_ID_SIZE
|
||||
# define SJ3_WORD_ID_SIZE 32
|
||||
#endif
|
||||
|
||||
typedef struct studyrec {
|
||||
unsigned char dummy[SJ3_WORD_ID_SIZE];
|
||||
} SJ3_STUDYREC;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct bunsetu {
|
||||
int srclen;
|
||||
int destlen;
|
||||
unsigned char *srcstr;
|
||||
unsigned char *deststr;
|
||||
struct studyrec dcid;
|
||||
} SJ3_BUNSETU;
|
||||
|
||||
|
||||
|
||||
typedef struct douon {
|
||||
unsigned char ddata[SJ3_BUNSETU_KANJI];
|
||||
int dlen;
|
||||
SJ3_STUDYREC dcid;
|
||||
} SJ3_DOUON;
|
||||
|
||||
|
||||
|
||||
#define SJ3_H_NRMNOUN 1
|
||||
#define SJ3_H_PRONOUN 12
|
||||
#define SJ3_H_LNAME 21
|
||||
#define SJ3_H_FNAME 22
|
||||
#define SJ3_H_LOCNAME 24
|
||||
#define SJ3_H_PREFIC 25
|
||||
#define SJ3_H_RENTAI 26
|
||||
#define SJ3_H_CONJUNC 27
|
||||
#define SJ3_H_SUBNUM 29
|
||||
#define SJ3_H_NUMERAL 30
|
||||
#define SJ3_H_PREFIX 31
|
||||
#define SJ3_H_POSTFIX 36
|
||||
#define SJ3_H_ADVERB 45
|
||||
#define SJ3_H_ADJECT 60
|
||||
#define SJ3_H_ADJVERB 71
|
||||
#define SJ3_H_SILVERB 80
|
||||
#define SJ3_H_ZILVERB 81
|
||||
#define SJ3_H_ONEVERB 90
|
||||
#define SJ3_H_KAVERB 91
|
||||
#define SJ3_H_GAVERB 92
|
||||
#define SJ3_H_SAVERB 93
|
||||
#define SJ3_H_TAVERB 94
|
||||
#define SJ3_H_NAVERB 95
|
||||
#define SJ3_H_BAVERB 96
|
||||
#define SJ3_H_MAVERB 97
|
||||
#define SJ3_H_RAVERB 98
|
||||
#define SJ3_H_WAVERB 99
|
||||
#define SJ3_H_SINGLE 189
|
||||
|
||||
/* sj3.c */
|
||||
int sj3_open(char *, char *);
|
||||
|
||||
int sj3_open_with_list(char *, char *, int, char **, int *, int **);
|
||||
|
||||
int sj3_close();
|
||||
|
||||
int sj3_getkan(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||
int sj3_getkan_euc(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||
int sj3_getkan_mb(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||
|
||||
int sj3_douoncnt(u_char *);
|
||||
int sj3_douoncnt_euc(u_char *);
|
||||
int sj3_douoncnt_mb(u_char *);
|
||||
|
||||
int sj3_getdouon(u_char *, SJ3_DOUON *);
|
||||
int sj3_getdouon_euc(u_char *, SJ3_DOUON *);
|
||||
int sj3_getdouon_mb(u_char *, SJ3_DOUON *);
|
||||
|
||||
int sj3_gakusyuu(SJ3_STUDYREC *);
|
||||
|
||||
int sj3_gakusyuu2(u_char *, u_char *, SJ3_STUDYREC *);
|
||||
int sj3_gakusyuu2_euc(u_char *, u_char *, SJ3_STUDYREC *);
|
||||
int sj3_gakusyuu2_mb(u_char *, u_char *, SJ3_STUDYREC *);
|
||||
|
||||
int sj3_touroku(u_char *, u_char *, int);
|
||||
int sj3_touroku_euc(u_char *, u_char *, int);
|
||||
int sj3_touroku_mb(u_char *, u_char *, int);
|
||||
|
||||
int sj3_syoukyo(u_char *, u_char *, int);
|
||||
int sj3_syoukyo_euc(u_char *, u_char *, int);
|
||||
int sj3_syoukyo_mb(u_char *, u_char *, int);
|
||||
|
||||
int sj3_getdict(u_char *);
|
||||
int sj3_getdict_euc(u_char *);
|
||||
int sj3_getdict_mb(u_char *);
|
||||
|
||||
int sj3_nextdict(u_char *);
|
||||
int sj3_nextdict_euc(u_char *);
|
||||
int sj3_nextdict_mb(u_char *);
|
||||
|
||||
int sj3_prevdict(u_char *);
|
||||
int sj3_prevdict_euc(u_char *);
|
||||
int sj3_prevdict_mb(u_char *);
|
||||
|
||||
int sj3_lockserv();
|
||||
|
||||
int sj3_unlockserv();
|
||||
|
||||
extern int sj3_error_number;
|
||||
|
||||
#endif /* SJ3LIB_H */
|
||||
69
include/sj3lib/sj3lowlib.h
Normal file
69
include/sj3lib/sj3lowlib.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
#ifndef SJ3LOWLIB_H
|
||||
#define SJ3LOWLIB_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
#endif /* SJ3LOWLIB_H */
|
||||
8
include/sj3rkcv/Makefile.am
Normal file
8
include/sj3rkcv/Makefile.am
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
EXTRA_DIST = \
|
||||
kana.h \
|
||||
kctype.h \
|
||||
key.h \
|
||||
rk.h \
|
||||
wchar16.h
|
||||
|
||||
include_HEADERS = sj3rkcv.h
|
||||
92
include/sj3rkcv/kana.h
Normal file
92
include/sj3rkcv/kana.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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: kana.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:45 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#define ZKATA1 0xa5
|
||||
#define ZHIRA1 0xa4
|
||||
#define ZKATAF2 0xa1
|
||||
#define ZKATAE2 0xf6
|
||||
#define ZHIRAF2 0xa1
|
||||
#define ZHIRAE2 0xf3
|
||||
#define ZKATAMU 0xe0
|
||||
#define ZHIRAMU 0xe0
|
||||
|
||||
#define ZKATAn (ZKATAE2-ZKATAF2+1)
|
||||
|
||||
|
||||
|
||||
#define ZEN_SPACE 0xa1a1
|
||||
#define ZEN_KTEN 0xa1a3
|
||||
#define ZEN_FKAKKO 0xa1d6
|
||||
#define ZEN_EKAKKO 0xa1d7
|
||||
#define ZEN_TTEN 0xa1a2
|
||||
#define ZEN_CTEN 0xa1a6
|
||||
#define ZEN_CHOUON 0xa1bc
|
||||
#define ZEN_DTEN 0xa1ab
|
||||
#define ZEN_HDTEN 0xa1ac
|
||||
#define ZEN_VU 0xa5f4
|
||||
|
||||
#define KANA_KTEN 0xa1
|
||||
#define KANA_FKAKKO 0xa2
|
||||
#define KANA_EKAKKO 0xa3
|
||||
#define KANA_TTEN 0xa4
|
||||
#define KANA_CTEN 0xa5
|
||||
#define KANA_CHOUON 0xb0
|
||||
#define KANA_DTEN 0xde
|
||||
#define KANA_HDTEN 0xdf
|
||||
|
||||
#define KANA_XA 0xa7
|
||||
#define KANA_XYA 0xac
|
||||
#define KANA_XTSU 0xaf
|
||||
|
||||
#define KANA_A 0xb1
|
||||
#define KANA_KA 0xb6
|
||||
#define KANA_SA 0xbb
|
||||
#define KANA_TA 0xc0
|
||||
#define KANA_NA 0xc5
|
||||
#define KANA_HA 0xca
|
||||
#define KANA_MA 0xcf
|
||||
#define KANA_YA 0xd4
|
||||
#define KANA_RA 0xd7
|
||||
#define KANA_WA 0xdc
|
||||
#define KANA_WO 0xa6
|
||||
|
||||
#define KANA_GA (KANA_KA << 8) + KANA_DTEN
|
||||
#define KANA_ZA (KANA_SA << 8) + KANA_DTEN
|
||||
#define KANA_DA (KANA_TA << 8) + KANA_DTEN
|
||||
#define KANA_BA (KANA_HA << 8) + KANA_DTEN
|
||||
#define KANA_PA (KANA_HA << 8) + KANA_HDTEN
|
||||
115
include/sj3rkcv/kctype.h
Normal file
115
include/sj3rkcv/kctype.h
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* 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: kctype.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:46 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if !defined(__sony_news) || (defined(__sony_news) && !defined(SVR4))
|
||||
#ifndef __KCTYPE
|
||||
#define __KCTYPE
|
||||
|
||||
#define sjis2euc sj3_sjis2euc
|
||||
#define jis2sjis sj3_jis2sjis
|
||||
#define euctosjis sj3_euctosjis
|
||||
#define sjis2jis sj3_sjis2jis
|
||||
#define euc2sjis sj3_euc2sjis
|
||||
#define jis2euc sj3_jis2euc
|
||||
#define sjistoeuc sj3_sjistoeuc
|
||||
|
||||
#ifdef issjis1
|
||||
#undef issjis1
|
||||
#endif
|
||||
#define issjis1(c) (((0x81 <= (c)) && ((c) <= 0x9f)) || \
|
||||
((0xe0 <= (c)) && ((c) <= 0xfc)))
|
||||
|
||||
#ifdef issjis2
|
||||
#undef issjis2
|
||||
#endif
|
||||
#define issjis2(c) (((0x40 <= (c)) && ((c) <= 0xfc)) && ((c) != 0x7f))
|
||||
|
||||
#ifdef iseuc
|
||||
#undef iseuc
|
||||
#endif
|
||||
#define iseuc(c) ((0xa1 <= (c)) && ((c) <= 0xfe))
|
||||
|
||||
#ifdef iseuckana
|
||||
#undef iseuckana
|
||||
#endif
|
||||
#define iseuckana(c) ((c) == 0x8e)
|
||||
|
||||
#ifdef iskana2
|
||||
#undef iskana2
|
||||
#endif
|
||||
#define iskana2(c) ((0xa1 <= (c)) && ((c) <= 0xdf))
|
||||
|
||||
#ifdef jiszen
|
||||
#undef jiszen
|
||||
#endif
|
||||
#define jiszen(c) (issjis1(((c) >> 8) & 0xff) && issjis2((c) & 0xff))
|
||||
|
||||
#ifdef isjjis
|
||||
#undef isjjis
|
||||
#endif
|
||||
#define isjjis(c) ((0x21 <= (c)) && ((c) <= 0x7e))
|
||||
|
||||
#ifdef jstrlen
|
||||
#undef jstrlen
|
||||
#endif
|
||||
#define jstrlen(s) euclen(s, 65535)
|
||||
|
||||
#ifdef iseuc3byte
|
||||
#undef iseuc3byte
|
||||
#endif
|
||||
#define iseuc3byte(c) ((c) == 0x8f)
|
||||
|
||||
#ifdef iseuc2byte
|
||||
#undef iseuc2byte
|
||||
#endif
|
||||
#define iseuc2byte(c) (iseuc(c) || ((c) == 0x8e))
|
||||
|
||||
#ifdef iskanji
|
||||
#undef iskanji
|
||||
#endif
|
||||
#define iskanji issjis1
|
||||
#ifdef iskanji2
|
||||
#undef iskanji2
|
||||
#endif
|
||||
#define iskanji2 issjis2
|
||||
#ifdef iskana
|
||||
#undef iskana
|
||||
#endif
|
||||
#define iskana iskana2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
98
include/sj3rkcv/key.h
Normal file
98
include/sj3rkcv/key.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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: key.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:47 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define KEY_NORMAL 0
|
||||
#define KEY_CONV 1
|
||||
#define KEY_HENKAN 2
|
||||
#define KEY_MUHENKAN 3
|
||||
#define KEY_KETTEI 4
|
||||
#define KEY_ZHIRA 5
|
||||
#define KEY_HALPHA 6
|
||||
#define KEY_ZALPHA 7
|
||||
#define KEY_HKATA 8
|
||||
#define KEY_ZKATA 9
|
||||
#define KEY_CODE 10
|
||||
#define KEY_ETC 11
|
||||
#define KEY_RIGHT 12
|
||||
#define KEY_LEFT 13
|
||||
#define KEY_UP 14
|
||||
#define KEY_DOWN 15
|
||||
#define KEY_TOGGLE 16
|
||||
#define KEY_EDIT 17
|
||||
|
||||
#define KEY_WRAP 18
|
||||
#define KEY_WRAPBACK 19
|
||||
#define KEY_HELP 20
|
||||
#define KEY_TOROKU 21
|
||||
#define KEY_SYOUKYO 22
|
||||
#define KEY_SJRC 23
|
||||
|
||||
#define KEY_HA_KET 24
|
||||
#define KEY_FLUSH 25
|
||||
#define KEY_BUFFER 26
|
||||
|
||||
#define KEY_HANKAKU 27
|
||||
#define KEY_ZENKAKU 28
|
||||
|
||||
#define KEY_HIRAGANA 29
|
||||
#define KEY_KATAKANA 30
|
||||
#define KEY_EISUU 31
|
||||
#define KEY_EIDAI 32
|
||||
#define KEY_ROMA 33
|
||||
|
||||
#define KEY_CANCEL 34
|
||||
#define KEY_RECONV 35
|
||||
|
||||
#define KEY_IGNORE 36
|
||||
#define KEY_DEBUG 37
|
||||
|
||||
#define KEY_TOP 38
|
||||
#define KEY_END 39
|
||||
#define KEY_RECONNECT 40
|
||||
#define KEY_KILL 41
|
||||
#define KEY_OTHER 42
|
||||
|
||||
#define KEY_MORE 43
|
||||
|
||||
|
||||
|
||||
#define UKEYNUM 64
|
||||
#define SEQLEN 8
|
||||
#define COMNUM 64
|
||||
|
||||
85
include/sj3rkcv/rk.h
Normal file
85
include/sj3rkcv/rk.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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: rk.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:48 $
|
||||
*/
|
||||
|
||||
#ifndef RK_H
|
||||
#define RK_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "wchar16.h"
|
||||
|
||||
#define SPACE 0x20
|
||||
#define TAB 0x09
|
||||
#define EOL 0x0a
|
||||
#define NSTR '\0'
|
||||
#ifndef ESC
|
||||
#define ESC 0x1b
|
||||
#endif
|
||||
#define QUOTA '\''
|
||||
#define BSL '\\'
|
||||
#define MASK 0xff
|
||||
|
||||
#define MAXLEN 256
|
||||
#define MAXWLEN 16
|
||||
#define MAXLLEN 64
|
||||
#define MAXCODE 256
|
||||
|
||||
#define CONTINUE 0
|
||||
#define NOMACH -1
|
||||
#define FAIL -1
|
||||
#define RKEND 0xffffffff
|
||||
#define ERRBEL 0xfffffffc
|
||||
#define ERRCODE 0x80000000
|
||||
#define RKMASK 0x0000ffff
|
||||
#define RKZEN 0xff00
|
||||
|
||||
#define SetMojilen(c) ((c << 16) & 0x00ff0000)
|
||||
#define GetMojilen(c) ((c & ERRCODE) ? (1) : ((c >> 16) & 0xff))
|
||||
|
||||
typedef struct rktable_w16 {
|
||||
wchar16_t *r_key;
|
||||
u_short *k_yomi;
|
||||
wchar16_t *r_str;
|
||||
struct rktable_w16 *next;
|
||||
} RkTablW16;
|
||||
|
||||
typedef struct rktable {
|
||||
u_char *r_key;
|
||||
u_short *k_yomi;
|
||||
u_char *r_str;
|
||||
struct rktable *next;
|
||||
} RkTabl;
|
||||
|
||||
#endif /* RK_H */
|
||||
|
||||
127
include/sj3rkcv/sj3rkcv.h
Normal file
127
include/sj3rkcv/sj3rkcv.h
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (c) 2004 Iwata <iwata@quasiquote.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SJ3RKCV_H
|
||||
#define SJ3RKCV_H
|
||||
|
||||
#include "rk.h"
|
||||
|
||||
/* rk_conv.c */
|
||||
#define RKSIZE 256
|
||||
#define RKINCZ 32
|
||||
typedef struct rkbufrec {
|
||||
RkTablW16 *rkbuf;
|
||||
RkTablW16 *rkend;
|
||||
struct rkbufrec *rkbufp;
|
||||
} RkbufRec;
|
||||
|
||||
#define STRSIZE 1024
|
||||
#define STRINCZ 256
|
||||
typedef struct strbufrec {
|
||||
wchar16_t *strbuf;
|
||||
wchar16_t *strend;
|
||||
struct strbufrec *strbufp;
|
||||
} StrbufRec;
|
||||
|
||||
#define YMISIZE 512
|
||||
#define YMIINCZ 64
|
||||
typedef struct ymibufrec {
|
||||
wchar16_t *ymibuf;
|
||||
wchar16_t *ymiend;
|
||||
struct ymibufrec *ymibufp;
|
||||
} YmibufRec;
|
||||
extern RkTabl *sj3_rcode[MAXCODE];
|
||||
extern RkTablW16 *sj3_rcode_w16[MAXCODE];
|
||||
extern RkTablW16 *rktblp;
|
||||
extern wchar16_t rline[MAXLLEN];
|
||||
extern wchar16_t lstr[MAXLLEN];
|
||||
|
||||
void sj3_rkcode(int);
|
||||
int sj3_rkinit2(char *, int);
|
||||
int rcode_sjis_init();
|
||||
int rcode_euc_init();
|
||||
int sj3_rkinit(char *);
|
||||
int sj3_rkinit_euc(char *);
|
||||
int sj3_rkinit_mb(char *);
|
||||
int sj3_rkinit_sub(char *rkfile, int (*)());
|
||||
char *rkgetyomi(char *, wchar16_t *, int *);
|
||||
char *getkey(char *, wchar16_t *, int *);
|
||||
void cltable();
|
||||
int chk_rstr(wchar16_t *, wchar16_t *, int, int);
|
||||
RkTablW16 *rkalloc();
|
||||
int stradd(wchar16_t **, wchar16_t *, int);
|
||||
int kstradd(wchar16_t **, wchar16_t *, int);
|
||||
RkTablW16 * mktable(wchar16_t *, int);
|
||||
void sj3_rkebell(int);
|
||||
void sj3_rkclear();
|
||||
void sj3_rkreset();
|
||||
void sj3_rkconvc(wchar16_t, u_int *);
|
||||
int sj3_rkconv2(wchar16_t *, u_int *, int);
|
||||
int sj3_rkconv(u_char *, u_char *);
|
||||
int sj3_rkconv_euc(u_char *, u_char *);
|
||||
int sj3_rkconv_mb(u_char *, u_char *);
|
||||
int sj3_rkconv_w16(wchar16_t *, wchar16_t *);
|
||||
int rkmatch(wchar16_t *, wchar16_t *, int);
|
||||
|
||||
/* sj3_rkcv.h */
|
||||
#ifdef ADDHK
|
||||
void setl_hktozh();
|
||||
#endif
|
||||
void mkkigou();
|
||||
int sj_addten(u_short, u_short);
|
||||
int sj_han2zen(u_short);
|
||||
int sj3_hantozen_euc(u_char *, u_char *);
|
||||
int sj3_hantozen_mb(u_char *, u_char *);
|
||||
int sj3_hantozen_w16(wchar16_t *, wchar16_t *);
|
||||
int sj_hantozen(wchar16_t *, wchar16_t *, int);
|
||||
int sj_zen2han(u_short);
|
||||
int sj3_zentohan(u_char *, u_char *);
|
||||
int sj3_zentohan_euc(u_char *, u_char *);
|
||||
int sj3_zentohan_mb(u_char *, u_char *);
|
||||
int sj3_zentohan_w16(wchar16_t *, wchar16_t *);
|
||||
int sj_zentohan(wchar16_t *, wchar16_t *, int);
|
||||
int sj_tokata(wchar16_t);
|
||||
int sj_tohira(wchar16_t);
|
||||
int sj_htok(wchar16_t *, wchar16_t *);
|
||||
int sj_ktoh(wchar16_t *, wchar16_t *);
|
||||
|
||||
/* wc16_str.c */
|
||||
int sj3_iswcntrl16(wchar16_t);
|
||||
int sj3_iswupper16(wchar16_t);
|
||||
int sj3_iswdigit16(wchar16_t);
|
||||
int sj3_iswxdigit16(wchar16_t);
|
||||
int sj3_wslen16(wchar16_t *);
|
||||
int sj3_wscmp16(wchar16_t *, wchar16_t *);
|
||||
int sj3_wsncmp16(wchar16_t *, wchar16_t *, int);
|
||||
wchar16_t *sj3_wscpy16(wchar16_t *, wchar16_t *);
|
||||
wchar16_t *sj3_wsncpy16(wchar16_t *, wchar16_t *, int);
|
||||
wchar16_t *sj3_wscat16(wchar16_t *, wchar16_t *);
|
||||
wchar16_t sj3_euc2wc16(unsigned int);
|
||||
wchar16_t sj3_sjis2wc16(unsigned int);
|
||||
unsigned int sj3_wc2euc16(wchar16_t);
|
||||
unsigned int sj3_wc2sjis16(wchar16_t);
|
||||
int sj3_wcs2eucs16(unsigned char *, wchar16_t *, int);
|
||||
int sj3_wcs2sjiss16(unsigned char *, wchar16_t *, int);
|
||||
int sj3_eucs2wcs16(wchar16_t *, unsigned char *, int);
|
||||
int sj3_sjiss2wcs16(wchar16_t *, unsigned char *, int);
|
||||
int sj3_mbstowcs16(wchar16_t *, unsigned char *, int);
|
||||
int sj3_wcstombs16(unsigned char *, unsigned char *, int);
|
||||
|
||||
/* XXX */
|
||||
extern int current_locale;
|
||||
|
||||
#endif
|
||||
|
||||
392
include/sj3rkcv/wchar16.h
Normal file
392
include/sj3rkcv/wchar16.h
Normal file
|
|
@ -0,0 +1,392 @@
|
|||
/*
|
||||
* 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: wchar16.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:52 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _WCHARH
|
||||
#define _WCHARH
|
||||
|
||||
|
||||
#if defined(__sony_news) && defined(SVR4)
|
||||
#define _WCHAR_T
|
||||
typedef unsigned short wchar_t;
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <widec.h>
|
||||
#include <wctype.h>
|
||||
typedef wchar_t wchar16_t;
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
typedef unsigned short wchar16_t;
|
||||
#endif
|
||||
#include "key.h"
|
||||
|
||||
#ifndef SS2
|
||||
#define SS2 0x8e
|
||||
#define SS3 0x8f
|
||||
#endif
|
||||
|
||||
#if !defined(__sony_news) || (defined(__sony_news) && !defined(SVR4))
|
||||
|
||||
#ifdef iswcntrl
|
||||
#undef iswcntrl
|
||||
#endif
|
||||
#define iswcntrl(wc) sj3_iswcntrl16(wc)
|
||||
#ifdef iswupper
|
||||
#undef iswupper
|
||||
#endif
|
||||
#define iswupper(wc) sj3_iswupper16(wc)
|
||||
#ifdef iswdigit
|
||||
#undef iswdigit
|
||||
#endif
|
||||
#define iswdigit(wc) sj3_iswdigit16(wc)
|
||||
#ifdef iswxdigit
|
||||
#undef iswxdigit
|
||||
#endif
|
||||
#define iswxdigit(wc) sj3_iswxdigit16(wc)
|
||||
#ifdef wslen
|
||||
#undef wslen
|
||||
#endif
|
||||
#define wslen(ws) sj3_wslen16(ws)
|
||||
#ifdef wscmp
|
||||
#undef wscmp
|
||||
#endif
|
||||
#define wscmp(ws1, ws2) sj3_wscmp16(ws1, ws2)
|
||||
#ifdef wsncmp
|
||||
#undef wsncmp
|
||||
#endif
|
||||
#define wsncmp(ws1, ws2, n) sj3_wsncmp16(ws1, ws2, n)
|
||||
#ifdef wscpy
|
||||
#undef wscpy
|
||||
#endif
|
||||
#define wscpy(ws1, ws2) sj3_wscpy16(ws1, ws2)
|
||||
#ifdef wsncpy
|
||||
#undef wsncpy
|
||||
#endif
|
||||
#define wsncpy(ws1, ws2, n) sj3_wsncpy16(ws1, ws2, n)
|
||||
#ifdef wscat
|
||||
#undef wscat
|
||||
#endif
|
||||
#define wscat(ws1, ws2) sj3_wscat16(ws1, ws2)
|
||||
#ifdef mbstowcs
|
||||
#undef mbstowcs
|
||||
#endif
|
||||
#define mbstowcs(mb, ws, n) sj3_mbstowcs16(mb, ws, n)
|
||||
#ifdef wcstombs
|
||||
#undef wcstombs
|
||||
#endif
|
||||
#define wcstombs(ws, mb, n) sj3_wcstombs16(ws, mb, n)
|
||||
#endif
|
||||
|
||||
|
||||
#define LC_CTYPE_SHIFTJIS 1
|
||||
#define LC_CTYPE_EUC 2
|
||||
|
||||
#define IsEUCHojo(x) (((unsigned char) (x)) == SS3)
|
||||
|
||||
|
||||
|
||||
|
||||
#define WcX0208MASK 0xffff
|
||||
#define WcX0212MASK 0xff7f
|
||||
#define WcJISMASK 0x7f7f
|
||||
#define WcLowMASK 0x00ff
|
||||
#define WcHighMASK 0xff00
|
||||
|
||||
#define WcASCIIFLAG 0x0000
|
||||
#define WcX0208FLAG 0x8080
|
||||
#define WcX0212FLAG 0x8000
|
||||
#define WcX0201FLAG 0x0080
|
||||
|
||||
#define WcLowByte(w) ((w) & 0xff)
|
||||
#define WcHighByte(w) (((w) >> 8) & 0xff)
|
||||
|
||||
#define WcIsASCII(w) ((((wchar16_t) (w)) & WcX0208FLAG) == WcASCIIFLAG)
|
||||
#define WcIsX0208(w) ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0208FLAG)
|
||||
#define WcIsX0201(w) ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0201FLAG)
|
||||
#define WcIsX0212(w) ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0212FLAG)
|
||||
|
||||
#define WcIsZENKAKU(w) ((((wchar16_t) (w)) & WcX0212FLAG) == WcX0212FLAG)
|
||||
#define WcIsHANKAKU(w) ((((wchar16_t) (w)) & WcX0212FLAG) == WcASCIIFLAG)
|
||||
#define WcIsKANJI(w) WcIsZENKAKU(w)
|
||||
#define WcIsKANA(w) WcIsX0201(w)
|
||||
|
||||
#define WcSetX0212(c1, c2) ((((c1) & 0xff) << 8) + ((c2) & 0x7f))
|
||||
#define WcJIS2X0208(w) ((w) | WcX0208FLAG)
|
||||
#define WcJIS2X0212(w) ((w) | WcX0212FLAG)
|
||||
#define Wc2JIS(w) ((w) & WcJISMASK)
|
||||
|
||||
|
||||
#define WCSJrun WcMessages[0]
|
||||
|
||||
#define WCMode_buff WcMessages[1]
|
||||
#define WCMode_unbuff WcMessages[2]
|
||||
|
||||
#define WCMode_Zhira WcMessages[3]
|
||||
#define WCMode_Zkata WcMessages[4]
|
||||
#define WCMode_Hkata WcMessages[5]
|
||||
#define WCMode_Zalpha WcMessages[6]
|
||||
#define WCMode_Halpha WcMessages[7]
|
||||
|
||||
#define WCGmode WcMessages[8]
|
||||
#define WCGEtc WcMessages[9]
|
||||
#define WCGetc WcMessages[10]
|
||||
|
||||
#define WCGHelp WcMessages[11]
|
||||
#define WCMHelp WcMessages[12]
|
||||
|
||||
|
||||
|
||||
#define WCGCshift WcMessages[13]
|
||||
#define WCGCeuc WcMessages[14]
|
||||
#define WCGCeuc2 WcMessages[15]
|
||||
#define WCGCjis WcMessages[16]
|
||||
#define WCGCjis2 WcMessages[17]
|
||||
#define WCGCkuten WcMessages[18]
|
||||
#define WCGCkuten2 WcMessages[19]
|
||||
|
||||
|
||||
|
||||
#define WCGtoroku WcMessages[20]
|
||||
#define WCMhani WcMessages[21]
|
||||
#define WCMyomi WcMessages[22]
|
||||
#define WCTOUROKU_OK WcMessages[23]
|
||||
#define WCSYOUKYO_OK WcMessages[24]
|
||||
#define WCTOUROKU_HIN WcMessages[25]
|
||||
#define WCTOUROKU_SUCC WcMessages[26]
|
||||
#define WCYomi WcMessages[27]
|
||||
#define WCOne WcMessages[28]
|
||||
#define WCY WcMessages[29]
|
||||
#define WCExist WcMessages[30]
|
||||
#define WCYomiTouroku WcMessages[31]
|
||||
#define WCKanjiTouroku WcMessages[32]
|
||||
#define WCOnajiTouroku WcMessages[33]
|
||||
#define WCUserTouroku WcMessages[34]
|
||||
#define WCJishoLock WcMessages[35]
|
||||
#define WCSystemError WcMessages[36]
|
||||
#define WCKanma WcMessages[37]
|
||||
|
||||
|
||||
#define WCGsyoukyo WcMessages[38]
|
||||
#define WCSYOUKYO_SUCC WcMessages[39]
|
||||
#define WCNotExist WcMessages[40]
|
||||
#define WCUserLock WcMessages[41]
|
||||
#define WCYomiShokyo WcMessages[42]
|
||||
#define WCKanjiShokyo WcMessages[43]
|
||||
#define WCShokyoError WcMessages[44]
|
||||
|
||||
|
||||
|
||||
#define WCSUCCsjrc WcMessages[45]
|
||||
#define WCFAILsjrc WcMessages[46]
|
||||
#define WCNOTHsjrc WcMessages[47]
|
||||
|
||||
|
||||
#define WCWeight_mes WcMessages[48]
|
||||
|
||||
|
||||
|
||||
#define WCGrcon WcMessages[49]
|
||||
#define WCRserv WcMessages[50]
|
||||
#define WCRserv_OK WcMessages[51]
|
||||
#define WCDiscon WcMessages[52]
|
||||
|
||||
#define WCSpace WcMessages[53]
|
||||
#define WCSpace2 WcMessages[54]
|
||||
#define WCContinue WcMessages[55]
|
||||
|
||||
|
||||
#define WCServer_Dead WcMessages[56]
|
||||
#define WCConnected WcMessages[57]
|
||||
#define WCNconnect WcMessages[58]
|
||||
#define WCNopen_Mdic WcMessages[59]
|
||||
#define WCNmake_Udir WcMessages[60]
|
||||
#define WCNmake_Udic WcMessages[61]
|
||||
#define WCNopen_Udic WcMessages[62]
|
||||
#define WCNmake_Study WcMessages[63]
|
||||
#define WCNopen_Study WcMessages[64]
|
||||
|
||||
|
||||
|
||||
#define WCGedit WcMessages[65]
|
||||
|
||||
|
||||
#define WCTooLong WcMessages[67]
|
||||
#define WCDollar WcMessages[68]
|
||||
|
||||
|
||||
#define WCOn WcMessages[69]
|
||||
#define WCOff WcMessages[70]
|
||||
|
||||
|
||||
#define WCMeishi WcMessages[71]
|
||||
#define WCMyouji WcMessages[72]
|
||||
#define WCNamae WcMessages[73]
|
||||
#define WCTimei WcMessages[74]
|
||||
#define WCSahen WcMessages[75]
|
||||
|
||||
|
||||
#define WCKara WcMessages[76]
|
||||
#define WCF1 WcMessages[77]
|
||||
#define WCF2 WcMessages[78]
|
||||
#define WCF3 WcMessages[79]
|
||||
#define WCF4 WcMessages[80]
|
||||
#define WCF5 WcMessages[81]
|
||||
#define WCF6 WcMessages[82]
|
||||
#define WCF7 WcMessages[83]
|
||||
#define WCF8 WcMessages[84]
|
||||
#define WCF9 WcMessages[85]
|
||||
#define WCF10 WcMessages[86]
|
||||
#define WCF11 WcMessages[87]
|
||||
#define WCF12 WcMessages[88]
|
||||
#define WCF13 WcMessages[89]
|
||||
#define WCF14 WcMessages[90]
|
||||
#define WCF15 WcMessages[91]
|
||||
#define WCF16 WcMessages[92]
|
||||
#define WCF17 WcMessages[93]
|
||||
#define WCF18 WcMessages[94]
|
||||
#define WCF19 WcMessages[95]
|
||||
#define WCF20 WcMessages[96]
|
||||
#define WCSelect WcMessages[97]
|
||||
#define WCKanji WcMessages[98]
|
||||
#define WCCancel WcMessages[99]
|
||||
#define WCExecute WcMessages[100]
|
||||
#define WCUp WcMessages[101]
|
||||
#define WCDown WcMessages[102]
|
||||
#define WCRight WcMessages[103]
|
||||
#define WCLeft WcMessages[104]
|
||||
|
||||
#define WCStart WcMessages[105]
|
||||
#define WCHenkan WcMessages[106]
|
||||
#define WCMuhen WcMessages[107]
|
||||
#define WCKettei WcMessages[108]
|
||||
#define WCHira WcMessages[109]
|
||||
#define WCHalpha WcMessages[110]
|
||||
#define WCZalpha WcMessages[111]
|
||||
#define WCHkata WcMessages[112]
|
||||
#define WCZkata WcMessages[113]
|
||||
#define WCCode WcMessages[114]
|
||||
#define WCEtc WcMessages[115]
|
||||
#define WCRightl WcMessages[116]
|
||||
#define WCLeftl WcMessages[117]
|
||||
#define WCKaku WcMessages[118]
|
||||
#define WCSyuku WcMessages[119]
|
||||
#define WCEdit WcMessages[120]
|
||||
#define WCToggle WcMessages[121]
|
||||
#define WCWrapback WcMessages[122]
|
||||
#define WCWrap WcMessages[123]
|
||||
#define WCSjrc WcMessages[124]
|
||||
#define WCBuffer WcMessages[125]
|
||||
#define WCToroku WcMessages[126]
|
||||
#define WCSyoukyo WcMessages[127]
|
||||
#define WCHelp WcMessages[128]
|
||||
#define WCHaKettei WcMessages[129]
|
||||
#define WCFlush WcMessages[130]
|
||||
#define WCDebug WcMessages[131]
|
||||
#define WCCancell WcMessages[132]
|
||||
#define WCSaihenkan WcMessages[133]
|
||||
#define WCIgnore WcMessages[134]
|
||||
#define WCTop WcMessages[135]
|
||||
#define WCEnd WcMessages[136]
|
||||
#define WCReconnect WcMessages[137]
|
||||
#define WCKill WcMessages[138]
|
||||
|
||||
|
||||
#define WCKey WcMessages[139]
|
||||
#define WCEscape WcMessages[140]
|
||||
#define WCSjxkey WcMessages[141]
|
||||
#define WCEtckey WcMessages[142]
|
||||
#define WCIntr WcMessages[143]
|
||||
#define WCBskey WcMessages[144]
|
||||
#define WCDelkey WcMessages[145]
|
||||
#define WCSetnormal WcMessages[146]
|
||||
#define WCThroughnext WcMessages[147]
|
||||
#define WCInitialmode WcMessages[148]
|
||||
#define WCHelpmode WcMessages[149]
|
||||
#define WCDefaultcode WcMessages[150]
|
||||
#define WCMuhenkanmode WcMessages[151]
|
||||
#define WCMuhenkaninedit WcMessages[152]
|
||||
#define WCMuhenkantoggle WcMessages[153]
|
||||
#define WCGuide WcMessages[154]
|
||||
#define WCForkshell WcMessages[155]
|
||||
#define WCExecshell WcMessages[156]
|
||||
#define WCDictionary WcMessages[157]
|
||||
#define WCUserdic WcMessages[158]
|
||||
#define WCMaindic WcMessages[159]
|
||||
#define WCRomaji WcMessages[160]
|
||||
#define WCBstudy WcMessages[161]
|
||||
#define WCSilent WcMessages[162]
|
||||
#define WCFlushafterconversion WcMessages[163]
|
||||
#define WCRkerrbell WcMessages[164]
|
||||
#define WCServer WcMessages[165]
|
||||
|
||||
#define WCShiftjis WcMessages[166]
|
||||
#define WCSjis WcMessages[167]
|
||||
#define WCEuc WcMessages[168]
|
||||
#define WCEuc2 WcMessages[169]
|
||||
#define WCJis WcMessages[170]
|
||||
#define WCJis2 WcMessages[171]
|
||||
#define WCKuten WcMessages[172]
|
||||
#define WCKuten2 WcMessages[173]
|
||||
|
||||
#define WCBuff WcMessages[174]
|
||||
#define WCUnbuff WcMessages[175]
|
||||
#define WCDirect WcMessages[176]
|
||||
|
||||
#define WCSj2 WcMessages[177]
|
||||
#define WCShift WcMessages[178]
|
||||
|
||||
#define WCFunction WcMessages[179]
|
||||
|
||||
#define WCUnbuffer WcMessages[180]
|
||||
#define WCFuncetc WcMessages[181]
|
||||
|
||||
extern wchar16_t *WcMessages[];
|
||||
|
||||
|
||||
|
||||
struct wcvtkey {
|
||||
wchar16_t *key_word;
|
||||
wchar16_t key_seq[SEQLEN];
|
||||
};
|
||||
|
||||
|
||||
struct functbl {
|
||||
wchar16_t *keyword;
|
||||
int (*func)();
|
||||
};
|
||||
|
||||
#endif
|
||||
11
lib/Makefile.am
Normal file
11
lib/Makefile.am
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
SUBDIRS = \
|
||||
sj3compat \
|
||||
sj3core \
|
||||
sj3lib \
|
||||
sj3rkcv
|
||||
|
||||
if SJ3_INTERNAL_LUA
|
||||
SUBDIRS += lua
|
||||
endif
|
||||
|
||||
|
||||
34
lib/lua/COPYRIGHT
Normal file
34
lib/lua/COPYRIGHT
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
Lua License
|
||||
-----------
|
||||
|
||||
Lua is licensed under the terms of the MIT license reproduced below.
|
||||
This means that Lua is free software and can be used for both academic
|
||||
and commercial purposes at absolutely no cost.
|
||||
|
||||
For details and rationale, see http://www.lua.org/license.html .
|
||||
|
||||
===============================================================================
|
||||
|
||||
Copyright (C) 1994-2007 Lua.org, PUC-Rio.
|
||||
|
||||
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 THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
===============================================================================
|
||||
|
||||
(end of COPYRIGHT)
|
||||
183
lib/lua/HISTORY
Normal file
183
lib/lua/HISTORY
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
HISTORY for Lua 5.1
|
||||
|
||||
* Changes from version 5.0 to 5.1
|
||||
-------------------------------
|
||||
Language:
|
||||
+ new module system.
|
||||
+ new semantics for control variables of fors.
|
||||
+ new semantics for setn/getn.
|
||||
+ new syntax/semantics for varargs.
|
||||
+ new long strings and comments.
|
||||
+ new `mod' operator (`%')
|
||||
+ new length operator #t
|
||||
+ metatables for all types
|
||||
API:
|
||||
+ new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
|
||||
+ user supplies memory allocator (lua_open becomes lua_newstate).
|
||||
+ luaopen_* functions must be called through Lua.
|
||||
Implementation:
|
||||
+ new configuration scheme via luaconf.h.
|
||||
+ incremental garbage collection.
|
||||
+ better handling of end-of-line in the lexer.
|
||||
+ fully reentrant parser (new Lua function `load')
|
||||
+ better support for 64-bit machines.
|
||||
+ native loadlib support for Mac OS X.
|
||||
+ standard distribution in only one library (lualib.a merged into lua.a)
|
||||
|
||||
* Changes from version 4.0 to 5.0
|
||||
-------------------------------
|
||||
Language:
|
||||
+ lexical scoping.
|
||||
+ Lua coroutines.
|
||||
+ standard libraries now packaged in tables.
|
||||
+ tags replaced by metatables and tag methods replaced by metamethods,
|
||||
stored in metatables.
|
||||
+ proper tail calls.
|
||||
+ each function can have its own global table, which can be shared.
|
||||
+ new __newindex metamethod, called when we insert a new key into a table.
|
||||
+ new block comments: --[[ ... ]].
|
||||
+ new generic for.
|
||||
+ new weak tables.
|
||||
+ new boolean type.
|
||||
+ new syntax "local function".
|
||||
+ (f()) returns the first value returned by f.
|
||||
+ {f()} fills a table with all values returned by f.
|
||||
+ \n ignored in [[\n .
|
||||
+ fixed and-or priorities.
|
||||
+ more general syntax for function definition (e.g. function a.x.y:f()...end).
|
||||
+ more general syntax for function calls (e.g. (print or write)(9)).
|
||||
+ new functions (time/date, tmpfile, unpack, require, load*, etc.).
|
||||
API:
|
||||
+ chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer.
|
||||
+ introduced lightweight userdata, a simple "void*" without a metatable.
|
||||
+ new error handling protocol: the core no longer prints error messages;
|
||||
all errors are reported to the caller on the stack.
|
||||
+ new lua_atpanic for host cleanup.
|
||||
+ new, signal-safe, hook scheme.
|
||||
Implementation:
|
||||
+ new license: MIT.
|
||||
+ new, faster, register-based virtual machine.
|
||||
+ support for external multithreading and coroutines.
|
||||
+ new and consistent error message format.
|
||||
+ the core no longer needs "stdio.h" for anything (except for a single
|
||||
use of sprintf to convert numbers to strings).
|
||||
+ lua.c now runs the environment variable LUA_INIT, if present. It can
|
||||
be "@filename", to run a file, or the chunk itself.
|
||||
+ support for user extensions in lua.c.
|
||||
sample implementation given for command line editing.
|
||||
+ new dynamic loading library, active by default on several platforms.
|
||||
+ safe garbage-collector metamethods.
|
||||
+ precompiled bytecodes checked for integrity (secure binary dostring).
|
||||
+ strings are fully aligned.
|
||||
+ position capture in string.find.
|
||||
+ read('*l') can read lines with embedded zeros.
|
||||
|
||||
* Changes from version 3.2 to 4.0
|
||||
-------------------------------
|
||||
Language:
|
||||
+ new "break" and "for" statements (both numerical and for tables).
|
||||
+ uniform treatment of globals: globals are now stored in a Lua table.
|
||||
+ improved error messages.
|
||||
+ no more '$debug': full speed *and* full debug information.
|
||||
+ new read form: read(N) for next N bytes.
|
||||
+ general read patterns now deprecated.
|
||||
(still available with -DCOMPAT_READPATTERNS.)
|
||||
+ all return values are passed as arguments for the last function
|
||||
(old semantics still available with -DLUA_COMPAT_ARGRET)
|
||||
+ garbage collection tag methods for tables now deprecated.
|
||||
+ there is now only one tag method for order.
|
||||
API:
|
||||
+ New API: fully re-entrant, simpler, and more efficient.
|
||||
+ New debug API.
|
||||
Implementation:
|
||||
+ faster than ever: cleaner virtual machine and new hashing algorithm.
|
||||
+ non-recursive garbage-collector algorithm.
|
||||
+ reduced memory usage for programs with many strings.
|
||||
+ improved treatment for memory allocation errors.
|
||||
+ improved support for 16-bit machines (we hope).
|
||||
+ code now compiles unmodified as both ANSI C and C++.
|
||||
+ numbers in bases other than 10 are converted using strtoul.
|
||||
+ new -f option in Lua to support #! scripts.
|
||||
+ luac can now combine text and binaries.
|
||||
|
||||
* Changes from version 3.1 to 3.2
|
||||
-------------------------------
|
||||
+ redirected all output in Lua's core to _ERRORMESSAGE and _ALERT.
|
||||
+ increased limit on the number of constants and globals per function
|
||||
(from 2^16 to 2^24).
|
||||
+ debugging info (lua_debug and hooks) moved into lua_state and new API
|
||||
functions provided to get and set this info.
|
||||
+ new debug lib gives full debugging access within Lua.
|
||||
+ new table functions "foreachi", "sort", "tinsert", "tremove", "getn".
|
||||
+ new io functions "flush", "seek".
|
||||
|
||||
* Changes from version 3.0 to 3.1
|
||||
-------------------------------
|
||||
+ NEW FEATURE: anonymous functions with closures (via "upvalues").
|
||||
+ new syntax:
|
||||
- local variables in chunks.
|
||||
- better scope control with DO block END.
|
||||
- constructors can now be also written: { record-part; list-part }.
|
||||
- more general syntax for function calls and lvalues, e.g.:
|
||||
f(x).y=1
|
||||
o:f(x,y):g(z)
|
||||
f"string" is sugar for f("string")
|
||||
+ strings may now contain arbitrary binary data (e.g., embedded zeros).
|
||||
+ major code re-organization and clean-up; reduced module interdependecies.
|
||||
+ no arbitrary limits on the total number of constants and globals.
|
||||
+ support for multiple global contexts.
|
||||
+ better syntax error messages.
|
||||
+ new traversal functions "foreach" and "foreachvar".
|
||||
+ the default for numbers is now double.
|
||||
changing it to use floats or longs is easy.
|
||||
+ complete debug information stored in pre-compiled chunks.
|
||||
+ sample interpreter now prompts user when run interactively, and also
|
||||
handles control-C interruptions gracefully.
|
||||
|
||||
* Changes from version 2.5 to 3.0
|
||||
-------------------------------
|
||||
+ NEW CONCEPT: "tag methods".
|
||||
Tag methods replace fallbacks as the meta-mechanism for extending the
|
||||
semantics of Lua. Whereas fallbacks had a global nature, tag methods
|
||||
work on objects having the same tag (e.g., groups of tables).
|
||||
Existing code that uses fallbacks should work without change.
|
||||
+ new, general syntax for constructors {[exp] = exp, ... }.
|
||||
+ support for handling variable number of arguments in functions (varargs).
|
||||
+ support for conditional compilation ($if ... $else ... $end).
|
||||
+ cleaner semantics in API simplifies host code.
|
||||
+ better support for writing libraries (auxlib.h).
|
||||
+ better type checking and error messages in the standard library.
|
||||
+ luac can now also undump.
|
||||
|
||||
* Changes from version 2.4 to 2.5
|
||||
-------------------------------
|
||||
+ io and string libraries are now based on pattern matching;
|
||||
the old libraries are still available for compatibility
|
||||
+ dofile and dostring can now return values (via return statement)
|
||||
+ better support for 16- and 64-bit machines
|
||||
+ expanded documentation, with more examples
|
||||
|
||||
* Changes from version 2.2 to 2.4
|
||||
-------------------------------
|
||||
+ external compiler creates portable binary files that can be loaded faster
|
||||
+ interface for debugging and profiling
|
||||
+ new "getglobal" fallback
|
||||
+ new functions for handling references to Lua objects
|
||||
+ new functions in standard lib
|
||||
+ only one copy of each string is stored
|
||||
+ expanded documentation, with more examples
|
||||
|
||||
* Changes from version 2.1 to 2.2
|
||||
-------------------------------
|
||||
+ functions now may be declared with any "lvalue" as a name
|
||||
+ garbage collection of functions
|
||||
+ support for pipes
|
||||
|
||||
* Changes from version 1.1 to 2.1
|
||||
-------------------------------
|
||||
+ object-oriented support
|
||||
+ fallbacks
|
||||
+ simplified syntax for tables
|
||||
+ many internal improvements
|
||||
|
||||
(end of HISTORY)
|
||||
99
lib/lua/INSTALL
Normal file
99
lib/lua/INSTALL
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
INSTALL for Lua 5.1
|
||||
|
||||
* Building Lua
|
||||
------------
|
||||
Lua is built in the src directory, but the build process can be
|
||||
controlled from the top-level Makefile.
|
||||
|
||||
Building Lua on Unix systems should be very easy. First do "make" and
|
||||
see if your platform is listed. If so, just do "make xxx", where xxx
|
||||
is your platform name. The platforms currently supported are:
|
||||
aix ansi bsd freebsd generic linux macosx mingw posix solaris
|
||||
|
||||
If your platform is not listed, try the closest one or posix, generic,
|
||||
ansi, in this order.
|
||||
|
||||
See below for customization instructions and for instructions on how
|
||||
to build with other Windows compilers.
|
||||
|
||||
If you want to check that Lua has been built correctly, do "make test"
|
||||
after building Lua. Also, have a look at the example programs in test.
|
||||
|
||||
* Installing Lua
|
||||
--------------
|
||||
Once you have built Lua, you may want to install it in an official
|
||||
place in your system. In this case, do "make install". The official
|
||||
place and the way to install files are defined in Makefile. You must
|
||||
have the right permissions to install files.
|
||||
|
||||
If you want to build and install Lua in one step, do "make xxx install",
|
||||
where xxx is your platform name.
|
||||
|
||||
If you want to install Lua locally, then do "make local". This will
|
||||
create directories bin, include, lib, man, and install Lua there as
|
||||
follows:
|
||||
|
||||
bin: lua luac
|
||||
include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp
|
||||
lib: liblua.a
|
||||
man/man1: lua.1 luac.1
|
||||
|
||||
These are the only directories you need for development.
|
||||
|
||||
There are man pages for lua and luac, in both nroff and html, and a
|
||||
reference manual in html in doc, some sample code in test, and some
|
||||
useful stuff in etc. You don't need these directories for development.
|
||||
|
||||
If you want to install Lua locally, but in some other directory, do
|
||||
"make install INSTALL_TOP=xxx", where xxx is your chosen directory.
|
||||
|
||||
See below for instructions for Windows and other systems.
|
||||
|
||||
* Customization
|
||||
-------------
|
||||
Three things can be customized by editing a file:
|
||||
- Where and how to install Lua -- edit Makefile.
|
||||
- How to build Lua -- edit src/Makefile.
|
||||
- Lua features -- edit src/luaconf.h.
|
||||
|
||||
You don't actually need to edit the Makefiles because you may set the
|
||||
relevant variables when invoking make.
|
||||
|
||||
On the other hand, if you need to select some Lua features, you'll need
|
||||
to edit src/luaconf.h. The edited file will be the one installed, and
|
||||
it will be used by any Lua clients that you build, to ensure consistency.
|
||||
|
||||
We strongly recommend that you enable dynamic loading. This is done
|
||||
automatically for all platforms listed above that have this feature
|
||||
(and also Windows). See src/luaconf.h and also src/Makefile.
|
||||
|
||||
* Building Lua on Windows and other systems
|
||||
-----------------------------------------
|
||||
If you're not using the usual Unix tools, then the instructions for
|
||||
building Lua depend on the compiler you use. You'll need to create
|
||||
projects (or whatever your compiler uses) for building the library,
|
||||
the interpreter, and the compiler, as follows:
|
||||
|
||||
library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
|
||||
lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c
|
||||
ltable.c ltm.c lundump.c lvm.c lzio.c
|
||||
lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
|
||||
ltablib.c lstrlib.c loadlib.c linit.c
|
||||
|
||||
interpreter: library, lua.c
|
||||
|
||||
compiler: library, luac.c print.c
|
||||
|
||||
If you use Visual Studio .NET, you can use etc/luavs.bat in its
|
||||
"Command Prompt".
|
||||
|
||||
If all you want is to build the Lua interpreter, you may put all .c files
|
||||
in a single project, except for luac.c and print.c. Or just use etc/all.c.
|
||||
|
||||
To use Lua as a library in your own programs, you'll need to know how to
|
||||
create and use libraries with your compiler.
|
||||
|
||||
As mentioned above, you may edit luaconf.h to select some features before
|
||||
building Lua.
|
||||
|
||||
(end of INSTALL)
|
||||
531
lib/lua/Makefile
Normal file
531
lib/lua/Makefile
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# lib/lua/Makefile. Generated from Makefile.in by configure.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = ../..
|
||||
|
||||
pkgdatadir = $(datadir)/sj3
|
||||
pkglibdir = $(libdir)/sj3
|
||||
pkgincludedir = $(includedir)/sj3
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = /usr/bin/install -c
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = i386-unknown-openbsd4.2
|
||||
host_triplet = i386-unknown-openbsd4.2
|
||||
subdir = lib/lua
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
INSTALL
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/config/pkg.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-exec-recursive install-info-recursive \
|
||||
install-recursive installcheck-recursive installdirs-recursive \
|
||||
pdf-recursive ps-recursive uninstall-info-recursive \
|
||||
uninstall-recursive
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = ${SHELL} /home/braindead/src/sj3/config/missing --run aclocal-1.9
|
||||
AMDEP_FALSE = #
|
||||
AMDEP_TRUE =
|
||||
AMTAR = ${SHELL} /home/braindead/src/sj3/config/missing --run tar
|
||||
AR = ar
|
||||
AS = as
|
||||
AUTOCONF = ${SHELL} /home/braindead/src/sj3/config/missing --run autoconf
|
||||
AUTOHEADER = ${SHELL} /home/braindead/src/sj3/config/missing --run autoheader
|
||||
AUTOMAKE = ${SHELL} /home/braindead/src/sj3/config/missing --run automake-1.9
|
||||
AWK = nawk
|
||||
BUILDABLE_SJ3CLIENT_FALSE = #
|
||||
BUILDABLE_SJ3CLIENT_TRUE =
|
||||
BUILDABLE_SJ3DEMO_FALSE = #
|
||||
BUILDABLE_SJ3DEMO_TRUE =
|
||||
BUILDABLE_SJ3DICT_FALSE = #
|
||||
BUILDABLE_SJ3DICT_TRUE =
|
||||
BUILDABLE_SJ3SERV_FALSE = #
|
||||
BUILDABLE_SJ3SERV_TRUE =
|
||||
CC = cc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -O2 -g -Wall
|
||||
CPP = cc -E
|
||||
CPPFLAGS =
|
||||
CXX = c++
|
||||
CXXCPP = c++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -O2 -pipe -Wall
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DHAVE_CONFIG_H
|
||||
DEPDIR = .deps
|
||||
DLLTOOL = dlltool
|
||||
ECHO = /bin/echo
|
||||
ECHO_C =
|
||||
ECHO_N = -n
|
||||
ECHO_T =
|
||||
EGREP = /usr/bin/grep -E
|
||||
EXEEXT =
|
||||
F77 = g77
|
||||
FFLAGS = -O2 -pipe -Wall
|
||||
GREP = /usr/bin/grep
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
|
||||
LDFLAGS =
|
||||
LIBM = -lm
|
||||
LIBOBJS = ${LIBOBJDIR}error$U.o
|
||||
LIBS =
|
||||
LIBSJ3CORE_MAJOR_VERSION = 2
|
||||
LIBSJ3CORE_MICRO_VERSION = 121
|
||||
LIBSJ3CORE_MICRO_VERSION_SUFFIX =
|
||||
LIBSJ3CORE_MINOR_VERSION = 0
|
||||
LIBSJ3CORE_VERSION = 2.0.121
|
||||
LIBSJ3CORE_VERSION_EXTRA =
|
||||
LIBSJ3CORE_VERSION_INFO = 2:121:0
|
||||
LIBSJ3CORE_VERSION_NUMBER = 20121
|
||||
LIBSJ3LIB_MAJOR_VERSION = 2
|
||||
LIBSJ3LIB_MICRO_VERSION = 121
|
||||
LIBSJ3LIB_MICRO_VERSION_SUFFIX =
|
||||
LIBSJ3LIB_MINOR_VERSION = 0
|
||||
LIBSJ3LIB_VERSION = 2.0.121
|
||||
LIBSJ3LIB_VERSION_EXTRA =
|
||||
LIBSJ3LIB_VERSION_INFO = 2:121:0
|
||||
LIBSJ3LIB_VERSION_NUMBER = 20121
|
||||
LIBSJ3RKCV_MAJOR_VERSION = 2
|
||||
LIBSJ3RKCV_MICRO_VERSION = 121
|
||||
LIBSJ3RKCV_MICRO_VERSION_SUFFIX =
|
||||
LIBSJ3RKCV_MINOR_VERSION = 0
|
||||
LIBSJ3RKCV_VERSION = 2.0.121
|
||||
LIBSJ3RKCV_VERSION_EXTRA =
|
||||
LIBSJ3RKCV_VERSION_INFO = 2:121:0
|
||||
LIBSJ3RKCV_VERSION_NUMBER = 20121
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS = ${LIBOBJDIR}error$U.lo
|
||||
LUA_CFLAGS = -I/usr/local//include
|
||||
LUA_LIBS = -L/usr/local//lib -llua -lm
|
||||
MAKEINFO = ${SHELL} /home/braindead/src/sj3/config/missing --run makeinfo
|
||||
OBJDUMP = objdump
|
||||
OBJEXT = o
|
||||
PACKAGE = sj3
|
||||
PACKAGE_BUGREPORT = iwata@quasiquote.org
|
||||
PACKAGE_NAME = sj3
|
||||
PACKAGE_STRING = sj3 2.0.1.21
|
||||
PACKAGE_TARNAME = sj3
|
||||
PACKAGE_VERSION = 2.0.1.21
|
||||
PATH_SEPARATOR = :
|
||||
PKG_CONFIG = /usr/bin/pkg-config
|
||||
RANLIB = ranlib
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
SJ3DICTDIR = /var/spool/sj3
|
||||
SJ3GROUP = _sj3
|
||||
SJ3OWNER = _sj3
|
||||
SJ3SYSCONFDIR = /etc/sj3
|
||||
SJ3VARDIR = /var
|
||||
SJ3_INTERNAL_LUA_FALSE =
|
||||
SJ3_INTERNAL_LUA_TRUE = #
|
||||
STRIP = strip
|
||||
VERSION = 2.0.1.21
|
||||
WRAP_LIB = -lwrap
|
||||
ac_ct_CC = cc
|
||||
ac_ct_CXX =
|
||||
ac_ct_F77 = g77
|
||||
am__fastdepCC_FALSE = #
|
||||
am__fastdepCC_TRUE =
|
||||
am__fastdepCXX_FALSE = #
|
||||
am__fastdepCXX_TRUE =
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
am__quote =
|
||||
am__tar = ${AMTAR} chof - "$$tardir"
|
||||
am__untar = ${AMTAR} xf -
|
||||
bindir = ${exec_prefix}/bin
|
||||
build = i386-unknown-openbsd4.2
|
||||
build_alias =
|
||||
build_cpu = i386
|
||||
build_os = openbsd4.2
|
||||
build_vendor = unknown
|
||||
datadir = ${datarootdir}
|
||||
datarootdir = ${prefix}/share
|
||||
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
|
||||
dvidir = ${docdir}
|
||||
exec_prefix = /usr/opt/sj3
|
||||
host = i386-unknown-openbsd4.2
|
||||
host_alias =
|
||||
host_cpu = i386
|
||||
host_os = openbsd4.2
|
||||
host_vendor = unknown
|
||||
htmldir = ${docdir}
|
||||
includedir = ${prefix}/include
|
||||
infodir = ${datarootdir}/info
|
||||
install_sh = /home/braindead/src/sj3/config/install-sh
|
||||
libdir = ${exec_prefix}/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = /var
|
||||
mandir = ${datarootdir}/man
|
||||
mkdir_p = $(SHELL) $(install_sh) -d
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /usr/opt/sj3
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
sharedstatedir = ${prefix}/com
|
||||
sysconfdir = /etc
|
||||
target_alias =
|
||||
SUBDIRS = \
|
||||
doc \
|
||||
etc \
|
||||
src \
|
||||
test
|
||||
|
||||
EXTRA_DIST = \
|
||||
COPYRIGHT
|
||||
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/lua/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu lib/lua/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(mkdir_p) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
distdir=`$(am__cd) $(distdir) && pwd`; \
|
||||
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$top_distdir" \
|
||||
distdir="$$distdir/$$subdir" \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
|
||||
clean clean-generic clean-libtool clean-recursive ctags \
|
||||
ctags-recursive distclean distclean-generic distclean-libtool \
|
||||
distclean-recursive distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-recursive \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool \
|
||||
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-info-am
|
||||
|
||||
HISTORY
|
||||
INSTALL
|
||||
README
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
11
lib/lua/Makefile.am
Normal file
11
lib/lua/Makefile.am
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
SUBDIRS = \
|
||||
doc \
|
||||
etc \
|
||||
src \
|
||||
test
|
||||
|
||||
EXTRA_DIST = \
|
||||
COPYRIGHT
|
||||
HISTORY
|
||||
INSTALL
|
||||
README
|
||||
37
lib/lua/README
Normal file
37
lib/lua/README
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
README for Lua 5.1
|
||||
|
||||
See INSTALL for installation instructions.
|
||||
See HISTORY for a summary of changes since the last released version.
|
||||
|
||||
* What is Lua?
|
||||
------------
|
||||
Lua is a powerful, light-weight programming language designed for extending
|
||||
applications. Lua is also frequently used as a general-purpose, stand-alone
|
||||
language. Lua is free software.
|
||||
|
||||
For complete information, visit Lua's web site at http://www.lua.org/ .
|
||||
For an executive summary, see http://www.lua.org/about.html .
|
||||
|
||||
Lua has been used in many different projects around the world.
|
||||
For a short list, see http://www.lua.org/uses.html .
|
||||
|
||||
* Availability
|
||||
------------
|
||||
Lua is freely available for both academic and commercial purposes.
|
||||
See COPYRIGHT and http://www.lua.org/license.html for details.
|
||||
Lua can be downloaded at http://www.lua.org/download.html .
|
||||
|
||||
* Installation
|
||||
------------
|
||||
Lua is implemented in pure ANSI C, and compiles unmodified in all known
|
||||
platforms that have an ANSI C compiler. In most Unix-like platforms, simply
|
||||
do "make" with a suitable target. See INSTALL for detailed instructions.
|
||||
|
||||
* Origin
|
||||
------
|
||||
Lua is developed at Lua.org, a laboratory of the Department of Computer
|
||||
Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro
|
||||
in Brazil).
|
||||
For more information about the authors, see http://www.lua.org/authors.html .
|
||||
|
||||
(end of README)
|
||||
13
lib/lua/doc/Makefile.am
Normal file
13
lib/lua/doc/Makefile.am
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
EXTRA_DIST = \
|
||||
amazon.gif \
|
||||
contents.html \
|
||||
cover.png \
|
||||
logo.gif \
|
||||
lua.1 \
|
||||
lua.css \
|
||||
lua.html \
|
||||
luac.1 \
|
||||
luac.html \
|
||||
manual.css \
|
||||
manual.html \
|
||||
readme.html
|
||||
BIN
lib/lua/doc/amazon.gif
Normal file
BIN
lib/lua/doc/amazon.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 797 B |
456
lib/lua/doc/contents.html
Normal file
456
lib/lua/doc/contents.html
Normal file
|
|
@ -0,0 +1,456 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Lua 5.1 reference manual - contents</TITLE>
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
|
||||
<STYLE TYPE="text/css">
|
||||
ul {
|
||||
list-style-type: none ;
|
||||
list-style-position: outside ;
|
||||
}
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
|
||||
<HR>
|
||||
<H1>
|
||||
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="" BORDER=0></A>
|
||||
Lua 5.1 Reference Manual
|
||||
</H1>
|
||||
|
||||
This is an online version of
|
||||
<BLOCKQUOTE>
|
||||
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
|
||||
<IMG SRC="cover.png" ALT="" TITLE="buy from Amazon" BORDER=1 ALIGN="left" HSPACE=12>
|
||||
</A>
|
||||
<B>Lua 5.1 Reference Manual</B>
|
||||
<BR>by R. Ierusalimschy, L. H. de Figueiredo, W. Celes
|
||||
<BR>Lua.org, August 2006
|
||||
<BR>ISBN 85-903798-3-3
|
||||
<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
|
||||
<IMG SRC="amazon.gif" ALT="[Buy from Amazon]" BORDER=0></A>
|
||||
<BR CLEAR="all">
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
|
||||
Buy a paper copy and
|
||||
<A HREF="http://www.lua.org/donations.html">help to support</A>
|
||||
the Lua project.
|
||||
<P>
|
||||
|
||||
<A HREF="manual.html">start</A>
|
||||
·
|
||||
<A HREF="#contents">contents</A>
|
||||
·
|
||||
<A HREF="#index">index</A>
|
||||
·
|
||||
<A HREF="http://www.lua.org/manual/5.1/errata.html">errata</A>
|
||||
<HR>
|
||||
<SMALL>
|
||||
Copyright © 2006-2007 Lua.org, PUC-Rio.
|
||||
Freely available under the terms of the
|
||||
<a href="http://www.lua.org/license.html#5">Lua license</a>.
|
||||
</SMALL>
|
||||
<P>
|
||||
|
||||
<H2><A NAME="contents">Contents</A></H2>
|
||||
<UL style="padding: 0">
|
||||
<LI><A HREF="manual.html#1">1 - Introduction</A>
|
||||
<LI><A HREF="manual.html#2">2 - The Language</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>
|
||||
<LI><A HREF="manual.html#2.2">2.2 - Values and Types</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.2.1">2.2.1 - Coercion</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.3">2.3 - Variables</A>
|
||||
<LI><A HREF="manual.html#2.4">2.4 - Statements</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.4.1">2.4.1 - Chunks</A>
|
||||
<LI><A HREF="manual.html#2.4.2">2.4.2 - Blocks</A>
|
||||
<LI><A HREF="manual.html#2.4.3">2.4.3 - Assignment</A>
|
||||
<LI><A HREF="manual.html#2.4.4">2.4.4 - Control Structures</A>
|
||||
<LI><A HREF="manual.html#2.4.5">2.4.5 - For Statement</A>
|
||||
<LI><A HREF="manual.html#2.4.6">2.4.6 - Function Calls as Statements</A>
|
||||
<LI><A HREF="manual.html#2.4.7">2.4.7 - Local Declarations</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.5">2.5 - Expressions</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.5.1">2.5.1 - Arithmetic Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.2">2.5.2 - Relational Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.3">2.5.3 - Logical Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.4">2.5.4 - Concatenation</A>
|
||||
<LI><A HREF="manual.html#2.5.5">2.5.5 - The Length Operator</A>
|
||||
<LI><A HREF="manual.html#2.5.6">2.5.6 - Precedence</A>
|
||||
<LI><A HREF="manual.html#2.5.7">2.5.7 - Table Constructors</A>
|
||||
<LI><A HREF="manual.html#2.5.8">2.5.8 - Function Calls</A>
|
||||
<LI><A HREF="manual.html#2.5.9">2.5.9 - Function Definitions</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.6">2.6 - Visibility Rules</A>
|
||||
<LI><A HREF="manual.html#2.7">2.7 - Error Handling</A>
|
||||
<LI><A HREF="manual.html#2.8">2.8 - Metatables</A>
|
||||
<LI><A HREF="manual.html#2.9">2.9 - Environments</A>
|
||||
<LI><A HREF="manual.html#2.10">2.10 - Garbage Collection</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.10.1">2.10.1 - Garbage-Collection Metamethods</A>
|
||||
<LI><A HREF="manual.html#2.10.2">2.10.2 - Weak Tables</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.11">2.11 - Coroutines</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#3.1">3.1 - The Stack</A>
|
||||
<LI><A HREF="manual.html#3.2">3.2 - Stack Size</A>
|
||||
<LI><A HREF="manual.html#3.3">3.3 - Pseudo-Indices</A>
|
||||
<LI><A HREF="manual.html#3.4">3.4 - C Closures</A>
|
||||
<LI><A HREF="manual.html#3.5">3.5 - Registry</A>
|
||||
<LI><A HREF="manual.html#3.6">3.6 - Error Handling in C</A>
|
||||
<LI><A HREF="manual.html#3.7">3.7 - Functions and Types</A>
|
||||
<LI><A HREF="manual.html#3.8">3.8 - The Debug Interface</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#4">4 - The Auxiliary Library</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#4.1">4.1 - Functions and Types</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#5">5 - Standard Libraries</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>
|
||||
<LI><A HREF="manual.html#5.2">5.2 - Coroutine Manipulation</A>
|
||||
<LI><A HREF="manual.html#5.3">5.3 - Modules</A>
|
||||
<LI><A HREF="manual.html#5.4">5.4 - String Manipulation</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#5.4.1">5.4.1 - Patterns</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#5.5">5.5 - Table Manipulation</A>
|
||||
<LI><A HREF="manual.html#5.6">5.6 - Mathematical Functions</A>
|
||||
<LI><A HREF="manual.html#5.7">5.7 - Input and Output Facilities</A>
|
||||
<LI><A HREF="manual.html#5.8">5.8 - Operating System Facilities</A>
|
||||
<LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>
|
||||
<LI><A HREF="manual.html#7">7 - Incompatibilities with the Previous Version</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#7.1">7.1 - Changes in the Language</A>
|
||||
<LI><A HREF="manual.html#7.2">7.2 - Changes in the Libraries</A>
|
||||
<LI><A HREF="manual.html#7.3">7.3 - Changes in the API</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#8">8 - The Complete Syntax of Lua</A>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="index">Index</A></H2>
|
||||
<TABLE WIDTH="100%">
|
||||
<TR VALIGN="top">
|
||||
<TD>
|
||||
<H3><A NAME="functions">Lua functions</A></H3>
|
||||
<A HREF="manual.html#pdf-_G">_G</A><BR>
|
||||
<A HREF="manual.html#pdf-_VERSION">_VERSION</A><BR>
|
||||
<A HREF="manual.html#pdf-assert">assert</A><BR>
|
||||
<A HREF="manual.html#pdf-collectgarbage">collectgarbage</A><BR>
|
||||
<A HREF="manual.html#pdf-dofile">dofile</A><BR>
|
||||
<A HREF="manual.html#pdf-error">error</A><BR>
|
||||
<A HREF="manual.html#pdf-getfenv">getfenv</A><BR>
|
||||
<A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR>
|
||||
<A HREF="manual.html#pdf-ipairs">ipairs</A><BR>
|
||||
<A HREF="manual.html#pdf-load">load</A><BR>
|
||||
<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
|
||||
<A HREF="manual.html#pdf-loadstring">loadstring</A><BR>
|
||||
<A HREF="manual.html#pdf-module">module</A><BR>
|
||||
<A HREF="manual.html#pdf-next">next</A><BR>
|
||||
<A HREF="manual.html#pdf-pairs">pairs</A><BR>
|
||||
<A HREF="manual.html#pdf-pcall">pcall</A><BR>
|
||||
<A HREF="manual.html#pdf-print">print</A><BR>
|
||||
<A HREF="manual.html#pdf-rawequal">rawequal</A><BR>
|
||||
<A HREF="manual.html#pdf-rawget">rawget</A><BR>
|
||||
<A HREF="manual.html#pdf-rawset">rawset</A><BR>
|
||||
<A HREF="manual.html#pdf-require">require</A><BR>
|
||||
<A HREF="manual.html#pdf-select">select</A><BR>
|
||||
<A HREF="manual.html#pdf-setfenv">setfenv</A><BR>
|
||||
<A HREF="manual.html#pdf-setmetatable">setmetatable</A><BR>
|
||||
<A HREF="manual.html#pdf-tonumber">tonumber</A><BR>
|
||||
<A HREF="manual.html#pdf-tostring">tostring</A><BR>
|
||||
<A HREF="manual.html#pdf-type">type</A><BR>
|
||||
<A HREF="manual.html#pdf-unpack">unpack</A><BR>
|
||||
<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>
|
||||
|
||||
</TD>
|
||||
<TD>
|
||||
<H3> </H3>
|
||||
<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
|
||||
<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
|
||||
<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
|
||||
<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>
|
||||
<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>
|
||||
<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getinfo">debug.getinfo</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getlocal">debug.getlocal</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getmetatable">debug.getmetatable</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getregistry">debug.getregistry</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.getupvalue">debug.getupvalue</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.setfenv">debug.setfenv</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.sethook">debug.sethook</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.setlocal">debug.setlocal</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>
|
||||
<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>
|
||||
<A HREF="manual.html#pdf-file:close">file:close</A><BR>
|
||||
<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>
|
||||
<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>
|
||||
<A HREF="manual.html#pdf-file:read">file:read</A><BR>
|
||||
<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>
|
||||
<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>
|
||||
<A HREF="manual.html#pdf-file:write">file:write</A><BR>
|
||||
<A HREF="manual.html#pdf-io.close">io.close</A><BR>
|
||||
<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>
|
||||
<A HREF="manual.html#pdf-io.input">io.input</A><BR>
|
||||
<A HREF="manual.html#pdf-io.lines">io.lines</A><BR>
|
||||
<A HREF="manual.html#pdf-io.open">io.open</A><BR>
|
||||
<A HREF="manual.html#pdf-io.output">io.output</A><BR>
|
||||
<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>
|
||||
<A HREF="manual.html#pdf-io.read">io.read</A><BR>
|
||||
<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>
|
||||
<A HREF="manual.html#pdf-io.type">io.type</A><BR>
|
||||
<A HREF="manual.html#pdf-io.write">io.write</A><BR>
|
||||
<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>
|
||||
<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>
|
||||
<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>
|
||||
<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
|
||||
<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>
|
||||
<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>
|
||||
<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
|
||||
<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>
|
||||
<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>
|
||||
<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>
|
||||
<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>
|
||||
<A HREF="manual.html#pdf-math.fmod">math.fmod</A><BR>
|
||||
<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>
|
||||
<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>
|
||||
<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>
|
||||
<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
|
||||
<A HREF="manual.html#pdf-math.log">math.log</A><BR>
|
||||
<A HREF="manual.html#pdf-math.max">math.max</A><BR>
|
||||
<A HREF="manual.html#pdf-math.min">math.min</A><BR>
|
||||
<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>
|
||||
<A HREF="manual.html#pdf-math.pi">math.pi</A><BR>
|
||||
<A HREF="manual.html#pdf-math.pow">math.pow</A><BR>
|
||||
<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>
|
||||
<A HREF="manual.html#pdf-math.random">math.random</A><BR>
|
||||
<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>
|
||||
<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
|
||||
<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>
|
||||
<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>
|
||||
<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
|
||||
<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>
|
||||
<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>
|
||||
<A HREF="manual.html#pdf-os.date">os.date</A><BR>
|
||||
<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>
|
||||
<A HREF="manual.html#pdf-os.execute">os.execute</A><BR>
|
||||
<A HREF="manual.html#pdf-os.exit">os.exit</A><BR>
|
||||
<A HREF="manual.html#pdf-os.getenv">os.getenv</A><BR>
|
||||
<A HREF="manual.html#pdf-os.remove">os.remove</A><BR>
|
||||
<A HREF="manual.html#pdf-os.rename">os.rename</A><BR>
|
||||
<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>
|
||||
<A HREF="manual.html#pdf-os.time">os.time</A><BR>
|
||||
<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>
|
||||
<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>
|
||||
<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>
|
||||
<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>
|
||||
<A HREF="manual.html#pdf-package.path">package.path</A><BR>
|
||||
<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>
|
||||
<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>
|
||||
<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>
|
||||
<A HREF="manual.html#pdf-string.char">string.char</A><BR>
|
||||
<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>
|
||||
<A HREF="manual.html#pdf-string.find">string.find</A><BR>
|
||||
<A HREF="manual.html#pdf-string.format">string.format</A><BR>
|
||||
<A HREF="manual.html#pdf-string.gmatch">string.gmatch</A><BR>
|
||||
<A HREF="manual.html#pdf-string.gsub">string.gsub</A><BR>
|
||||
<A HREF="manual.html#pdf-string.len">string.len</A><BR>
|
||||
<A HREF="manual.html#pdf-string.lower">string.lower</A><BR>
|
||||
<A HREF="manual.html#pdf-string.match">string.match</A><BR>
|
||||
<A HREF="manual.html#pdf-string.rep">string.rep</A><BR>
|
||||
<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>
|
||||
<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>
|
||||
<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>
|
||||
<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>
|
||||
<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>
|
||||
<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>
|
||||
<A HREF="manual.html#pdf-table.remove">table.remove</A><BR>
|
||||
<A HREF="manual.html#pdf-table.sort">table.sort</A><BR>
|
||||
|
||||
</TD>
|
||||
<TD>
|
||||
<H3>C API</H3>
|
||||
<A HREF="manual.html#lua_Alloc">lua_Alloc</A><BR>
|
||||
<A HREF="manual.html#lua_CFunction">lua_CFunction</A><BR>
|
||||
<A HREF="manual.html#lua_Debug">lua_Debug</A><BR>
|
||||
<A HREF="manual.html#lua_Hook">lua_Hook</A><BR>
|
||||
<A HREF="manual.html#lua_Integer">lua_Integer</A><BR>
|
||||
<A HREF="manual.html#lua_Number">lua_Number</A><BR>
|
||||
<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>
|
||||
<A HREF="manual.html#lua_State">lua_State</A><BR>
|
||||
<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>
|
||||
<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>
|
||||
<A HREF="manual.html#lua_call">lua_call</A><BR>
|
||||
<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>
|
||||
<A HREF="manual.html#lua_close">lua_close</A><BR>
|
||||
<A HREF="manual.html#lua_concat">lua_concat</A><BR>
|
||||
<A HREF="manual.html#lua_cpcall">lua_cpcall</A><BR>
|
||||
<A HREF="manual.html#lua_createtable">lua_createtable</A><BR>
|
||||
<A HREF="manual.html#lua_dump">lua_dump</A><BR>
|
||||
<A HREF="manual.html#lua_equal">lua_equal</A><BR>
|
||||
<A HREF="manual.html#lua_error">lua_error</A><BR>
|
||||
<A HREF="manual.html#lua_gc">lua_gc</A><BR>
|
||||
<A HREF="manual.html#lua_getallocf">lua_getallocf</A><BR>
|
||||
<A HREF="manual.html#lua_getfenv">lua_getfenv</A><BR>
|
||||
<A HREF="manual.html#lua_getfield">lua_getfield</A><BR>
|
||||
<A HREF="manual.html#lua_getglobal">lua_getglobal</A><BR>
|
||||
<A HREF="manual.html#lua_gethook">lua_gethook</A><BR>
|
||||
<A HREF="manual.html#lua_gethookcount">lua_gethookcount</A><BR>
|
||||
<A HREF="manual.html#lua_gethookmask">lua_gethookmask</A><BR>
|
||||
<A HREF="manual.html#lua_getinfo">lua_getinfo</A><BR>
|
||||
<A HREF="manual.html#lua_getlocal">lua_getlocal</A><BR>
|
||||
<A HREF="manual.html#lua_getmetatable">lua_getmetatable</A><BR>
|
||||
<A HREF="manual.html#lua_getstack">lua_getstack</A><BR>
|
||||
<A HREF="manual.html#lua_gettable">lua_gettable</A><BR>
|
||||
<A HREF="manual.html#lua_gettop">lua_gettop</A><BR>
|
||||
<A HREF="manual.html#lua_getupvalue">lua_getupvalue</A><BR>
|
||||
<A HREF="manual.html#lua_insert">lua_insert</A><BR>
|
||||
<A HREF="manual.html#lua_isboolean">lua_isboolean</A><BR>
|
||||
<A HREF="manual.html#lua_iscfunction">lua_iscfunction</A><BR>
|
||||
<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>
|
||||
<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>
|
||||
<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>
|
||||
<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>
|
||||
<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>
|
||||
<A HREF="manual.html#lua_istable">lua_istable</A><BR>
|
||||
<A HREF="manual.html#lua_isthread">lua_isthread</A><BR>
|
||||
<A HREF="manual.html#lua_isuserdata">lua_isuserdata</A><BR>
|
||||
<A HREF="manual.html#lua_lessthan">lua_lessthan</A><BR>
|
||||
<A HREF="manual.html#lua_load">lua_load</A><BR>
|
||||
<A HREF="manual.html#lua_newstate">lua_newstate</A><BR>
|
||||
<A HREF="manual.html#lua_newtable">lua_newtable</A><BR>
|
||||
<A HREF="manual.html#lua_newthread">lua_newthread</A><BR>
|
||||
<A HREF="manual.html#lua_newuserdata">lua_newuserdata</A><BR>
|
||||
<A HREF="manual.html#lua_next">lua_next</A><BR>
|
||||
<A HREF="manual.html#lua_objlen">lua_objlen</A><BR>
|
||||
<A HREF="manual.html#lua_pcall">lua_pcall</A><BR>
|
||||
<A HREF="manual.html#lua_pop">lua_pop</A><BR>
|
||||
<A HREF="manual.html#lua_pushboolean">lua_pushboolean</A><BR>
|
||||
<A HREF="manual.html#lua_pushcclosure">lua_pushcclosure</A><BR>
|
||||
<A HREF="manual.html#lua_pushcfunction">lua_pushcfunction</A><BR>
|
||||
<A HREF="manual.html#lua_pushfstring">lua_pushfstring</A><BR>
|
||||
<A HREF="manual.html#lua_pushinteger">lua_pushinteger</A><BR>
|
||||
<A HREF="manual.html#lua_pushlightuserdata">lua_pushlightuserdata</A><BR>
|
||||
<A HREF="manual.html#lua_pushlstring">lua_pushlstring</A><BR>
|
||||
<A HREF="manual.html#lua_pushnil">lua_pushnil</A><BR>
|
||||
<A HREF="manual.html#lua_pushnumber">lua_pushnumber</A><BR>
|
||||
<A HREF="manual.html#lua_pushstring">lua_pushstring</A><BR>
|
||||
<A HREF="manual.html#lua_pushthread">lua_pushthread</A><BR>
|
||||
<A HREF="manual.html#lua_pushvalue">lua_pushvalue</A><BR>
|
||||
<A HREF="manual.html#lua_pushvfstring">lua_pushvfstring</A><BR>
|
||||
<A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR>
|
||||
<A HREF="manual.html#lua_rawget">lua_rawget</A><BR>
|
||||
<A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR>
|
||||
<A HREF="manual.html#lua_rawset">lua_rawset</A><BR>
|
||||
<A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR>
|
||||
<A HREF="manual.html#lua_register">lua_register</A><BR>
|
||||
<A HREF="manual.html#lua_remove">lua_remove</A><BR>
|
||||
<A HREF="manual.html#lua_replace">lua_replace</A><BR>
|
||||
<A HREF="manual.html#lua_resume">lua_resume</A><BR>
|
||||
<A HREF="manual.html#lua_setallocf">lua_setallocf</A><BR>
|
||||
<A HREF="manual.html#lua_setfenv">lua_setfenv</A><BR>
|
||||
<A HREF="manual.html#lua_setfield">lua_setfield</A><BR>
|
||||
<A HREF="manual.html#lua_setglobal">lua_setglobal</A><BR>
|
||||
<A HREF="manual.html#lua_sethook">lua_sethook</A><BR>
|
||||
<A HREF="manual.html#lua_setlocal">lua_setlocal</A><BR>
|
||||
<A HREF="manual.html#lua_setmetatable">lua_setmetatable</A><BR>
|
||||
<A HREF="manual.html#lua_settable">lua_settable</A><BR>
|
||||
<A HREF="manual.html#lua_settop">lua_settop</A><BR>
|
||||
<A HREF="manual.html#lua_setupvalue">lua_setupvalue</A><BR>
|
||||
<A HREF="manual.html#lua_status">lua_status</A><BR>
|
||||
<A HREF="manual.html#lua_toboolean">lua_toboolean</A><BR>
|
||||
<A HREF="manual.html#lua_tocfunction">lua_tocfunction</A><BR>
|
||||
<A HREF="manual.html#lua_tointeger">lua_tointeger</A><BR>
|
||||
<A HREF="manual.html#lua_tolstring">lua_tolstring</A><BR>
|
||||
<A HREF="manual.html#lua_tonumber">lua_tonumber</A><BR>
|
||||
<A HREF="manual.html#lua_topointer">lua_topointer</A><BR>
|
||||
<A HREF="manual.html#lua_tostring">lua_tostring</A><BR>
|
||||
<A HREF="manual.html#lua_tothread">lua_tothread</A><BR>
|
||||
<A HREF="manual.html#lua_touserdata">lua_touserdata</A><BR>
|
||||
<A HREF="manual.html#lua_type">lua_type</A><BR>
|
||||
<A HREF="manual.html#lua_typename">lua_typename</A><BR>
|
||||
<A HREF="manual.html#lua_upvalueindex">lua_upvalueindex</A><BR>
|
||||
<A HREF="manual.html#lua_xmove">lua_xmove</A><BR>
|
||||
<A HREF="manual.html#lua_yield">lua_yield</A><BR>
|
||||
|
||||
</TD>
|
||||
<TD>
|
||||
<H3>auxiliary library</H3>
|
||||
<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>
|
||||
<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>
|
||||
<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>
|
||||
<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>
|
||||
<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>
|
||||
<A HREF="manual.html#luaL_addstring">luaL_addstring</A><BR>
|
||||
<A HREF="manual.html#luaL_addvalue">luaL_addvalue</A><BR>
|
||||
<A HREF="manual.html#luaL_argcheck">luaL_argcheck</A><BR>
|
||||
<A HREF="manual.html#luaL_argerror">luaL_argerror</A><BR>
|
||||
<A HREF="manual.html#luaL_buffinit">luaL_buffinit</A><BR>
|
||||
<A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR>
|
||||
<A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR>
|
||||
<A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR>
|
||||
<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
|
||||
<A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR>
|
||||
<A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR>
|
||||
<A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR>
|
||||
<A HREF="manual.html#luaL_checkoption">luaL_checkoption</A><BR>
|
||||
<A HREF="manual.html#luaL_checkstack">luaL_checkstack</A><BR>
|
||||
<A HREF="manual.html#luaL_checkstring">luaL_checkstring</A><BR>
|
||||
<A HREF="manual.html#luaL_checktype">luaL_checktype</A><BR>
|
||||
<A HREF="manual.html#luaL_checkudata">luaL_checkudata</A><BR>
|
||||
<A HREF="manual.html#luaL_dofile">luaL_dofile</A><BR>
|
||||
<A HREF="manual.html#luaL_dostring">luaL_dostring</A><BR>
|
||||
<A HREF="manual.html#luaL_error">luaL_error</A><BR>
|
||||
<A HREF="manual.html#luaL_getmetafield">luaL_getmetafield</A><BR>
|
||||
<A HREF="manual.html#luaL_getmetatable">luaL_getmetatable</A><BR>
|
||||
<A HREF="manual.html#luaL_gsub">luaL_gsub</A><BR>
|
||||
<A HREF="manual.html#luaL_loadbuffer">luaL_loadbuffer</A><BR>
|
||||
<A HREF="manual.html#luaL_loadfile">luaL_loadfile</A><BR>
|
||||
<A HREF="manual.html#luaL_loadstring">luaL_loadstring</A><BR>
|
||||
<A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR>
|
||||
<A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR>
|
||||
<A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR>
|
||||
<A HREF="manual.html#luaL_optint">luaL_optint</A><BR>
|
||||
<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
|
||||
<A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR>
|
||||
<A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR>
|
||||
<A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR>
|
||||
<A HREF="manual.html#luaL_optstring">luaL_optstring</A><BR>
|
||||
<A HREF="manual.html#luaL_prepbuffer">luaL_prepbuffer</A><BR>
|
||||
<A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR>
|
||||
<A HREF="manual.html#luaL_ref">luaL_ref</A><BR>
|
||||
<A HREF="manual.html#luaL_register">luaL_register</A><BR>
|
||||
<A HREF="manual.html#luaL_typename">luaL_typename</A><BR>
|
||||
<A HREF="manual.html#luaL_typerror">luaL_typerror</A><BR>
|
||||
<A HREF="manual.html#luaL_unref">luaL_unref</A><BR>
|
||||
<A HREF="manual.html#luaL_where">luaL_where</A><BR>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<SMALL>
|
||||
Last update:
|
||||
Fri Mar 23 08:33:19 BRT 2007
|
||||
</SMALL>
|
||||
<!--
|
||||
Last change: minor edit
|
||||
-->
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
lib/lua/doc/cover.png
Normal file
BIN
lib/lua/doc/cover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
lib/lua/doc/logo.gif
Normal file
BIN
lib/lua/doc/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
163
lib/lua/doc/lua.1
Normal file
163
lib/lua/doc/lua.1
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
.\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $
|
||||
.TH LUA 1 "$Date: 2006/01/06 16:03:34 $"
|
||||
.SH NAME
|
||||
lua \- Lua interpreter
|
||||
.SH SYNOPSIS
|
||||
.B lua
|
||||
[
|
||||
.I options
|
||||
]
|
||||
[
|
||||
.I script
|
||||
[
|
||||
.I args
|
||||
]
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B lua
|
||||
is the stand-alone Lua interpreter.
|
||||
It loads and executes Lua programs,
|
||||
either in textual source form or
|
||||
in precompiled binary form.
|
||||
(Precompiled binaries are output by
|
||||
.BR luac ,
|
||||
the Lua compiler.)
|
||||
.B lua
|
||||
can be used as a batch interpreter and also interactively.
|
||||
.LP
|
||||
The given
|
||||
.I options
|
||||
(see below)
|
||||
are executed and then
|
||||
the Lua program in file
|
||||
.I script
|
||||
is loaded and executed.
|
||||
The given
|
||||
.I args
|
||||
are available to
|
||||
.I script
|
||||
as strings in a global table named
|
||||
.BR arg .
|
||||
If these arguments contain spaces or other characters special to the shell,
|
||||
then they should be quoted
|
||||
(but note that the quotes will be removed by the shell).
|
||||
The arguments in
|
||||
.B arg
|
||||
start at 0,
|
||||
which contains the string
|
||||
.RI ' script '.
|
||||
The index of the last argument is stored in
|
||||
.BR arg.n .
|
||||
The arguments given in the command line before
|
||||
.IR script ,
|
||||
including the name of the interpreter,
|
||||
are available in negative indices in
|
||||
.BR arg .
|
||||
.LP
|
||||
At the very start,
|
||||
before even handling the command line,
|
||||
.B lua
|
||||
executes the contents of the environment variable
|
||||
.BR LUA_INIT ,
|
||||
if it is defined.
|
||||
If the value of
|
||||
.B LUA_INIT
|
||||
is of the form
|
||||
.RI '@ filename ',
|
||||
then
|
||||
.I filename
|
||||
is executed.
|
||||
Otherwise, the string is assumed to be a Lua statement and is executed.
|
||||
.LP
|
||||
Options start with
|
||||
.B '\-'
|
||||
and are described below.
|
||||
You can use
|
||||
.B "'\--'"
|
||||
to signal the end of options.
|
||||
.LP
|
||||
If no arguments are given,
|
||||
then
|
||||
.B "\-v \-i"
|
||||
is assumed when the standard input is a terminal;
|
||||
otherwise,
|
||||
.B "\-"
|
||||
is assumed.
|
||||
.LP
|
||||
In interactive mode,
|
||||
.B lua
|
||||
prompts the user,
|
||||
reads lines from the standard input,
|
||||
and executes them as they are read.
|
||||
If a line does not contain a complete statement,
|
||||
then a secondary prompt is displayed and
|
||||
lines are read until a complete statement is formed or
|
||||
a syntax error is found.
|
||||
So, one way to interrupt the reading of an incomplete statement is
|
||||
to force a syntax error:
|
||||
adding a
|
||||
.B ';'
|
||||
in the middle of a statement is a sure way of forcing a syntax error
|
||||
(except inside multiline strings and comments; these must be closed explicitly).
|
||||
If a line starts with
|
||||
.BR '=' ,
|
||||
then
|
||||
.B lua
|
||||
displays the values of all the expressions in the remainder of the
|
||||
line. The expressions must be separated by commas.
|
||||
The primary prompt is the value of the global variable
|
||||
.BR _PROMPT ,
|
||||
if this value is a string;
|
||||
otherwise, the default prompt is used.
|
||||
Similarly, the secondary prompt is the value of the global variable
|
||||
.BR _PROMPT2 .
|
||||
So,
|
||||
to change the prompts,
|
||||
set the corresponding variable to a string of your choice.
|
||||
You can do that after calling the interpreter
|
||||
or on the command line
|
||||
(but in this case you have to be careful with quotes
|
||||
if the prompt string contains a space; otherwise you may confuse the shell.)
|
||||
The default prompts are "> " and ">> ".
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-
|
||||
load and execute the standard input as a file,
|
||||
that is,
|
||||
not interactively,
|
||||
even when the standard input is a terminal.
|
||||
.TP
|
||||
.BI \-e " stat"
|
||||
execute statement
|
||||
.IR stat .
|
||||
You need to quote
|
||||
.I stat
|
||||
if it contains spaces, quotes,
|
||||
or other characters special to the shell.
|
||||
.TP
|
||||
.B \-i
|
||||
enter interactive mode after
|
||||
.I script
|
||||
is executed.
|
||||
.TP
|
||||
.BI \-l " name"
|
||||
call
|
||||
.BI require(' name ')
|
||||
before executing
|
||||
.IR script .
|
||||
Typically used to load libraries.
|
||||
.TP
|
||||
.B \-v
|
||||
show version information.
|
||||
.SH "SEE ALSO"
|
||||
.BR luac (1)
|
||||
.br
|
||||
http://www.lua.org/
|
||||
.SH DIAGNOSTICS
|
||||
Error messages should be self explanatory.
|
||||
.SH AUTHORS
|
||||
R. Ierusalimschy,
|
||||
L. H. de Figueiredo,
|
||||
and
|
||||
W. Celes
|
||||
.\" EOF
|
||||
41
lib/lua/doc/lua.css
Normal file
41
lib/lua/doc/lua.css
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
body {
|
||||
color: #000000 ;
|
||||
background-color: #FFFFFF ;
|
||||
font-family: sans-serif ;
|
||||
text-align: justify ;
|
||||
margin-right: 20px ;
|
||||
margin-left: 20px ;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: normal ;
|
||||
font-style: italic ;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: #000080 ;
|
||||
background-color: inherit ;
|
||||
text-decoration: none ;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
background-color: inherit ;
|
||||
text-decoration: none ;
|
||||
}
|
||||
|
||||
a:link:hover, a:visited:hover {
|
||||
color: #000080 ;
|
||||
background-color: #E0E0FF ;
|
||||
}
|
||||
|
||||
a:link:active, a:visited:active {
|
||||
color: #FF0000 ;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0 ;
|
||||
height: 1px ;
|
||||
color: #a0a0a0 ;
|
||||
background-color: #a0a0a0 ;
|
||||
}
|
||||
|
||||
172
lib/lua/doc/lua.html
Normal file
172
lib/lua/doc/lua.html
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LUA man page</TITLE>
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<H2>NAME</H2>
|
||||
lua - Lua interpreter
|
||||
<H2>SYNOPSIS</H2>
|
||||
<B>lua</B>
|
||||
[
|
||||
<I>options</I>
|
||||
]
|
||||
[
|
||||
<I>script</I>
|
||||
[
|
||||
<I>args</I>
|
||||
]
|
||||
]
|
||||
<H2>DESCRIPTION</H2>
|
||||
<B>lua</B>
|
||||
is the stand-alone Lua interpreter.
|
||||
It loads and executes Lua programs,
|
||||
either in textual source form or
|
||||
in precompiled binary form.
|
||||
(Precompiled binaries are output by
|
||||
<B>luac</B>,
|
||||
the Lua compiler.)
|
||||
<B>lua</B>
|
||||
can be used as a batch interpreter and also interactively.
|
||||
<P>
|
||||
The given
|
||||
<I>options</I>
|
||||
(see below)
|
||||
are executed and then
|
||||
the Lua program in file
|
||||
<I>script</I>
|
||||
is loaded and executed.
|
||||
The given
|
||||
<I>args</I>
|
||||
are available to
|
||||
<I>script</I>
|
||||
as strings in a global table named
|
||||
<B>arg</B>.
|
||||
If these arguments contain spaces or other characters special to the shell,
|
||||
then they should be quoted
|
||||
(but note that the quotes will be removed by the shell).
|
||||
The arguments in
|
||||
<B>arg</B>
|
||||
start at 0,
|
||||
which contains the string
|
||||
'<I>script</I>'.
|
||||
The index of the last argument is stored in
|
||||
<B>arg.n</B>.
|
||||
The arguments given in the command line before
|
||||
<I>script</I>,
|
||||
including the name of the interpreter,
|
||||
are available in negative indices in
|
||||
<B>arg</B>.
|
||||
<P>
|
||||
At the very start,
|
||||
before even handling the command line,
|
||||
<B>lua</B>
|
||||
executes the contents of the environment variable
|
||||
<B>LUA_INIT</B>,
|
||||
if it is defined.
|
||||
If the value of
|
||||
<B>LUA_INIT</B>
|
||||
is of the form
|
||||
'@<I>filename</I>',
|
||||
then
|
||||
<I>filename</I>
|
||||
is executed.
|
||||
Otherwise, the string is assumed to be a Lua statement and is executed.
|
||||
<P>
|
||||
Options start with
|
||||
<B>'-'</B>
|
||||
and are described below.
|
||||
You can use
|
||||
<B>'--'</B>
|
||||
to signal the end of options.
|
||||
<P>
|
||||
If no arguments are given,
|
||||
then
|
||||
<B>"-v -i"</B>
|
||||
is assumed when the standard input is a terminal;
|
||||
otherwise,
|
||||
<B>"-"</B>
|
||||
is assumed.
|
||||
<P>
|
||||
In interactive mode,
|
||||
<B>lua</B>
|
||||
prompts the user,
|
||||
reads lines from the standard input,
|
||||
and executes them as they are read.
|
||||
If a line does not contain a complete statement,
|
||||
then a secondary prompt is displayed and
|
||||
lines are read until a complete statement is formed or
|
||||
a syntax error is found.
|
||||
So, one way to interrupt the reading of an incomplete statement is
|
||||
to force a syntax error:
|
||||
adding a
|
||||
<B>';'</B>
|
||||
in the middle of a statement is a sure way of forcing a syntax error
|
||||
(except inside multiline strings and comments; these must be closed explicitly).
|
||||
If a line starts with
|
||||
<B>'='</B>,
|
||||
then
|
||||
<B>lua</B>
|
||||
displays the values of all the expressions in the remainder of the
|
||||
line. The expressions must be separated by commas.
|
||||
The primary prompt is the value of the global variable
|
||||
<B>_PROMPT</B>,
|
||||
if this value is a string;
|
||||
otherwise, the default prompt is used.
|
||||
Similarly, the secondary prompt is the value of the global variable
|
||||
<B>_PROMPT2</B>.
|
||||
So,
|
||||
to change the prompts,
|
||||
set the corresponding variable to a string of your choice.
|
||||
You can do that after calling the interpreter
|
||||
or on the command line
|
||||
(but in this case you have to be careful with quotes
|
||||
if the prompt string contains a space; otherwise you may confuse the shell.)
|
||||
The default prompts are "> " and ">> ".
|
||||
<H2>OPTIONS</H2>
|
||||
<P>
|
||||
<B>-</B>
|
||||
load and execute the standard input as a file,
|
||||
that is,
|
||||
not interactively,
|
||||
even when the standard input is a terminal.
|
||||
<P>
|
||||
<B>-e </B><I>stat</I>
|
||||
execute statement
|
||||
<I>stat</I>.
|
||||
You need to quote
|
||||
<I>stat </I>
|
||||
if it contains spaces, quotes,
|
||||
or other characters special to the shell.
|
||||
<P>
|
||||
<B>-i</B>
|
||||
enter interactive mode after
|
||||
<I>script</I>
|
||||
is executed.
|
||||
<P>
|
||||
<B>-l </B><I>name</I>
|
||||
call
|
||||
<B>require</B>('<I>name</I>')
|
||||
before executing
|
||||
<I>script</I>.
|
||||
Typically used to load libraries.
|
||||
<P>
|
||||
<B>-v</B>
|
||||
show version information.
|
||||
<H2>SEE ALSO</H2>
|
||||
<B>luac</B>(1)
|
||||
<BR>
|
||||
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
|
||||
<H2>DIAGNOSTICS</H2>
|
||||
Error messages should be self explanatory.
|
||||
<H2>AUTHORS</H2>
|
||||
R. Ierusalimschy,
|
||||
L. H. de Figueiredo,
|
||||
and
|
||||
W. Celes
|
||||
<!-- EOF -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
lib/lua/doc/luac.1
Normal file
136
lib/lua/doc/luac.1
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
.\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $
|
||||
.TH LUAC 1 "$Date: 2006/01/06 16:03:34 $"
|
||||
.SH NAME
|
||||
luac \- Lua compiler
|
||||
.SH SYNOPSIS
|
||||
.B luac
|
||||
[
|
||||
.I options
|
||||
] [
|
||||
.I filenames
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B luac
|
||||
is the Lua compiler.
|
||||
It translates programs written in the Lua programming language
|
||||
into binary files that can be later loaded and executed.
|
||||
.LP
|
||||
The main advantages of precompiling chunks are:
|
||||
faster loading,
|
||||
protecting source code from accidental user changes,
|
||||
and
|
||||
off-line syntax checking.
|
||||
.LP
|
||||
Pre-compiling does not imply faster execution
|
||||
because in Lua chunks are always compiled into bytecodes before being executed.
|
||||
.B luac
|
||||
simply allows those bytecodes to be saved in a file for later execution.
|
||||
.LP
|
||||
Pre-compiled chunks are not necessarily smaller than the corresponding source.
|
||||
The main goal in pre-compiling is faster loading.
|
||||
.LP
|
||||
The binary files created by
|
||||
.B luac
|
||||
are portable only among architectures with the same word size and byte order.
|
||||
.LP
|
||||
.B luac
|
||||
produces a single output file containing the bytecodes
|
||||
for all source files given.
|
||||
By default,
|
||||
the output file is named
|
||||
.BR luac.out ,
|
||||
but you can change this with the
|
||||
.B \-o
|
||||
option.
|
||||
.LP
|
||||
In the command line,
|
||||
you can mix
|
||||
text files containing Lua source and
|
||||
binary files containing precompiled chunks.
|
||||
This is useful to combine several precompiled chunks,
|
||||
even from different (but compatible) platforms,
|
||||
into a single precompiled chunk.
|
||||
.LP
|
||||
You can use
|
||||
.B "'\-'"
|
||||
to indicate the standard input as a source file
|
||||
and
|
||||
.B "'\--'"
|
||||
to signal the end of options
|
||||
(that is,
|
||||
all remaining arguments will be treated as files even if they start with
|
||||
.BR "'\-'" ).
|
||||
.LP
|
||||
The internal format of the binary files produced by
|
||||
.B luac
|
||||
is likely to change when a new version of Lua is released.
|
||||
So,
|
||||
save the source files of all Lua programs that you precompile.
|
||||
.LP
|
||||
.SH OPTIONS
|
||||
Options must be separate.
|
||||
.TP
|
||||
.B \-l
|
||||
produce a listing of the compiled bytecode for Lua's virtual machine.
|
||||
Listing bytecodes is useful to learn about Lua's virtual machine.
|
||||
If no files are given, then
|
||||
.B luac
|
||||
loads
|
||||
.B luac.out
|
||||
and lists its contents.
|
||||
.TP
|
||||
.BI \-o " file"
|
||||
output to
|
||||
.IR file ,
|
||||
instead of the default
|
||||
.BR luac.out .
|
||||
(You can use
|
||||
.B "'\-'"
|
||||
for standard output,
|
||||
but not on platforms that open standard output in text mode.)
|
||||
The output file may be a source file because
|
||||
all files are loaded before the output file is written.
|
||||
Be careful not to overwrite precious files.
|
||||
.TP
|
||||
.B \-p
|
||||
load files but do not generate any output file.
|
||||
Used mainly for syntax checking and for testing precompiled chunks:
|
||||
corrupted files will probably generate errors when loaded.
|
||||
Lua always performs a thorough integrity test on precompiled chunks.
|
||||
Bytecode that passes this test is completely safe,
|
||||
in the sense that it will not break the interpreter.
|
||||
However,
|
||||
there is no guarantee that such code does anything sensible.
|
||||
(None can be given, because the halting problem is unsolvable.)
|
||||
If no files are given, then
|
||||
.B luac
|
||||
loads
|
||||
.B luac.out
|
||||
and tests its contents.
|
||||
No messages are displayed if the file passes the integrity test.
|
||||
.TP
|
||||
.B \-s
|
||||
strip debug information before writing the output file.
|
||||
This saves some space in very large chunks,
|
||||
but if errors occur when running a stripped chunk,
|
||||
then the error messages may not contain the full information they usually do.
|
||||
For instance,
|
||||
line numbers and names of local variables are lost.
|
||||
.TP
|
||||
.B \-v
|
||||
show version information.
|
||||
.SH FILES
|
||||
.TP 15
|
||||
.B luac.out
|
||||
default output file
|
||||
.SH "SEE ALSO"
|
||||
.BR lua (1)
|
||||
.br
|
||||
http://www.lua.org/
|
||||
.SH DIAGNOSTICS
|
||||
Error messages should be self explanatory.
|
||||
.SH AUTHORS
|
||||
L. H. de Figueiredo,
|
||||
R. Ierusalimschy and
|
||||
W. Celes
|
||||
.\" EOF
|
||||
145
lib/lua/doc/luac.html
Normal file
145
lib/lua/doc/luac.html
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<!-- $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LUAC man page</TITLE>
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<H2>NAME</H2>
|
||||
luac - Lua compiler
|
||||
<H2>SYNOPSIS</H2>
|
||||
<B>luac</B>
|
||||
[
|
||||
<I>options</I>
|
||||
] [
|
||||
<I>filenames</I>
|
||||
]
|
||||
<H2>DESCRIPTION</H2>
|
||||
<B>luac</B>
|
||||
is the Lua compiler.
|
||||
It translates programs written in the Lua programming language
|
||||
into binary files that can be later loaded and executed.
|
||||
<P>
|
||||
The main advantages of precompiling chunks are:
|
||||
faster loading,
|
||||
protecting source code from accidental user changes,
|
||||
and
|
||||
off-line syntax checking.
|
||||
<P>
|
||||
Precompiling does not imply faster execution
|
||||
because in Lua chunks are always compiled into bytecodes before being executed.
|
||||
<B>luac</B>
|
||||
simply allows those bytecodes to be saved in a file for later execution.
|
||||
<P>
|
||||
Precompiled chunks are not necessarily smaller than the corresponding source.
|
||||
The main goal in precompiling is faster loading.
|
||||
<P>
|
||||
The binary files created by
|
||||
<B>luac</B>
|
||||
are portable only among architectures with the same word size and byte order.
|
||||
<P>
|
||||
<B>luac</B>
|
||||
produces a single output file containing the bytecodes
|
||||
for all source files given.
|
||||
By default,
|
||||
the output file is named
|
||||
<B>luac.out</B>,
|
||||
but you can change this with the
|
||||
<B>-o</B>
|
||||
option.
|
||||
<P>
|
||||
In the command line,
|
||||
you can mix
|
||||
text files containing Lua source and
|
||||
binary files containing precompiled chunks.
|
||||
This is useful because several precompiled chunks,
|
||||
even from different (but compatible) platforms,
|
||||
can be combined into a single precompiled chunk.
|
||||
<P>
|
||||
You can use
|
||||
<B>'-'</B>
|
||||
to indicate the standard input as a source file
|
||||
and
|
||||
<B>'--'</B>
|
||||
to signal the end of options
|
||||
(that is,
|
||||
all remaining arguments will be treated as files even if they start with
|
||||
<B>'-'</B>).
|
||||
<P>
|
||||
The internal format of the binary files produced by
|
||||
<B>luac</B>
|
||||
is likely to change when a new version of Lua is released.
|
||||
So,
|
||||
save the source files of all Lua programs that you precompile.
|
||||
<P>
|
||||
<H2>OPTIONS</H2>
|
||||
Options must be separate.
|
||||
<P>
|
||||
<B>-l</B>
|
||||
produce a listing of the compiled bytecode for Lua's virtual machine.
|
||||
Listing bytecodes is useful to learn about Lua's virtual machine.
|
||||
If no files are given, then
|
||||
<B>luac</B>
|
||||
loads
|
||||
<B>luac.out</B>
|
||||
and lists its contents.
|
||||
<P>
|
||||
<B>-o </B><I>file</I>
|
||||
output to
|
||||
<I>file</I>,
|
||||
instead of the default
|
||||
<B>luac.out</B>.
|
||||
(You can use
|
||||
<B>'-'</B>
|
||||
for standard output,
|
||||
but not on platforms that open standard output in text mode.)
|
||||
The output file may be a source file because
|
||||
all files are loaded before the output file is written.
|
||||
Be careful not to overwrite precious files.
|
||||
<P>
|
||||
<B>-p</B>
|
||||
load files but do not generate any output file.
|
||||
Used mainly for syntax checking and for testing precompiled chunks:
|
||||
corrupted files will probably generate errors when loaded.
|
||||
Lua always performs a thorough integrity test on precompiled chunks.
|
||||
Bytecode that passes this test is completely safe,
|
||||
in the sense that it will not break the interpreter.
|
||||
However,
|
||||
there is no guarantee that such code does anything sensible.
|
||||
(None can be given, because the halting problem is unsolvable.)
|
||||
If no files are given, then
|
||||
<B>luac</B>
|
||||
loads
|
||||
<B>luac.out</B>
|
||||
and tests its contents.
|
||||
No messages are displayed if the file passes the integrity test.
|
||||
<P>
|
||||
<B>-s</B>
|
||||
strip debug information before writing the output file.
|
||||
This saves some space in very large chunks,
|
||||
but if errors occur when running a stripped chunk,
|
||||
then the error messages may not contain the full information they usually do.
|
||||
For instance,
|
||||
line numbers and names of local variables are lost.
|
||||
<P>
|
||||
<B>-v</B>
|
||||
show version information.
|
||||
<H2>FILES</H2>
|
||||
<P>
|
||||
<B>luac.out</B>
|
||||
default output file
|
||||
<H2>SEE ALSO</H2>
|
||||
<B>lua</B>(1)
|
||||
<BR>
|
||||
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
|
||||
<H2>DIAGNOSTICS</H2>
|
||||
Error messages should be self explanatory.
|
||||
<H2>AUTHORS</H2>
|
||||
L. H. de Figueiredo,
|
||||
R. Ierusalimschy and
|
||||
W. Celes
|
||||
<!-- EOF -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
7
lib/lua/doc/manual.css
Normal file
7
lib/lua/doc/manual.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
h3 code {
|
||||
font-family: inherit ;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: 105% ;
|
||||
}
|
||||
8521
lib/lua/doc/manual.html
Normal file
8521
lib/lua/doc/manual.html
Normal file
File diff suppressed because it is too large
Load diff
40
lib/lua/doc/readme.html
Normal file
40
lib/lua/doc/readme.html
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Lua documentation</TITLE>
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
|
||||
<HR>
|
||||
<H1>
|
||||
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A>
|
||||
Documentation
|
||||
</H1>
|
||||
|
||||
This is the documentation included in the source distribution of Lua 5.1.2.
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="contents.html">Reference manual</A>
|
||||
<LI><A HREF="lua.html">lua man page</A>
|
||||
<LI><A HREF="luac.html">luac man page</A>
|
||||
<LI><A HREF="../README">lua/README</A>
|
||||
<LI><A HREF="../etc/README">lua/etc/README</A>
|
||||
<LI><A HREF="../test/README">lua/test/README</A>
|
||||
</UL>
|
||||
|
||||
Lua's
|
||||
<A HREF="http://www.lua.org/">official web site</A>
|
||||
contains updated documentation,
|
||||
especially the
|
||||
<A HREF="http://www.lua.org/manual/5.1/">reference manual</A>.
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<SMALL>
|
||||
Last update:
|
||||
Fri Mar 23 14:19:36 BRT 2007
|
||||
</SMALL>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
10
lib/lua/etc/Makefile.am
Normal file
10
lib/lua/etc/Makefile.am
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
EXTRA_DIST = \
|
||||
README \
|
||||
all.c \
|
||||
lua.hpp \
|
||||
lua.ico \
|
||||
lua.pc \
|
||||
luavs.bat \
|
||||
min.c \
|
||||
noparser.c \
|
||||
strict.lua
|
||||
37
lib/lua/etc/README
Normal file
37
lib/lua/etc/README
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
This directory contains some useful files and code.
|
||||
Unlike the code in ../src, everything here is in the public domain.
|
||||
|
||||
If any of the makes fail, you're probably not using the same libraries
|
||||
used to build Lua. Set MYLIBS in Makefile accordingly.
|
||||
|
||||
all.c
|
||||
Full Lua interpreter in a single file.
|
||||
Do "make one" for a demo.
|
||||
|
||||
lua.hpp
|
||||
Lua header files for C++ using 'extern "C"'.
|
||||
|
||||
lua.ico
|
||||
A Lua icon for Windows (and web sites: save as favicon.ico).
|
||||
Drawn by hand by Markus Gritsch <gritsch@iue.tuwien.ac.at>.
|
||||
|
||||
lua.pc
|
||||
pkg-config data for Lua
|
||||
|
||||
luavs.bat
|
||||
Script to build Lua under "Visual Studio .NET Command Prompt".
|
||||
Run it from the toplevel as etc\luavs.bat.
|
||||
|
||||
min.c
|
||||
A minimal Lua interpreter.
|
||||
Good for learning and for starting your own.
|
||||
Do "make min" for a demo.
|
||||
|
||||
noparser.c
|
||||
Linking with noparser.o avoids loading the parsing modules in lualib.a.
|
||||
Do "make noparser" for a demo.
|
||||
|
||||
strict.lua
|
||||
Traps uses of undeclared global variables.
|
||||
Do "make strict" for a demo.
|
||||
|
||||
38
lib/lua/etc/all.c
Normal file
38
lib/lua/etc/all.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* all.c -- Lua core, libraries and interpreter in a single file
|
||||
*/
|
||||
|
||||
#define luaall_c
|
||||
|
||||
#include "lapi.c"
|
||||
#include "lcode.c"
|
||||
#include "ldebug.c"
|
||||
#include "ldo.c"
|
||||
#include "ldump.c"
|
||||
#include "lfunc.c"
|
||||
#include "lgc.c"
|
||||
#include "llex.c"
|
||||
#include "lmem.c"
|
||||
#include "lobject.c"
|
||||
#include "lopcodes.c"
|
||||
#include "lparser.c"
|
||||
#include "lstate.c"
|
||||
#include "lstring.c"
|
||||
#include "ltable.c"
|
||||
#include "ltm.c"
|
||||
#include "lundump.c"
|
||||
#include "lvm.c"
|
||||
#include "lzio.c"
|
||||
|
||||
#include "lauxlib.c"
|
||||
#include "lbaselib.c"
|
||||
#include "ldblib.c"
|
||||
#include "liolib.c"
|
||||
#include "linit.c"
|
||||
#include "lmathlib.c"
|
||||
#include "loadlib.c"
|
||||
#include "loslib.c"
|
||||
#include "lstrlib.c"
|
||||
#include "ltablib.c"
|
||||
|
||||
#include "lua.c"
|
||||
9
lib/lua/etc/lua.hpp
Normal file
9
lib/lua/etc/lua.hpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// lua.hpp
|
||||
// Lua header files for C++
|
||||
// <<extern "C">> not supplied automatically because Lua also compiles as C++
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
}
|
||||
BIN
lib/lua/etc/lua.ico
Normal file
BIN
lib/lua/etc/lua.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
31
lib/lua/etc/lua.pc
Normal file
31
lib/lua/etc/lua.pc
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# lua.pc -- pkg-config data for Lua
|
||||
|
||||
# vars from install Makefile
|
||||
|
||||
# grep '^V=' ../Makefile
|
||||
V= 5.1
|
||||
# grep '^R=' ../Makefile
|
||||
R= 5.1.2
|
||||
|
||||
# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
|
||||
prefix= @prefix@
|
||||
INSTALL_BIN= ${prefix}/bin
|
||||
INSTALL_INC= ${prefix}/include
|
||||
INSTALL_LIB= ${prefix}/lib
|
||||
INSTALL_MAN= ${prefix}/man/man1
|
||||
INSTALL_LMOD= ${prefix}/share/lua/${V}
|
||||
INSTALL_CMOD= ${prefix}/lib/lua/${V}
|
||||
|
||||
# canonical vars
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: Lua
|
||||
Description: An Extensible Extension Language
|
||||
Version: ${R}
|
||||
Requires:
|
||||
Libs: -L${libdir} -llua -lm
|
||||
Cflags: -I${includedir}
|
||||
|
||||
# (end of lua.pc)
|
||||
15
lib/lua/etc/luavs.bat
Normal file
15
lib/lua/etc/luavs.bat
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
rem script to build Lua under "Visual Studio .NET Command Prompt".
|
||||
rem do not run it from this directory, run it from the toplevel: etc\luavs.bat
|
||||
rem it creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src.
|
||||
|
||||
cd src
|
||||
cl /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DLUA_BUILD_AS_DLL l*.c
|
||||
del lua.obj luac.obj
|
||||
link /DLL /out:lua51.dll l*.obj
|
||||
cl /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DLUA_BUILD_AS_DLL lua.c
|
||||
link /out:lua.exe lua.obj lua51.lib
|
||||
cl /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE l*.c print.c
|
||||
del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj loslib.obj ltablib.obj lstrlib.obj loadlib.obj
|
||||
link /out:luac.exe *.obj
|
||||
del *.obj
|
||||
cd ..
|
||||
39
lib/lua/etc/min.c
Normal file
39
lib/lua/etc/min.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* min.c -- a minimal Lua interpreter
|
||||
* loads stdin only with minimal error handling.
|
||||
* no interaction, and no standard library, only a "print" function.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
static int print(lua_State *L)
|
||||
{
|
||||
int n=lua_gettop(L);
|
||||
int i;
|
||||
for (i=1; i<=n; i++)
|
||||
{
|
||||
if (i>1) printf("\t");
|
||||
if (lua_isstring(L,i))
|
||||
printf("%s",lua_tostring(L,i));
|
||||
else if (lua_isnil(L,i)==2)
|
||||
printf("%s","nil");
|
||||
else if (lua_isboolean(L,i))
|
||||
printf("%s",lua_toboolean(L,i) ? "true" : "false");
|
||||
else
|
||||
printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i));
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
lua_State *L=lua_open();
|
||||
lua_register(L,"print",print);
|
||||
if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1));
|
||||
lua_close(L);
|
||||
return 0;
|
||||
}
|
||||
50
lib/lua/etc/noparser.c
Normal file
50
lib/lua/etc/noparser.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* The code below can be used to make a Lua core that does not contain the
|
||||
* parsing modules (lcode, llex, lparser), which represent 35% of the total core.
|
||||
* You'll only be able to load binary files and strings, precompiled with luac.
|
||||
* (Of course, you'll have to build luac with the original parsing modules!)
|
||||
*
|
||||
* To use this module, simply compile it ("make noparser" does that) and list
|
||||
* its object file before the Lua libraries. The linker should then not load
|
||||
* the parsing modules. To try it, do "make luab".
|
||||
*
|
||||
* If you also want to avoid the dump module (ldump.o), define NODUMP.
|
||||
* #define NODUMP
|
||||
*/
|
||||
|
||||
#define LUA_CORE
|
||||
|
||||
#include "llex.h"
|
||||
#include "lparser.h"
|
||||
#include "lzio.h"
|
||||
|
||||
LUAI_FUNC void luaX_init (lua_State *L) {
|
||||
UNUSED(L);
|
||||
}
|
||||
|
||||
LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
|
||||
UNUSED(z);
|
||||
UNUSED(buff);
|
||||
UNUSED(name);
|
||||
lua_pushliteral(L,"parser not loaded");
|
||||
lua_error(L);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef NODUMP
|
||||
#include "lundump.h"
|
||||
|
||||
LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) {
|
||||
UNUSED(f);
|
||||
UNUSED(w);
|
||||
UNUSED(data);
|
||||
UNUSED(strip);
|
||||
#if 1
|
||||
UNUSED(L);
|
||||
return 0;
|
||||
#else
|
||||
lua_pushliteral(L,"dumper not loaded");
|
||||
lua_error(L);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
39
lib/lua/etc/strict.lua
Normal file
39
lib/lua/etc/strict.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
--
|
||||
-- strict.lua
|
||||
-- checks uses of undeclared global variables
|
||||
-- All global variables must be 'declared' through a regular assignment
|
||||
-- (even assigning nil will do) in a main chunk before being used
|
||||
-- anywhere or assigned to inside a function.
|
||||
--
|
||||
|
||||
local mt = getmetatable(_G)
|
||||
if mt == nil then
|
||||
mt = {}
|
||||
setmetatable(_G, mt)
|
||||
end
|
||||
|
||||
mt.__declared = {}
|
||||
|
||||
local function what ()
|
||||
local d = debug.getinfo(3, "S")
|
||||
return d and d.what or "C"
|
||||
end
|
||||
|
||||
mt.__newindex = function (t, n, v)
|
||||
if not mt.__declared[n] then
|
||||
local w = what()
|
||||
if w ~= "main" and w ~= "C" then
|
||||
error("assign to undeclared variable '"..n.."'", 2)
|
||||
end
|
||||
mt.__declared[n] = true
|
||||
end
|
||||
rawset(t, n, v)
|
||||
end
|
||||
|
||||
mt.__index = function (t, n)
|
||||
if not mt.__declared[n] and what() ~= "C" then
|
||||
error("variable '"..n.."' is not declared", 2)
|
||||
end
|
||||
return rawget(t, n)
|
||||
end
|
||||
|
||||
64
lib/lua/src/Makefile.am
Normal file
64
lib/lua/src/Makefile.am
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
AM_CFLAGS = $(lua_CFLAGS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
lua.c \
|
||||
luac.c \
|
||||
print.c
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include/sj3compat
|
||||
|
||||
noinst_LTLIBRARIES = liblua.la
|
||||
|
||||
liblua_la_SOURCES = \
|
||||
lapi.h \
|
||||
ldebug.h \
|
||||
lgc.h \
|
||||
lmem.h \
|
||||
lparser.h \
|
||||
ltable.h \
|
||||
luaconf.h \
|
||||
lvm.h \
|
||||
lauxlib.h \
|
||||
ldo.h \
|
||||
llex.h \
|
||||
lobject.h \
|
||||
lstate.h \
|
||||
ltm.h \
|
||||
lualib.h \
|
||||
lzio.h \
|
||||
lcode.h \
|
||||
lfunc.h \
|
||||
llimits.h \
|
||||
lopcodes.h \
|
||||
lstring.h \
|
||||
lua.h \
|
||||
lundump.h \
|
||||
lapi.c \
|
||||
lcode.c \
|
||||
ldebug.c \
|
||||
ldo.c \
|
||||
ldump.c \
|
||||
lfunc.c \
|
||||
lgc.c \
|
||||
llex.c \
|
||||
lmem.c \
|
||||
lobject.c \
|
||||
lopcodes.c \
|
||||
lparser.c \
|
||||
lstate.c \
|
||||
lstring.c \
|
||||
ltable.c \
|
||||
ltm.c \
|
||||
lundump.c \
|
||||
lvm.c \
|
||||
lzio.c \
|
||||
lauxlib.c \
|
||||
lbaselib.c \
|
||||
ldblib.c \
|
||||
liolib.c \
|
||||
lmathlib.c \
|
||||
loslib.c \
|
||||
ltablib.c \
|
||||
lstrlib.c \
|
||||
loadlib.c \
|
||||
linit.c
|
||||
1080
lib/lua/src/lapi.c
Normal file
1080
lib/lua/src/lapi.c
Normal file
File diff suppressed because it is too large
Load diff
16
lib/lua/src/lapi.h
Normal file
16
lib/lua/src/lapi.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
** $Id: lapi.h,v 2.2 2005/04/25 19:24:10 roberto Exp $
|
||||
** Auxiliary functions from Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
#ifndef lapi_h
|
||||
#define lapi_h
|
||||
|
||||
|
||||
#include "lobject.h"
|
||||
|
||||
|
||||
LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
|
||||
|
||||
#endif
|
||||
653
lib/lua/src/lauxlib.c
Normal file
653
lib/lua/src/lauxlib.c
Normal file
|
|
@ -0,0 +1,653 @@
|
|||
/*
|
||||
** $Id: lauxlib.c,v 1.159 2006/03/21 19:31:09 roberto Exp $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* This file uses only the official API of Lua.
|
||||
** Any function declared here could be written as an application function.
|
||||
*/
|
||||
|
||||
#define lauxlib_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
|
||||
|
||||
#define FREELIST_REF 0 /* free list of references */
|
||||
|
||||
|
||||
/* convert a stack index to positive */
|
||||
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \
|
||||
lua_gettop(L) + (i) + 1)
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Error-report functions
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
|
||||
lua_Debug ar;
|
||||
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
|
||||
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
|
||||
lua_getinfo(L, "n", &ar);
|
||||
if (strcmp(ar.namewhat, "method") == 0) {
|
||||
narg--; /* do not count `self' */
|
||||
if (narg == 0) /* error is in the self argument itself? */
|
||||
return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
|
||||
ar.name, extramsg);
|
||||
}
|
||||
if (ar.name == NULL)
|
||||
ar.name = "?";
|
||||
return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
|
||||
narg, ar.name, extramsg);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
|
||||
const char *msg = lua_pushfstring(L, "%s expected, got %s",
|
||||
tname, luaL_typename(L, narg));
|
||||
return luaL_argerror(L, narg, msg);
|
||||
}
|
||||
|
||||
|
||||
static void tag_error (lua_State *L, int narg, int tag) {
|
||||
luaL_typerror(L, narg, lua_typename(L, tag));
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_where (lua_State *L, int level) {
|
||||
lua_Debug ar;
|
||||
if (lua_getstack(L, level, &ar)) { /* check function at level */
|
||||
lua_getinfo(L, "Sl", &ar); /* get info about it */
|
||||
if (ar.currentline > 0) { /* is there info? */
|
||||
lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
|
||||
return;
|
||||
}
|
||||
}
|
||||
lua_pushliteral(L, ""); /* else, no information available... */
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
luaL_where(L, 1);
|
||||
lua_pushvfstring(L, fmt, argp);
|
||||
va_end(argp);
|
||||
lua_concat(L, 2);
|
||||
return lua_error(L);
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]) {
|
||||
const char *name = (def) ? luaL_optstring(L, narg, def) :
|
||||
luaL_checkstring(L, narg);
|
||||
int i;
|
||||
for (i=0; lst[i]; i++)
|
||||
if (strcmp(lst[i], name) == 0)
|
||||
return i;
|
||||
return luaL_argerror(L, narg,
|
||||
lua_pushfstring(L, "invalid option " LUA_QS, name));
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
|
||||
if (!lua_isnil(L, -1)) /* name already in use? */
|
||||
return 0; /* leave previous value on top, but return 0 */
|
||||
lua_pop(L, 1);
|
||||
lua_newtable(L); /* create metatable */
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
|
||||
void *p = lua_touserdata(L, ud);
|
||||
if (p != NULL) { /* value is a userdata? */
|
||||
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
|
||||
if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
|
||||
lua_pop(L, 2); /* remove both metatables */
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
luaL_typerror(L, ud, tname); /* else error */
|
||||
return NULL; /* to avoid warnings */
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
|
||||
if (!lua_checkstack(L, space))
|
||||
luaL_error(L, "stack overflow (%s)", mes);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
|
||||
if (lua_type(L, narg) != t)
|
||||
tag_error(L, narg, t);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkany (lua_State *L, int narg) {
|
||||
if (lua_type(L, narg) == LUA_TNONE)
|
||||
luaL_argerror(L, narg, "value expected");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
|
||||
const char *s = lua_tolstring(L, narg, len);
|
||||
if (!s) tag_error(L, narg, LUA_TSTRING);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
|
||||
const char *def, size_t *len) {
|
||||
if (lua_isnoneornil(L, narg)) {
|
||||
if (len)
|
||||
*len = (def ? strlen(def) : 0);
|
||||
return def;
|
||||
}
|
||||
else return luaL_checklstring(L, narg, len);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
|
||||
lua_Number d = lua_tonumber(L, narg);
|
||||
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
|
||||
tag_error(L, narg, LUA_TNUMBER);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
|
||||
return luaL_opt(L, luaL_checknumber, narg, def);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
|
||||
lua_Integer d = lua_tointeger(L, narg);
|
||||
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
|
||||
tag_error(L, narg, LUA_TNUMBER);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
|
||||
lua_Integer def) {
|
||||
return luaL_opt(L, luaL_checkinteger, narg, def);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
|
||||
if (!lua_getmetatable(L, obj)) /* no metatable? */
|
||||
return 0;
|
||||
lua_pushstring(L, event);
|
||||
lua_rawget(L, -2);
|
||||
if (lua_isnil(L, -1)) {
|
||||
lua_pop(L, 2); /* remove metatable and metafield */
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
lua_remove(L, -2); /* remove only metatable */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
|
||||
obj = abs_index(L, obj);
|
||||
if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
|
||||
return 0;
|
||||
lua_pushvalue(L, obj);
|
||||
lua_call(L, 1, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l) {
|
||||
luaI_openlib(L, libname, l, 0);
|
||||
}
|
||||
|
||||
|
||||
static int libsize (const luaL_Reg *l) {
|
||||
int size = 0;
|
||||
for (; l->name; l++) size++;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaI_openlib (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l, int nup) {
|
||||
if (libname) {
|
||||
int size = libsize(l);
|
||||
/* check whether lib already exists */
|
||||
luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", size);
|
||||
lua_getfield(L, -1, libname); /* get _LOADED[libname] */
|
||||
if (!lua_istable(L, -1)) { /* not found? */
|
||||
lua_pop(L, 1); /* remove previous result */
|
||||
/* try global variable (and create one if it does not exist) */
|
||||
if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL)
|
||||
luaL_error(L, "name conflict for module " LUA_QS, libname);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */
|
||||
}
|
||||
lua_remove(L, -2); /* remove _LOADED table */
|
||||
lua_insert(L, -(nup+1)); /* move library table to below upvalues */
|
||||
}
|
||||
for (; l->name; l++) {
|
||||
int i;
|
||||
for (i=0; i<nup; i++) /* copy upvalues to the top */
|
||||
lua_pushvalue(L, -nup);
|
||||
lua_pushcclosure(L, l->func, nup);
|
||||
lua_setfield(L, -(nup+2), l->name);
|
||||
}
|
||||
lua_pop(L, nup); /* remove upvalues */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** getn-setn: size for arrays
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
#if defined(LUA_COMPAT_GETN)
|
||||
|
||||
static int checkint (lua_State *L, int topop) {
|
||||
int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1;
|
||||
lua_pop(L, topop);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static void getsizes (lua_State *L) {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES");
|
||||
if (lua_isnil(L, -1)) { /* no `size' table? */
|
||||
lua_pop(L, 1); /* remove nil */
|
||||
lua_newtable(L); /* create it */
|
||||
lua_pushvalue(L, -1); /* `size' will be its own metatable */
|
||||
lua_setmetatable(L, -2);
|
||||
lua_pushliteral(L, "kv");
|
||||
lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
|
||||
t = abs_index(L, t);
|
||||
lua_pushliteral(L, "n");
|
||||
lua_rawget(L, t);
|
||||
if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
|
||||
lua_pushliteral(L, "n"); /* use it */
|
||||
lua_pushinteger(L, n);
|
||||
lua_rawset(L, t);
|
||||
}
|
||||
else { /* use `sizes' */
|
||||
getsizes(L);
|
||||
lua_pushvalue(L, t);
|
||||
lua_pushinteger(L, n);
|
||||
lua_rawset(L, -3); /* sizes[t] = n */
|
||||
lua_pop(L, 1); /* remove `sizes' */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_getn (lua_State *L, int t) {
|
||||
int n;
|
||||
t = abs_index(L, t);
|
||||
lua_pushliteral(L, "n"); /* try t.n */
|
||||
lua_rawget(L, t);
|
||||
if ((n = checkint(L, 1)) >= 0) return n;
|
||||
getsizes(L); /* else try sizes[t] */
|
||||
lua_pushvalue(L, t);
|
||||
lua_rawget(L, -2);
|
||||
if ((n = checkint(L, 2)) >= 0) return n;
|
||||
return (int)lua_objlen(L, t);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
|
||||
const char *r) {
|
||||
const char *wild;
|
||||
size_t l = strlen(p);
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
while ((wild = strstr(s, p)) != NULL) {
|
||||
luaL_addlstring(&b, s, wild - s); /* push prefix */
|
||||
luaL_addstring(&b, r); /* push replacement in place of pattern */
|
||||
s = wild + l; /* continue after `p' */
|
||||
}
|
||||
luaL_addstring(&b, s); /* push last suffix */
|
||||
luaL_pushresult(&b);
|
||||
return lua_tostring(L, -1);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
|
||||
const char *fname, int szhint) {
|
||||
const char *e;
|
||||
lua_pushvalue(L, idx);
|
||||
do {
|
||||
e = strchr(fname, '.');
|
||||
if (e == NULL) e = fname + strlen(fname);
|
||||
lua_pushlstring(L, fname, e - fname);
|
||||
lua_rawget(L, -2);
|
||||
if (lua_isnil(L, -1)) { /* no such field? */
|
||||
lua_pop(L, 1); /* remove this nil */
|
||||
lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
|
||||
lua_pushlstring(L, fname, e - fname);
|
||||
lua_pushvalue(L, -2);
|
||||
lua_settable(L, -4); /* set new table into field */
|
||||
}
|
||||
else if (!lua_istable(L, -1)) { /* field has a non-table value? */
|
||||
lua_pop(L, 2); /* remove table and value */
|
||||
return fname; /* return problematic part of the name */
|
||||
}
|
||||
lua_remove(L, -2); /* remove previous table */
|
||||
fname = e + 1;
|
||||
} while (*e == '.');
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Generic Buffer manipulation
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
#define bufflen(B) ((B)->p - (B)->buffer)
|
||||
#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))
|
||||
|
||||
#define LIMIT (LUA_MINSTACK/2)
|
||||
|
||||
|
||||
static int emptybuffer (luaL_Buffer *B) {
|
||||
size_t l = bufflen(B);
|
||||
if (l == 0) return 0; /* put nothing on stack */
|
||||
else {
|
||||
lua_pushlstring(B->L, B->buffer, l);
|
||||
B->p = B->buffer;
|
||||
B->lvl++;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void adjuststack (luaL_Buffer *B) {
|
||||
if (B->lvl > 1) {
|
||||
lua_State *L = B->L;
|
||||
int toget = 1; /* number of levels to concat */
|
||||
size_t toplen = lua_strlen(L, -1);
|
||||
do {
|
||||
size_t l = lua_strlen(L, -(toget+1));
|
||||
if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
|
||||
toplen += l;
|
||||
toget++;
|
||||
}
|
||||
else break;
|
||||
} while (toget < B->lvl);
|
||||
lua_concat(L, toget);
|
||||
B->lvl = B->lvl - toget + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
|
||||
if (emptybuffer(B))
|
||||
adjuststack(B);
|
||||
return B->buffer;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
|
||||
while (l--)
|
||||
luaL_addchar(B, *s++);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
|
||||
luaL_addlstring(B, s, strlen(s));
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
|
||||
emptybuffer(B);
|
||||
lua_concat(B->L, B->lvl);
|
||||
B->lvl = 1;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
|
||||
lua_State *L = B->L;
|
||||
size_t vl;
|
||||
const char *s = lua_tolstring(L, -1, &vl);
|
||||
if (vl <= bufffree(B)) { /* fit into buffer? */
|
||||
memcpy(B->p, s, vl); /* put it there */
|
||||
B->p += vl;
|
||||
lua_pop(L, 1); /* remove from stack */
|
||||
}
|
||||
else {
|
||||
if (emptybuffer(B))
|
||||
lua_insert(L, -2); /* put buffer before new value */
|
||||
B->lvl++; /* add new value into B stack */
|
||||
adjuststack(B);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
|
||||
B->L = L;
|
||||
B->p = B->buffer;
|
||||
B->lvl = 0;
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
LUALIB_API int luaL_ref (lua_State *L, int t) {
|
||||
int ref;
|
||||
t = abs_index(L, t);
|
||||
if (lua_isnil(L, -1)) {
|
||||
lua_pop(L, 1); /* remove from stack */
|
||||
return LUA_REFNIL; /* `nil' has a unique fixed reference */
|
||||
}
|
||||
lua_rawgeti(L, t, FREELIST_REF); /* get first free element */
|
||||
ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */
|
||||
lua_pop(L, 1); /* remove it from stack */
|
||||
if (ref != 0) { /* any free element? */
|
||||
lua_rawgeti(L, t, ref); /* remove it from list */
|
||||
lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */
|
||||
}
|
||||
else { /* no free elements */
|
||||
ref = (int)lua_objlen(L, t);
|
||||
ref++; /* create new reference */
|
||||
}
|
||||
lua_rawseti(L, t, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
|
||||
if (ref >= 0) {
|
||||
t = abs_index(L, t);
|
||||
lua_rawgeti(L, t, FREELIST_REF);
|
||||
lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */
|
||||
lua_pushinteger(L, ref);
|
||||
lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Load functions
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
typedef struct LoadF {
|
||||
int extraline;
|
||||
FILE *f;
|
||||
char buff[LUAL_BUFFERSIZE];
|
||||
} LoadF;
|
||||
|
||||
|
||||
static const char *getF (lua_State *L, void *ud, size_t *size) {
|
||||
LoadF *lf = (LoadF *)ud;
|
||||
(void)L;
|
||||
if (lf->extraline) {
|
||||
lf->extraline = 0;
|
||||
*size = 1;
|
||||
return "\n";
|
||||
}
|
||||
if (feof(lf->f)) return NULL;
|
||||
*size = fread(lf->buff, 1, LUAL_BUFFERSIZE, lf->f);
|
||||
return (*size > 0) ? lf->buff : NULL;
|
||||
}
|
||||
|
||||
|
||||
static int errfile (lua_State *L, const char *what, int fnameindex) {
|
||||
const char *serr = strerror(errno);
|
||||
const char *filename = lua_tostring(L, fnameindex) + 1;
|
||||
lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
|
||||
lua_remove(L, fnameindex);
|
||||
return LUA_ERRFILE;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
|
||||
LoadF lf;
|
||||
int status, readstatus;
|
||||
int c;
|
||||
int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */
|
||||
lf.extraline = 0;
|
||||
if (filename == NULL) {
|
||||
lua_pushliteral(L, "=stdin");
|
||||
lf.f = stdin;
|
||||
}
|
||||
else {
|
||||
lua_pushfstring(L, "@%s", filename);
|
||||
lf.f = fopen(filename, "r");
|
||||
if (lf.f == NULL) return errfile(L, "open", fnameindex);
|
||||
}
|
||||
c = getc(lf.f);
|
||||
if (c == '#') { /* Unix exec. file? */
|
||||
lf.extraline = 1;
|
||||
while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */
|
||||
if (c == '\n') c = getc(lf.f);
|
||||
}
|
||||
if (c == LUA_SIGNATURE[0] && lf.f != stdin) { /* binary file? */
|
||||
fclose(lf.f);
|
||||
lf.f = fopen(filename, "rb"); /* reopen in binary mode */
|
||||
if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
|
||||
/* skip eventual `#!...' */
|
||||
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
|
||||
lf.extraline = 0;
|
||||
}
|
||||
ungetc(c, lf.f);
|
||||
status = lua_load(L, getF, &lf, lua_tostring(L, -1));
|
||||
readstatus = ferror(lf.f);
|
||||
if (lf.f != stdin) fclose(lf.f); /* close file (even in case of errors) */
|
||||
if (readstatus) {
|
||||
lua_settop(L, fnameindex); /* ignore results from `lua_load' */
|
||||
return errfile(L, "read", fnameindex);
|
||||
}
|
||||
lua_remove(L, fnameindex);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
typedef struct LoadS {
|
||||
const char *s;
|
||||
size_t size;
|
||||
} LoadS;
|
||||
|
||||
|
||||
static const char *getS (lua_State *L, void *ud, size_t *size) {
|
||||
LoadS *ls = (LoadS *)ud;
|
||||
(void)L;
|
||||
if (ls->size == 0) return NULL;
|
||||
*size = ls->size;
|
||||
ls->size = 0;
|
||||
return ls->s;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
|
||||
const char *name) {
|
||||
LoadS ls;
|
||||
ls.s = buff;
|
||||
ls.size = size;
|
||||
return lua_load(L, getS, &ls, name);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {
|
||||
return luaL_loadbuffer(L, s, strlen(s), s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
|
||||
(void)ud;
|
||||
(void)osize;
|
||||
if (nsize == 0) {
|
||||
free(ptr);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return realloc(ptr, nsize);
|
||||
}
|
||||
|
||||
|
||||
static int panic (lua_State *L) {
|
||||
(void)L; /* to avoid warnings */
|
||||
fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n",
|
||||
lua_tostring(L, -1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API lua_State *luaL_newstate (void) {
|
||||
lua_State *L = lua_newstate(l_alloc, NULL);
|
||||
if (L) lua_atpanic(L, &panic);
|
||||
return L;
|
||||
}
|
||||
|
||||
174
lib/lua/src/lauxlib.h
Normal file
174
lib/lua/src/lauxlib.h
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
** $Id: lauxlib.h,v 1.88 2006/04/12 20:31:15 roberto Exp $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lauxlib_h
|
||||
#define lauxlib_h
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
|
||||
#if defined(LUA_COMPAT_GETN)
|
||||
LUALIB_API int (luaL_getn) (lua_State *L, int t);
|
||||
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
|
||||
#else
|
||||
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
|
||||
#define luaL_setn(L,i,j) ((void)0) /* no op! */
|
||||
#endif
|
||||
|
||||
#if defined(LUA_COMPAT_OPENLIB)
|
||||
#define luaI_openlib luaL_openlib
|
||||
#endif
|
||||
|
||||
|
||||
/* extra error code for `luaL_load' */
|
||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||
|
||||
|
||||
typedef struct luaL_Reg {
|
||||
const char *name;
|
||||
lua_CFunction func;
|
||||
} luaL_Reg;
|
||||
|
||||
|
||||
|
||||
LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l, int nup);
|
||||
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l);
|
||||
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
|
||||
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
|
||||
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
|
||||
size_t *l);
|
||||
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
|
||||
const char *def, size_t *l);
|
||||
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
|
||||
|
||||
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
|
||||
lua_Integer def);
|
||||
|
||||
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
|
||||
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
|
||||
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
|
||||
|
||||
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
|
||||
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
||||
|
||||
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
|
||||
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
|
||||
|
||||
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]);
|
||||
|
||||
LUALIB_API int (luaL_ref) (lua_State *L, int t);
|
||||
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
|
||||
|
||||
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
|
||||
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
|
||||
const char *name);
|
||||
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
|
||||
|
||||
LUALIB_API lua_State *(luaL_newstate) (void);
|
||||
|
||||
|
||||
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
|
||||
const char *r);
|
||||
|
||||
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
const char *fname, int szhint);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ===============================================================
|
||||
** some useful macros
|
||||
** ===============================================================
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond,numarg,extramsg) \
|
||||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
|
||||
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
|
||||
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
|
||||
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
|
||||
|
||||
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
|
||||
|
||||
#define luaL_dofile(L, fn) \
|
||||
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
|
||||
#define luaL_dostring(L, s) \
|
||||
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
||||
|
||||
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
|
||||
|
||||
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Generic Buffer manipulation
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
typedef struct luaL_Buffer {
|
||||
char *p; /* current position in buffer */
|
||||
int lvl; /* number of strings in the stack (level) */
|
||||
lua_State *L;
|
||||
char buffer[LUAL_BUFFERSIZE];
|
||||
} luaL_Buffer;
|
||||
|
||||
#define luaL_addchar(B,c) \
|
||||
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
|
||||
(*(B)->p++ = (char)(c)))
|
||||
|
||||
/* compatibility only */
|
||||
#define luaL_putchar(B,c) luaL_addchar(B,c)
|
||||
|
||||
#define luaL_addsize(B,n) ((B)->p += (n))
|
||||
|
||||
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
|
||||
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
|
||||
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
|
||||
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
|
||||
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
|
||||
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
|
||||
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
/* compatibility with ref system */
|
||||
|
||||
/* pre-defined references */
|
||||
#define LUA_NOREF (-2)
|
||||
#define LUA_REFNIL (-1)
|
||||
|
||||
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
|
||||
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
|
||||
|
||||
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
|
||||
|
||||
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
|
||||
|
||||
|
||||
#define luaL_reg luaL_Reg
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
643
lib/lua/src/lbaselib.c
Normal file
643
lib/lua/src/lbaselib.c
Normal file
|
|
@ -0,0 +1,643 @@
|
|||
/*
|
||||
** $Id: lbaselib.c,v 1.191a 2006/06/02 15:34:00 roberto Exp $
|
||||
** Basic library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define lbaselib_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** If your system does not support `stdout', you can just remove this function.
|
||||
** If you need, you can define your own `print' function, following this
|
||||
** model but changing `fputs' to put the strings at a proper place
|
||||
** (a console window or a log file, for instance).
|
||||
*/
|
||||
static int luaB_print (lua_State *L) {
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
int i;
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i=1; i<=n; i++) {
|
||||
const char *s;
|
||||
lua_pushvalue(L, -1); /* function to be called */
|
||||
lua_pushvalue(L, i); /* value to print */
|
||||
lua_call(L, 1, 1);
|
||||
s = lua_tostring(L, -1); /* get result */
|
||||
if (s == NULL)
|
||||
return luaL_error(L, LUA_QL("tostring") " must return a string to "
|
||||
LUA_QL("print"));
|
||||
if (i>1) fputs("\t", stdout);
|
||||
fputs(s, stdout);
|
||||
lua_pop(L, 1); /* pop result */
|
||||
}
|
||||
fputs("\n", stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_tonumber (lua_State *L) {
|
||||
int base = luaL_optint(L, 2, 10);
|
||||
if (base == 10) { /* standard conversion */
|
||||
luaL_checkany(L, 1);
|
||||
if (lua_isnumber(L, 1)) {
|
||||
lua_pushnumber(L, lua_tonumber(L, 1));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const char *s1 = luaL_checkstring(L, 1);
|
||||
char *s2;
|
||||
unsigned long n;
|
||||
luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
|
||||
n = strtoul(s1, &s2, base);
|
||||
if (s1 != s2) { /* at least one valid digit? */
|
||||
while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */
|
||||
if (*s2 == '\0') { /* no invalid trailing characters? */
|
||||
lua_pushnumber(L, (lua_Number)n);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
lua_pushnil(L); /* else not a number */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_error (lua_State *L) {
|
||||
int level = luaL_optint(L, 2, 1);
|
||||
lua_settop(L, 1);
|
||||
if (lua_isstring(L, 1) && level > 0) { /* add extra information? */
|
||||
luaL_where(L, level);
|
||||
lua_pushvalue(L, 1);
|
||||
lua_concat(L, 2);
|
||||
}
|
||||
return lua_error(L);
|
||||
}
|
||||
|
||||
|
||||
static int luaB_getmetatable (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_getmetatable(L, 1)) {
|
||||
lua_pushnil(L);
|
||||
return 1; /* no metatable */
|
||||
}
|
||||
luaL_getmetafield(L, 1, "__metatable");
|
||||
return 1; /* returns either __metatable field (if present) or metatable */
|
||||
}
|
||||
|
||||
|
||||
static int luaB_setmetatable (lua_State *L) {
|
||||
int t = lua_type(L, 2);
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
|
||||
"nil or table expected");
|
||||
if (luaL_getmetafield(L, 1, "__metatable"))
|
||||
luaL_error(L, "cannot change a protected metatable");
|
||||
lua_settop(L, 2);
|
||||
lua_setmetatable(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void getfunc (lua_State *L, int opt) {
|
||||
if (lua_isfunction(L, 1)) lua_pushvalue(L, 1);
|
||||
else {
|
||||
lua_Debug ar;
|
||||
int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
|
||||
luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
|
||||
if (lua_getstack(L, level, &ar) == 0)
|
||||
luaL_argerror(L, 1, "invalid level");
|
||||
lua_getinfo(L, "f", &ar);
|
||||
if (lua_isnil(L, -1))
|
||||
luaL_error(L, "no function environment for tail call at level %d",
|
||||
level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_getfenv (lua_State *L) {
|
||||
getfunc(L, 1);
|
||||
if (lua_iscfunction(L, -1)) /* is a C function? */
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */
|
||||
else
|
||||
lua_getfenv(L, -1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_setfenv (lua_State *L) {
|
||||
luaL_checktype(L, 2, LUA_TTABLE);
|
||||
getfunc(L, 0);
|
||||
lua_pushvalue(L, 2);
|
||||
if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) {
|
||||
/* change environment of current thread */
|
||||
lua_pushthread(L);
|
||||
lua_insert(L, -2);
|
||||
lua_setfenv(L, -2);
|
||||
return 0;
|
||||
}
|
||||
else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
|
||||
luaL_error(L,
|
||||
LUA_QL("setfenv") " cannot change environment of given object");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_rawequal (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
luaL_checkany(L, 2);
|
||||
lua_pushboolean(L, lua_rawequal(L, 1, 2));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_rawget (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_checkany(L, 2);
|
||||
lua_settop(L, 2);
|
||||
lua_rawget(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int luaB_rawset (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_checkany(L, 2);
|
||||
luaL_checkany(L, 3);
|
||||
lua_settop(L, 3);
|
||||
lua_rawset(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_gcinfo (lua_State *L) {
|
||||
lua_pushinteger(L, lua_getgccount(L));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_collectgarbage (lua_State *L) {
|
||||
static const char *const opts[] = {"stop", "restart", "collect",
|
||||
"count", "step", "setpause", "setstepmul", NULL};
|
||||
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
|
||||
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
|
||||
int o = luaL_checkoption(L, 1, "collect", opts);
|
||||
int ex = luaL_optint(L, 2, 0);
|
||||
int res = lua_gc(L, optsnum[o], ex);
|
||||
switch (optsnum[o]) {
|
||||
case LUA_GCCOUNT: {
|
||||
int b = lua_gc(L, LUA_GCCOUNTB, 0);
|
||||
lua_pushnumber(L, res + ((lua_Number)b/1024));
|
||||
return 1;
|
||||
}
|
||||
case LUA_GCSTEP: {
|
||||
lua_pushboolean(L, res);
|
||||
return 1;
|
||||
}
|
||||
default: {
|
||||
lua_pushnumber(L, res);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_type (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
lua_pushstring(L, luaL_typename(L, 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_next (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 2); /* create a 2nd argument if there isn't one */
|
||||
if (lua_next(L, 1))
|
||||
return 2;
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_pairs (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */
|
||||
lua_pushvalue(L, 1); /* state, */
|
||||
lua_pushnil(L); /* and initial value */
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
static int ipairsaux (lua_State *L) {
|
||||
int i = luaL_checkint(L, 2);
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
i++; /* next value */
|
||||
lua_pushinteger(L, i);
|
||||
lua_rawgeti(L, 1, i);
|
||||
return (lua_isnil(L, -1)) ? 0 : 2;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_ipairs (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */
|
||||
lua_pushvalue(L, 1); /* state, */
|
||||
lua_pushinteger(L, 0); /* and initial value */
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
static int load_aux (lua_State *L, int status) {
|
||||
if (status == 0) /* OK? */
|
||||
return 1;
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
lua_insert(L, -2); /* put before error message */
|
||||
return 2; /* return nil plus error message */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_loadstring (lua_State *L) {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, 1, &l);
|
||||
const char *chunkname = luaL_optstring(L, 2, s);
|
||||
return load_aux(L, luaL_loadbuffer(L, s, l, chunkname));
|
||||
}
|
||||
|
||||
|
||||
static int luaB_loadfile (lua_State *L) {
|
||||
const char *fname = luaL_optstring(L, 1, NULL);
|
||||
return load_aux(L, luaL_loadfile(L, fname));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Reader for generic `load' function: `lua_load' uses the
|
||||
** stack for internal stuff, so the reader cannot change the
|
||||
** stack top. Instead, it keeps its resulting string in a
|
||||
** reserved slot inside the stack.
|
||||
*/
|
||||
static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
|
||||
(void)ud; /* to avoid warnings */
|
||||
luaL_checkstack(L, 2, "too many nested functions");
|
||||
lua_pushvalue(L, 1); /* get function */
|
||||
lua_call(L, 0, 1); /* call it */
|
||||
if (lua_isnil(L, -1)) {
|
||||
*size = 0;
|
||||
return NULL;
|
||||
}
|
||||
else if (lua_isstring(L, -1)) {
|
||||
lua_replace(L, 3); /* save string in a reserved stack slot */
|
||||
return lua_tolstring(L, 3, size);
|
||||
}
|
||||
else luaL_error(L, "reader function must return a string");
|
||||
return NULL; /* to avoid warnings */
|
||||
}
|
||||
|
||||
|
||||
static int luaB_load (lua_State *L) {
|
||||
int status;
|
||||
const char *cname = luaL_optstring(L, 2, "=(load)");
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
lua_settop(L, 3); /* function, eventual name, plus one reserved slot */
|
||||
status = lua_load(L, generic_reader, NULL, cname);
|
||||
return load_aux(L, status);
|
||||
}
|
||||
|
||||
|
||||
static int luaB_dofile (lua_State *L) {
|
||||
const char *fname = luaL_optstring(L, 1, NULL);
|
||||
int n = lua_gettop(L);
|
||||
if (luaL_loadfile(L, fname) != 0) lua_error(L);
|
||||
lua_call(L, 0, LUA_MULTRET);
|
||||
return lua_gettop(L) - n;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
|
||||
return lua_gettop(L);
|
||||
}
|
||||
|
||||
|
||||
static int luaB_unpack (lua_State *L) {
|
||||
int i, e, n;
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
i = luaL_optint(L, 2, 1);
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0) return 0; /* empty range */
|
||||
luaL_checkstack(L, n, "table too big to unpack");
|
||||
for (; i<=e; i++) /* push arg[i...e] */
|
||||
lua_rawgeti(L, 1, i);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_select (lua_State *L) {
|
||||
int n = lua_gettop(L);
|
||||
if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
|
||||
lua_pushinteger(L, n-1);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
int i = luaL_checkint(L, 1);
|
||||
if (i < 0) i = n + i;
|
||||
else if (i > n) i = n;
|
||||
luaL_argcheck(L, 1 <= i, 1, "index out of range");
|
||||
return n - i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_pcall (lua_State *L) {
|
||||
int status;
|
||||
luaL_checkany(L, 1);
|
||||
status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0);
|
||||
lua_pushboolean(L, (status == 0));
|
||||
lua_insert(L, 1);
|
||||
return lua_gettop(L); /* return status + all results */
|
||||
}
|
||||
|
||||
|
||||
static int luaB_xpcall (lua_State *L) {
|
||||
int status;
|
||||
luaL_checkany(L, 2);
|
||||
lua_settop(L, 2);
|
||||
lua_insert(L, 1); /* put error function under function to be called */
|
||||
status = lua_pcall(L, 0, LUA_MULTRET, 1);
|
||||
lua_pushboolean(L, (status == 0));
|
||||
lua_replace(L, 1);
|
||||
return lua_gettop(L); /* return status + all results */
|
||||
}
|
||||
|
||||
|
||||
static int luaB_tostring (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */
|
||||
return 1; /* use its value */
|
||||
switch (lua_type(L, 1)) {
|
||||
case LUA_TNUMBER:
|
||||
lua_pushstring(L, lua_tostring(L, 1));
|
||||
break;
|
||||
case LUA_TSTRING:
|
||||
lua_pushvalue(L, 1);
|
||||
break;
|
||||
case LUA_TBOOLEAN:
|
||||
lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false"));
|
||||
break;
|
||||
case LUA_TNIL:
|
||||
lua_pushliteral(L, "nil");
|
||||
break;
|
||||
default:
|
||||
lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1));
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_newproxy (lua_State *L) {
|
||||
lua_settop(L, 1);
|
||||
lua_newuserdata(L, 0); /* create proxy */
|
||||
if (lua_toboolean(L, 1) == 0)
|
||||
return 1; /* no metatable */
|
||||
else if (lua_isboolean(L, 1)) {
|
||||
lua_newtable(L); /* create a new metatable `m' ... */
|
||||
lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */
|
||||
lua_pushboolean(L, 1);
|
||||
lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */
|
||||
}
|
||||
else {
|
||||
int validproxy = 0; /* to check if weaktable[metatable(u)] == true */
|
||||
if (lua_getmetatable(L, 1)) {
|
||||
lua_rawget(L, lua_upvalueindex(1));
|
||||
validproxy = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1); /* remove value */
|
||||
}
|
||||
luaL_argcheck(L, validproxy, 1, "boolean or proxy expected");
|
||||
lua_getmetatable(L, 1); /* metatable is valid; get it */
|
||||
}
|
||||
lua_setmetatable(L, 2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg base_funcs[] = {
|
||||
{"assert", luaB_assert},
|
||||
{"collectgarbage", luaB_collectgarbage},
|
||||
{"dofile", luaB_dofile},
|
||||
{"error", luaB_error},
|
||||
{"gcinfo", luaB_gcinfo},
|
||||
{"getfenv", luaB_getfenv},
|
||||
{"getmetatable", luaB_getmetatable},
|
||||
{"loadfile", luaB_loadfile},
|
||||
{"load", luaB_load},
|
||||
{"loadstring", luaB_loadstring},
|
||||
{"next", luaB_next},
|
||||
{"pcall", luaB_pcall},
|
||||
{"print", luaB_print},
|
||||
{"rawequal", luaB_rawequal},
|
||||
{"rawget", luaB_rawget},
|
||||
{"rawset", luaB_rawset},
|
||||
{"select", luaB_select},
|
||||
{"setfenv", luaB_setfenv},
|
||||
{"setmetatable", luaB_setmetatable},
|
||||
{"tonumber", luaB_tonumber},
|
||||
{"tostring", luaB_tostring},
|
||||
{"type", luaB_type},
|
||||
{"unpack", luaB_unpack},
|
||||
{"xpcall", luaB_xpcall},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Coroutine library
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
int status;
|
||||
if (!lua_checkstack(co, narg))
|
||||
luaL_error(L, "too many arguments to resume");
|
||||
if (lua_status(co) == 0 && lua_gettop(co) == 0) {
|
||||
lua_pushliteral(L, "cannot resume dead coroutine");
|
||||
return -1; /* error flag */
|
||||
}
|
||||
lua_xmove(L, co, narg);
|
||||
status = lua_resume(co, narg);
|
||||
if (status == 0 || status == LUA_YIELD) {
|
||||
int nres = lua_gettop(co);
|
||||
if (!lua_checkstack(L, nres))
|
||||
luaL_error(L, "too many results to resume");
|
||||
lua_xmove(co, L, nres); /* move yielded values */
|
||||
return nres;
|
||||
}
|
||||
else {
|
||||
lua_xmove(co, L, 1); /* move error message */
|
||||
return -1; /* error flag */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_coresume (lua_State *L) {
|
||||
lua_State *co = lua_tothread(L, 1);
|
||||
int r;
|
||||
luaL_argcheck(L, co, 1, "coroutine expected");
|
||||
r = auxresume(L, co, lua_gettop(L) - 1);
|
||||
if (r < 0) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_insert(L, -2);
|
||||
return 2; /* return false + error message */
|
||||
}
|
||||
else {
|
||||
lua_pushboolean(L, 1);
|
||||
lua_insert(L, -(r + 1));
|
||||
return r + 1; /* return true + `resume' returns */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int luaB_auxwrap (lua_State *L) {
|
||||
lua_State *co = lua_tothread(L, lua_upvalueindex(1));
|
||||
int r = auxresume(L, co, lua_gettop(L));
|
||||
if (r < 0) {
|
||||
if (lua_isstring(L, -1)) { /* error object is a string? */
|
||||
luaL_where(L, 1); /* add extra info */
|
||||
lua_insert(L, -2);
|
||||
lua_concat(L, 2);
|
||||
}
|
||||
lua_error(L); /* propagate error */
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_cocreate (lua_State *L) {
|
||||
lua_State *NL = lua_newthread(L);
|
||||
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
|
||||
"Lua function expected");
|
||||
lua_pushvalue(L, 1); /* move function to top */
|
||||
lua_xmove(L, NL, 1); /* move function from L to NL */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_cowrap (lua_State *L) {
|
||||
luaB_cocreate(L);
|
||||
lua_pushcclosure(L, luaB_auxwrap, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_yield (lua_State *L) {
|
||||
return lua_yield(L, lua_gettop(L));
|
||||
}
|
||||
|
||||
|
||||
static int luaB_costatus (lua_State *L) {
|
||||
lua_State *co = lua_tothread(L, 1);
|
||||
luaL_argcheck(L, co, 1, "coroutine expected");
|
||||
if (L == co) lua_pushliteral(L, "running");
|
||||
else {
|
||||
switch (lua_status(co)) {
|
||||
case LUA_YIELD:
|
||||
lua_pushliteral(L, "suspended");
|
||||
break;
|
||||
case 0: {
|
||||
lua_Debug ar;
|
||||
if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
|
||||
lua_pushliteral(L, "normal"); /* it is running */
|
||||
else if (lua_gettop(co) == 0)
|
||||
lua_pushliteral(L, "dead");
|
||||
else
|
||||
lua_pushliteral(L, "suspended"); /* initial state */
|
||||
break;
|
||||
}
|
||||
default: /* some error occured */
|
||||
lua_pushliteral(L, "dead");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_corunning (lua_State *L) {
|
||||
if (lua_pushthread(L))
|
||||
return 0; /* main thread is not a coroutine */
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg co_funcs[] = {
|
||||
{"create", luaB_cocreate},
|
||||
{"resume", luaB_coresume},
|
||||
{"running", luaB_corunning},
|
||||
{"status", luaB_costatus},
|
||||
{"wrap", luaB_cowrap},
|
||||
{"yield", luaB_yield},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static void auxopen (lua_State *L, const char *name,
|
||||
lua_CFunction f, lua_CFunction u) {
|
||||
lua_pushcfunction(L, u);
|
||||
lua_pushcclosure(L, f, 1);
|
||||
lua_setfield(L, -2, name);
|
||||
}
|
||||
|
||||
|
||||
static void base_open (lua_State *L) {
|
||||
/* set global _G */
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_setglobal(L, "_G");
|
||||
/* open lib into global table */
|
||||
luaL_register(L, "_G", base_funcs);
|
||||
lua_pushliteral(L, LUA_VERSION);
|
||||
lua_setglobal(L, "_VERSION"); /* set global _VERSION */
|
||||
/* `ipairs' and `pairs' need auxliliary functions as upvalues */
|
||||
auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
|
||||
auxopen(L, "pairs", luaB_pairs, luaB_next);
|
||||
/* `newproxy' needs a weaktable as upvalue */
|
||||
lua_createtable(L, 0, 1); /* new table `w' */
|
||||
lua_pushvalue(L, -1); /* `w' will be its own metatable */
|
||||
lua_setmetatable(L, -2);
|
||||
lua_pushliteral(L, "kv");
|
||||
lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
|
||||
lua_pushcclosure(L, luaB_newproxy, 1);
|
||||
lua_setglobal(L, "newproxy"); /* set global `newproxy' */
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaopen_base (lua_State *L) {
|
||||
base_open(L);
|
||||
luaL_register(L, LUA_COLIBNAME, co_funcs);
|
||||
return 2;
|
||||
}
|
||||
|
||||
839
lib/lua/src/lcode.c
Normal file
839
lib/lua/src/lcode.c
Normal file
|
|
@ -0,0 +1,839 @@
|
|||
/*
|
||||
** $Id: lcode.c,v 2.25a 2006/03/21 19:28:49 roberto Exp $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define lcode_c
|
||||
#define LUA_CORE
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lcode.h"
|
||||
#include "ldebug.h"
|
||||
#include "ldo.h"
|
||||
#include "lgc.h"
|
||||
#include "llex.h"
|
||||
#include "lmem.h"
|
||||
#include "lobject.h"
|
||||
#include "lopcodes.h"
|
||||
#include "lparser.h"
|
||||
#include "ltable.h"
|
||||
|
||||
|
||||
#define hasjumps(e) ((e)->t != (e)->f)
|
||||
|
||||
|
||||
static int isnumeral(expdesc *e) {
|
||||
return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);
|
||||
}
|
||||
|
||||
|
||||
void luaK_nil (FuncState *fs, int from, int n) {
|
||||
Instruction *previous;
|
||||
if (fs->pc > fs->lasttarget) { /* no jumps to current position? */
|
||||
if (fs->pc == 0) { /* function start? */
|
||||
if (from >= fs->nactvar)
|
||||
return; /* positions are already clean */
|
||||
}
|
||||
else {
|
||||
previous = &fs->f->code[fs->pc-1];
|
||||
if (GET_OPCODE(*previous) == OP_LOADNIL) {
|
||||
int pfrom = GETARG_A(*previous);
|
||||
int pto = GETARG_B(*previous);
|
||||
if (pfrom <= from && from <= pto+1) { /* can connect both? */
|
||||
if (from+n-1 > pto)
|
||||
SETARG_B(*previous, from+n-1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */
|
||||
}
|
||||
|
||||
|
||||
int luaK_jump (FuncState *fs) {
|
||||
int jpc = fs->jpc; /* save list of jumps to here */
|
||||
int j;
|
||||
fs->jpc = NO_JUMP;
|
||||
j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
|
||||
luaK_concat(fs, &j, jpc); /* keep them on hold */
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
void luaK_ret (FuncState *fs, int first, int nret) {
|
||||
luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);
|
||||
}
|
||||
|
||||
|
||||
static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
|
||||
luaK_codeABC(fs, op, A, B, C);
|
||||
return luaK_jump(fs);
|
||||
}
|
||||
|
||||
|
||||
static void fixjump (FuncState *fs, int pc, int dest) {
|
||||
Instruction *jmp = &fs->f->code[pc];
|
||||
int offset = dest-(pc+1);
|
||||
lua_assert(dest != NO_JUMP);
|
||||
if (abs(offset) > MAXARG_sBx)
|
||||
luaX_syntaxerror(fs->ls, "control structure too long");
|
||||
SETARG_sBx(*jmp, offset);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** returns current `pc' and marks it as a jump target (to avoid wrong
|
||||
** optimizations with consecutive instructions not in the same basic block).
|
||||
*/
|
||||
int luaK_getlabel (FuncState *fs) {
|
||||
fs->lasttarget = fs->pc;
|
||||
return fs->pc;
|
||||
}
|
||||
|
||||
|
||||
static int getjump (FuncState *fs, int pc) {
|
||||
int offset = GETARG_sBx(fs->f->code[pc]);
|
||||
if (offset == NO_JUMP) /* point to itself represents end of list */
|
||||
return NO_JUMP; /* end of list */
|
||||
else
|
||||
return (pc+1)+offset; /* turn offset into absolute position */
|
||||
}
|
||||
|
||||
|
||||
static Instruction *getjumpcontrol (FuncState *fs, int pc) {
|
||||
Instruction *pi = &fs->f->code[pc];
|
||||
if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))
|
||||
return pi-1;
|
||||
else
|
||||
return pi;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** check whether list has any jump that do not produce a value
|
||||
** (or produce an inverted value)
|
||||
*/
|
||||
static int need_value (FuncState *fs, int list) {
|
||||
for (; list != NO_JUMP; list = getjump(fs, list)) {
|
||||
Instruction i = *getjumpcontrol(fs, list);
|
||||
if (GET_OPCODE(i) != OP_TESTSET) return 1;
|
||||
}
|
||||
return 0; /* not found */
|
||||
}
|
||||
|
||||
|
||||
static int patchtestreg (FuncState *fs, int node, int reg) {
|
||||
Instruction *i = getjumpcontrol(fs, node);
|
||||
if (GET_OPCODE(*i) != OP_TESTSET)
|
||||
return 0; /* cannot patch other instructions */
|
||||
if (reg != NO_REG && reg != GETARG_B(*i))
|
||||
SETARG_A(*i, reg);
|
||||
else /* no register to put value or register already has the value */
|
||||
*i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void removevalues (FuncState *fs, int list) {
|
||||
for (; list != NO_JUMP; list = getjump(fs, list))
|
||||
patchtestreg(fs, list, NO_REG);
|
||||
}
|
||||
|
||||
|
||||
static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
|
||||
int dtarget) {
|
||||
while (list != NO_JUMP) {
|
||||
int next = getjump(fs, list);
|
||||
if (patchtestreg(fs, list, reg))
|
||||
fixjump(fs, list, vtarget);
|
||||
else
|
||||
fixjump(fs, list, dtarget); /* jump to default target */
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void dischargejpc (FuncState *fs) {
|
||||
patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
|
||||
fs->jpc = NO_JUMP;
|
||||
}
|
||||
|
||||
|
||||
void luaK_patchlist (FuncState *fs, int list, int target) {
|
||||
if (target == fs->pc)
|
||||
luaK_patchtohere(fs, list);
|
||||
else {
|
||||
lua_assert(target < fs->pc);
|
||||
patchlistaux(fs, list, target, NO_REG, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_patchtohere (FuncState *fs, int list) {
|
||||
luaK_getlabel(fs);
|
||||
luaK_concat(fs, &fs->jpc, list);
|
||||
}
|
||||
|
||||
|
||||
void luaK_concat (FuncState *fs, int *l1, int l2) {
|
||||
if (l2 == NO_JUMP) return;
|
||||
else if (*l1 == NO_JUMP)
|
||||
*l1 = l2;
|
||||
else {
|
||||
int list = *l1;
|
||||
int next;
|
||||
while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */
|
||||
list = next;
|
||||
fixjump(fs, list, l2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_checkstack (FuncState *fs, int n) {
|
||||
int newstack = fs->freereg + n;
|
||||
if (newstack > fs->f->maxstacksize) {
|
||||
if (newstack >= MAXSTACK)
|
||||
luaX_syntaxerror(fs->ls, "function or expression too complex");
|
||||
fs->f->maxstacksize = cast_byte(newstack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_reserveregs (FuncState *fs, int n) {
|
||||
luaK_checkstack(fs, n);
|
||||
fs->freereg += n;
|
||||
}
|
||||
|
||||
|
||||
static void freereg (FuncState *fs, int reg) {
|
||||
if (!ISK(reg) && reg >= fs->nactvar) {
|
||||
fs->freereg--;
|
||||
lua_assert(reg == fs->freereg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void freeexp (FuncState *fs, expdesc *e) {
|
||||
if (e->k == VNONRELOC)
|
||||
freereg(fs, e->u.s.info);
|
||||
}
|
||||
|
||||
|
||||
static int addk (FuncState *fs, TValue *k, TValue *v) {
|
||||
lua_State *L = fs->L;
|
||||
TValue *idx = luaH_set(L, fs->h, k);
|
||||
Proto *f = fs->f;
|
||||
int oldsize = f->sizek;
|
||||
if (ttisnumber(idx)) {
|
||||
lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v));
|
||||
return cast_int(nvalue(idx));
|
||||
}
|
||||
else { /* constant not found; create a new entry */
|
||||
setnvalue(idx, cast_num(fs->nk));
|
||||
luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,
|
||||
MAXARG_Bx, "constant table overflow");
|
||||
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
|
||||
setobj(L, &f->k[fs->nk], v);
|
||||
luaC_barrier(L, f, v);
|
||||
return fs->nk++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int luaK_stringK (FuncState *fs, TString *s) {
|
||||
TValue o;
|
||||
setsvalue(fs->L, &o, s);
|
||||
return addk(fs, &o, &o);
|
||||
}
|
||||
|
||||
|
||||
int luaK_numberK (FuncState *fs, lua_Number r) {
|
||||
TValue o;
|
||||
setnvalue(&o, r);
|
||||
return addk(fs, &o, &o);
|
||||
}
|
||||
|
||||
|
||||
static int boolK (FuncState *fs, int b) {
|
||||
TValue o;
|
||||
setbvalue(&o, b);
|
||||
return addk(fs, &o, &o);
|
||||
}
|
||||
|
||||
|
||||
static int nilK (FuncState *fs) {
|
||||
TValue k, v;
|
||||
setnilvalue(&v);
|
||||
/* cannot use nil as key; instead use table itself to represent nil */
|
||||
sethvalue(fs->L, &k, fs->h);
|
||||
return addk(fs, &k, &v);
|
||||
}
|
||||
|
||||
|
||||
void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
|
||||
if (e->k == VCALL) { /* expression is an open function call? */
|
||||
SETARG_C(getcode(fs, e), nresults+1);
|
||||
}
|
||||
else if (e->k == VVARARG) {
|
||||
SETARG_B(getcode(fs, e), nresults+1);
|
||||
SETARG_A(getcode(fs, e), fs->freereg);
|
||||
luaK_reserveregs(fs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_setoneret (FuncState *fs, expdesc *e) {
|
||||
if (e->k == VCALL) { /* expression is an open function call? */
|
||||
e->k = VNONRELOC;
|
||||
e->u.s.info = GETARG_A(getcode(fs, e));
|
||||
}
|
||||
else if (e->k == VVARARG) {
|
||||
SETARG_B(getcode(fs, e), 2);
|
||||
e->k = VRELOCABLE; /* can relocate its simple result */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_dischargevars (FuncState *fs, expdesc *e) {
|
||||
switch (e->k) {
|
||||
case VLOCAL: {
|
||||
e->k = VNONRELOC;
|
||||
break;
|
||||
}
|
||||
case VUPVAL: {
|
||||
e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
case VGLOBAL: {
|
||||
e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
case VINDEXED: {
|
||||
freereg(fs, e->u.s.aux);
|
||||
freereg(fs, e->u.s.info);
|
||||
e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
case VVARARG:
|
||||
case VCALL: {
|
||||
luaK_setoneret(fs, e);
|
||||
break;
|
||||
}
|
||||
default: break; /* there is one value available (somewhere) */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int code_label (FuncState *fs, int A, int b, int jump) {
|
||||
luaK_getlabel(fs); /* those instructions may be jump targets */
|
||||
return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);
|
||||
}
|
||||
|
||||
|
||||
static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
|
||||
luaK_dischargevars(fs, e);
|
||||
switch (e->k) {
|
||||
case VNIL: {
|
||||
luaK_nil(fs, reg, 1);
|
||||
break;
|
||||
}
|
||||
case VFALSE: case VTRUE: {
|
||||
luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
|
||||
break;
|
||||
}
|
||||
case VK: {
|
||||
luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info);
|
||||
break;
|
||||
}
|
||||
case VKNUM: {
|
||||
luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
|
||||
break;
|
||||
}
|
||||
case VRELOCABLE: {
|
||||
Instruction *pc = &getcode(fs, e);
|
||||
SETARG_A(*pc, reg);
|
||||
break;
|
||||
}
|
||||
case VNONRELOC: {
|
||||
if (reg != e->u.s.info)
|
||||
luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lua_assert(e->k == VVOID || e->k == VJMP);
|
||||
return; /* nothing to do... */
|
||||
}
|
||||
}
|
||||
e->u.s.info = reg;
|
||||
e->k = VNONRELOC;
|
||||
}
|
||||
|
||||
|
||||
static void discharge2anyreg (FuncState *fs, expdesc *e) {
|
||||
if (e->k != VNONRELOC) {
|
||||
luaK_reserveregs(fs, 1);
|
||||
discharge2reg(fs, e, fs->freereg-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void exp2reg (FuncState *fs, expdesc *e, int reg) {
|
||||
discharge2reg(fs, e, reg);
|
||||
if (e->k == VJMP)
|
||||
luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */
|
||||
if (hasjumps(e)) {
|
||||
int final; /* position after whole expression */
|
||||
int p_f = NO_JUMP; /* position of an eventual LOAD false */
|
||||
int p_t = NO_JUMP; /* position of an eventual LOAD true */
|
||||
if (need_value(fs, e->t) || need_value(fs, e->f)) {
|
||||
int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);
|
||||
p_f = code_label(fs, reg, 0, 1);
|
||||
p_t = code_label(fs, reg, 1, 0);
|
||||
luaK_patchtohere(fs, fj);
|
||||
}
|
||||
final = luaK_getlabel(fs);
|
||||
patchlistaux(fs, e->f, final, reg, p_f);
|
||||
patchlistaux(fs, e->t, final, reg, p_t);
|
||||
}
|
||||
e->f = e->t = NO_JUMP;
|
||||
e->u.s.info = reg;
|
||||
e->k = VNONRELOC;
|
||||
}
|
||||
|
||||
|
||||
void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
|
||||
luaK_dischargevars(fs, e);
|
||||
freeexp(fs, e);
|
||||
luaK_reserveregs(fs, 1);
|
||||
exp2reg(fs, e, fs->freereg - 1);
|
||||
}
|
||||
|
||||
|
||||
int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
|
||||
luaK_dischargevars(fs, e);
|
||||
if (e->k == VNONRELOC) {
|
||||
if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */
|
||||
if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */
|
||||
exp2reg(fs, e, e->u.s.info); /* put value on it */
|
||||
return e->u.s.info;
|
||||
}
|
||||
}
|
||||
luaK_exp2nextreg(fs, e); /* default */
|
||||
return e->u.s.info;
|
||||
}
|
||||
|
||||
|
||||
void luaK_exp2val (FuncState *fs, expdesc *e) {
|
||||
if (hasjumps(e))
|
||||
luaK_exp2anyreg(fs, e);
|
||||
else
|
||||
luaK_dischargevars(fs, e);
|
||||
}
|
||||
|
||||
|
||||
int luaK_exp2RK (FuncState *fs, expdesc *e) {
|
||||
luaK_exp2val(fs, e);
|
||||
switch (e->k) {
|
||||
case VKNUM:
|
||||
case VTRUE:
|
||||
case VFALSE:
|
||||
case VNIL: {
|
||||
if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
|
||||
e->u.s.info = (e->k == VNIL) ? nilK(fs) :
|
||||
(e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
|
||||
boolK(fs, (e->k == VTRUE));
|
||||
e->k = VK;
|
||||
return RKASK(e->u.s.info);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
case VK: {
|
||||
if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */
|
||||
return RKASK(e->u.s.info);
|
||||
else break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
/* not a constant in the right range: put it in a register */
|
||||
return luaK_exp2anyreg(fs, e);
|
||||
}
|
||||
|
||||
|
||||
void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
|
||||
switch (var->k) {
|
||||
case VLOCAL: {
|
||||
freeexp(fs, ex);
|
||||
exp2reg(fs, ex, var->u.s.info);
|
||||
return;
|
||||
}
|
||||
case VUPVAL: {
|
||||
int e = luaK_exp2anyreg(fs, ex);
|
||||
luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0);
|
||||
break;
|
||||
}
|
||||
case VGLOBAL: {
|
||||
int e = luaK_exp2anyreg(fs, ex);
|
||||
luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info);
|
||||
break;
|
||||
}
|
||||
case VINDEXED: {
|
||||
int e = luaK_exp2RK(fs, ex);
|
||||
luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lua_assert(0); /* invalid var kind to store */
|
||||
break;
|
||||
}
|
||||
}
|
||||
freeexp(fs, ex);
|
||||
}
|
||||
|
||||
|
||||
void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
|
||||
int func;
|
||||
luaK_exp2anyreg(fs, e);
|
||||
freeexp(fs, e);
|
||||
func = fs->freereg;
|
||||
luaK_reserveregs(fs, 2);
|
||||
luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key));
|
||||
freeexp(fs, key);
|
||||
e->u.s.info = func;
|
||||
e->k = VNONRELOC;
|
||||
}
|
||||
|
||||
|
||||
static void invertjump (FuncState *fs, expdesc *e) {
|
||||
Instruction *pc = getjumpcontrol(fs, e->u.s.info);
|
||||
lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&
|
||||
GET_OPCODE(*pc) != OP_TEST);
|
||||
SETARG_A(*pc, !(GETARG_A(*pc)));
|
||||
}
|
||||
|
||||
|
||||
static int jumponcond (FuncState *fs, expdesc *e, int cond) {
|
||||
if (e->k == VRELOCABLE) {
|
||||
Instruction ie = getcode(fs, e);
|
||||
if (GET_OPCODE(ie) == OP_NOT) {
|
||||
fs->pc--; /* remove previous OP_NOT */
|
||||
return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);
|
||||
}
|
||||
/* else go through */
|
||||
}
|
||||
discharge2anyreg(fs, e);
|
||||
freeexp(fs, e);
|
||||
return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond);
|
||||
}
|
||||
|
||||
|
||||
void luaK_goiftrue (FuncState *fs, expdesc *e) {
|
||||
int pc; /* pc of last jump */
|
||||
luaK_dischargevars(fs, e);
|
||||
switch (e->k) {
|
||||
case VK: case VKNUM: case VTRUE: {
|
||||
pc = NO_JUMP; /* always true; do nothing */
|
||||
break;
|
||||
}
|
||||
case VFALSE: {
|
||||
pc = luaK_jump(fs); /* always jump */
|
||||
break;
|
||||
}
|
||||
case VJMP: {
|
||||
invertjump(fs, e);
|
||||
pc = e->u.s.info;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
pc = jumponcond(fs, e, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */
|
||||
luaK_patchtohere(fs, e->t);
|
||||
e->t = NO_JUMP;
|
||||
}
|
||||
|
||||
|
||||
static void luaK_goiffalse (FuncState *fs, expdesc *e) {
|
||||
int pc; /* pc of last jump */
|
||||
luaK_dischargevars(fs, e);
|
||||
switch (e->k) {
|
||||
case VNIL: case VFALSE: {
|
||||
pc = NO_JUMP; /* always false; do nothing */
|
||||
break;
|
||||
}
|
||||
case VTRUE: {
|
||||
pc = luaK_jump(fs); /* always jump */
|
||||
break;
|
||||
}
|
||||
case VJMP: {
|
||||
pc = e->u.s.info;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
pc = jumponcond(fs, e, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */
|
||||
luaK_patchtohere(fs, e->f);
|
||||
e->f = NO_JUMP;
|
||||
}
|
||||
|
||||
|
||||
static void codenot (FuncState *fs, expdesc *e) {
|
||||
luaK_dischargevars(fs, e);
|
||||
switch (e->k) {
|
||||
case VNIL: case VFALSE: {
|
||||
e->k = VTRUE;
|
||||
break;
|
||||
}
|
||||
case VK: case VKNUM: case VTRUE: {
|
||||
e->k = VFALSE;
|
||||
break;
|
||||
}
|
||||
case VJMP: {
|
||||
invertjump(fs, e);
|
||||
break;
|
||||
}
|
||||
case VRELOCABLE:
|
||||
case VNONRELOC: {
|
||||
discharge2anyreg(fs, e);
|
||||
freeexp(fs, e);
|
||||
e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0);
|
||||
e->k = VRELOCABLE;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lua_assert(0); /* cannot happen */
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* interchange true and false lists */
|
||||
{ int temp = e->f; e->f = e->t; e->t = temp; }
|
||||
removevalues(fs, e->f);
|
||||
removevalues(fs, e->t);
|
||||
}
|
||||
|
||||
|
||||
void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
|
||||
t->u.s.aux = luaK_exp2RK(fs, k);
|
||||
t->k = VINDEXED;
|
||||
}
|
||||
|
||||
|
||||
static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
|
||||
lua_Number v1, v2, r;
|
||||
if (!isnumeral(e1) || !isnumeral(e2)) return 0;
|
||||
v1 = e1->u.nval;
|
||||
v2 = e2->u.nval;
|
||||
switch (op) {
|
||||
case OP_ADD: r = luai_numadd(v1, v2); break;
|
||||
case OP_SUB: r = luai_numsub(v1, v2); break;
|
||||
case OP_MUL: r = luai_nummul(v1, v2); break;
|
||||
case OP_DIV:
|
||||
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
|
||||
r = luai_numdiv(v1, v2); break;
|
||||
case OP_MOD:
|
||||
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
|
||||
r = luai_nummod(v1, v2); break;
|
||||
case OP_POW: r = luai_numpow(v1, v2); break;
|
||||
case OP_UNM: r = luai_numunm(v1); break;
|
||||
case OP_LEN: return 0; /* no constant folding for 'len' */
|
||||
default: lua_assert(0); r = 0; break;
|
||||
}
|
||||
if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
|
||||
e1->u.nval = r;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
|
||||
if (constfolding(op, e1, e2))
|
||||
return;
|
||||
else {
|
||||
int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;
|
||||
int o1 = luaK_exp2RK(fs, e1);
|
||||
if (o1 > o2) {
|
||||
freeexp(fs, e1);
|
||||
freeexp(fs, e2);
|
||||
}
|
||||
else {
|
||||
freeexp(fs, e2);
|
||||
freeexp(fs, e1);
|
||||
}
|
||||
e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2);
|
||||
e1->k = VRELOCABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
|
||||
expdesc *e2) {
|
||||
int o1 = luaK_exp2RK(fs, e1);
|
||||
int o2 = luaK_exp2RK(fs, e2);
|
||||
freeexp(fs, e2);
|
||||
freeexp(fs, e1);
|
||||
if (cond == 0 && op != OP_EQ) {
|
||||
int temp; /* exchange args to replace by `<' or `<=' */
|
||||
temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
|
||||
cond = 1;
|
||||
}
|
||||
e1->u.s.info = condjump(fs, op, cond, o1, o2);
|
||||
e1->k = VJMP;
|
||||
}
|
||||
|
||||
|
||||
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
|
||||
expdesc e2;
|
||||
e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
|
||||
switch (op) {
|
||||
case OPR_MINUS: {
|
||||
if (e->k == VK)
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
|
||||
codearith(fs, OP_UNM, e, &e2);
|
||||
break;
|
||||
}
|
||||
case OPR_NOT: codenot(fs, e); break;
|
||||
case OPR_LEN: {
|
||||
luaK_exp2anyreg(fs, e); /* cannot operate on constants */
|
||||
codearith(fs, OP_LEN, e, &e2);
|
||||
break;
|
||||
}
|
||||
default: lua_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
|
||||
switch (op) {
|
||||
case OPR_AND: {
|
||||
luaK_goiftrue(fs, v);
|
||||
break;
|
||||
}
|
||||
case OPR_OR: {
|
||||
luaK_goiffalse(fs, v);
|
||||
break;
|
||||
}
|
||||
case OPR_CONCAT: {
|
||||
luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */
|
||||
break;
|
||||
}
|
||||
case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
|
||||
case OPR_MOD: case OPR_POW: {
|
||||
if (!isnumeral(v)) luaK_exp2RK(fs, v);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
luaK_exp2RK(fs, v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
|
||||
switch (op) {
|
||||
case OPR_AND: {
|
||||
lua_assert(e1->t == NO_JUMP); /* list must be closed */
|
||||
luaK_dischargevars(fs, e2);
|
||||
luaK_concat(fs, &e2->f, e1->f);
|
||||
*e1 = *e2;
|
||||
break;
|
||||
}
|
||||
case OPR_OR: {
|
||||
lua_assert(e1->f == NO_JUMP); /* list must be closed */
|
||||
luaK_dischargevars(fs, e2);
|
||||
luaK_concat(fs, &e2->t, e1->t);
|
||||
*e1 = *e2;
|
||||
break;
|
||||
}
|
||||
case OPR_CONCAT: {
|
||||
luaK_exp2val(fs, e2);
|
||||
if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
|
||||
lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1);
|
||||
freeexp(fs, e1);
|
||||
SETARG_B(getcode(fs, e2), e1->u.s.info);
|
||||
e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info;
|
||||
}
|
||||
else {
|
||||
luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
|
||||
codearith(fs, OP_CONCAT, e1, e2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break;
|
||||
case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break;
|
||||
case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break;
|
||||
case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break;
|
||||
case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break;
|
||||
case OPR_POW: codearith(fs, OP_POW, e1, e2); break;
|
||||
case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break;
|
||||
case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break;
|
||||
case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break;
|
||||
case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break;
|
||||
case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break;
|
||||
case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break;
|
||||
default: lua_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void luaK_fixline (FuncState *fs, int line) {
|
||||
fs->f->lineinfo[fs->pc - 1] = line;
|
||||
}
|
||||
|
||||
|
||||
static int luaK_code (FuncState *fs, Instruction i, int line) {
|
||||
Proto *f = fs->f;
|
||||
dischargejpc(fs); /* `pc' will change */
|
||||
/* put new instruction in code array */
|
||||
luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
|
||||
MAX_INT, "code size overflow");
|
||||
f->code[fs->pc] = i;
|
||||
/* save corresponding line information */
|
||||
luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
|
||||
MAX_INT, "code size overflow");
|
||||
f->lineinfo[fs->pc] = line;
|
||||
return fs->pc++;
|
||||
}
|
||||
|
||||
|
||||
int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
|
||||
lua_assert(getOpMode(o) == iABC);
|
||||
lua_assert(getBMode(o) != OpArgN || b == 0);
|
||||
lua_assert(getCMode(o) != OpArgN || c == 0);
|
||||
return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline);
|
||||
}
|
||||
|
||||
|
||||
int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
|
||||
lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
|
||||
lua_assert(getCMode(o) == OpArgN);
|
||||
return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline);
|
||||
}
|
||||
|
||||
|
||||
void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
|
||||
int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
|
||||
int b = (tostore == LUA_MULTRET) ? 0 : tostore;
|
||||
lua_assert(tostore != 0);
|
||||
if (c <= MAXARG_C)
|
||||
luaK_codeABC(fs, OP_SETLIST, base, b, c);
|
||||
else {
|
||||
luaK_codeABC(fs, OP_SETLIST, base, b, 0);
|
||||
luaK_code(fs, cast(Instruction, c), fs->ls->lastline);
|
||||
}
|
||||
fs->freereg = base + 1; /* free registers with list values */
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue