Compare commits
No commits in common. "codex/hepburn-normalize" and "main" have entirely different histories.
codex/hepb
...
main
177 changed files with 34662 additions and 30354 deletions
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
UseTab: Always
|
||||
TabWidth: 8
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AccessModifierOffset: -4
|
||||
NamespaceIndentation: All
|
||||
IndentWidth: 8
|
||||
PointerAlignment: Left
|
||||
ColumnLimit: 0
|
||||
AllowShortIfStatementsOnASingleLine: Always
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
SpaceBeforeParens: Never
|
||||
AlignEscapedNewlines: DontAlign
|
||||
SortIncludes: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
#IndentPPDirectives: AfterHash
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(sj3 VERSION 2.0.99 LANGUAGES C)
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
if(NOT DEFINED CMAKE_C_STANDARD)
|
||||
set(CMAKE_C_STANDARD 90)
|
||||
endif()
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
||||
set(SJ3CONFDIR "/etc/sj3" CACHE PATH "SJ3 configuration directory")
|
||||
set(SJ3DICTDIR "${CMAKE_INSTALL_PREFIX}/share/sj3/dict" CACHE PATH
|
||||
"SJ3 dictionary directory")
|
||||
|
||||
check_c_source_compiles("
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
# error C99 required
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
int main(void) {
|
||||
uint8_t u8 = 0;
|
||||
uint16_t u16 = 0;
|
||||
uint32_t u32 = 0;
|
||||
uint64_t u64 = 0;
|
||||
return (int)(u8 + u16 + u32 + u64);
|
||||
}
|
||||
" HAVE_C99_STDINT)
|
||||
|
||||
configure_file(config.h.cmake config.h @ONLY)
|
||||
configure_file(Paths.h.in Paths.h @ONLY)
|
||||
|
||||
add_library(sj3types INTERFACE)
|
||||
target_include_directories(sj3types INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_library(sj3_core_types OBJECT
|
||||
wc16_str.c
|
||||
string.c
|
||||
string2.c
|
||||
)
|
||||
target_link_libraries(sj3_core_types PRIVATE sj3types)
|
||||
138
CODE_OF_CONDUCT.md
Normal file
138
CODE_OF_CONDUCT.md
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<!--
|
||||
-- SPDX-License-Identifier: CC-BY-4.0
|
||||
-- Copyright 2014 Coraline Ada Ehmke
|
||||
-->
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
<mogino@acm.org>.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
|
||||
8
Makefile
8
Makefile
|
|
@ -44,10 +44,10 @@ KANAKAN_OBJS = adddic.o addelcmn.o alloc.o charsize.o chrtbl.o cl2knj.o \
|
|||
clstudy.o cmpstr.o conjunc.o connect.o cvtclknj.o cvtdict.o \
|
||||
cvtkanji.o deldic.o depend.o dict.o functbl.o fuzoku.o \
|
||||
fzkyomi.o getkanji.o getrank.o global2.o hzstrlen.o init.o \
|
||||
istrcmp.o memory2.o mk2claus.o mkbunsetsu.o mkjiritsu.o mkkouho.o \
|
||||
istrcmp.o memory2.o mk2claus.o mkbunset.o mkjiritu.o mkkouho.o \
|
||||
mknumber.o mvmemd.o mvmemi.o peepdic.o ph2knj.o ph_khtbl.o \
|
||||
priority.o prtytbl.o s2ctbl.o selclrec.o selsuuji.o setconj.o \
|
||||
setjrec.o setkouho.o setsubi.o sj2code.o skiphblk.o skipkstr.o \
|
||||
setjrec.o setkouho.o setubi.o sj2code.o skiphblk.o skipkstr.o \
|
||||
srchdict.o srchhead.o srchidx.o srchnum.o stbtbl.o stttbl.o \
|
||||
study.o suujitbl.o terminat.o termtbl.o wakachi.o
|
||||
SJ3RKCV_OBJS = rk_conv.o sj3_rkcv.o wc16_str.o
|
||||
|
|
@ -58,9 +58,9 @@ SJ3_OBJS = code.o common.o conv.o display.o douon.o edit.o etc.o \
|
|||
eucmessage.o funckey.o henkan.o kigou.o libif.o nmttyslot.o \
|
||||
romaji.o screen.o sj3.o sj3ver.o sjgetchar.o sjrc2.o \
|
||||
stat_conv.o term.o toroku.o version2.o
|
||||
SJ3DIC_OBJS = codecnv.o dictdisp.o dictmake.o hinshi.o sj3dic.o sj3err.o \
|
||||
SJ3DIC_OBJS = codecnv.o dictdisp.o dictmake.o hinsi.o sj3dic.o sj3err.o \
|
||||
sjrc.o
|
||||
SJ3MKDIC_OBJS = char.o cnvhinshi.o file.o global.o hindo.o knjcvt.o makedict.o \
|
||||
SJ3MKDIC_OBJS = char.o cnvhinsi.o file.o global.o hindo.o knjcvt.o makedict.o \
|
||||
makelist.o makeseg.o memory.o offset.o readline.o string2.o
|
||||
SJ3STAT_OBJS = sj3stat.o
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ adddic.o: adddic.c sj_euc.h sj_sysvdef.h sj_kcnv.h sj_typedef.h \
|
|||
addelcmn.o: addelcmn.c sj_euc.h sj_sysvdef.h sj_kcnv.h sj_typedef.h \
|
||||
sj_rename.h sj_var.h sj_dict.h sj_study.h sj_table.h sj_func.h \
|
||||
sj_struct.h Struct.h const.h Paths.h sj_global.h \
|
||||
sj_hinshi.h sj_yomi.h kanakan.h
|
||||
sj_hinsi.h sj_yomi.h kanakan.h
|
||||
alloc.o: alloc.c sj_rename.h sj_typedef.h const.h Paths.h sj_euc.h \
|
||||
sj_sysvdef.h sj_var.h sj_struct.h kanakan.h Struct.h sj_dict.h
|
||||
char.o: char.c sj_euc.h sj_sysvdef.h const.h Paths.h
|
||||
|
|
@ -20,7 +20,7 @@ clstudy.o: clstudy.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
|||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h kanakan.h
|
||||
cmpstr.o: cmpstr.c sj_rename.h const.h Paths.h sj_euc.h sj_sysvdef.h \
|
||||
sj_typedef.h
|
||||
cnvhinshi.o: cnvhinshi.c dicttool.h sj_struct2.h const.h Paths.h sj_euc.h \
|
||||
cnvhinsi.o: cnvhinsi.c dicttool.h sj_struct2.h const.h Paths.h sj_euc.h \
|
||||
sj_sysvdef.h GramTable
|
||||
code.o: code.c sj_sysvdef.h wchar16.h key.h kctype.h sj2.h rk.h
|
||||
codecnv.o: codecnv.c sjctype.h sj_sysvdef.h sjtool.h
|
||||
|
|
@ -79,7 +79,7 @@ functbl.o: functbl.c sj_rename.h sj_func.h sj_typedef.h sj_struct.h \
|
|||
kanakan.h
|
||||
fuzoku.o: fuzoku.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h sj_dict.h \
|
||||
sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h Paths.h \
|
||||
sj_euc.h sj_sysvdef.h sj_global.h sj_hinshi.h sj_right.h \
|
||||
sj_euc.h sj_sysvdef.h sj_global.h sj_hinsi.h sj_right.h \
|
||||
sj_yomi.h
|
||||
fzkyomi.o: fzkyomi.c const.h Paths.h sj_euc.h sj_sysvdef.h sj_rename.h \
|
||||
sj_typedef.h sj_yomi.h sj_right.h sj_left.h
|
||||
|
|
@ -96,7 +96,7 @@ henkan.o: henkan.c common.h conversion.h sj2.h wchar16.h key.h \
|
|||
sj_sysvdef.h sj3libsj3.h sj3lib.h henkan.h kctype.h
|
||||
hindo.o: hindo.c sj_struct.h sj_typedef.h dicttool.h sj_struct2.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h
|
||||
hinshi.o: hinshi.c sj_hinshi.h
|
||||
hinsi.o: hinsi.c sj_hinsi.h
|
||||
hzstrlen.o: hzstrlen.c sj_euc.h sj_sysvdef.h sj_rename.h sj_typedef.h \
|
||||
const.h Paths.h sj_dict.h kanakan.h sj_struct.h Struct.h sj_var.h
|
||||
init.o: init.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h sj_dict.h \
|
||||
|
|
@ -128,17 +128,17 @@ memory2.o: memory2.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
|||
mk2claus.o: mk2claus.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_right.h
|
||||
mkbunsetsu.o: mkbunsetsu.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
mkbunset.o: mkbunset.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_hinshi.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_hinsi.h \
|
||||
kanakan.h
|
||||
mkjiritsu.o: mkjiritsu.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
mkjiritu.o: mkjiritu.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h kanakan.h
|
||||
mkkouho.o: mkkouho.c sj_euc.h sj_sysvdef.h sj_kcnv.h sj_typedef.h \
|
||||
sj_rename.h sj_var.h sj_dict.h sj_study.h sj_table.h sj_func.h \
|
||||
sj_struct.h Struct.h const.h Paths.h sj_global.h \
|
||||
sj_hinshi.h sj_suuji.h kanakan.h
|
||||
sj_hinsi.h sj_suuji.h kanakan.h
|
||||
mknumber.o: mknumber.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_yomi.h \
|
||||
|
|
@ -160,7 +160,7 @@ ph_khtbl.o: ph_khtbl.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
|||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h kanakan.h
|
||||
priority.o: priority.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_hinshi.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_hinsi.h \
|
||||
sj_right.h sj_prty.h
|
||||
prtytbl.o: prtytbl.c sj_rename.h sj_typedef.h
|
||||
readline.o: readline.c sj_euc.h sj_sysvdef.h const.h Paths.h sj_macro.h \
|
||||
|
|
@ -179,18 +179,18 @@ selsuuji.o: selsuuji.c sj_rename.h sj_typedef.h const.h Paths.h sj_euc.h \
|
|||
setconj.o: setconj.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_right.h \
|
||||
sj_hinshi.h sj_yomi.h kanakan.h
|
||||
sj_hinsi.h sj_yomi.h kanakan.h
|
||||
setjrec.o: setjrec.c sj_euc.h sj_sysvdef.h sj_kcnv.h sj_typedef.h \
|
||||
sj_rename.h sj_var.h sj_dict.h sj_study.h sj_table.h sj_func.h \
|
||||
sj_struct.h Struct.h const.h Paths.h sj_global.h \
|
||||
sj_hinshi.h kanakan.h
|
||||
sj_hinsi.h kanakan.h
|
||||
setkouho.o: setkouho.c sj_euc.h sj_sysvdef.h sj_kcnv.h sj_typedef.h \
|
||||
sj_rename.h sj_var.h sj_dict.h sj_study.h sj_table.h sj_func.h \
|
||||
sj_struct.h Struct.h const.h Paths.h sj_global.h \
|
||||
sj_hinshi.h kanakan.h
|
||||
setsubi.o: setsubi.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h sj_dict.h \
|
||||
sj_hinsi.h kanakan.h
|
||||
setubi.o: setubi.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h sj_dict.h \
|
||||
sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h Paths.h \
|
||||
sj_euc.h sj_sysvdef.h sj_global.h sj_hinshi.h kanakan.h
|
||||
sj_euc.h sj_sysvdef.h sj_global.h sj_hinsi.h kanakan.h
|
||||
setup.o: setup.c sj_sysvdef.h sj_typedef.h sj_var.h sj_dict.h sj_struct.h \
|
||||
sj_rename.h const.h Paths.h sj_euc.h Struct.h sj_global.h kanakan.h \
|
||||
server.h
|
||||
|
|
@ -204,7 +204,7 @@ sj3_rkcv.o: sj3_rkcv.c wchar16.h key.h sj2.h sj_sysvdef.h kana.h rk.h \
|
|||
sj3dic.o: sj3dic.c sj_sysvdef.h sjtool.h sj3lib.h sj3dic.h
|
||||
sj3err.o: sj3err.c sj3err.h
|
||||
sj3lib.o: sj3lib.c config.h const.h Paths.h sj_euc.h sj_sysvdef.h \
|
||||
sj3err.h sj_hinshi.h sj3lib.h
|
||||
sj3err.h sj_hinsi.h sj3lib.h
|
||||
sj3stat.o: sj3stat.c const.h Paths.h sj_euc.h sj_sysvdef.h sj3err.h \
|
||||
sj3lib.h
|
||||
sj3ver.o: sj3ver.c sj2.h wchar16.h key.h sj_sysvdef.h
|
||||
|
|
@ -229,10 +229,10 @@ srchidx.o: srchidx.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
|||
srchnum.o: srchnum.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_yomi.h \
|
||||
sj_hinshi.h sj_suuji.h kanakan.h
|
||||
sj_hinsi.h sj_suuji.h kanakan.h
|
||||
stat_conv.o: stat_conv.c common.h conversion.h sj2.h wchar16.h key.h \
|
||||
sj_sysvdef.h sj3libsj3.h sj3lib.h henkan.h rk.h
|
||||
stbtbl.o: stbtbl.c sj_rename.h sj_typedef.h sj_yomi.h sj_hinshi.h
|
||||
stbtbl.o: stbtbl.c sj_rename.h sj_typedef.h sj_yomi.h sj_hinsi.h
|
||||
string.o: string.c config.h sj_euc.h sj_sysvdef.h sj3lib.h
|
||||
string2.o: string2.c const.h Paths.h sj_euc.h sj_sysvdef.h dicttool.h \
|
||||
sj_struct2.h
|
||||
|
|
@ -255,5 +255,5 @@ version2.o: version2.c sj2.h wchar16.h key.h sj_sysvdef.h
|
|||
wakachi.o: wakachi.c sj_kcnv.h sj_typedef.h sj_rename.h sj_var.h \
|
||||
sj_dict.h sj_study.h sj_table.h sj_func.h sj_struct.h Struct.h const.h \
|
||||
Paths.h sj_euc.h sj_sysvdef.h sj_global.h sj_right.h \
|
||||
sj_hinshi.h kanakan.h
|
||||
sj_hinsi.h kanakan.h
|
||||
wc16_str.o: wc16_str.c sj_sysvdef.h sj_euc.h wchar16.h key.h
|
||||
|
|
|
|||
10
Sjrc
10
Sjrc
|
|
@ -26,6 +26,12 @@
|
|||
## from Sony Corporation.
|
||||
##
|
||||
|
||||
##
|
||||
## $SonyRCSfile: Sjrc,v $
|
||||
## $SonyRevision: 1.1 $
|
||||
## $SonyDate: 1994/06/03 08:03:06 $
|
||||
##
|
||||
|
||||
# SJ3用セット・アップ・ファイル
|
||||
# .sjrc file sample
|
||||
# sj3 1.00, 1990 Sony Corp.
|
||||
|
|
@ -42,7 +48,7 @@
|
|||
.key.right ^F
|
||||
.key.left ^B
|
||||
.key.kakuchou ^O
|
||||
.key.shukushou ^I
|
||||
.key.syukusyou ^I
|
||||
.key.wrap ^N
|
||||
.key.wrapback ^P
|
||||
.key.saihenkan ^Y
|
||||
|
|
@ -75,7 +81,7 @@
|
|||
|
||||
# その他キーが押されたときのコマンド・キーの指定
|
||||
#.etckey.toroku hira
|
||||
#.etckey.shoukyo zkatakana
|
||||
#.etckey.syoukyo zkatakana
|
||||
#.etckey.help hkatakana
|
||||
#.etckey.sjrc zalpha
|
||||
|
||||
|
|
|
|||
5
Sjrk
5
Sjrk
|
|
@ -26,6 +26,11 @@
|
|||
## from Sony Corporation.
|
||||
##
|
||||
|
||||
##
|
||||
## $SonyRCSfile: Sjrk,v $
|
||||
## $SonyRevision: 1.1 $
|
||||
## $SonyDate: 1994/06/03 08:03:07 $
|
||||
##
|
||||
#
|
||||
# ローマ字かな変換規則定義ファイル
|
||||
# デフォルトファイル
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@
|
|||
## from Sony Corporation.
|
||||
##
|
||||
|
||||
##
|
||||
## $SonyRCSfile: Xterm.cvt,v $
|
||||
## $SonyRevision: 1.1 $
|
||||
## $SonyDate: 1994/06/03 08:03:08 $
|
||||
##
|
||||
# sj3 command key alias file
|
||||
# for xterm
|
||||
#
|
||||
|
|
|
|||
66
adddic.c
66
adddic.c
|
|
@ -27,20 +27,32 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: adddic.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:26 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static unsigned int checkdict(unsigned char* kanji, TypeGram grm);
|
||||
static int cal_nextym(unsigned char* ptr);
|
||||
static int usr_freelen(void);
|
||||
static void sprt_seg(TypeDicSeg seg, TypeDicOfs ofs);
|
||||
static void apnd_uidx(TypeDicSeg seg, unsigned char* yomi, int len);
|
||||
|
||||
|
||||
unsigned int
|
||||
adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
||||
adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinsi)
|
||||
{
|
||||
unsigned int err;
|
||||
unsigned char yptr[MaxWdYomiLen+1];
|
||||
unsigned char kptr[MaxWdKanjiLen+1];
|
||||
|
|
@ -66,14 +78,14 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
STDYIN *stdy;
|
||||
STDYOUT stdydat;
|
||||
|
||||
if((err = addel_arg(yomi, kanji, hinshi, yptr, sizeof(yptr))) != 0)
|
||||
if ((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) != 0)
|
||||
return err;
|
||||
|
||||
inputyomi = yomi;
|
||||
cnvstart = ystart = yptr;
|
||||
cnvlen = strlen(yptr);
|
||||
|
||||
if((err = checkdict(kanji, hinshi)) != 0)
|
||||
if ((err = checkdict(kanji, hinsi)) != 0)
|
||||
return err;
|
||||
|
||||
if (!curdict -> maxunit) return AD_NotUserDict;
|
||||
|
|
@ -93,11 +105,11 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
dstofs = douofs = p1 - dicbuf;
|
||||
hnsofs = knjofs = 0;
|
||||
if (i) {
|
||||
i = srchgram(p1, &p1, hinshi);
|
||||
i = srchgram(p1, &p1, hinsi);
|
||||
dstofs = hnsofs = p1 - dicbuf;
|
||||
if (i) {
|
||||
srchkanji(&p1, kptr, klen);
|
||||
if(*p1 != HinshiBlkTerm) return AD_ArExist;
|
||||
if (*p1 != HinsiBlkTerm) return AD_ArExist;
|
||||
dstofs = knjofs = p1 - dicbuf;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,7 +122,8 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
newsiz = DouonBlkSizeNumber + nlen;
|
||||
|
||||
nxtask = cal_nextym(p1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
oldsiz = newsiz = getsize(p1);
|
||||
nxtask = 0;
|
||||
}
|
||||
|
|
@ -191,7 +204,7 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
nlen = getnlen(douptr) - nxtask;
|
||||
*douptr = (size >> 8);
|
||||
if (nlen & 0x10) *douptr |= NokoriYomiTop;
|
||||
if(plen & 0x10) *douptr |= AsshukuYomiTop;
|
||||
if (plen & 0x10) *douptr |= AssyukuYomiTop;
|
||||
*(douptr + 1) = size;
|
||||
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
|
||||
|
||||
|
|
@ -213,7 +226,7 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
*dstptr = 0;
|
||||
nlen = cnvlen - saml;
|
||||
if (nlen & 0x10) *dstptr |= NokoriYomiTop;
|
||||
if(saml & 0x10) *dstptr |= AsshukuYomiTop;
|
||||
if (saml & 0x10) *dstptr |= AssyukuYomiTop;
|
||||
*dstptr++ |= (size >> 8);
|
||||
*dstptr++ = size;
|
||||
*dstptr++ = ((nlen&0x0f)|((saml&0x0f)<<4));
|
||||
|
|
@ -226,18 +239,18 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
nlen = getnlen(douptr);
|
||||
*douptr = (newsiz >> 8);
|
||||
if (nlen & 0x10) *douptr |= NokoriYomiTop;
|
||||
if(plen & 0x10) *douptr |= AsshukuYomiTop;
|
||||
if (plen & 0x10) *douptr |= AssyukuYomiTop;
|
||||
*(douptr + 1) = newsiz;
|
||||
*(douptr + 2) = ((nlen & 0x0f) | ((plen & 0x0f) << 4));
|
||||
}
|
||||
|
||||
if(!knjofs) *dstptr++ = hinshi;
|
||||
if (!knjofs) *dstptr++ = hinsi;
|
||||
|
||||
stdydat.stdy1.offset = dstptr - dicbuf;
|
||||
for (saml = 0 ; saml < klen ; ) *dstptr++ = kptr[saml++];
|
||||
if (klen > 0) *dstptr++ = KanjiStrEnd;
|
||||
|
||||
if(!knjofs) *dstptr++ = HinshiBlkTerm;
|
||||
if (!knjofs) *dstptr++ = HinsiBlkTerm;
|
||||
|
||||
(*curdict->putdic)(curdict, segnum);
|
||||
|
||||
|
|
@ -257,7 +270,8 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
mkclidx();
|
||||
putcldic();
|
||||
break;
|
||||
} else if(err == OVER)
|
||||
}
|
||||
else if (err == OVER)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +282,7 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
stdydat.stdy1.sttkj = 0;
|
||||
stdydat.stdy1.ka_kj = 0;
|
||||
stdydat.stdy1.nmflg = 0;
|
||||
stdydat.hinshi = hinshi;
|
||||
stdydat.hinshi = hinsi;
|
||||
stdydat.len = cnvlen;
|
||||
stdydat.sttlen = 0;
|
||||
stdydat.sttfg = 0;
|
||||
|
|
@ -278,8 +292,10 @@ adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
checksub(unsigned char* kanji, TypeGram grm) {
|
||||
checksub(unsigned char* kanji, TypeGram grm)
|
||||
{
|
||||
unsigned char *tagp;
|
||||
unsigned char *ptr;
|
||||
unsigned char *endp;
|
||||
|
|
@ -303,7 +319,7 @@ checksub(unsigned char* kanji, TypeGram grm) {
|
|||
|
||||
while (ptr < endp) {
|
||||
flg = (grm == *ptr++);
|
||||
while(*ptr != HinshiBlkTerm) {
|
||||
while (*ptr != HinsiBlkTerm) {
|
||||
if (flg) {
|
||||
buf[getkanji(inputyomi, cnvlen, ptr, buf)] = 0;
|
||||
if (cmpstr(kanji, buf)) return -1;
|
||||
|
|
@ -319,8 +335,10 @@ checksub(unsigned char* kanji, TypeGram grm) {
|
|||
return dounum;
|
||||
}
|
||||
|
||||
|
||||
static unsigned int
|
||||
checkdict(unsigned char* kanji, TypeGram grm) {
|
||||
checkdict(unsigned char* kanji, TypeGram grm)
|
||||
{
|
||||
DICTL *dp;
|
||||
int dounum = 0;
|
||||
int tmp;
|
||||
|
|
@ -343,8 +361,10 @@ checkdict(unsigned char* kanji, TypeGram grm) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
cal_nextym(unsigned char* ptr) {
|
||||
cal_nextym(unsigned char* ptr)
|
||||
{
|
||||
int count = 0;
|
||||
unsigned char *src;
|
||||
int len;
|
||||
|
|
@ -365,8 +385,10 @@ cal_nextym(unsigned char* ptr) {
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
usr_freelen(void) {
|
||||
usr_freelen(void)
|
||||
{
|
||||
unsigned char* ptr;
|
||||
|
||||
ptr = segtop();
|
||||
|
|
@ -375,8 +397,10 @@ usr_freelen(void) {
|
|||
return(curdict->seglen - (ptr - dicbuf));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sprt_seg(TypeDicSeg seg, TypeDicOfs ofs) {
|
||||
sprt_seg(TypeDicSeg seg, TypeDicOfs ofs)
|
||||
{
|
||||
TypeDicSeg s;
|
||||
unsigned char *pos;
|
||||
unsigned char *p;
|
||||
|
|
@ -448,8 +472,10 @@ sprt_seg(TypeDicSeg seg, TypeDicOfs ofs) {
|
|||
(*curdict->putdic)(curdict, seg);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
apnd_uidx(TypeDicSeg seg, unsigned char* yomi, int len) {
|
||||
apnd_uidx(TypeDicSeg seg, unsigned char* yomi, int len)
|
||||
{
|
||||
unsigned char *p;
|
||||
unsigned char *q;
|
||||
|
||||
|
|
|
|||
143
addelcmn.c
143
addelcmn.c
|
|
@ -27,26 +27,43 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: addelcmn.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:27 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinshi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
int sj2cd_str();
|
||||
void mvmemi(), mvmemd(), mkidxtbl();
|
||||
|
||||
void set_size(unsigned char* p, int size, int plen, int nlen) {
|
||||
|
||||
|
||||
void
|
||||
set_size (unsigned char *p, int size, int plen, int nlen)
|
||||
{
|
||||
*p = (unsigned char)(size >> 8);
|
||||
if (nlen & 0x10) *p |= NokoriYomiTop;
|
||||
if(plen & 0x10) *p |= AsshukuYomiTop;
|
||||
if (plen & 0x10) *p |= AssyukuYomiTop;
|
||||
*(p + 1) = (unsigned char)size;
|
||||
*(p + 2) = (unsigned char)((nlen & 0x0f) | ((plen & 0x0f) << 4));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isvyomi(unsigned char* yp) {
|
||||
isvyomi (unsigned char *yp)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!*yp) return FALSE;
|
||||
|
|
@ -61,8 +78,11 @@ isvyomi(unsigned char* yp) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isvknj(unsigned char* kanji) {
|
||||
isvknj(unsigned char *kanji)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!*kanji) return FALSE;
|
||||
|
|
@ -76,7 +96,8 @@ isvknj(unsigned char* kanji) {
|
|||
if (isknj1(*kanji)) {
|
||||
kanji += 2;
|
||||
len += 2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
kanji++;
|
||||
len += 2;
|
||||
}
|
||||
|
|
@ -87,13 +108,16 @@ isvknj(unsigned char* kanji) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isgrm(TypeGram gram) {
|
||||
isgrm (TypeGram gram)
|
||||
{
|
||||
int grm = gram;
|
||||
|
||||
if(MEISHI_1 <= grm && grm <= D_MEISHI_6) return TRUE;
|
||||
if(MYOUJI <= grm && grm <= JOSUUSHI2) return TRUE;
|
||||
if(KEIYOUSHI_1 <= grm && grm <= DO_ZAHEN) return TRUE;
|
||||
if (MEISI_1 <= grm && grm <= D_MEISI_6) return TRUE;
|
||||
if (MYOUJI <= grm && grm <= JOSUUSI2) return TRUE;
|
||||
if (KEIYOUSI_1 <= grm && grm <= DO_ZAHEN) return TRUE;
|
||||
if (DO_1DAN_1 <= grm && grm <= DO_WAGO_2) return TRUE;
|
||||
if (DO_KAGO_5 <= grm && grm <= DO_WAGO_5) return TRUE;
|
||||
if (DO_KAGO_6 <= grm && grm <= DO_WAGO_6) return TRUE;
|
||||
|
|
@ -106,19 +130,25 @@ isgrm(TypeGram gram) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int
|
||||
addel_arg(unsigned char* yp, unsigned char* kp, TypeGram grm, unsigned char* nyp, int len) {
|
||||
addel_arg (unsigned char *yp, unsigned char *kp, TypeGram grm, unsigned char *nyp, int len)
|
||||
{
|
||||
unsigned int err = 0;
|
||||
|
||||
if (!sj2cd_str(yp, nyp, len)) err |= AD_BadYomi;
|
||||
if (!isvyomi(nyp)) err |= AD_BadYomi;
|
||||
if (!isvknj(kp)) err |= AD_BadKanji;
|
||||
if(!isgrm(grm)) err |= AD_BadHinshi;
|
||||
if (!isgrm(grm)) err |= AD_BadHinsi;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
yomi2kata(unsigned char* src, unsigned char* dst) {
|
||||
yomi2kata (unsigned char *src, unsigned char *dst)
|
||||
{
|
||||
int first;
|
||||
int second;
|
||||
|
||||
|
|
@ -128,7 +158,8 @@ yomi2kata(unsigned char* src, unsigned char* dst) {
|
|||
if (first != 0xa4) {
|
||||
*dst++ = first;
|
||||
*dst++ = second;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*dst++ = 0xa5;
|
||||
*dst++ = second;
|
||||
}
|
||||
|
|
@ -137,16 +168,22 @@ yomi2kata(unsigned char* src, unsigned char* dst) {
|
|||
*dst = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
top_strcmp(unsigned char* src, unsigned char* dst) {
|
||||
top_strcmp (unsigned char *src, unsigned char *dst)
|
||||
{
|
||||
int i;
|
||||
for (i = 0 ; *src && (*src == *dst) ; src++, dst++) i++;
|
||||
i /= 2;
|
||||
return (i > MaxYomiAskNumber) ? MaxYomiAskNumber : i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
last_strcmp(unsigned char* src, unsigned char* dst) {
|
||||
last_strcmp (unsigned char *src, unsigned char *dst)
|
||||
{
|
||||
int slen;
|
||||
int dlen;
|
||||
|
||||
|
|
@ -160,7 +197,11 @@ last_strcmp(unsigned char* src, unsigned char* dst) {
|
|||
return (dlen / 2);
|
||||
}
|
||||
|
||||
int cvtknj(unsigned char* yomi, unsigned char* knj, unsigned char* dst) {
|
||||
|
||||
|
||||
int
|
||||
cvtknj (unsigned char *yomi, unsigned char *knj, unsigned char *dst)
|
||||
{
|
||||
unsigned char kana[MaxWdYomiLen * 2 + 1];
|
||||
int len;
|
||||
unsigned char *keep;
|
||||
|
|
@ -169,9 +210,10 @@ int cvtknj(unsigned char* yomi, unsigned char* knj, unsigned char* dst) {
|
|||
yomi2kata(yomi, kana);
|
||||
|
||||
if ((len = top_strcmp(yomi, knj)) != 0) {
|
||||
*dst = (unsigned char)(ZenHiraAsshuku | (len - 1));
|
||||
} else if((len = top_strcmp(kana, knj)) != 0) {
|
||||
*dst = (unsigned char)(ZenKataAsshuku | (len - 1));
|
||||
*dst = (unsigned char)(ZenHiraAssyuku | (len - 1));
|
||||
}
|
||||
else if ((len = top_strcmp(kana, knj)) != 0) {
|
||||
*dst = (unsigned char)(ZenKataAssyuku | (len - 1));
|
||||
}
|
||||
|
||||
if (len) {
|
||||
|
|
@ -182,26 +224,26 @@ int cvtknj(unsigned char* yomi, unsigned char* knj, unsigned char* dst) {
|
|||
if (*knj) {
|
||||
for ( ; ; ) {
|
||||
if ((len = last_strcmp(yomi, knj)) != 0) {
|
||||
*dst++ = (unsigned char)(ZenHiraAsshuku | (len - 1));
|
||||
*dst++ = (unsigned char)(ZenHiraAssyuku | (len - 1));
|
||||
break;
|
||||
} else if((len = last_strcmp(kana, knj)) != 0) {
|
||||
*dst++ = (unsigned char)(ZenKataAsshuku | (len - 1));
|
||||
}
|
||||
else if ((len = last_strcmp(kana, knj)) != 0) {
|
||||
*dst++ = (unsigned char)(ZenKataAssyuku | (len - 1));
|
||||
break;
|
||||
} else if(*knj == SS2) {
|
||||
}
|
||||
else if (*knj == SS2) {
|
||||
knj++;
|
||||
*dst++ = (unsigned char)LeadingHankaku;
|
||||
*dst++ = *knj++;
|
||||
} else if (*knj == SS3) {
|
||||
knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask);
|
||||
knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
*dst++ = *knj++;
|
||||
} else if (*knj & 0x80) {
|
||||
*dst++ = (*knj & NormalKanjiMask);
|
||||
knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask);
|
||||
knj++;
|
||||
} else {
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
*dst++ = (*knj & NormalKanjiMask); knj++;
|
||||
}
|
||||
else {
|
||||
*dst++ = (unsigned char)LeadingHankaku;
|
||||
*dst++ = *knj++;
|
||||
}
|
||||
|
|
@ -217,7 +259,11 @@ int cvtknj(unsigned char* yomi, unsigned char* knj, unsigned char* dst) {
|
|||
return (dst - keep);
|
||||
}
|
||||
|
||||
int srchkana(unsigned char** ptr, int* saml) {
|
||||
|
||||
|
||||
int
|
||||
srchkana (unsigned char **ptr, int *saml)
|
||||
{
|
||||
unsigned char *p;
|
||||
int cmp;
|
||||
int cnt = 0;
|
||||
|
|
@ -253,7 +299,11 @@ int srchkana(unsigned char** ptr, int* saml) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int srchgram(unsigned char* ptr, unsigned char** dst, TypeGram hinshi) {
|
||||
|
||||
|
||||
int
|
||||
srchgram (unsigned char *ptr, unsigned char **dst, TypeGram hinsi)
|
||||
{
|
||||
unsigned char *endp;
|
||||
int cnt = 0, nlen;
|
||||
int flg = FALSE;
|
||||
|
|
@ -263,14 +313,14 @@ int srchgram(unsigned char* ptr, unsigned char** dst, TypeGram hinshi) {
|
|||
nlen = getnlen(ptr);
|
||||
ptr += DouonBlkSizeNumber + nlen;
|
||||
while (ptr < endp) {
|
||||
if(*ptr == hinshi) {
|
||||
if (*ptr == hinsi) {
|
||||
*dst = ptr;
|
||||
flg = TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
ptr += codesize(*ptr);
|
||||
} while(*ptr != HinshiBlkTerm);
|
||||
} while (*ptr != HinsiBlkTerm);
|
||||
ptr++;
|
||||
cnt++;
|
||||
}
|
||||
|
|
@ -281,7 +331,11 @@ int srchgram(unsigned char* ptr, unsigned char** dst, TypeGram hinshi) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int srchkanji(unsigned char** dst, unsigned char* knj, int klen) {
|
||||
|
||||
|
||||
int
|
||||
srchkanji (unsigned char **dst, unsigned char *knj, int klen)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
unsigned char *p, *q;
|
||||
int len;
|
||||
|
|
@ -290,7 +344,7 @@ int srchkanji(unsigned char** dst, unsigned char* knj, int klen) {
|
|||
|
||||
ptr = *dst + 1;
|
||||
|
||||
while(*ptr != HinshiBlkTerm) {
|
||||
while (*ptr != HinsiBlkTerm) {
|
||||
for (p = ptr, q = knj, len = klen ; len ; len--)
|
||||
if (*p++ != *q++) break;
|
||||
|
||||
|
|
@ -311,8 +365,11 @@ int srchkanji(unsigned char** dst, unsigned char* knj, int klen) {
|
|||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TypeIdxOfs
|
||||
count_uidx(void) {
|
||||
count_uidx (void)
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
p = get_idxptr(curdict->segunit - 1);
|
||||
|
|
@ -321,7 +378,11 @@ count_uidx(void) {
|
|||
return (curdict->idxlen - (p - idxbuf));
|
||||
}
|
||||
|
||||
void chg_uidx(TypeDicSeg seg, unsigned char* yomi, int len) {
|
||||
|
||||
|
||||
void
|
||||
chg_uidx (TypeDicSeg seg, unsigned char *yomi, int len)
|
||||
{
|
||||
unsigned char *p, *q;
|
||||
int olen;
|
||||
|
||||
|
|
@ -333,7 +394,8 @@ void chg_uidx(TypeDicSeg seg, unsigned char* yomi, int len) {
|
|||
|
||||
if (len > olen) {
|
||||
mvmemd(q - (len-olen), q, (int)(q - (len-olen) - p));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mvmemi(p + (olen-len), p, (int)(q - (p + (olen-len))));
|
||||
}
|
||||
|
||||
|
|
@ -343,3 +405,4 @@ void chg_uidx(TypeDicSeg seg, unsigned char* yomi, int len) {
|
|||
|
||||
mkidxtbl(curdict);
|
||||
}
|
||||
|
||||
|
|
|
|||
25
alloc.c
25
alloc.c
|
|
@ -27,6 +27,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: alloc.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:28 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "sj_rename.h"
|
||||
|
|
@ -42,7 +52,9 @@
|
|||
static JREC *jrec = NULL;
|
||||
static CLREC *clrec = NULL;
|
||||
|
||||
JREC* alloc_jrec(void) {
|
||||
JREC*
|
||||
alloc_jrec(void)
|
||||
{
|
||||
JREC *p;
|
||||
int i;
|
||||
|
||||
|
|
@ -59,7 +71,9 @@ JREC* alloc_jrec(void) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void free_jrec(JREC* p) {
|
||||
void
|
||||
free_jrec(JREC *p)
|
||||
{
|
||||
if (p != NULL) {
|
||||
p -> jsort = jrec;
|
||||
jrec = p;
|
||||
|
|
@ -67,7 +81,8 @@ void free_jrec(JREC* p) {
|
|||
}
|
||||
|
||||
CLREC*
|
||||
alloc_clrec(void) {
|
||||
alloc_clrec(void)
|
||||
{
|
||||
CLREC *p;
|
||||
int i;
|
||||
|
||||
|
|
@ -84,7 +99,9 @@ alloc_clrec(void) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void free_clrec(CLREC* p) {
|
||||
void
|
||||
free_clrec(CLREC* p)
|
||||
{
|
||||
if (p != NULL) {
|
||||
p -> clsort = clrec;
|
||||
clrec = p;
|
||||
|
|
|
|||
166
char.c
166
char.c
|
|
@ -27,6 +27,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -34,7 +35,10 @@
|
|||
#include "sj_euc.h"
|
||||
#include "const.h"
|
||||
|
||||
int cnvyomi(int code) {
|
||||
|
||||
int
|
||||
cnvyomi(int code)
|
||||
{
|
||||
unsigned short hh;
|
||||
unsigned char high;
|
||||
unsigned char low;
|
||||
|
|
@ -46,19 +50,17 @@ int cnvyomi(int code) {
|
|||
if (!hh) {
|
||||
if (high == 0xa1) {
|
||||
switch (low) {
|
||||
case 0xbc:
|
||||
return 1;
|
||||
case 0xf4:
|
||||
return 2;
|
||||
case 0xf7:
|
||||
return 3;
|
||||
case 0xa7:
|
||||
return 4;
|
||||
case 0xbc: return 1;
|
||||
case 0xf4: return 2;
|
||||
case 0xf7: return 3;
|
||||
case 0xa7: return 4;
|
||||
}
|
||||
} else if(high == 0xa2) {
|
||||
}
|
||||
else if (high == 0xa2) {
|
||||
if (low == 0xa9)
|
||||
return 4;
|
||||
} else if(high == 0xa3) {
|
||||
}
|
||||
else if (high == 0xa3) {
|
||||
if (low < 0xb0)
|
||||
;
|
||||
else if (low <= 0xb9)
|
||||
|
|
@ -71,19 +73,18 @@ int cnvyomi(int code) {
|
|||
;
|
||||
else if (low <= 0xfa)
|
||||
return(low - 0xe1 + 0x34);
|
||||
} else if(high == 0xa4) {
|
||||
}
|
||||
else if (high == 0xa4) {
|
||||
if (low < 0xa1)
|
||||
;
|
||||
else if (low <= 0xf3)
|
||||
return(low - 0xa1 + 0x4e);
|
||||
} else if(high == 0xa5) {
|
||||
}
|
||||
else if (high == 0xa5) {
|
||||
switch (low) {
|
||||
case 0xf4:
|
||||
return 0xa1;
|
||||
case 0xf5:
|
||||
return 0xa2;
|
||||
case 0xf6:
|
||||
return 0xa3;
|
||||
case 0xf4: return 0xa1;
|
||||
case 0xf5: return 0xa2;
|
||||
case 0xf6: return 0xa3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +92,10 @@ int cnvyomi(int code) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int h2kcode(int code) {
|
||||
|
||||
int
|
||||
h2kcode(int code)
|
||||
{
|
||||
unsigned short hh;
|
||||
unsigned char high;
|
||||
unsigned char low;
|
||||
|
|
@ -112,15 +116,18 @@ int h2kcode(int code) {
|
|||
return (0);
|
||||
}
|
||||
|
||||
int codesize(unsigned char code) {
|
||||
|
||||
int
|
||||
codesize(unsigned char code)
|
||||
{
|
||||
switch (code&KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
case ZenKataAsshuku:
|
||||
case KanjiAsshuku:
|
||||
case ZenHiraAssyuku:
|
||||
case ZenKataAssyuku:
|
||||
case KanjiAssyuku:
|
||||
case KanjiStrEnd:
|
||||
return 1;
|
||||
case LeadingHankaku:
|
||||
case OffsetAsshuku:
|
||||
case OffsetAssyuku:
|
||||
case AiAttribute:
|
||||
return 2;
|
||||
default:
|
||||
|
|
@ -128,18 +135,21 @@ int codesize(unsigned char code) {
|
|||
}
|
||||
}
|
||||
|
||||
void output_knj(FILE* fp, unsigned char* p, int l) {
|
||||
|
||||
void
|
||||
output_knj(FILE* fp, unsigned char* p, int l)
|
||||
{
|
||||
while (l > 0) {
|
||||
switch (*p & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
case ZenHiraAssyuku:
|
||||
fprintf(fp, "\244\322%d", (*p++ & 0x0f) + 1);
|
||||
l--;
|
||||
break;
|
||||
case ZenKataAsshuku:
|
||||
case ZenKataAssyuku:
|
||||
fprintf(fp, "\245\253%d", (*p++ & 0x0f) + 1);
|
||||
l--;
|
||||
break;
|
||||
case KanjiAsshuku:
|
||||
case KanjiAssyuku:
|
||||
fprintf(fp, "\260\265%1x", (*p++ & 0x0f));
|
||||
l--;
|
||||
break;
|
||||
|
|
@ -148,95 +158,84 @@ void output_knj(FILE* fp, unsigned char* p, int l) {
|
|||
l = 0;
|
||||
fprintf(stderr, "\244\252\244\253\244\267\244\244");
|
||||
#else
|
||||
fputc(*p++, fp);
|
||||
l--;
|
||||
fputc(*p++, fp);
|
||||
l--;
|
||||
fputc(*p++, fp); l--;
|
||||
fputc(*p++, fp); l--;
|
||||
#endif
|
||||
break;
|
||||
case OffsetAsshuku:
|
||||
case OffsetAssyuku:
|
||||
fprintf(fp, "ofs%1x", (*p++ & 0x0f));
|
||||
l--;
|
||||
fprintf(fp, "%02x", *p++);
|
||||
l--;
|
||||
fprintf(fp, "%02x", *p++); l--;
|
||||
break;
|
||||
case AiAttribute:
|
||||
fprintf(fp, "\302\260%1x", (*p++ & 0x0f));
|
||||
l--;
|
||||
fprintf(fp, "%02x", *p++);
|
||||
l--;
|
||||
fprintf(fp, "%02x", *p++); l--;
|
||||
break;
|
||||
case KanjiStrEnd:
|
||||
p++;
|
||||
l--;
|
||||
p++; l--;
|
||||
break;
|
||||
default:
|
||||
if (p[1] & 0x80)
|
||||
fputc(SS3, fp);
|
||||
fputc((*p | 0x80), fp);
|
||||
l--;
|
||||
p++;
|
||||
fputc((*p | 0x80), fp);
|
||||
l--;
|
||||
p++;
|
||||
fputc((*p | 0x80), fp); l--; p++;
|
||||
fputc((*p | 0x80), fp); l--; p++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void output_str(FILE* fp, char* p) {
|
||||
while(*p) {
|
||||
fputc(*p, fp);
|
||||
p++;
|
||||
}
|
||||
|
||||
void
|
||||
output_str(FILE* fp, char* p)
|
||||
{
|
||||
while (*p) { fputc(*p, fp); p++; }
|
||||
}
|
||||
|
||||
void output_int(FILE* fp, int* p) {
|
||||
|
||||
void
|
||||
output_int(FILE* fp, int* p)
|
||||
{
|
||||
while (*p) {
|
||||
if (*p < 0x100) {
|
||||
fputc(*p, fp);
|
||||
p++;
|
||||
} else if(*p < 0x10000) {
|
||||
fputc(*p, fp); p++;
|
||||
}
|
||||
else if (*p < 0x10000) {
|
||||
fputc((*p >> 8) & 0xff, fp);
|
||||
fputc(*p & 0xff, fp);
|
||||
p++;
|
||||
} else if(*p < 0x1000000) {
|
||||
fputc(*p & 0xff, fp); p++;
|
||||
}
|
||||
else if (*p < 0x1000000) {
|
||||
fputc((*p >> 16) & 0xff, fp);
|
||||
fputc((*p >> 8) & 0xff, fp);
|
||||
fputc(*p & 0xff, fp);
|
||||
p++;
|
||||
} else {
|
||||
fputc(*p & 0xff, fp); p++;
|
||||
}
|
||||
else {
|
||||
fputc((*p >> 24) & 0xff, fp);
|
||||
fputc((*p >> 16) & 0xff, fp);
|
||||
fputc((*p >> 8) & 0xff, fp);
|
||||
fputc(*p & 0xff, fp);
|
||||
p++;
|
||||
fputc(*p & 0xff, fp); p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
yomi2zen(int code) {
|
||||
yomi2zen(int code)
|
||||
{
|
||||
static char num[] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
|
||||
switch (code) {
|
||||
case 0x01:
|
||||
return 0xa1bc;
|
||||
case 0x02:
|
||||
return 0xa1f4;
|
||||
case 0x03:
|
||||
return 0xa1f7;
|
||||
case 0x04:
|
||||
return 0xa2a9;
|
||||
case 0xa1:
|
||||
return 0xa5f4;
|
||||
case 0xa2:
|
||||
return 0xa5f5;
|
||||
case 0xa3:
|
||||
return 0xa5f6;
|
||||
default:
|
||||
break;
|
||||
case 0x01: return 0xa1bc;
|
||||
case 0x02: return 0xa1f4;
|
||||
case 0x03: return 0xa1f7;
|
||||
case 0x04: return 0xa2a9;
|
||||
case 0xa1: return 0xa5f4;
|
||||
case 0xa2: return 0xa5f5;
|
||||
case 0xa3: return 0xa5f6;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (code < 0x10)
|
||||
|
|
@ -257,7 +256,10 @@ yomi2zen(int code) {
|
|||
return ((num[(code >> 4) & 0x0f] << 8) | num[code & 0x0f]);
|
||||
}
|
||||
|
||||
void output_yomi(FILE* fp, unsigned char* p) {
|
||||
|
||||
void
|
||||
output_yomi(FILE* fp, unsigned char* p)
|
||||
{
|
||||
int i;
|
||||
|
||||
while (*p) {
|
||||
|
|
|
|||
22
charsize.c
22
charsize.c
|
|
@ -27,24 +27,36 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: charsize.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:29 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
int codesize(unsigned char code) {
|
||||
int
|
||||
codesize(unsigned char code)
|
||||
{
|
||||
switch (code & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
case ZenKataAsshuku:
|
||||
case KanjiAsshuku:
|
||||
case ZenHiraAssyuku:
|
||||
case ZenKataAssyuku:
|
||||
case KanjiAssyuku:
|
||||
case KanjiStrEnd:
|
||||
return 1;
|
||||
case LeadingHankaku:
|
||||
case OffsetAsshuku:
|
||||
case OffsetAssyuku:
|
||||
case AiAttribute:
|
||||
return 2;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
14
chrtbl.c
14
chrtbl.c
|
|
@ -27,10 +27,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: chrtbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:30 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "const.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
|
||||
|
||||
unsigned char chrtbl[256] =
|
||||
{
|
||||
0,
|
||||
|
|
@ -288,4 +299,5 @@ unsigned char chrtbl[256] =
|
|||
TAI_KGU,
|
||||
TAI_KGU,
|
||||
TAI_KGU,
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
|
|
|||
63
cl2knj.c
63
cl2knj.c
|
|
@ -27,18 +27,32 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cl2knj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:31 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
int sj2cd_chr();
|
||||
void cvtclknj(), freework();
|
||||
|
||||
|
||||
static CLREC* nextrecblk(void);
|
||||
static CLREC* prevrecblk(void);
|
||||
static void initkbuf(unsigned char* kouho);
|
||||
|
||||
int cl2knj(unsigned char* yomi, int len, unsigned char* kouho) {
|
||||
|
||||
int
|
||||
cl2knj(unsigned char* yomi, int len, unsigned char* kouho)
|
||||
{
|
||||
unsigned char *ptr1;
|
||||
unsigned char *ptr2;
|
||||
int i;
|
||||
|
|
@ -49,8 +63,7 @@ int cl2knj(unsigned char* yomi, int len, unsigned char* kouho) {
|
|||
|
||||
if (len > MaxClInputLen * 2) len = MaxClInputLen * 2;
|
||||
|
||||
ptr1 = yomi;
|
||||
ptr2 = hyomi;
|
||||
ptr1 = yomi; ptr2 = hyomi;
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
if (isknj1(*ptr1)) {
|
||||
if (++i >= len) break;
|
||||
|
|
@ -69,8 +82,8 @@ int cl2knj(unsigned char* yomi, int len, unsigned char* kouho) {
|
|||
cnvstart = ystart = hyomi;
|
||||
cnvlen = strlen(hyomi);
|
||||
|
||||
mkjiritsu(0);
|
||||
mkbunsetsu();
|
||||
mkjiritu(0);
|
||||
mkbunsetu();
|
||||
if (!maxclptr) wakachi();
|
||||
|
||||
jrt1st = maxjptr;
|
||||
|
|
@ -86,7 +99,11 @@ int cl2knj(unsigned char* yomi, int len, unsigned char* kouho) {
|
|||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
int nextcl(unsigned char* kouho, int mode) {
|
||||
|
||||
|
||||
int
|
||||
nextcl(unsigned char* kouho, int mode)
|
||||
{
|
||||
CLREC *clptr;
|
||||
|
||||
initkbuf(kouho);
|
||||
|
|
@ -95,12 +112,14 @@ int nextcl(unsigned char* kouho, int mode) {
|
|||
|
||||
if (!mode && (selectid < khcount)) {
|
||||
selectid++;
|
||||
} else if((mode < 2) && (clptr = nextrecblk())) {
|
||||
}
|
||||
else if((mode < 2) && (clptr = nextrecblk())) {
|
||||
selectid = 1;
|
||||
clt1st = clptr;
|
||||
mkkouho();
|
||||
getrank();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cvtclknj();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -110,8 +129,10 @@ int nextcl(unsigned char* kouho, int mode) {
|
|||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
|
||||
static CLREC*
|
||||
nextrecblk(void) {
|
||||
nextrecblk(void)
|
||||
{
|
||||
CLREC *clptr;
|
||||
int keeplen;
|
||||
|
||||
|
|
@ -124,7 +145,10 @@ nextrecblk(void) {
|
|||
return clptr;
|
||||
}
|
||||
|
||||
int prevcl(unsigned char* kouho, int mode) {
|
||||
|
||||
int
|
||||
prevcl(unsigned char* kouho, int mode)
|
||||
{
|
||||
CLREC *clptr;
|
||||
|
||||
initkbuf(kouho);
|
||||
|
|
@ -133,12 +157,14 @@ int prevcl(unsigned char* kouho, int mode) {
|
|||
|
||||
if (!mode && (selectid > 1)) {
|
||||
selectid--;
|
||||
} else if((mode < 2) && (clptr = prevrecblk())) {
|
||||
}
|
||||
else if ((mode < 2) && (clptr = prevrecblk())) {
|
||||
clt1st = clptr;
|
||||
mkkouho();
|
||||
getrank();
|
||||
selectid = khcount;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cvtclknj();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -148,8 +174,10 @@ int prevcl(unsigned char* kouho, int mode) {
|
|||
return hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
}
|
||||
|
||||
|
||||
static CLREC*
|
||||
prevrecblk(void) {
|
||||
prevrecblk(void)
|
||||
{
|
||||
CLREC *clptr;
|
||||
CLREC *keepptr;
|
||||
int keeplen;
|
||||
|
|
@ -171,12 +199,17 @@ prevrecblk(void) {
|
|||
return keepptr;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
initkbuf(unsigned char* kouho) {
|
||||
initkbuf(unsigned char* kouho)
|
||||
{
|
||||
kanjitmp = kouho;
|
||||
memset(kanjitmp, 0, sizeof(STDYOUT) + 1);
|
||||
}
|
||||
|
||||
int selectnum(void) {
|
||||
|
||||
int
|
||||
selectnum(void)
|
||||
{
|
||||
return selectid;
|
||||
}
|
||||
|
|
|
|||
49
clstudy.c
49
clstudy.c
|
|
@ -27,11 +27,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: clstudy.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:32 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
int sj2cd_str();
|
||||
void mvmemd(), mvmemi();
|
||||
|
||||
|
|
@ -39,7 +49,10 @@ static unsigned char* delcldata(unsigned char* ycode);
|
|||
static int delclold(void);
|
||||
static unsigned char* srchclpos(unsigned char* ycode);
|
||||
|
||||
int clstudy(unsigned char* yomi1, unsigned char* yomi2, STDYOUT* stdy) {
|
||||
|
||||
int
|
||||
clstudy(unsigned char* yomi1, unsigned char* yomi2, STDYOUT *stdy)
|
||||
{
|
||||
unsigned char ytmp[CLSTDY_TMPLEN];
|
||||
unsigned char *dst, *ptr;
|
||||
int ret;
|
||||
|
|
@ -58,9 +71,11 @@ int clstudy(unsigned char* yomi1, unsigned char* yomi2, STDYOUT* stdy) {
|
|||
(void)delcldata(ytmp);
|
||||
|
||||
ret = ClstudyNormEnd;
|
||||
} else if(!stdy) {
|
||||
}
|
||||
else if (!stdy) {
|
||||
return ClstudyParaErr;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!sj2cd_str(yomi1, ytmp, CLSTDY_TMPLEN))
|
||||
return ClstudyYomiErr;
|
||||
len1 = strlen(ytmp);
|
||||
|
|
@ -93,7 +108,8 @@ int clstudy(unsigned char* yomi1, unsigned char* yomi2, STDYOUT* stdy) {
|
|||
memcpy(ytmp, ClYomiPos(dst), len2);
|
||||
|
||||
ret = ClstudyNormEnd;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ret = ClstudyNoArea;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,8 +120,10 @@ int clstudy(unsigned char* yomi1, unsigned char* yomi2, STDYOUT* stdy) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char*
|
||||
delcldata(unsigned char* ycode) {
|
||||
delcldata(unsigned char* ycode)
|
||||
{
|
||||
unsigned char *tagptr;
|
||||
unsigned char *ptr1;
|
||||
unsigned char *ptr2;
|
||||
|
|
@ -126,7 +144,8 @@ delcldata(unsigned char* ycode) {
|
|||
|
||||
if (!*ptr1 || !len1) {
|
||||
delclsub(tagptr);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tagptr = ClNextTag(tagptr);
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +153,10 @@ delcldata(unsigned char* ycode) {
|
|||
return tagptr;
|
||||
}
|
||||
|
||||
void delclsub(unsigned char* target) {
|
||||
|
||||
void
|
||||
delclsub(unsigned char* target)
|
||||
{
|
||||
unsigned char *src;
|
||||
int num;
|
||||
int tmp;
|
||||
|
|
@ -159,8 +181,10 @@ void delclsub(unsigned char* target) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
delclold(void) {
|
||||
delclold(void)
|
||||
{
|
||||
unsigned char *tagptr;
|
||||
unsigned char *target;
|
||||
int num;
|
||||
|
|
@ -191,8 +215,10 @@ delclold(void) {
|
|||
return num;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char*
|
||||
srchclpos(unsigned char* ycode) {
|
||||
srchclpos(unsigned char* ycode)
|
||||
{
|
||||
unsigned char *tagptr;
|
||||
unsigned char *target;
|
||||
unsigned char *ptr1;
|
||||
|
|
@ -233,7 +259,10 @@ srchclpos(unsigned char* ycode) {
|
|||
return target ? target : tagptr;
|
||||
}
|
||||
|
||||
void mkclidx(void) {
|
||||
|
||||
void
|
||||
mkclidx(void)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
int num;
|
||||
int st, ed;
|
||||
|
|
|
|||
10
cmpstr.c
10
cmpstr.c
|
|
@ -27,6 +27,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cmpstr.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:32 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "const.h"
|
||||
#include "sj_typedef.h"
|
||||
|
|
|
|||
|
|
@ -27,10 +27,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cnvhinsi.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1996/05/27 06:59:47 $
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "dicttool.h"
|
||||
|
||||
|
||||
struct gram_code {
|
||||
char *name;
|
||||
int code;
|
||||
|
|
@ -42,7 +50,9 @@ struct gram_code {
|
|||
|
||||
#define GramMax (sizeof(gramtbl)/sizeof(struct gram_code) - 1)
|
||||
|
||||
int u_strcmp(unsigned char* a, unsigned char* b) {
|
||||
int
|
||||
u_strcmp(unsigned char* a, unsigned char* b)
|
||||
{
|
||||
if (!a || !b) return 0;
|
||||
|
||||
while (*a && *b) {
|
||||
|
|
@ -56,7 +66,10 @@ int u_strcmp(unsigned char* a, unsigned char* b) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int cnvhinshi(unsigned char* buf) {
|
||||
|
||||
int
|
||||
cnvhinsi(unsigned char *buf)
|
||||
{
|
||||
int min;
|
||||
int max;
|
||||
int mid;
|
||||
|
|
@ -68,8 +81,10 @@ int cnvhinshi(unsigned char* buf) {
|
|||
|
||||
mid = (min + max) / 2;
|
||||
|
||||
|
||||
i = u_strcmp(buf, gramtbl[mid].name);
|
||||
|
||||
|
||||
if (i < 0) {
|
||||
max = mid - 1;
|
||||
}
|
||||
|
|
@ -83,10 +98,15 @@ int cnvhinshi(unsigned char* buf) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* hinshi_str(int code) {
|
||||
|
||||
|
||||
char*
|
||||
hinsi_str(int code)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i <= GramMax ; i++) {
|
||||
22
code.c
22
code.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: code.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:09 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_sysvdef.h"
|
||||
#include "wchar16.h"
|
||||
#include "kctype.h"
|
||||
|
|
@ -142,7 +150,8 @@ wchar16_t c;
|
|||
}
|
||||
|
||||
unsigned short
|
||||
strtocode() {
|
||||
strtocode()
|
||||
{
|
||||
int c;
|
||||
unsigned short code;
|
||||
|
||||
|
|
@ -171,7 +180,9 @@ strtocode() {
|
|||
}
|
||||
}
|
||||
|
||||
void ChangeCode(void) {
|
||||
void
|
||||
ChangeCode (void)
|
||||
{
|
||||
if (cur_code == CODE_KUTEN2)
|
||||
cur_code = CODE_SJIS;
|
||||
else {
|
||||
|
|
@ -190,11 +201,14 @@ void ChangeCode(void) {
|
|||
}
|
||||
}
|
||||
|
||||
SetCode(code) int code;
|
||||
SetCode(code)
|
||||
int code;
|
||||
{
|
||||
cur_code = code;
|
||||
}
|
||||
|
||||
GetCcode() {
|
||||
GetCcode()
|
||||
{
|
||||
return(cur_code);
|
||||
}
|
||||
|
||||
|
|
|
|||
33
codecnv.c
33
codecnv.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: codecnv.c,v $
|
||||
* $SonyRevision: 1.3 $
|
||||
* $SonyDate: 1997/01/23 11:26:31 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -36,7 +44,9 @@
|
|||
|
||||
static int euc_mode;
|
||||
|
||||
int init_code() {
|
||||
int
|
||||
init_code()
|
||||
{
|
||||
char *loc;
|
||||
|
||||
#ifdef LACKOF_SETLOCALE
|
||||
|
|
@ -66,7 +76,8 @@ int init_code() {
|
|||
}
|
||||
|
||||
void
|
||||
cnvcode(s) unsigned char* s;
|
||||
cnvcode(s)
|
||||
unsigned char *s;
|
||||
{
|
||||
if (euc_mode) {
|
||||
unsigned short i;
|
||||
|
|
@ -76,20 +87,24 @@ void
|
|||
if (iseuckana(i)) {
|
||||
if (*s) {
|
||||
*d++ = *s++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*d++ = i;
|
||||
break;
|
||||
}
|
||||
} else if(iseuc(i)) {
|
||||
}
|
||||
else if (iseuc(i)) {
|
||||
if (*s) {
|
||||
i = euc2sjis((i << 8) + *s++);
|
||||
*d++ = (i >> 8);
|
||||
*d++ = i;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*d++ = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*d++ = i;
|
||||
}
|
||||
}
|
||||
|
|
@ -122,7 +137,8 @@ unsigned char* s;
|
|||
}
|
||||
|
||||
void
|
||||
normal_out(fmt, p1, p2, p3, p4, p5) char* fmt;
|
||||
normal_out(fmt, p1, p2, p3, p4, p5)
|
||||
char *fmt;
|
||||
int p1, p2, p3, p4, p5;
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
|
@ -132,7 +148,8 @@ int p1, p2, p3, p4, p5;
|
|||
}
|
||||
|
||||
void
|
||||
error_out(fmt, p1, p2, p3, p4, p5) char* fmt;
|
||||
error_out(fmt, p1, p2, p3, p4, p5)
|
||||
char *fmt;
|
||||
int p1, p2, p3, p4, p5;
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
|
|
|||
29
common.c
29
common.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: common.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:10 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "conversion.h"
|
||||
|
||||
int allways_buff = 0;
|
||||
|
|
@ -40,7 +48,8 @@ Conversion* current_conversion;
|
|||
Conversion *default_conversion;
|
||||
|
||||
Conversion *
|
||||
AllocConversion() {
|
||||
AllocConversion ()
|
||||
{
|
||||
Conversion *c;
|
||||
|
||||
if ((c = (Conversion *)malloc (sizeof(Conversion))) == NULL) {
|
||||
|
|
@ -87,30 +96,36 @@ PushConversion(c)
|
|||
push_conversion = c;
|
||||
}
|
||||
|
||||
PopConversion() {
|
||||
PopConversion ()
|
||||
{
|
||||
if (push_conversion)
|
||||
current_conversion = push_conversion;
|
||||
}
|
||||
|
||||
Conversion *
|
||||
GetConversion() {
|
||||
GetConversion ()
|
||||
{
|
||||
return (current_conversion);
|
||||
}
|
||||
|
||||
InitConversion() {
|
||||
InitConversion ()
|
||||
{
|
||||
default_conversion = AllocConversion ();
|
||||
DefaultConversion ();
|
||||
}
|
||||
|
||||
DefaultConversion() {
|
||||
DefaultConversion ()
|
||||
{
|
||||
current_conversion = default_conversion;
|
||||
}
|
||||
|
||||
EndConversion() {
|
||||
EndConversion ()
|
||||
{
|
||||
free (default_conversion);
|
||||
}
|
||||
|
||||
int wcbyte(str)
|
||||
int
|
||||
wcbyte(str)
|
||||
wchar16_t *str;
|
||||
{
|
||||
count=0;
|
||||
|
|
|
|||
10
common.h
10
common.h
|
|
@ -27,6 +27,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: common.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:42 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "conversion.h"
|
||||
|
||||
extern Conversion *current_conversion;
|
||||
|
|
|
|||
145
comuni.c
145
comuni.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: comuni.c,v $
|
||||
* $SonyRevision: 1.4 $
|
||||
* $SonyDate: 1994/11/16 07:34:05 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -101,7 +110,10 @@ static int putpos = 0;
|
|||
static int buflen = 0;
|
||||
static int getpos = 0;
|
||||
|
||||
void socket_init(void) {
|
||||
|
||||
void
|
||||
socket_init(void)
|
||||
{
|
||||
#ifdef SVR4
|
||||
int i;
|
||||
|
||||
|
|
@ -117,8 +129,11 @@ void socket_init(void) {
|
|||
maxfds = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_fd(int fd) {
|
||||
set_fd(int fd)
|
||||
{
|
||||
#ifdef SVR4
|
||||
poll_fds[maxfds].fd = fd;
|
||||
poll_fds[maxfds].events = POLLIN;
|
||||
|
|
@ -129,8 +144,11 @@ set_fd(int fd) {
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
clr_fd(int fd) {
|
||||
clr_fd(int fd)
|
||||
{
|
||||
#ifdef SVR4
|
||||
int i, j;
|
||||
|
||||
|
|
@ -161,8 +179,10 @@ clr_fd(int fd) {
|
|||
|
||||
#if (!defined(TLI) || (defined(TLI) && defined(SOCK_UNIX)))
|
||||
|
||||
|
||||
static void
|
||||
open_af_unix(void) {
|
||||
open_af_unix(void)
|
||||
{
|
||||
struct sockaddr_un sunix;
|
||||
|
||||
unlink(socket_name);
|
||||
|
|
@ -205,8 +225,10 @@ struct t_call* inet_callptr;
|
|||
struct netconfig *nconf;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
open_af_inet(void) {
|
||||
open_af_inet(void)
|
||||
{
|
||||
#ifdef TLI
|
||||
struct t_bind *req;
|
||||
struct nd_hostserv hserv;
|
||||
|
|
@ -224,6 +246,7 @@ open_af_inet(void) {
|
|||
#endif
|
||||
int true = 1;
|
||||
|
||||
|
||||
#ifdef TLI
|
||||
if (( handlep = setnetpath()) == NULL) {
|
||||
fprintf(stderr, "Setnetpath fail\n");
|
||||
|
|
@ -311,6 +334,7 @@ open_af_inet(void) {
|
|||
|
||||
inet_callptr->addr = *(addrs->n_addrs);
|
||||
|
||||
|
||||
inet_callptr->udata.maxlen = 0;
|
||||
inet_callptr->udata.len = 0;
|
||||
inet_callptr->udata.buf = (char *) NULL;
|
||||
|
|
@ -342,7 +366,8 @@ open_af_inet(void) {
|
|||
fprintf(stderr,
|
||||
"Port %d is already in use\n",
|
||||
port);
|
||||
} else
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Can't bind AF_INET socket\n");
|
||||
shutdown(fd_inet, 2);
|
||||
close(fd_inet);
|
||||
|
|
@ -359,7 +384,9 @@ open_af_inet(void) {
|
|||
set_fd(fd_inet);
|
||||
}
|
||||
|
||||
void open_socket(void) {
|
||||
void
|
||||
open_socket(void)
|
||||
{
|
||||
open_af_inet();
|
||||
#if (!defined(TLI) || (defined(TLI) && defined(SOCK_UNIX)))
|
||||
open_af_unix();
|
||||
|
|
@ -368,8 +395,10 @@ void open_socket(void) {
|
|||
|
||||
#if (!defined(TLI) || (defined(TLI) && defined(SOCK_UNIX)))
|
||||
|
||||
|
||||
static int
|
||||
connect_af_unix(void) {
|
||||
connect_af_unix(void)
|
||||
{
|
||||
struct sockaddr_un sunix;
|
||||
int i = sizeof(sunix);
|
||||
int fd;
|
||||
|
|
@ -381,7 +410,9 @@ connect_af_unix(void) {
|
|||
#endif
|
||||
|
||||
#ifdef TLI
|
||||
int accept_func(int fd, struct t_call* callptr, char* name, int closeflg) {
|
||||
int
|
||||
accept_func(int fd, struct t_call* callptr, char* name, int closeflg)
|
||||
{
|
||||
int newfd;
|
||||
int look;
|
||||
extern int t_errno;
|
||||
|
|
@ -412,8 +443,11 @@ int accept_func(int fd, struct t_call* callptr, char* name, int closeflg) {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static int
|
||||
connect_af_inet(void) {
|
||||
connect_af_inet(void)
|
||||
{
|
||||
#ifndef TLI
|
||||
struct sockaddr_in sin;
|
||||
int i = sizeof(sin);
|
||||
|
|
@ -423,6 +457,7 @@ connect_af_inet(void) {
|
|||
#ifdef TLI
|
||||
if (t_listen(fd_inet, inet_callptr) < 0) {
|
||||
warning_out("t_listen error");
|
||||
|
||||
}
|
||||
|
||||
if ((fd = accept_func(fd_inet, inet_callptr, nconf->nc_device, FALSE)) == ERROR)
|
||||
|
|
@ -435,8 +470,10 @@ connect_af_inet(void) {
|
|||
|
||||
#if (!defined(TLI) || (defined(TLI) && defined(SOCK_UNIX)))
|
||||
|
||||
|
||||
static void
|
||||
close_af_unix(void) {
|
||||
close_af_unix(void)
|
||||
{
|
||||
struct sockaddr_un sunix;
|
||||
int true = 1;
|
||||
int i;
|
||||
|
|
@ -453,8 +490,11 @@ close_af_unix(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void
|
||||
close_af_inet(void) {
|
||||
close_af_inet(void)
|
||||
{
|
||||
#ifndef TLI
|
||||
struct sockaddr_in sin;
|
||||
#endif
|
||||
|
|
@ -482,13 +522,17 @@ close_af_inet(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void close_socket(void) {
|
||||
void
|
||||
close_socket(void)
|
||||
{
|
||||
#if (!defined(TLI) || (defined(TLI) && defined(SOCK_UNIX)))
|
||||
close_af_unix();
|
||||
#endif
|
||||
close_af_inet();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
#ifdef SVR4
|
||||
connect_client(struct pollfd *readfds)
|
||||
|
|
@ -544,6 +588,9 @@ connect_client(fd_set* readfds)
|
|||
#endif /* SVR4 */
|
||||
if (fd == ERROR) return;
|
||||
|
||||
|
||||
|
||||
|
||||
if (client_num >= MaxClientNum || client_num >= max_client) {
|
||||
warning_out("No more client");
|
||||
}
|
||||
|
|
@ -552,6 +599,7 @@ connect_client(fd_set* readfds)
|
|||
debug_out(1, "client create(%d)\r\n", fd);
|
||||
logging_out("connect to client on %d", fd);
|
||||
|
||||
|
||||
if ((client_tmp = (Client *)malloc(sizeof(Client))) != NULL) {
|
||||
memset(client_tmp, 0, sizeof(Client));
|
||||
client_tmp->fd = fd;
|
||||
|
|
@ -585,10 +633,14 @@ connect_client(fd_set* readfds)
|
|||
shutdown(fd, 2);
|
||||
close(fd);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Client*
|
||||
disconnect_client(Client* cp) {
|
||||
disconnect_client(Client *cp)
|
||||
{
|
||||
WorkArea *wp;
|
||||
StdyFile *sp;
|
||||
int fd;
|
||||
|
|
@ -648,7 +700,9 @@ disconnect_client(Client* cp) {
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
void communicate(void) {
|
||||
void
|
||||
communicate(void)
|
||||
{
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
|
|
@ -664,6 +718,7 @@ void communicate(void) {
|
|||
|
||||
fd_set readfds;
|
||||
|
||||
|
||||
readfds = fds_org;
|
||||
while (select(maxfds,&readfds,NULL,NULL,NULL) == ERROR) {
|
||||
if (errno != EINTR) error_out("select");
|
||||
|
|
@ -704,7 +759,10 @@ void communicate(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void put_flush(void) {
|
||||
|
||||
void
|
||||
put_flush(void)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
char *p;
|
||||
|
|
@ -719,41 +777,58 @@ void put_flush(void) {
|
|||
putpos = 0;
|
||||
}
|
||||
|
||||
void put_byte(int c) {
|
||||
|
||||
void
|
||||
put_byte(int c)
|
||||
{
|
||||
putbuf[putpos++] = c;
|
||||
if (putpos >= sizeof(putbuf)) put_flush();
|
||||
}
|
||||
|
||||
void put_work(int c) {
|
||||
|
||||
void
|
||||
put_work(int c)
|
||||
{
|
||||
put_byte(c >> 8);
|
||||
put_byte(c & 0xff);
|
||||
}
|
||||
|
||||
void put_int(int c) {
|
||||
|
||||
void
|
||||
put_int(int c)
|
||||
{
|
||||
put_byte(c >> (8 * 3));
|
||||
put_byte(c >> (8 * 2));
|
||||
put_byte(c >> (8 * 1));
|
||||
put_byte(c);
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
put_string(unsigned char* p) {
|
||||
put_string(unsigned char* p)
|
||||
{
|
||||
if (p) {
|
||||
do {
|
||||
put_byte(*p);
|
||||
} while (*p++);
|
||||
} else
|
||||
}
|
||||
else
|
||||
put_byte(0);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
put_ndata(unsigned char* p, int n) {
|
||||
put_ndata(unsigned char* p, int n)
|
||||
{
|
||||
while (n-- > 0) put_byte(p ? *p++ : 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
void get_buf(void) {
|
||||
|
||||
void
|
||||
get_buf(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (;;) {
|
||||
|
|
@ -768,19 +843,28 @@ void get_buf(void) {
|
|||
getpos = 0;
|
||||
}
|
||||
|
||||
int get_byte(void) {
|
||||
|
||||
int
|
||||
get_byte(void)
|
||||
{
|
||||
if (getpos >= buflen) get_buf();
|
||||
return (getbuf[getpos++] & 0xff);
|
||||
}
|
||||
|
||||
int get_word(void) {
|
||||
|
||||
int
|
||||
get_word(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = get_byte();
|
||||
return ((i << 8) | get_byte());
|
||||
}
|
||||
|
||||
int get_int(void) {
|
||||
|
||||
int
|
||||
get_int(void)
|
||||
{
|
||||
int i0;
|
||||
int i1;
|
||||
int i2;
|
||||
|
|
@ -791,7 +875,10 @@ int get_int(void) {
|
|||
return((i0 << (8*3)) | (i1 << (8*2)) | (i2 << (8*1)) | get_byte());
|
||||
}
|
||||
|
||||
int get_nstring(unsigned char* p, int n) {
|
||||
|
||||
int
|
||||
get_nstring(unsigned char* p, int n)
|
||||
{
|
||||
int c;
|
||||
|
||||
do {
|
||||
|
|
@ -802,8 +889,10 @@ int get_nstring(unsigned char* p, int n) {
|
|||
return (n < 0) ? ERROR : 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
get_ndata(unsigned char* p, int n) {
|
||||
get_ndata(unsigned char* p, int n)
|
||||
{
|
||||
while (n-- > 0) *p++ = get_byte();
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef OCONFIGURE_CONFIG_H
|
||||
#define OCONFIGURE_CONFIG_H
|
||||
|
||||
#cmakedefine01 HAVE_C99_STDINT
|
||||
|
||||
#ifndef HAVE_MD5
|
||||
# define HAVE_MD5 1
|
||||
#endif
|
||||
#ifndef HAVE_SHA2
|
||||
# define HAVE_SHA2 1
|
||||
#endif
|
||||
|
||||
#endif /* OCONFIGURE_CONFIG_H */
|
||||
5
configure
vendored
5
configure
vendored
|
|
@ -221,7 +221,6 @@ HAVE_B64_NTOP=
|
|||
HAVE_CAPSICUM=
|
||||
HAVE_CRYPT=
|
||||
HAVE_CRYPT_NEWHASH=
|
||||
HAVE_C99_STDINT=
|
||||
HAVE_ENDIAN_H=
|
||||
HAVE_ERR=
|
||||
HAVE_EXPLICIT_BZERO=
|
||||
|
|
@ -392,7 +391,6 @@ runtest b64_ntop B64_NTOP "" "" "-lresolv" || true
|
|||
runtest capsicum CAPSICUM || true
|
||||
runtest crypt CRYPT "" "" "-lcrypt" || true
|
||||
runtest crypt_newhash CRYPT_NEWHASH || true
|
||||
runtest c99_stdint C99_STDINT || true
|
||||
runtest endian_h ENDIAN_H || true
|
||||
runtest err ERR || true
|
||||
runtest explicit_bzero EXPLICIT_BZERO || true
|
||||
|
|
@ -515,7 +513,7 @@ fi
|
|||
if [ ${HAVE_MD5} -eq 0 -o \
|
||||
${HAVE_SHA2} -eq 0 ]
|
||||
then
|
||||
echo "#include \"sj_stdint.h\" /* C99 stdint.h or C89 fallback types */"
|
||||
echo "#include <stdint.h> /* C99 [u]int[nn]_t types */"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
|
@ -557,7 +555,6 @@ cat << __HEREDOC__
|
|||
#define HAVE_CAPSICUM ${HAVE_CAPSICUM}
|
||||
#define HAVE_CRYPT ${HAVE_CRYPT}
|
||||
#define HAVE_CRYPT_NEWHASH ${HAVE_CRYPT_NEWHASH}
|
||||
#define HAVE_C99_STDINT ${HAVE_C99_STDINT}
|
||||
#define HAVE_ENDIAN_H ${HAVE_ENDIAN_H}
|
||||
#define HAVE_ERR ${HAVE_ERR}
|
||||
#define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO}
|
||||
|
|
|
|||
306
conjunc.c
306
conjunc.c
|
|
@ -27,6 +27,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: conjunc.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:33 $
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_yomi.h"
|
||||
|
|
@ -53,7 +60,8 @@ static unsigned char sahencnj[] = {
|
|||
0x31, _RE, R_KATEI2,
|
||||
0x31, _RO, R_MEIREI1,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char zahencnj[] = {
|
||||
0x00, R_CUT,
|
||||
|
|
@ -66,7 +74,8 @@ static unsigned char zahencnj[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x01, _ZE, R_MIZEN3,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ka5cnj1[] = {
|
||||
0x01, _I, R_ONBIN2,
|
||||
|
|
@ -75,7 +84,8 @@ static unsigned char ka5cnj1[] = {
|
|||
0x01, _KU, R_SHUUSI,
|
||||
0x01, _KE, R_KAMEI,
|
||||
0x02, _KO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ka5cnj3[] = {
|
||||
0x01, _I, R_ONBIN2,
|
||||
|
|
@ -84,7 +94,8 @@ static unsigned char ka5cnj3[] = {
|
|||
0x01, _KU, R_SHUUSI,
|
||||
0x01, _KE, R_KAMEI,
|
||||
0x02, _KO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ka5cnj5[] = {
|
||||
0x01, _I, R_ONBIN2,
|
||||
|
|
@ -99,7 +110,8 @@ static unsigned char ka5cnj5[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _KO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ka5cnj7[] = {
|
||||
0x01, _I, R_ONBIN2,
|
||||
|
|
@ -114,7 +126,8 @@ static unsigned char ka5cnj7[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _KO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ga5cnj1[] = {
|
||||
0x01, _I, R_ONBIN3,
|
||||
|
|
@ -123,7 +136,8 @@ static unsigned char ga5cnj1[] = {
|
|||
0x01, _GU, R_SHUUSI,
|
||||
0x01, _GE, R_KAMEI,
|
||||
0x02, _GO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ga5cnj3[] = {
|
||||
0x01, _I, R_ONBIN3,
|
||||
|
|
@ -132,7 +146,8 @@ static unsigned char ga5cnj3[] = {
|
|||
0x01, _GU, R_SHUUSI,
|
||||
0x01, _GE, R_KAMEI,
|
||||
0x02, _GO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ga5cnj5[] = {
|
||||
0x01, _I, R_ONBIN3,
|
||||
|
|
@ -147,7 +162,8 @@ static unsigned char ga5cnj5[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _GO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ga5cnj7[] = {
|
||||
0x01, _I, R_ONBIN3,
|
||||
|
|
@ -162,7 +178,8 @@ static unsigned char ga5cnj7[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _GO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sa5cnj1[] = {
|
||||
0x01, _SA, R_MIZEN5,
|
||||
|
|
@ -170,7 +187,8 @@ static unsigned char sa5cnj1[] = {
|
|||
0x01, _SU, R_SHUUSI,
|
||||
0x01, _SE, R_KAMEI,
|
||||
0x02, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sa5cnj3[] = {
|
||||
0x01, _SA, R_MIZEN5,
|
||||
|
|
@ -178,7 +196,8 @@ static unsigned char sa5cnj3[] = {
|
|||
0x01, _SU, R_SHUUSI,
|
||||
0x01, _SE, R_KAMEI,
|
||||
0x02, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sa5cnj5[] = {
|
||||
0x01, _SA, R_MIZEN5,
|
||||
|
|
@ -188,7 +207,8 @@ static unsigned char sa5cnj5[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sa5cnj7[] = {
|
||||
0x01, _SA, R_MIZEN5,
|
||||
|
|
@ -198,7 +218,8 @@ static unsigned char sa5cnj7[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ta5cnj1[] = {
|
||||
0x01, _TA, R_MIZEN5,
|
||||
|
|
@ -207,7 +228,8 @@ static unsigned char ta5cnj1[] = {
|
|||
0x01, _TU, R_SHUUSI,
|
||||
0x01, _TE, R_KAMEI,
|
||||
0x02, _TO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ta5cnj3[] = {
|
||||
0x01, _TA, R_MIZEN5,
|
||||
|
|
@ -216,7 +238,8 @@ static unsigned char ta5cnj3[] = {
|
|||
0x01, _TU, R_SHUUSI,
|
||||
0x01, _TE, R_KAMEI,
|
||||
0x02, _TO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ta5cnj5[] = {
|
||||
0x01, _TA, R_MIZEN5,
|
||||
|
|
@ -231,7 +254,8 @@ static unsigned char ta5cnj5[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _TO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ta5cnj7[] = {
|
||||
0x01, _TA, R_MIZEN5,
|
||||
|
|
@ -246,7 +270,9 @@ static unsigned char ta5cnj7[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _TO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
|
||||
static unsigned char na5cnj[] = {
|
||||
0x01, _NA, R_MIZEN5,
|
||||
|
|
@ -255,7 +281,8 @@ static unsigned char na5cnj[] = {
|
|||
0x01, _NE, R_KAMEI,
|
||||
0x02, _NO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ba5cnj1[] = {
|
||||
0x01, _BA, R_MIZEN5,
|
||||
|
|
@ -264,7 +291,8 @@ static unsigned char ba5cnj1[] = {
|
|||
0x01, _BE, R_KAMEI,
|
||||
0x02, _BO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ba5cnj3[] = {
|
||||
0x01, _BA, R_MIZEN5,
|
||||
|
|
@ -273,7 +301,8 @@ static unsigned char ba5cnj3[] = {
|
|||
0x01, _BE, R_KAMEI,
|
||||
0x02, _BO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ba5cnj5[] = {
|
||||
0x01, _BA, R_MIZEN5,
|
||||
|
|
@ -288,7 +317,8 @@ static unsigned char ba5cnj5[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x02, _BO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ba5cnj7[] = {
|
||||
0x01, _BA, R_MIZEN5,
|
||||
|
|
@ -303,7 +333,8 @@ static unsigned char ba5cnj7[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x02, _BO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ma5cnj1[] = {
|
||||
0x01, _MA, R_MIZEN5,
|
||||
|
|
@ -312,7 +343,8 @@ static unsigned char ma5cnj1[] = {
|
|||
0x01, _ME, R_KAMEI,
|
||||
0x02, _MO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ma5cnj3[] = {
|
||||
0x01, _MA, R_MIZEN5,
|
||||
|
|
@ -321,7 +353,8 @@ static unsigned char ma5cnj3[] = {
|
|||
0x01, _ME, R_KAMEI,
|
||||
0x02, _MO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ma5cnj5[] = {
|
||||
0x01, _MA, R_MIZEN5,
|
||||
|
|
@ -336,7 +369,8 @@ static unsigned char ma5cnj5[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x02, _MO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ma5cnj7[] = {
|
||||
0x01, _MA, R_MIZEN5,
|
||||
|
|
@ -351,7 +385,8 @@ static unsigned char ma5cnj7[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x02, _MO, _U, R_AROU,
|
||||
0x01, _NN, R_ONBIN3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ra5cnj1[] = {
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
|
|
@ -360,7 +395,8 @@ static unsigned char ra5cnj1[] = {
|
|||
0x01, _RU, R_SHUUSI,
|
||||
0x01, _RE, R_KAMEI,
|
||||
0x02, _RO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ra5cnj3[] = {
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
|
|
@ -369,7 +405,8 @@ static unsigned char ra5cnj3[] = {
|
|||
0x01, _RU, R_SHUUSI,
|
||||
0x01, _RE, R_KAMEI,
|
||||
0x02, _RO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ra5cnj5[] = {
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
|
|
@ -384,7 +421,8 @@ static unsigned char ra5cnj5[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _RO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ra5cnj7[] = {
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
|
|
@ -399,7 +437,8 @@ static unsigned char ra5cnj7[] = {
|
|||
0x11, _RU, R_SHUUSI,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x02, _RO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char wa5cnj1[] = {
|
||||
0x01, _I, R_RENYOU5,
|
||||
|
|
@ -408,7 +447,8 @@ static unsigned char wa5cnj1[] = {
|
|||
0x02, _O, _U, R_AROU,
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
0x01, _WA, R_MIZEN5,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char wa5cnj3[] = {
|
||||
0x01, _I, R_RENYOU7,
|
||||
|
|
@ -417,7 +457,8 @@ static unsigned char wa5cnj3[] = {
|
|||
0x02, _O, _U, R_AROU,
|
||||
0x01, _XTU, R_ONBIN2,
|
||||
0x01, _WA, R_MIZEN5,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char wa5cnj5[] = {
|
||||
0x01, _I, R_RENYOU5,
|
||||
|
|
@ -432,7 +473,8 @@ static unsigned char wa5cnj5[] = {
|
|||
0x11, _SI, R_SA5RENYOU3,
|
||||
0x11, _SU, R_SHUUSI,
|
||||
0x12, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char wa5cnj7[] = {
|
||||
0x01, _I, R_RENYOU7,
|
||||
|
|
@ -447,7 +489,8 @@ static unsigned char wa5cnj7[] = {
|
|||
0x11, _SI, R_SA5RENYOU3,
|
||||
0x11, _SU, R_SHUUSI,
|
||||
0x12, _SO, _U, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ichicnj1[] = {
|
||||
0x00, R_RENYOU1,
|
||||
|
|
@ -455,7 +498,8 @@ static unsigned char ichicnj1[] = {
|
|||
0x01, _RU, R_SHUUSI,
|
||||
0x01, _RE, R_KATEI2,
|
||||
0x01, _RO, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ichicnj3[] = {
|
||||
0x00, R_RENYOU3,
|
||||
|
|
@ -463,7 +507,8 @@ static unsigned char ichicnj3[] = {
|
|||
0x01, _RU, R_SHUUSI,
|
||||
0x01, _RE, R_KATEI2,
|
||||
0x01, _RO, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou1[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -473,7 +518,8 @@ static unsigned char keiyou1[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou2[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -483,8 +529,9 @@ static unsigned char keiyou2[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0xff};
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou3[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -494,7 +541,7 @@ static unsigned char keiyou3[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -505,8 +552,9 @@ static unsigned char keiyou3[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0xff};
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou4[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -522,8 +570,9 @@ static unsigned char keiyou4[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0xff};
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou5[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -539,7 +588,7 @@ static unsigned char keiyou5[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -550,8 +599,9 @@ static unsigned char keiyou5[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0xff};
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou6[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -561,7 +611,7 @@ static unsigned char keiyou6[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -572,8 +622,8 @@ static unsigned char keiyou6[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _ME, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _ME, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -584,7 +634,8 @@ static unsigned char keiyou6[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou7[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -600,7 +651,7 @@ static unsigned char keiyou7[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -611,8 +662,8 @@ static unsigned char keiyou7[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _ME, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _ME, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -623,7 +674,8 @@ static unsigned char keiyou7[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou8[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -639,7 +691,7 @@ static unsigned char keiyou8[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -650,9 +702,9 @@ static unsigned char keiyou8[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _MI, R_FZKMEISHI,
|
||||
0x01, _ME, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _MI, R_FZKMEISI,
|
||||
0x01, _ME, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -663,7 +715,8 @@ static unsigned char keiyou8[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou9[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -679,7 +732,7 @@ static unsigned char keiyou9[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -690,8 +743,9 @@ static unsigned char keiyou9[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0xff};
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou10[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -707,7 +761,7 @@ static unsigned char keiyou10[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _GE, R_DMEISHI,
|
||||
0x01, _GE, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -718,8 +772,8 @@ static unsigned char keiyou10[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _ME, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _ME, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -730,7 +784,8 @@ static unsigned char keiyou10[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyou11[] = {
|
||||
0x80, R_KGOKAN,
|
||||
|
|
@ -740,9 +795,9 @@ static unsigned char keiyou11[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _MI, R_FZKMEISHI,
|
||||
0x01, _ME, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _MI, R_FZKMEISI,
|
||||
0x01, _ME, R_DMEISI,
|
||||
0x11, _DA, R_DSHUUSI1,
|
||||
0x21, _XTU, R_ONBIN1,
|
||||
0x22, _RO, _U, R_DAROU,
|
||||
|
|
@ -753,7 +808,8 @@ static unsigned char keiyou11[] = {
|
|||
0x21, _RU, R_DRENTAI3,
|
||||
0x21, _RE, R_KAMEI,
|
||||
0x11, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keidou1[] = {
|
||||
0x80, R_DGOKAN,
|
||||
|
|
@ -767,18 +823,20 @@ static unsigned char keidou1[] = {
|
|||
0x11, _RU, R_DRENTAI3,
|
||||
0x11, _RE, R_KAMEI,
|
||||
0x01, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keidou2[] = {
|
||||
0x80, R_DGOKAN,
|
||||
0x02, _TA, _RU, R_DRENTAI2,
|
||||
0x11, _RE, R_KATEI2,
|
||||
0x01, _TO, R_DRENYOU3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keidou4[] = {
|
||||
0x80, R_DGOKAN,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _DA, R_DSHUUSI1,
|
||||
0x11, _XTU, R_ONBIN1,
|
||||
0x12, _RO, _U, R_DAROU,
|
||||
|
|
@ -789,7 +847,8 @@ static unsigned char keidou4[] = {
|
|||
0x11, _RU, R_DRENTAI3,
|
||||
0x11, _RE, R_KAMEI,
|
||||
0x01, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keidou9[] = {
|
||||
0x80, R_DGOKAN,
|
||||
|
|
@ -805,10 +864,11 @@ static unsigned char keidou9[] = {
|
|||
0x01, _NI, R_DRENYOU2,
|
||||
0x01, _NO, R_CUT,
|
||||
0x12, _KO, _TO, R_KOTO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sahenmeisi1[] = {
|
||||
0x00, R_SMEISHI1,
|
||||
0x00, R_SMEISI1,
|
||||
0x01, _SA, R_MIZEN1,
|
||||
0x01, _SI, R_SI1,
|
||||
0x11, _RO, R_MEIREI1,
|
||||
|
|
@ -817,10 +877,11 @@ static unsigned char sahenmeisi1[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x01, _SE, R_MIZEN2,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char sahenmeisi2[] = {
|
||||
0x00, R_SMEISHI1,
|
||||
0x00, R_SMEISI1,
|
||||
0x01, _SA, R_MIZEN1,
|
||||
0x01, _SI, R_SI1,
|
||||
0x11, _RO, R_MEIREI1,
|
||||
|
|
@ -829,11 +890,12 @@ static unsigned char sahenmeisi2[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x01, _SE, R_MIZEN2,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keidoumeisi[] = {
|
||||
0x00, R_DMEISHI,
|
||||
0x01, _SA, R_FZKMEISHI,
|
||||
0x00, R_DMEISI,
|
||||
0x01, _SA, R_FZKMEISI,
|
||||
0x01, _DA, R_DSHUUSI1,
|
||||
0x11, _XTU, R_ONBIN1,
|
||||
0x12, _RO, _U, R_DAROU,
|
||||
|
|
@ -844,7 +906,8 @@ static unsigned char keidoumeisi[] = {
|
|||
0x11, _RU, R_DRENTAI3,
|
||||
0x11, _RE, R_KAMEI,
|
||||
0x01, _NI, R_DRENYOU2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char keiyoustb[] = {
|
||||
0x00, R_KSTB,
|
||||
|
|
@ -854,25 +917,28 @@ static unsigned char keiyoustb[] = {
|
|||
0x01, _KI, R_KRENTAI,
|
||||
0x01, _KU, R_KRENYOU,
|
||||
0x02, _KE, _RE, R_KATEI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char ichistb[] = {
|
||||
0x00, R_ICHISETSUBI,
|
||||
0x00, R_ICHISETUBI,
|
||||
0x01, _YO, R_MEIREI2,
|
||||
0x01, _RU, R_SHUUSI,
|
||||
0x01, _RE, R_KATEI2,
|
||||
0x01, _RO, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi2[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x01, _TO, R_F_FUKUSHI,
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _TO, R_F_FUKUSI,
|
||||
0x11, _SI, R_SI1,
|
||||
0x11, _HA, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x11, _HA, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi3[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _SA, R_MIZEN1,
|
||||
0x01, _SI, R_SI1,
|
||||
0x11, _RO, R_MEIREI1,
|
||||
|
|
@ -881,13 +947,14 @@ static unsigned char fukusi3[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x01, _SE, R_MIZEN2,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0x01, _TO, R_F_FUKUSHI,
|
||||
0x01, _TO, R_F_FUKUSI,
|
||||
0x11, _SI, R_SI1,
|
||||
0x11, _HA, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x11, _HA, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi4[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _SA, R_MIZEN1,
|
||||
0x01, _SI, R_SI1,
|
||||
0x11, _RO, R_MEIREI1,
|
||||
|
|
@ -896,38 +963,43 @@ static unsigned char fukusi4[] = {
|
|||
0x11, _RE, R_KATEI2,
|
||||
0x01, _SE, R_MIZEN2,
|
||||
0x11, _YO, R_MEIREI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi5[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x01, _NI, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _NI, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi6[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x01, _MO, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _MO, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi7[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x01, _NO, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _NO, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi8[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _DA, R_DSHUUSI1,
|
||||
0x11, _XTU, R_ONBIN1,
|
||||
0x02, _DE, _SI, R_DESHI,
|
||||
0x21, _XYO, R_SHO,
|
||||
0x31, _U, R_DESHOU,
|
||||
0x11, _SU, R_DESU,
|
||||
0x01, _TO, R_F_FUKUSHI,
|
||||
0x01, _TO, R_F_FUKUSI,
|
||||
0x11, _SI, R_SI1,
|
||||
0x11, _HA, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x11, _HA, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fukusi9[] = {
|
||||
0x00, R_FUKUSHI,
|
||||
0x00, R_FUKUSI,
|
||||
0x01, _SA, R_MIZEN1,
|
||||
0x01, _SI, R_SI1,
|
||||
0x11, _RO, R_MEIREI1,
|
||||
|
|
@ -942,11 +1014,12 @@ static unsigned char fukusi9[] = {
|
|||
0x21, _XYO, R_SHO,
|
||||
0x31, _U, R_DESHOU,
|
||||
0x11, _SU, R_DESU,
|
||||
0x01, _TO, R_F_FUKUSHI,
|
||||
0x01, _TO, R_F_FUKUSI,
|
||||
0x11, _SI, R_SI1,
|
||||
0x11, _HA, R_F_FUKUSHI,
|
||||
0x01, _NO, R_F_FUKUSHI,
|
||||
0xff};
|
||||
0x11, _HA, R_F_FUKUSI,
|
||||
0x01, _NO, R_F_FUKUSI,
|
||||
0xff
|
||||
};
|
||||
|
||||
unsigned char *conjadr[] = {
|
||||
0,
|
||||
|
|
@ -1168,4 +1241,5 @@ unsigned char* conjadr[] = {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
|
|
|||
38
const.h
38
const.h
|
|
@ -90,7 +90,7 @@
|
|||
#define AD_NotUserDict 0x0001
|
||||
#define AD_BadYomi 0x0002
|
||||
#define AD_BadKanji 0x0004
|
||||
#define AD_BadHinshi 0x0008
|
||||
#define AD_BadHinsi 0x0008
|
||||
|
||||
#define AD_ArExist 0x0010
|
||||
#define AD_OvflwDouBlk 0x0020
|
||||
|
|
@ -99,12 +99,12 @@
|
|||
#define AD_OvflwIndex 0x0100
|
||||
|
||||
#define AD_NoMidasi 0x0010
|
||||
#define AD_NoHinshi 0x0020
|
||||
#define AD_NoHinsi 0x0020
|
||||
#define AD_NoKanji 0x0040
|
||||
|
||||
#define C_WAKACHI 0x00
|
||||
#define C_MINASI 0x01
|
||||
#define C_BUNSETSU 0x02
|
||||
#define C_BUNSETU 0x02
|
||||
#define C_DICT 0x03
|
||||
#define C_N_ARABIA 0x04
|
||||
#define C_N_ARACMA 0x05
|
||||
|
|
@ -134,8 +134,8 @@
|
|||
#define K_DOUSHI 1
|
||||
#define K_YOUGEN 2
|
||||
#define K_TAIGEN 3
|
||||
#define K_FUKUSHI 4
|
||||
#define K_RENTAISHI 5
|
||||
#define K_FUKUSI 4
|
||||
#define K_RENTAISI 5
|
||||
#define K_SONOTA 6
|
||||
|
||||
#define EUC_a1 (unsigned char)0xa1
|
||||
|
|
@ -195,7 +195,7 @@
|
|||
|
||||
#define MaxYomiLength 32
|
||||
#define MaxKanjiLength 32
|
||||
#define MaxHinshiNumber 16
|
||||
#define MaxHinsiNumber 16
|
||||
#define MaxAtrNumber 16
|
||||
#define MaxJosiNumber 16
|
||||
|
||||
|
|
@ -205,20 +205,20 @@
|
|||
#define DouonBlkSizeNumber 3
|
||||
|
||||
#define DouonBlkTerm 0xff
|
||||
#define HinshiBlkTerm 0xff
|
||||
#define HinsiBlkTerm 0xff
|
||||
|
||||
#define NormalKanjiMask 0x7f
|
||||
#define SS3Kanji 0x0080
|
||||
#define ZenHiraAsshuku 0x80
|
||||
#define OffsetAsshuku 0x90
|
||||
#define ZenKataAsshuku 0xa0
|
||||
#define ZenHiraAssyuku 0x80
|
||||
#define OffsetAssyuku 0x90
|
||||
#define ZenKataAssyuku 0xa0
|
||||
#define AiAttribute 0xb0
|
||||
#define KanjiAsshuku 0xc0
|
||||
#define KanjiAssyuku 0xc0
|
||||
#define LeadingHankaku 0xd0
|
||||
#define KanjiStrEnd 0x00
|
||||
#define IsAsshuku 0x80
|
||||
#define IsAssyuku 0x80
|
||||
#define AssukuUse2byte 0x90
|
||||
#define KnjAsshukuMask 0x0f
|
||||
#define KnjAssyukuMask 0x0f
|
||||
#define KanjiCodeMask 0x0f
|
||||
#define KanjiModeMask 0xf0
|
||||
#define AtrMsKanjiOfs 0xc0c0
|
||||
|
|
@ -229,29 +229,29 @@
|
|||
#define IllegalFormat "\245\325\245\251\241\274\245\336\245\303\245\310\244\254\260\333\276\357\244\307\244\271"
|
||||
#define TooLongYomi "\306\311\244\337\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
|
||||
#define TooLongKanji "\264\301\273\372\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
|
||||
#define TooLongHinshi "\311\312\273\354\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
|
||||
#define TooLongHinsi "\311\312\273\354\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271"
|
||||
#define TooLongGroup "\245\260\245\353\241\274\245\327\314\276\244\254\260\333\276\357\244\307\244\271"
|
||||
#define TooLongJosi "\275\365\273\354\312\270\273\372\316\363\244\254\260\333\276\357\244\307\244\271"
|
||||
#define BadHinshi "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\311\312\273\354\244\307\244\271"
|
||||
#define BadHinsi "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\311\312\273\354\244\307\244\271"
|
||||
#define BadGroup "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\245\260\245\353\241\274\245\327\244\307\244\271"
|
||||
#define BadJosi "\305\320\317\277\244\265\244\354\244\306\244\244\244\312\244\244\275\365\273\354\244\307\244\271"
|
||||
#define NoYomiString "\306\311\244\337\312\270\273\372\316\363\244\254\274\350\306\300\244\307\244\255\244\336\244\273\244\363"
|
||||
#define NoKanjiString "\264\301\273\372\312\270\273\372\316\363\244\254\274\350\306\300\244\307\244\255\244\336\244\273\244\363"
|
||||
#define TooManyAtr "\302\260\300\255\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
|
||||
#define TooManyHinshi "\311\312\273\354\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
|
||||
#define TooManyHinsi "\311\312\273\354\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
|
||||
#define TooManyJosi "\275\365\273\354\244\316\277\364\244\254\302\277\244\271\244\256\244\336\244\271"
|
||||
#define NoDataInMain "\245\341\245\244\245\363\274\255\275\361\244\313\302\270\272\337\244\267\244\336\244\273\244\363"
|
||||
#define TooManyTarget "\311\312\273\354\244\362\243\261\244\304\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244"
|
||||
|
||||
#define HinshiTankan cnvhinshi("\303\261\264\301")
|
||||
#define HinsiTankan cnvhinsi("\303\261\264\301")
|
||||
|
||||
#define DIVLIST 1
|
||||
#define ASSHUKUREC 2
|
||||
#define ASSYUKUREC 2
|
||||
#define STRING 3
|
||||
#define HINDOREC 4
|
||||
#define OFFSETREC 5
|
||||
#define KANJIREC 6
|
||||
#define HINSHIREC 7
|
||||
#define HINSIREC 7
|
||||
#define DOUONREC 8
|
||||
|
||||
#endif /* SJ3_CONST_H_ */
|
||||
|
|
|
|||
159
conv.c
159
conv.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: conv.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:11 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include "wchar16.h"
|
||||
#include "select.h"
|
||||
|
|
@ -34,100 +42,63 @@
|
|||
#include "inkey.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define MSEC 300
|
||||
|
||||
|
||||
|
||||
int keyvalue;
|
||||
|
||||
char *funckey[] = {
|
||||
"\033OH",
|
||||
"\033OP",
|
||||
"\033OQ",
|
||||
"\033OR",
|
||||
"\033OS",
|
||||
"\033OT",
|
||||
"\033OU",
|
||||
"\033OV",
|
||||
"\033OW",
|
||||
"\033OX",
|
||||
"\033OY",
|
||||
"\033OZ",
|
||||
"\033[C",
|
||||
"\033OC",
|
||||
"\033[D",
|
||||
"\033OD",
|
||||
"\033[A",
|
||||
"\033OA",
|
||||
"\033[B",
|
||||
"\033OB",
|
||||
"\033[H",
|
||||
"\033[4~",
|
||||
"\033[11~",
|
||||
"\033[8~",
|
||||
"\033[12~",
|
||||
"\033[13~",
|
||||
"\033[9~",
|
||||
"\033[14~",
|
||||
"\033[15~",
|
||||
"\033[17~",
|
||||
"\033[18~",
|
||||
"\033[19~",
|
||||
"\033[20~",
|
||||
"\033[21~",
|
||||
"\033[7~",
|
||||
"\033OH", "\033OP", "\033OQ",
|
||||
"\033OR", "\033OS", "\033OT",
|
||||
"\033OU", "\033OV", "\033OW",
|
||||
"\033OX", "\033OY", "\033OZ",
|
||||
"\033[C", "\033OC", "\033[D",
|
||||
"\033OD", "\033[A", "\033OA",
|
||||
"\033[B", "\033OB", "\033[H",
|
||||
"\033[4~", "\033[11~", "\033[8~",
|
||||
"\033[12~", "\033[13~", "\033[9~",
|
||||
"\033[14~", "\033[15~", "\033[17~",
|
||||
"\033[18~", "\033[19~", "\033[20~",
|
||||
"\033[21~", "\033[7~",
|
||||
};
|
||||
|
||||
int funcvalue[] = {
|
||||
KEY_CONV,
|
||||
KEY_HENKAN,
|
||||
KEY_MUHENKAN,
|
||||
KEY_ETC,
|
||||
KEY_KETTEI,
|
||||
KEY_CODE,
|
||||
KEY_HALPHA,
|
||||
KEY_ZALPHA,
|
||||
KEY_HKATA,
|
||||
KEY_ZKATA,
|
||||
KEY_ZHIRA,
|
||||
KEY_OTHER,
|
||||
KEY_RIGHT,
|
||||
KEY_RIGHT,
|
||||
KEY_LEFT,
|
||||
KEY_LEFT,
|
||||
KEY_UP,
|
||||
KEY_UP,
|
||||
KEY_DOWN,
|
||||
KEY_DOWN,
|
||||
KEY_CONV,
|
||||
KEY_HENKAN,
|
||||
KEY_HENKAN,
|
||||
KEY_MUHENKAN,
|
||||
KEY_MUHENKAN,
|
||||
KEY_ETC,
|
||||
KEY_KETTEI,
|
||||
KEY_KETTEI,
|
||||
KEY_CODE,
|
||||
KEY_HALPHA,
|
||||
KEY_ZALPHA,
|
||||
KEY_HKATA,
|
||||
KEY_ZKATA,
|
||||
KEY_ZHIRA,
|
||||
KEY_CONV,
|
||||
KEY_CONV, KEY_HENKAN, KEY_MUHENKAN,
|
||||
KEY_ETC, KEY_KETTEI, KEY_CODE,
|
||||
KEY_HALPHA, KEY_ZALPHA, KEY_HKATA,
|
||||
KEY_ZKATA, KEY_ZHIRA, KEY_OTHER,
|
||||
KEY_RIGHT, KEY_RIGHT, KEY_LEFT,
|
||||
KEY_LEFT, KEY_UP, KEY_UP,
|
||||
KEY_DOWN, KEY_DOWN, KEY_CONV,
|
||||
KEY_HENKAN, KEY_HENKAN, KEY_MUHENKAN,
|
||||
KEY_MUHENKAN, KEY_ETC, KEY_KETTEI,
|
||||
KEY_KETTEI, KEY_CODE, KEY_HALPHA,
|
||||
KEY_ZALPHA, KEY_HKATA, KEY_ZKATA,
|
||||
KEY_ZHIRA, KEY_CONV,
|
||||
};
|
||||
|
||||
int keynumber = sizeof(funckey)/sizeof(char*);
|
||||
|
||||
|
||||
|
||||
extern int Direct;
|
||||
extern int master;
|
||||
extern wchar16_t Ukey[UKEYNUM][SEQLEN+1];
|
||||
extern int Uvalue[];
|
||||
extern int Unumber;
|
||||
|
||||
convert_stat() {
|
||||
|
||||
|
||||
convert_stat ()
|
||||
{
|
||||
stat_init ();
|
||||
stat_conv ();
|
||||
}
|
||||
|
||||
inputprocess() {
|
||||
inputprocess ()
|
||||
{
|
||||
int c;
|
||||
wchar16_t obuf[2];
|
||||
|
||||
|
|
@ -159,13 +130,15 @@ inputprocess() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
wchar16_t ibuf[KEYBUFSIZ];
|
||||
wchar16_t pars_seq[KEYBUFSIZ];
|
||||
int buf_count = 0;
|
||||
int pars_n;
|
||||
static int escape = 0;
|
||||
|
||||
inkey() {
|
||||
inkey ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
wchar16_t c;
|
||||
|
|
@ -177,7 +150,8 @@ inkey() {
|
|||
if (escape && cv->Cflag)
|
||||
master_flush ();
|
||||
c = *ibuf;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ((c = SJ_getchar ()) == (wchar16_t) EOF)
|
||||
|
||||
return ((short) c);
|
||||
|
|
@ -185,10 +159,12 @@ inkey() {
|
|||
buf_count = 1;
|
||||
}
|
||||
|
||||
|
||||
if (*ibuf == ESC) {
|
||||
keyvalue = sequence (ibuf, &buf_count);
|
||||
escape = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
escape = 0;
|
||||
}
|
||||
|
||||
|
|
@ -223,12 +199,15 @@ sequence(buf, count)
|
|||
int *count;
|
||||
{
|
||||
|
||||
|
||||
|
||||
int n;
|
||||
SELECT_FD ifds;
|
||||
struct timeval t;
|
||||
wchar16_t *s;
|
||||
int value;
|
||||
|
||||
|
||||
if (*count > 1 && (value = parse_escape (buf, count, 1)) != KEY_MORE)
|
||||
return (value);
|
||||
|
||||
|
|
@ -259,6 +238,8 @@ int* count;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
parse_escape (s, count, more)
|
||||
wchar16_t *s;
|
||||
int *count;
|
||||
|
|
@ -270,21 +251,28 @@ int more;
|
|||
|
||||
possible = 0;
|
||||
|
||||
|
||||
|
||||
for (i = 0 ; i < Unumber ; i ++) {
|
||||
|
||||
|
||||
for (j=0 ; j < *count ; j++) {
|
||||
if (s[j] != Ukey[i][j])
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (j == wslen (&Ukey[i][0])) {
|
||||
|
||||
|
||||
Strncpy (pars_seq, s, j);
|
||||
pars_seq[j] = (wchar16_t) '\0';
|
||||
pars_n = j;
|
||||
|
||||
|
||||
*count -= j;
|
||||
|
||||
|
||||
if (*count > 0) {
|
||||
Strncpy (temp, &s[j], *count);
|
||||
temp[*count] = (wchar16_t) '\0';
|
||||
|
|
@ -292,25 +280,33 @@ int more;
|
|||
}
|
||||
|
||||
return (Uvalue[i]);
|
||||
} else if(j == *count)
|
||||
}
|
||||
else if (j == *count)
|
||||
possible = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i = 0 ; i < keynumber ; i ++) {
|
||||
|
||||
|
||||
for (j = 0 ; j < *count ; j ++) {
|
||||
if (s[j] != (unsigned char)funckey[i][j])
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (j == strlen (funckey[i])) {
|
||||
|
||||
|
||||
Strncpy (pars_seq, s, j);
|
||||
pars_seq[j] = (wchar16_t) '\0';
|
||||
pars_n = j;
|
||||
|
||||
|
||||
*count -= j;
|
||||
|
||||
|
||||
if (*count > 0) {
|
||||
Strncpy (temp, &s[j], *count);
|
||||
temp[*count] = (wchar16_t) '\0';
|
||||
|
|
@ -318,7 +314,8 @@ int more;
|
|||
}
|
||||
|
||||
return (funcvalue[i]);
|
||||
} else if(j == *count)
|
||||
}
|
||||
else if (j == *count)
|
||||
possible = 1;
|
||||
}
|
||||
|
||||
|
|
@ -336,9 +333,11 @@ int more;
|
|||
}
|
||||
}
|
||||
|
||||
write_pseq(mod) int mod;
|
||||
write_pseq (mod)
|
||||
int mod;
|
||||
{
|
||||
|
||||
|
||||
if (mod == 3) {
|
||||
if (pars_n > 0) {
|
||||
pars_n = 0;
|
||||
|
|
@ -357,7 +356,8 @@ write_pseq(mod) int mod;
|
|||
if (pars_n == 1) {
|
||||
pars_n = 0;
|
||||
return (*pars_seq);
|
||||
} else if(IsGoto(*pars_seq)) {
|
||||
}
|
||||
else if (IsGoto (*pars_seq)) {
|
||||
Strncpy (&ibuf[buf_count], &pars_seq[1], pars_n - 1);
|
||||
buf_count += pars_n - 1;
|
||||
pars_n = 0;
|
||||
|
|
@ -369,3 +369,4 @@ write_pseq(mod) int mod;
|
|||
pars_n = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
13
conversion.h
13
conversion.h
|
|
@ -27,11 +27,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: conversion.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:43 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj2.h"
|
||||
#include "sj3libsj3.h"
|
||||
#include "henkan.h"
|
||||
|
||||
typedef struct bunsetsu_sj3 Bunsetsu;
|
||||
typedef struct bunsetu_sj3 Bunsetu;
|
||||
|
||||
typedef struct _Conversion {
|
||||
unsigned short out_mode[BUFFLENGTH*2];
|
||||
|
|
@ -68,7 +76,7 @@ typedef struct _Conversion {
|
|||
short CurBun;
|
||||
short PreBun;
|
||||
|
||||
Bunsetsu Bun[BUFFLENGTH];
|
||||
Bunsetu Bun[BUFFLENGTH];
|
||||
|
||||
wchar16_t out_buf[BUFFLENGTH * 2];
|
||||
unsigned char in_mode[BUFFLENGTH * 2];
|
||||
|
|
@ -96,6 +104,7 @@ typedef struct _Conversion {
|
|||
unsigned char wrap;
|
||||
} Conversion;
|
||||
|
||||
|
||||
wchar16_t osave_buf[BUFFLENGTH * 2];
|
||||
unsigned short osave_mode[BUFFLENGTH * 2];
|
||||
unsigned short isave_mode[BUFFLENGTH * 2];
|
||||
|
|
|
|||
22
cvtclknj.c
22
cvtclknj.c
|
|
@ -27,14 +27,32 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cvtclknj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:38 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
|
||||
|
||||
|
||||
void cvtkouho(), setstyrec();
|
||||
|
||||
void cvtclknj() {
|
||||
|
||||
|
||||
void cvtclknj()
|
||||
{
|
||||
KHREC *krec;
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
|
||||
if (!selectid) selectid = khcount;
|
||||
|
||||
i = khcount;
|
||||
|
|
@ -45,7 +63,9 @@ void cvtclknj() {
|
|||
krec++;
|
||||
}
|
||||
|
||||
|
||||
setstyrec(krec);
|
||||
|
||||
|
||||
cvtkouho(krec);
|
||||
}
|
||||
|
|
|
|||
58
cvtdict.c
58
cvtdict.c
|
|
@ -27,11 +27,24 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cvtdict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:40 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
||||
|
||||
|
||||
void
|
||||
cvtdict(KHREC *krec, CLREC *clrec, int flg)
|
||||
{
|
||||
TypeDicOfs ofs;
|
||||
unsigned char *yptr;
|
||||
int jlen;
|
||||
|
|
@ -42,14 +55,17 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
JREC *jrec;
|
||||
int i, j;
|
||||
|
||||
|
||||
ofs = krec -> offs;
|
||||
jrec = clrec -> jnode;
|
||||
cllen = clrec -> cllen;
|
||||
|
||||
yptr = inputyomi;
|
||||
|
||||
|
||||
jlen = jrec -> jlen;
|
||||
|
||||
|
||||
if ((i = jrec -> sttofs) != 0) {
|
||||
|
||||
if (i == SETTOU_KIGOU) {
|
||||
|
|
@ -57,6 +73,7 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
fptr = yptr;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
fptr = Settou_ptr(i);
|
||||
sttlen = SttYomiLen(fptr);
|
||||
|
|
@ -70,16 +87,20 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
yptr += sttlen * 2;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
sttlen = 0;
|
||||
|
||||
|
||||
if (flg) {
|
||||
|
||||
(*Cvtnum_func[krec->mode - 1])(ystart + sttlen, yptr, jrec);
|
||||
|
||||
|
||||
yptr += (i = jrec -> numlen) * 2;
|
||||
jlen -= i;
|
||||
|
||||
|
||||
if (jrec -> stbofs) {
|
||||
*kanjitmp++ = *yptr++;
|
||||
*kanjitmp++ = *yptr++;
|
||||
|
|
@ -89,16 +110,19 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
stblen = 0;
|
||||
}
|
||||
|
||||
else if((i = jrec->stbofs) && (fptr = getstb(jrec->hinshi))) {
|
||||
|
||||
else if ((i = jrec -> stbofs) && (fptr = getstb(jrec -> hinsi))) {
|
||||
fptr += i - 1;
|
||||
stblen = StbYomiLen(fptr);
|
||||
jlen -= stblen;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
stblen = 0;
|
||||
}
|
||||
|
||||
|
||||
if (ofs) {
|
||||
if (seldict(jrec -> dicid)) {
|
||||
(*curdict->getdic)(curdict, jrec -> jseg);
|
||||
|
|
@ -106,7 +130,8 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
kanjitmp +=
|
||||
getkanji(yptr, jlen, dicbuf + ofs, kanjitmp);
|
||||
yptr += jlen * 2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
while (jlen-- > 0) {
|
||||
for ( i = 0; i < euc_codesize(*yptr); i++)
|
||||
*kanjitmp++ = yptr[i];
|
||||
|
|
@ -115,6 +140,7 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (stblen) {
|
||||
i = StbKnjLen(fptr);
|
||||
fptr += stblen + 2;
|
||||
|
|
@ -122,6 +148,7 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
yptr += stblen * 2;
|
||||
}
|
||||
|
||||
|
||||
i = cllen - (jrec -> jlen);
|
||||
while (i-- > 0) {
|
||||
for ( j = 0; j < euc_codesize(*yptr); j++)
|
||||
|
|
@ -130,13 +157,18 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
|
|||
}
|
||||
}
|
||||
|
||||
void cvtminasi(int len) {
|
||||
|
||||
|
||||
void
|
||||
cvtminasi(int len)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = inputyomi;
|
||||
|
||||
while (len-- > 0) {
|
||||
|
||||
|
||||
if (isknj1(*ptr)) {
|
||||
*kanjitmp++ = *ptr++;
|
||||
*kanjitmp++ = *ptr++;
|
||||
|
|
@ -152,7 +184,11 @@ void cvtminasi(int len) {
|
|||
}
|
||||
}
|
||||
|
||||
void cvtwakachi(CLREC* clrec) {
|
||||
|
||||
|
||||
void
|
||||
cvtwakachi(CLREC *clrec)
|
||||
{
|
||||
int jlen;
|
||||
unsigned char *ym;
|
||||
int cnt;
|
||||
|
|
@ -160,6 +196,7 @@ void cvtwakachi(CLREC* clrec) {
|
|||
|
||||
ym = inputyomi;
|
||||
|
||||
|
||||
cnt = jlen = clrec -> jnode -> jlen;
|
||||
while (cnt-- > 0) {
|
||||
if (isknj1(*ym)) {
|
||||
|
|
@ -168,16 +205,19 @@ void cvtwakachi(CLREC* clrec) {
|
|||
ch = *++ym;
|
||||
if (0xa1 <= ch && ch <= 0xf3) {
|
||||
*kanjitmp++ = 0xa5;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*kanjitmp++ = 0xa4;
|
||||
}
|
||||
*kanjitmp++ = ch;
|
||||
ym++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*kanjitmp++ = *ym++;
|
||||
*kanjitmp++ = *ym++;
|
||||
}
|
||||
} else if(*ym == SS3) {
|
||||
}
|
||||
else if (*ym == SS3) {
|
||||
*kanjitmp++ = *ym++;
|
||||
*kanjitmp++ = *ym++;
|
||||
*kanjitmp++ = *ym++;
|
||||
|
|
@ -186,9 +226,11 @@ void cvtwakachi(CLREC* clrec) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
cnt = clrec -> cllen - jlen;
|
||||
while (cnt-- > 0) {
|
||||
|
||||
|
||||
if (isknj1(*ym)) {
|
||||
*kanjitmp++ = *ym++;
|
||||
*kanjitmp++ = *ym++;
|
||||
|
|
|
|||
54
cvtkanji.c
54
cvtkanji.c
|
|
@ -27,15 +27,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: cvtkanji.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:41 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
void mkknjmax();
|
||||
void mvmemi(), free_clall();
|
||||
void free_jall();
|
||||
|
||||
void cvtphknj(void) {
|
||||
|
||||
|
||||
void
|
||||
cvtphknj (void)
|
||||
{
|
||||
int i, j;
|
||||
CLREC *clrec;
|
||||
CLREC *clkp;
|
||||
|
|
@ -52,6 +66,7 @@ void cvtphknj(void) {
|
|||
clrec = clrec -> clsort;
|
||||
}
|
||||
|
||||
|
||||
if (clkp && stdytop) {
|
||||
|
||||
if (stdytop -> nmflg)
|
||||
|
|
@ -60,40 +75,54 @@ void cvtphknj(void) {
|
|||
|
||||
kouhotbl[0].rank = 1;
|
||||
|
||||
|
||||
kanjitmp = kanjibuf + 1;
|
||||
|
||||
|
||||
setstyrec(kouhotbl);
|
||||
|
||||
|
||||
cvtkouho(kouhotbl);
|
||||
|
||||
|
||||
i = kanjitmp - kanjibuf;
|
||||
if (i < kanjilen) {
|
||||
|
||||
kanjilen -= i;
|
||||
|
||||
|
||||
ystart += clt1st -> cllen;
|
||||
|
||||
j = hzstrlen(inputyomi, (int)clt1st -> cllen);
|
||||
kanjibuf[0] = (unsigned char)j;
|
||||
|
||||
|
||||
inputyomi += j;
|
||||
|
||||
|
||||
memcpy(kanjibuf, kanjipos, i);
|
||||
kanjipos += i;
|
||||
} else
|
||||
}
|
||||
else
|
||||
kanjilen = 0;
|
||||
|
||||
not_enough_memory:
|
||||
|
||||
|
||||
free_clall(clt1st);
|
||||
free_jall (jrt1st);
|
||||
}
|
||||
|
||||
void cvtkouho(KHREC* krec) {
|
||||
|
||||
|
||||
void
|
||||
cvtkouho (KHREC *krec)
|
||||
{
|
||||
CLREC *clrec;
|
||||
|
||||
clrec = krec -> clrec;
|
||||
|
||||
|
||||
switch (clrec -> jnode -> class) {
|
||||
case C_DICT:
|
||||
cvtdict(krec, clrec, FALSE);
|
||||
|
|
@ -112,7 +141,7 @@ void cvtkouho(KHREC* krec) {
|
|||
cvtdict(krec, clrec, TRUE);
|
||||
break;
|
||||
|
||||
case C_BUNSETSU:
|
||||
case C_BUNSETU :
|
||||
case C_MINASI :
|
||||
cvtminasi((int)clrec -> cllen);
|
||||
break;
|
||||
|
|
@ -122,10 +151,15 @@ void cvtkouho(KHREC* krec) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
*kanjitmp++ = 0;
|
||||
}
|
||||
|
||||
void setstyrec(KHREC* krec) {
|
||||
|
||||
|
||||
void
|
||||
setstyrec (KHREC *krec)
|
||||
{
|
||||
JREC *jrec;
|
||||
KHREC *kptr;
|
||||
int ii;
|
||||
|
|
@ -134,11 +168,13 @@ void setstyrec(KHREC* krec) {
|
|||
|
||||
jrec = krec -> clrec -> jnode;
|
||||
|
||||
|
||||
if (krec -> mode && !krec -> offs) {
|
||||
|
||||
for (ii = khcount, kptr = kouhotbl ; ii--; kptr++)
|
||||
if (kptr -> rank == 1) break;
|
||||
|
||||
|
||||
stdy.stdy1.offset = kptr -> offs;
|
||||
stdy.stdy1.seg = kptr -> clrec -> jnode -> jseg;
|
||||
stdy.stdy1.styno = kptr -> styno;
|
||||
|
|
@ -155,19 +191,23 @@ void setstyrec(KHREC* krec) {
|
|||
}
|
||||
stdy.stdy1.sttkj = krec -> sttkj;
|
||||
stdy.stdy1.ka_kj = krec -> ka_kj;
|
||||
stdy.hinshi = jrec->hinshi;
|
||||
stdy.hinshi = jrec -> hinsi;
|
||||
stdy.len = jrec -> jlen;
|
||||
stdy.sttfg = krec -> sttfg;
|
||||
stdy.ka_fg = krec -> ka_fg;
|
||||
|
||||
if(jrec->stbofs && (fptr = getstb(jrec->hinshi)) != NULL)
|
||||
|
||||
if (jrec -> stbofs && (fptr = getstb(jrec -> hinsi)) != NULL)
|
||||
stdy.len -= StbYomiLen(fptr + jrec -> stbofs - 1);
|
||||
|
||||
|
||||
if ((fptr = Settou_ptr(jrec -> sttofs)) != NULL)
|
||||
stdy.sttlen = SttYomiLen(fptr);
|
||||
else
|
||||
stdy.sttlen = 0;
|
||||
|
||||
|
||||
memcpy((unsigned char *)&stdy, kanjitmp, sizeof(STDYOUT));
|
||||
kanjitmp += sizeof(STDYOUT);
|
||||
}
|
||||
|
||||
|
|
|
|||
58
deldic.c
58
deldic.c
|
|
@ -27,21 +27,34 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: deldic.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:42 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
void mvmemi();
|
||||
void mkidxtbl();
|
||||
|
||||
|
||||
static int del_douon(TypeDicSeg seg, unsigned char* ptr, TypeDicOfs ofs);
|
||||
static int del_segment(TypeDicSeg seg);
|
||||
static void del_uidx(TypeDicSeg seg);
|
||||
static void del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size);
|
||||
|
||||
|
||||
unsigned int
|
||||
deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
||||
deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinsi)
|
||||
{
|
||||
unsigned char yptr[MaxWdYomiLen + 1];
|
||||
unsigned char kptr[MaxWdKanjiLen + 1];
|
||||
unsigned int err;
|
||||
|
|
@ -56,7 +69,7 @@ deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
unsigned char *stp, *edp;
|
||||
int size, len;
|
||||
|
||||
if((err = addel_arg(yomi, kanji, hinshi, yptr, sizeof(yptr))) != 0)
|
||||
if ((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) != 0)
|
||||
return err;
|
||||
|
||||
if ((curdict -> maxunit) == 0) return AD_NotUserDict;
|
||||
|
|
@ -71,11 +84,11 @@ deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
|
||||
if ((dblknum = srchkana(&p1, &samlen)) == 0) return AD_NoMidasi;
|
||||
|
||||
if((hblknum = srchgram(p1, &p2, hinshi)) == 0) return AD_NoHinshi;
|
||||
if ((hblknum = srchgram(p1, &p2, hinsi)) == 0) return AD_NoHinsi;
|
||||
|
||||
p3 = p2;
|
||||
kblknum = srchkanji(&p3, kptr, knjlen);
|
||||
if(*p3 == HinshiBlkTerm) return AD_NoKanji;
|
||||
if (*p3 == HinsiBlkTerm) return AD_NoKanji;
|
||||
ofs = p3 - dicbuf;
|
||||
|
||||
edp = skipkstr(p3);
|
||||
|
|
@ -84,14 +97,17 @@ deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
if (hblknum == 1) {
|
||||
if (dblknum == 1) {
|
||||
return del_segment(useg);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return del_douon(useg, p1, ofs);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
stp = p2;
|
||||
edp++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
stp = p3;
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +129,10 @@ deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi) {
|
|||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
del_douon(TypeDicSeg seg, unsigned char* ptr, TypeDicOfs ofs) {
|
||||
del_douon(TypeDicSeg seg, unsigned char* ptr, TypeDicOfs ofs)
|
||||
{
|
||||
unsigned char *nxt, *p1, *p2;
|
||||
int size;
|
||||
int nlen, plen, len;
|
||||
|
|
@ -125,13 +143,15 @@ del_douon(TypeDicSeg seg, unsigned char* ptr, TypeDicOfs ofs) {
|
|||
size = nxt - ptr;
|
||||
|
||||
memset(ptr, DicSegTerm, dicbuf + curdict->seglen - nxt);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
size = getsize(nxt);
|
||||
nlen = getnlen(nxt);
|
||||
plen = getplen(nxt);
|
||||
|
||||
if (ptr == segtop()) {
|
||||
if(nlen + plen > (unsigned int)count_uidx() + strlen(get_idxptr(seg)))
|
||||
if (nlen + plen > (unsigned int) count_uidx()
|
||||
+ strlen(get_idxptr(seg)))
|
||||
return AD_OvflwIndex;
|
||||
}
|
||||
|
||||
|
|
@ -159,8 +179,10 @@ del_douon(TypeDicSeg seg, unsigned char* ptr, TypeDicOfs ofs) {
|
|||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
del_segment(TypeDicSeg seg) {
|
||||
del_segment(TypeDicSeg seg)
|
||||
{
|
||||
int i;
|
||||
STDYIN *styp;
|
||||
TypeDicID dicid;
|
||||
|
|
@ -173,7 +195,8 @@ del_segment(TypeDicSeg seg) {
|
|||
(*curdict->putdic)(curdict, sg - 1);
|
||||
}
|
||||
curdict->segunit--;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
memset(dicbuf, DicSegTerm, (int)curdict->seglen);
|
||||
dicbuf[0] = 0;
|
||||
(*curdict->putdic)(curdict, DicSegBase);
|
||||
|
|
@ -213,13 +236,16 @@ del_segment(TypeDicSeg seg) {
|
|||
return AD_Done;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
del_uidx(TypeDicSeg seg) {
|
||||
del_uidx(TypeDicSeg seg)
|
||||
{
|
||||
unsigned char *p, *q;
|
||||
int len;
|
||||
|
||||
p = get_idxptr(seg);
|
||||
for(q = p; *q++;);
|
||||
for (q = p ; *q++; )
|
||||
;
|
||||
|
||||
mvmemi(q, p, idxbuf + curdict->idxlen - q);
|
||||
|
||||
|
|
@ -231,8 +257,10 @@ del_uidx(TypeDicSeg seg) {
|
|||
mkidxtbl(curdict);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size) {
|
||||
del_stdy(TypeDicSeg seg, TypeDicOfs ofs, int size)
|
||||
{
|
||||
int i;
|
||||
TypeStyNum stdynum;
|
||||
STDYIN *stdy;
|
||||
|
|
|
|||
357
depend.c
357
depend.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: depend.c,v $
|
||||
* $SonyRevision: 1.4 $
|
||||
* $SonyDate: 1997/10/07 07:39:45 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include <errno.h>
|
||||
|
|
@ -39,6 +48,7 @@
|
|||
#include "sj3err.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
#if defined(__FD_SET) && !defined(FD_SET)
|
||||
# define FD_SET __FD_SET
|
||||
# define FD_CLR __FD_CLR
|
||||
|
|
@ -47,11 +57,14 @@
|
|||
extern int serv_errno;
|
||||
extern Global *work_base;
|
||||
|
||||
|
||||
DictFile *dictlink = NULL;
|
||||
StdyFile *stdylink = NULL;
|
||||
|
||||
|
||||
static long
|
||||
get4byte(unsigned char* p) {
|
||||
get4byte(unsigned char* p)
|
||||
{
|
||||
long i;
|
||||
|
||||
i = *p;
|
||||
|
|
@ -61,89 +74,91 @@ get4byte(unsigned char* p) {
|
|||
}
|
||||
|
||||
static void
|
||||
Put4byte(unsigned char* p, long n) {
|
||||
Put4byte(unsigned char* p, long n)
|
||||
{
|
||||
p += 3;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p = n;
|
||||
}
|
||||
|
||||
#define put4byte(p, n) Put4byte((p), (long)(n))
|
||||
|
||||
|
||||
static int
|
||||
fgetfile(FILE* fp, long pos, int len, void* p) {
|
||||
fgetfile(FILE* fp, long pos, int len, void* p)
|
||||
{
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
}
|
||||
if (fread(p, len, 1, fp) != 1) {
|
||||
serv_errno = SJ3_FileReadError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileReadError; return ERROR;
|
||||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
|
||||
static int
|
||||
fputfile(FILE* fp, long pos, int len, unsigned char* p) {
|
||||
fputfile(FILE* fp, long pos, int len, unsigned char* p)
|
||||
{
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
}
|
||||
if (fwrite(p, len, 1, fp) != 1) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileWriteError; return ERROR;
|
||||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
|
||||
static int
|
||||
getfile(int fd, off_t pos, int len, void* p) {
|
||||
getfile(int fd, off_t pos, int len, void* p)
|
||||
{
|
||||
if (lseek(fd, pos, L_SET) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
}
|
||||
if (read(fd, p, len) != len) {
|
||||
serv_errno = SJ3_FileReadError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileReadError; return ERROR;
|
||||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
|
||||
static int
|
||||
putfile(int fd, off_t pos, int len, void* p) {
|
||||
putfile(int fd, off_t pos, int len, void* p)
|
||||
{
|
||||
if (lseek(fd, pos, L_SET) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileSeekError; return ERROR;
|
||||
}
|
||||
if (write(fd, p, len) != len) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
return ERROR;
|
||||
serv_errno = SJ3_FileWriteError; return ERROR;
|
||||
}
|
||||
return SJ3_NormalEnd;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_passwd(unsigned char* buf, char* passwd) {
|
||||
check_passwd(unsigned char* buf, char* passwd)
|
||||
{
|
||||
buf += PasswdPos;
|
||||
return (*buf && strncmp(passwd, buf, PasswdLen)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
set_passwd(unsigned char* buf, char* passwd) {
|
||||
set_passwd(unsigned char* buf, char* passwd)
|
||||
{
|
||||
strncpy(buf + PasswdPos, passwd, PasswdLen);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_dictfile(unsigned char* buf) {
|
||||
check_dictfile(unsigned char* buf)
|
||||
{
|
||||
return (DictVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
|
||||
static DictFile*
|
||||
search_same_dict(ino_t ino) {
|
||||
search_same_dict(ino_t ino)
|
||||
{
|
||||
DictFile *p;
|
||||
|
||||
for (p = dictlink ; p != NULL ; p = p -> link)
|
||||
|
|
@ -152,32 +167,38 @@ search_same_dict(ino_t ino) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getofs(DictFile* dp) {
|
||||
getofs(DictFile* dp)
|
||||
{
|
||||
idxofs = dp -> ofsptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
getidx(DictFile* dp) {
|
||||
getidx(DictFile* dp)
|
||||
{
|
||||
idxbuf = dp -> buffer + dp -> idxstrt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
getdic(DictFile* dp, TypeDicSeg seg) {
|
||||
getdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
if (seg >= dp->dict.segunit) return -1;
|
||||
dicbuf = dp->buffer + dp->segstrt + dp->dict.seglen * seg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
putidx(DictFile* dp, TypeDicSeg seg) {
|
||||
putidx(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
return putfile(dp->fd, dp->idxstrt, dp->dict.idxlen, idxbuf);
|
||||
}
|
||||
|
||||
static int
|
||||
putdic(DictFile* dp, TypeDicSeg seg) {
|
||||
putdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
unsigned char *p;
|
||||
long i, j;
|
||||
|
||||
|
|
@ -205,7 +226,8 @@ putdic(DictFile* dp, TypeDicSeg seg) {
|
|||
}
|
||||
|
||||
static int
|
||||
rszdic(DictFile* dp, TypeDicSeg seg) {
|
||||
rszdic(DictFile* dp, TypeDicSeg seg)
|
||||
{
|
||||
long i;
|
||||
unsigned char *p;
|
||||
|
||||
|
|
@ -229,8 +251,10 @@ rszdic(DictFile* dp, TypeDicSeg seg) {
|
|||
return putfile(dp->fd, 0, HeaderLength, dp->buffer);
|
||||
}
|
||||
|
||||
|
||||
DictFile*
|
||||
opendict(char* name, char* passwd) {
|
||||
opendict(char* name, char* passwd)
|
||||
{
|
||||
FILE *fp;
|
||||
struct stat sbuf;
|
||||
DictFile *dfp;
|
||||
|
|
@ -238,6 +262,7 @@ opendict(char* name, char* passwd) {
|
|||
int i;
|
||||
unsigned char *dp;
|
||||
|
||||
|
||||
if (stat(name, &sbuf) == ERROR) {
|
||||
if (errno == ENOENT)
|
||||
serv_errno = SJ3_FileNotExist;
|
||||
|
|
@ -246,30 +271,32 @@ opendict(char* name, char* passwd) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ((dfp = search_same_dict(sbuf.st_ino)) != NULL) {
|
||||
dfp->refcnt++;
|
||||
return dfp;
|
||||
dfp -> refcnt++; return dfp;
|
||||
}
|
||||
|
||||
|
||||
if ((fp = fopen(name, "r+")) == NULL) {
|
||||
if ((fp = fopen(name, "r")) == NULL) {
|
||||
serv_errno = SJ3_CannotOpenFile;
|
||||
return NULL;
|
||||
serv_errno = SJ3_CannotOpenFile; return NULL;
|
||||
}
|
||||
i = FALSE;
|
||||
} else
|
||||
}
|
||||
else
|
||||
i = TRUE;
|
||||
|
||||
|
||||
if (fgetfile(fp, 0L, sizeof(tmp), tmp) == ERROR) goto error1;
|
||||
|
||||
|
||||
if (!check_dictfile(tmp)) {
|
||||
serv_errno = SJ3_IllegalDictFile;
|
||||
goto error1;
|
||||
serv_errno = SJ3_IllegalDictFile; goto error1;
|
||||
}
|
||||
|
||||
|
||||
if (!check_passwd(tmp, passwd)) {
|
||||
serv_errno = SJ3_IncorrectPasswd;
|
||||
goto error1;
|
||||
serv_errno = SJ3_IncorrectPasswd; goto error1;
|
||||
}
|
||||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
|
||||
|
|
@ -277,12 +304,10 @@ opendict(char* name, char* passwd) {
|
|||
#else
|
||||
if ((dp = (unsigned char *)malloc(sbuf.st_size)) == NULL) {
|
||||
#endif
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error1;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error1;
|
||||
}
|
||||
if ((dfp = (DictFile *)malloc(sizeof(*dfp))) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error2;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error2;
|
||||
}
|
||||
memset(dfp, '\0', sizeof(*dfp));
|
||||
|
||||
|
|
@ -314,8 +339,7 @@ opendict(char* name, char* passwd) {
|
|||
if (i < dfp -> dict.maxunit) i = dfp -> dict.maxunit;
|
||||
i *= sizeof(TypeIdxOfs);
|
||||
if ((dfp -> ofsptr = (TypeIdxOfs *)malloc(i)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error3;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error3;
|
||||
}
|
||||
mkidxtbl(&(dfp -> dict));
|
||||
|
||||
|
|
@ -324,21 +348,25 @@ opendict(char* name, char* passwd) {
|
|||
|
||||
return dfp;
|
||||
|
||||
error3:
|
||||
free((char*)dfp);
|
||||
error2:
|
||||
free((char*)dp);
|
||||
error1:
|
||||
fclose(fp);
|
||||
|
||||
|
||||
error3: free((char *)dfp);
|
||||
error2: free((char *)dp);
|
||||
error1: fclose(fp);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int closedict(DictFile* dfp) {
|
||||
|
||||
int
|
||||
closedict(DictFile* dfp)
|
||||
{
|
||||
DictFile *df;
|
||||
|
||||
|
||||
if (--dfp->refcnt > 0) return 0;
|
||||
|
||||
|
||||
if (dictlink == dfp)
|
||||
dictlink = dfp -> link;
|
||||
else {
|
||||
|
|
@ -349,8 +377,10 @@ int closedict(DictFile* dfp) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (dfp -> fp) fclose(dfp ->fp);
|
||||
|
||||
|
||||
free((char *)(dfp -> ofsptr));
|
||||
free((char *)(dfp -> buffer));
|
||||
free((char *)dfp);
|
||||
|
|
@ -358,27 +388,38 @@ int closedict(DictFile* dfp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static fd_set zero_fd_set = { { 0 } };
|
||||
|
||||
void lock_dict(DictFile* p, int fd) {
|
||||
void
|
||||
lock_dict(DictFile* p, int fd)
|
||||
{
|
||||
FD_SET(fd, &(p -> lock));
|
||||
}
|
||||
|
||||
void unlock_dict(DictFile* p, int fd) {
|
||||
void
|
||||
unlock_dict(DictFile* p, int fd)
|
||||
{
|
||||
FD_CLR(fd, &(p -> lock));
|
||||
}
|
||||
|
||||
int is_dict_locked(DictFile* p) {
|
||||
int
|
||||
is_dict_locked(DictFile* p)
|
||||
{
|
||||
return memcmp(&(p -> lock), &zero_fd_set, sizeof(zero_fd_set));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_stdyfile(unsigned char* buf) {
|
||||
check_stdyfile(unsigned char* buf)
|
||||
{
|
||||
return (StdyVersion != get4byte(buf + VersionPos)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
|
||||
static StdyFile*
|
||||
search_same_stdy(ino_t ino) {
|
||||
search_same_stdy(ino_t ino)
|
||||
{
|
||||
StdyFile *p;
|
||||
|
||||
for (p = stdylink ; p != NULL ; p = p -> link)
|
||||
|
|
@ -387,8 +428,10 @@ search_same_stdy(ino_t ino) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
StdyFile*
|
||||
openstdy(char* name, char* passwd) {
|
||||
openstdy(char* name, char* passwd)
|
||||
{
|
||||
FILE *fp;
|
||||
struct stat sbuf;
|
||||
StdyFile *sfp;
|
||||
|
|
@ -401,6 +444,7 @@ openstdy(char* name, char* passwd) {
|
|||
long clstdypos, clstdylen, clstdystep;
|
||||
long len;
|
||||
|
||||
|
||||
if (stat(name, &sbuf) == ERROR) {
|
||||
if (errno == ENOENT)
|
||||
serv_errno = SJ3_FileNotExist;
|
||||
|
|
@ -409,34 +453,36 @@ openstdy(char* name, char* passwd) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ((sfp = search_same_stdy(sbuf.st_ino)) != NULL) {
|
||||
sfp->refcnt++;
|
||||
return sfp;
|
||||
sfp -> refcnt++; return sfp;
|
||||
}
|
||||
|
||||
|
||||
if ((hd = (unsigned char *)malloc(HeaderLength+CommentLength)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
return NULL;
|
||||
serv_errno = SJ3_NotEnoughMemory; return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ((fp = fopen(name, "r+")) == NULL) {
|
||||
serv_errno = SJ3_CannotOpenFile;
|
||||
goto error0;
|
||||
serv_errno = SJ3_CannotOpenFile; goto error0;
|
||||
}
|
||||
|
||||
|
||||
if (fgetfile(fp, 0L, HeaderLength+CommentLength, hd) == ERROR)
|
||||
goto error1;
|
||||
|
||||
|
||||
if (!check_stdyfile(hd)) {
|
||||
serv_errno = SJ3_IllegalStdyFile;
|
||||
goto error1;
|
||||
serv_errno = SJ3_IllegalStdyFile; goto error1;
|
||||
}
|
||||
|
||||
|
||||
if (!check_passwd(hd, passwd)) {
|
||||
serv_errno = SJ3_IncorrectPasswd;
|
||||
goto error1;
|
||||
serv_errno = SJ3_IncorrectPasswd; goto error1;
|
||||
}
|
||||
|
||||
|
||||
stdycnt = get4byte(hd + StdyNormCnt);
|
||||
stdypos = get4byte(hd + StdyNormPos);
|
||||
stdylen = get4byte(hd + StdyNormLen);
|
||||
|
|
@ -448,28 +494,27 @@ openstdy(char* name, char* passwd) {
|
|||
clstdystep = get4byte(hd + StdyClIdxStep);
|
||||
len = sizeof(STDYIN) * stdymax;
|
||||
|
||||
|
||||
if ((sfp = (StdyFile *)malloc(sizeof(*sfp))) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error1;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error1;
|
||||
}
|
||||
memset(sfp, '\0', sizeof(*sfp));
|
||||
if ((sp = (STDYIN *)malloc(len)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error2;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error2;
|
||||
}
|
||||
if ((cip = (unsigned short *)malloc(clidxlen)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error3;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error3;
|
||||
}
|
||||
if ((clp = (unsigned char *)malloc(clstdylen)) == NULL) {
|
||||
serv_errno = SJ3_NotEnoughMemory;
|
||||
goto error4;
|
||||
serv_errno = SJ3_NotEnoughMemory; goto error4;
|
||||
}
|
||||
|
||||
|
||||
if (fgetfile(fp, clidxpos, clidxlen, cip) == ERROR) goto error5;
|
||||
if (fgetfile(fp, clstdypos, clstdylen, clp) == ERROR) goto error5;
|
||||
if (fgetfile(fp, stdypos, len, sp) == ERROR) stdycnt = 0;
|
||||
|
||||
|
||||
sfp -> stdy.stdycnt = stdycnt;
|
||||
sfp -> stdy.stdymax = stdymax;
|
||||
sfp -> stdy.stdydic = sp;
|
||||
|
|
@ -488,27 +533,28 @@ openstdy(char* name, char* passwd) {
|
|||
|
||||
return sfp;
|
||||
|
||||
error5:
|
||||
free((char*)clp);
|
||||
error4:
|
||||
free((char*)cip);
|
||||
error3:
|
||||
free((char*)sp);
|
||||
error2:
|
||||
free((char*)sfp);
|
||||
error1:
|
||||
fclose(fp);
|
||||
error0:
|
||||
free((char*)hd);
|
||||
|
||||
|
||||
error5: free((char *)clp);
|
||||
error4: free((char *)cip);
|
||||
error3: free((char *)sp);
|
||||
error2: free((char *)sfp);
|
||||
error1: fclose(fp);
|
||||
error0: free((char *)hd);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int closestdy(StdyFile* sfp) {
|
||||
|
||||
int
|
||||
closestdy(StdyFile* sfp)
|
||||
{
|
||||
StdyFile *sf;
|
||||
|
||||
|
||||
if (--sfp->refcnt > 0) return 0;
|
||||
|
||||
|
||||
if (stdylink == sfp)
|
||||
stdylink = sfp -> link;
|
||||
else {
|
||||
|
|
@ -519,8 +565,10 @@ int closestdy(StdyFile* sfp) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (sfp -> fp) fclose(sfp ->fp);
|
||||
|
||||
|
||||
free((char *)sfp -> stdy.stdydic);
|
||||
free((char *)sfp -> stdy.clstdyidx);
|
||||
free((char *)sfp -> stdy.clstdydic);
|
||||
|
|
@ -530,7 +578,10 @@ int closestdy(StdyFile* sfp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int putstydic(void) {
|
||||
|
||||
int
|
||||
putstydic(void)
|
||||
{
|
||||
int fd;
|
||||
unsigned char *hd;
|
||||
StdyFile *sf;
|
||||
|
|
@ -540,17 +591,23 @@ int putstydic(void) {
|
|||
fd = sf -> fd;
|
||||
hd = sf -> header;
|
||||
|
||||
|
||||
put4byte(hd + StdyNormCnt, sf -> stdy.stdycnt);
|
||||
|
||||
|
||||
len = sizeof(STDYIN) * sf -> stdy.stdymax;
|
||||
put4byte(hd + StdyNormLen, len);
|
||||
|
||||
|
||||
if (putfile(fd, 0, HeaderLength+CommentLength, hd)) return ERROR;
|
||||
|
||||
|
||||
return putfile(fd, get4byte(hd + StdyNormPos), len, sf -> stdy.stdydic);
|
||||
}
|
||||
|
||||
int putcldic(void) {
|
||||
int
|
||||
putcldic(void)
|
||||
{
|
||||
int fd;
|
||||
unsigned char *hd;
|
||||
StdyFile *sf;
|
||||
|
|
@ -566,56 +623,56 @@ int putcldic(void) {
|
|||
get4byte(hd + StdyClSegLen), sf -> stdy.clstdydic);
|
||||
}
|
||||
|
||||
int makedict(char* path, int idxlen, int seglen, int segnum) {
|
||||
|
||||
int
|
||||
makedict(char* path, int idxlen, int seglen, int segnum)
|
||||
{
|
||||
FILE *fp;
|
||||
unsigned char tmp[HeaderLength + CommentLength];
|
||||
long pos = HeaderLength + CommentLength;
|
||||
int ret = ERROR;
|
||||
int i;
|
||||
|
||||
|
||||
if (idxlen < MinIdxLen || seglen < MinSegLen || segnum < MinSegNum) {
|
||||
serv_errno = SJ3_IllegalParameter;
|
||||
return ret;
|
||||
serv_errno = SJ3_IllegalParameter; return ret;
|
||||
}
|
||||
|
||||
if (!(fp = fopen(path, "w"))) {
|
||||
serv_errno = SJ3_CannotCreateFile;
|
||||
return ret;
|
||||
serv_errno = SJ3_CannotCreateFile; return ret;
|
||||
}
|
||||
memset(tmp, '\0', sizeof(tmp));
|
||||
put4byte(tmp + VersionPos, DictVersion);
|
||||
|
||||
|
||||
put4byte(tmp + DictIdxPos, pos);
|
||||
put4byte(tmp + DictIdxLen, idxlen);
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileSeekError; goto error;
|
||||
}
|
||||
for (i = 0 ; i < idxlen ; i++)
|
||||
if (putc(0, fp)) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
pos += idxlen;
|
||||
|
||||
|
||||
put4byte(tmp + DictSegPos, pos);
|
||||
put4byte(tmp + DictSegLen, seglen);
|
||||
put4byte(tmp + DictSegNum, 1);
|
||||
put4byte(tmp + DictSegMax, segnum);
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileSeekError; goto error;
|
||||
}
|
||||
if (putc(0, fp)) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
for (i = 1 ; i < seglen ; i++)
|
||||
if (putc(0xff, fp) != 0xff) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
|
||||
|
||||
if (fputfile(fp, 0L, sizeof(tmp), tmp) == SJ3_NormalEnd)
|
||||
ret = SJ3_NormalEnd;
|
||||
error:
|
||||
|
|
@ -624,78 +681,78 @@ error:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int makestdy(char* path, int stynum, int clstep, int cllen) {
|
||||
|
||||
int
|
||||
makestdy(char* path, int stynum, int clstep, int cllen)
|
||||
{
|
||||
FILE *fp;
|
||||
unsigned char tmp[HeaderLength + CommentLength];
|
||||
long pos = HeaderLength + CommentLength;
|
||||
int ret = ERROR;
|
||||
int i, j;
|
||||
|
||||
|
||||
if (stynum == 0) stynum = MinStyNum;
|
||||
if (clstep == 0) clstep = MinClStep;
|
||||
if (cllen == 0) cllen = MinClLen;
|
||||
|
||||
|
||||
if (stynum < MinStyNum || clstep < MinClStep || cllen < MinClLen) {
|
||||
serv_errno = SJ3_IllegalParameter;
|
||||
return ret;
|
||||
serv_errno = SJ3_IllegalParameter; return ret;
|
||||
}
|
||||
if (stynum > MaxStyNum || clstep > MaxClStep || cllen > MaxClLen) {
|
||||
serv_errno = SJ3_IllegalParameter;
|
||||
return ret;
|
||||
serv_errno = SJ3_IllegalParameter; return ret;
|
||||
}
|
||||
|
||||
if (!(fp = fopen(path, "w"))) {
|
||||
serv_errno = SJ3_CannotCreateFile;
|
||||
return ret;
|
||||
serv_errno = SJ3_CannotCreateFile; return ret;
|
||||
}
|
||||
memset(tmp, '\0', sizeof(tmp));
|
||||
put4byte(tmp + VersionPos, StdyVersion);
|
||||
|
||||
|
||||
j = 256 * sizeof(unsigned short);
|
||||
put4byte(tmp + StdyClIdxPos, pos);
|
||||
put4byte(tmp + StdyClIdxLen, j);
|
||||
put4byte(tmp + StdyClIdxStep, clstep);
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileSeekError; goto error;
|
||||
}
|
||||
for (i = 0 ; i < j ; i++)
|
||||
if (putc(0, fp)) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
pos += j;
|
||||
|
||||
|
||||
put4byte(tmp + StdyClSegPos, pos);
|
||||
put4byte(tmp + StdyClSegLen, cllen);
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileSeekError; goto error;
|
||||
}
|
||||
for (i = 0 ; i < cllen ; i++)
|
||||
if (putc(0, fp)) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
pos += cllen;
|
||||
|
||||
|
||||
j = sizeof(STDYIN) * stynum;
|
||||
put4byte(tmp + StdyNormPos, pos);
|
||||
put4byte(tmp + StdyNormLen, j);
|
||||
put4byte(tmp + StdyNormNum, stynum);
|
||||
put4byte(tmp + StdyNormCnt, 0);
|
||||
if (fseek(fp, pos, 0) == ERROR) {
|
||||
serv_errno = SJ3_FileSeekError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileSeekError; goto error;
|
||||
}
|
||||
for (i = 0 ; i < j ; i++) {
|
||||
if (putc(0, fp)) {
|
||||
serv_errno = SJ3_FileWriteError;
|
||||
goto error;
|
||||
serv_errno = SJ3_FileWriteError; goto error;
|
||||
}
|
||||
}
|
||||
pos += j;
|
||||
|
||||
|
||||
if (fputfile(fp, 0L, sizeof(tmp), tmp) == SJ3_NormalEnd)
|
||||
ret = SJ3_NormalEnd;
|
||||
error:
|
||||
|
|
@ -704,17 +761,25 @@ error:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void sj_closeall(void) {
|
||||
|
||||
void
|
||||
sj_closeall(void)
|
||||
{
|
||||
while (dictlink) closedict(dictlink);
|
||||
while (stdylink) closestdy(stdylink);
|
||||
}
|
||||
|
||||
int set_dictpass(DictFile* dp, char* pass) {
|
||||
|
||||
int
|
||||
set_dictpass(DictFile* dp, char* pass)
|
||||
{
|
||||
set_passwd(dp -> buffer, pass);
|
||||
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
|
||||
}
|
||||
|
||||
int set_stdypass(char* pass) {
|
||||
int
|
||||
set_stdypass(char* pass)
|
||||
{
|
||||
StdyFile *sp;
|
||||
|
||||
sp = (StdyFile *)stdy_base;
|
||||
|
|
@ -722,17 +787,24 @@ int set_stdypass(char* pass) {
|
|||
return putfile(sp->fd, 0, HeaderLength+CommentLength, sp->header);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_comment(unsigned char* buf, char* comment) {
|
||||
set_comment(unsigned char* buf, char* comment)
|
||||
{
|
||||
strncpy(buf + HeaderLength, comment, CommentLength);
|
||||
}
|
||||
|
||||
int set_dictcmnt(DictFile* dp, char* cmnt) {
|
||||
int
|
||||
set_dictcmnt(DictFile* dp, char* cmnt)
|
||||
{
|
||||
set_comment(dp -> buffer, cmnt);
|
||||
return putfile(dp->fd, 0, HeaderLength+CommentLength, dp->buffer);
|
||||
}
|
||||
|
||||
int set_stdycmnt(char* cmnt) {
|
||||
int
|
||||
set_stdycmnt(char* cmnt)
|
||||
{
|
||||
StdyFile *sp;
|
||||
|
||||
sp = (StdyFile *)stdy_base;
|
||||
|
|
@ -740,7 +812,10 @@ int set_stdycmnt(char* cmnt) {
|
|||
return putfile(sp->fd, 0, HeaderLength+CommentLength, sp->header);
|
||||
}
|
||||
|
||||
void get_stdysize(int* stynum, int* clstep, int* cllen) {
|
||||
|
||||
void
|
||||
get_stdysize(int* stynum, int* clstep, int* cllen)
|
||||
{
|
||||
*stynum = StudyMax;
|
||||
*clstep = ClStudyStep;
|
||||
*cllen = ClStudyLen;
|
||||
|
|
|
|||
23
dict.c
23
dict.c
|
|
@ -27,12 +27,24 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: dict.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:45 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
void get_askknj(void) {
|
||||
|
||||
void
|
||||
get_askknj(void)
|
||||
{
|
||||
unsigned char *p;
|
||||
unsigned char *q;
|
||||
unsigned char *r;
|
||||
|
|
@ -61,7 +73,10 @@ void get_askknj(void) {
|
|||
}
|
||||
}
|
||||
|
||||
int seldict(TypeDicID id) {
|
||||
|
||||
int
|
||||
seldict(TypeDicID id)
|
||||
{
|
||||
DICTL *dp;
|
||||
|
||||
for (dp = dictlist ; dp ; dp = dp -> next) {
|
||||
|
|
@ -73,8 +88,10 @@ int seldict(TypeDicID id) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
get_idxptr(TypeDicSeg seg) {
|
||||
get_idxptr(TypeDicSeg seg)
|
||||
{
|
||||
(*curdict->getofs)(curdict);
|
||||
(*curdict->getidx)(curdict);
|
||||
|
||||
|
|
|
|||
14
dictdisp.c
14
dictdisp.c
|
|
@ -27,12 +27,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: dictdisp.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:34 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
void
|
||||
dictdisp(output) char* output;
|
||||
dictdisp(output)
|
||||
char *output;
|
||||
{
|
||||
unsigned char buf[BUFSIZ];
|
||||
unsigned char *p;
|
||||
|
|
@ -46,7 +55,8 @@ void
|
|||
error_out("%s \244\254\245\252\241\274\245\327\245\363\244\307\244\255\244\336\244\273\244\363", output);
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
fp = stdout;
|
||||
|
||||
flg = sj3_getdict_mb(buf);
|
||||
|
|
|
|||
20
dictmake.c
20
dictmake.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: dictmake.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:35 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_sysvdef.h"
|
||||
#include <stdio.h>
|
||||
#ifdef SVR4
|
||||
|
|
@ -46,7 +55,8 @@ extern int force_flag;
|
|||
extern int verbose_flag;
|
||||
extern int _sys_code;
|
||||
|
||||
static void touroku(y, k, h) char *y, *k, *h;
|
||||
static void touroku(y, k, h)
|
||||
char *y, *k, *h;
|
||||
{
|
||||
int err;
|
||||
int grm;
|
||||
|
|
@ -108,7 +118,7 @@ static void touroku(y, k, h) char *y, *k, *h;
|
|||
if (force_flag) break;
|
||||
exit(1);
|
||||
|
||||
case SJ3_BAD_HINSHI_CODE:
|
||||
case SJ3_BAD_HINSI_CODE:
|
||||
error_out("\305\320\317\277\244\307\244\255\244\312\244\244\311\312\273\354\244\307\244\271 %s:%s:%s", y, k, h);
|
||||
if (force_flag) break;
|
||||
exit(1);
|
||||
|
|
@ -125,7 +135,8 @@ static void touroku(y, k, h) char *y, *k, *h;
|
|||
}
|
||||
|
||||
void
|
||||
dictmake(input) char* input;
|
||||
dictmake(input)
|
||||
char *input;
|
||||
{
|
||||
unsigned char buf[BUFSIZ];
|
||||
FILE *fp;
|
||||
|
|
@ -141,7 +152,8 @@ void
|
|||
error_out("%s \244\254\245\252\241\274\245\327\245\363\244\307\244\255\244\336\244\273\244\363", input);
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
fp = stdin;
|
||||
|
||||
while (fgets((char *)buf, sizeof(buf), fp)) {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ void output_str(FILE* fp, char* p);
|
|||
void output_int (FILE* fp, int* p);
|
||||
void output_yomi (FILE* fp, unsigned char* p);
|
||||
|
||||
/* cnvhinshi.c */
|
||||
int cnvhinshi(unsigned char* buf);
|
||||
/* cnvhinsi.c */
|
||||
int cnvhinsi (unsigned char *buf);
|
||||
|
||||
/* file.c */
|
||||
FILE* Fopen (char* filename, char* type);
|
||||
|
|
@ -67,7 +67,7 @@ void knjhnd_set(unsigned char* p, int l);
|
|||
void knjhnd_reset (unsigned char* p, int l);
|
||||
int decide_knjask (void);
|
||||
void clear_hindo (void);
|
||||
void clear_asshuku(void);
|
||||
void clear_assyuku (void);
|
||||
|
||||
/* knjcvt.c */
|
||||
unsigned char* knjofscvt (unsigned char* ptr, int len, int* ret);
|
||||
|
|
@ -82,7 +82,7 @@ void mark_file(FILE* out);
|
|||
/* makelist.c */
|
||||
void clear_list (void);
|
||||
void flush_douon (void);
|
||||
void makelist(int* yomi, int* kanji, int hinshi, int* atr);
|
||||
void makelist (int* yomi, int* kanji, int hinsi, int* atr);
|
||||
|
||||
/* makeseg.c */
|
||||
size_t make_knjstr (unsigned char* src, int len, unsigned char* dst);
|
||||
|
|
@ -112,3 +112,4 @@ int last_strcmp(int* src, int* dst);
|
|||
int string_cmp (unsigned char* p1, int l1, unsigned char* p2, int l2);
|
||||
|
||||
#endif /* _DICTTOOL_H_ */
|
||||
|
||||
|
|
|
|||
118
display.c
118
display.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: display.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:12 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_sysvdef.h"
|
||||
#include <errno.h>
|
||||
#include "common.h"
|
||||
|
|
@ -37,6 +45,8 @@ char bp[TCBUFSIZE];
|
|||
char bpwork[AREASIZE];
|
||||
char cmove[SHORTLENGTH];
|
||||
|
||||
|
||||
|
||||
extern int master;
|
||||
extern int vflag;
|
||||
extern char term_name[];
|
||||
|
|
@ -46,7 +56,10 @@ char * CM, *US, *UE, *SO, *SE, *CE, *CS, *BEL, *RP, *AP, *TS, *FS, *DS, *I2;
|
|||
char *SC,*RC,*SR,*DO;
|
||||
static int keyboard = OTHER_KB;
|
||||
|
||||
checkterm() {
|
||||
|
||||
|
||||
checkterm ()
|
||||
{
|
||||
char *kb, *area, *tgetstr (), *tmp;
|
||||
int val;
|
||||
Conversion *cv;
|
||||
|
|
@ -123,6 +136,7 @@ checkterm() {
|
|||
}
|
||||
#ifdef SVR4
|
||||
|
||||
|
||||
if (strstr(term_name, "news") != NULL) {
|
||||
keyboard = NEWS_KB;
|
||||
set_news();
|
||||
|
|
@ -143,28 +157,33 @@ checkterm() {
|
|||
strcpy (cmove, CM);
|
||||
}
|
||||
|
||||
void outc(c) char c;
|
||||
void outc(c)
|
||||
char c;
|
||||
{
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
void erroutc(c) {
|
||||
void erroutc(c)
|
||||
{
|
||||
fputc (c, stderr);
|
||||
}
|
||||
|
||||
start_guideline() {
|
||||
start_guideline ()
|
||||
{
|
||||
if (status_line && I2)
|
||||
tputs(I2, 1, erroutc);
|
||||
}
|
||||
|
||||
end_guideline() {
|
||||
end_guideline ()
|
||||
{
|
||||
if (status_line) {
|
||||
tputs(DS, 1, outc);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
put_space(n) int n;
|
||||
put_space (n)
|
||||
int n;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -172,11 +191,13 @@ put_space(n) int n;
|
|||
putchar (' ');
|
||||
}
|
||||
|
||||
Backspace() {
|
||||
Backspace ()
|
||||
{
|
||||
putchar (BS);
|
||||
}
|
||||
|
||||
master_flush() {
|
||||
master_flush ()
|
||||
{
|
||||
SELECT_FD ifds;
|
||||
int nc;
|
||||
struct timeval t;
|
||||
|
|
@ -204,7 +225,8 @@ master_flush() {
|
|||
return (0);
|
||||
}
|
||||
|
||||
ThroughIntr() {
|
||||
ThroughIntr ()
|
||||
{
|
||||
wchar16_t s[2];
|
||||
|
||||
SJ_read (s, 1);
|
||||
|
|
@ -212,42 +234,58 @@ ThroughIntr() {
|
|||
if (isintr (*s)) {
|
||||
master_out (s, 1);
|
||||
return (1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
unget_inkey2 (s, 1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
under_in() {
|
||||
under_in ()
|
||||
{
|
||||
tputs(US, 1, outc);
|
||||
}
|
||||
|
||||
under_out() {
|
||||
under_out ()
|
||||
{
|
||||
tputs(UE, 1, outc);
|
||||
}
|
||||
|
||||
reverse_in() {
|
||||
reverse_in ()
|
||||
{
|
||||
tputs(SO, 1, outc);
|
||||
}
|
||||
|
||||
reverse_out() {
|
||||
reverse_out ()
|
||||
{
|
||||
tputs(SE, 1, outc);
|
||||
}
|
||||
|
||||
beep() {
|
||||
|
||||
|
||||
beep ()
|
||||
{
|
||||
tputs(BEL, 1, outc);
|
||||
Flush ();
|
||||
}
|
||||
|
||||
CursorSet(row, col) unsigned short row, col;
|
||||
|
||||
|
||||
CursorSet (row, col)
|
||||
unsigned short row, col;
|
||||
{
|
||||
tputs(tgoto(CM, col - 1, row - 1), 1, outc);
|
||||
Flush ();
|
||||
}
|
||||
|
||||
RegionSet(row1, row2) int row1, row2;
|
||||
|
||||
|
||||
RegionSet (row1, row2)
|
||||
int row1, row2;
|
||||
{
|
||||
|
||||
|
||||
|
||||
tputs (SC, 1, outc);
|
||||
tputs (tgoto (CS, row2, row1 - 1), 1, outc);
|
||||
tputs (RC, 1, outc);
|
||||
|
|
@ -265,7 +303,8 @@ RegionSet(row1, row2) int row1, row2;
|
|||
|
||||
int master_flush_flag = 1;
|
||||
|
||||
CursorRead(row, col) unsigned short* row, *col;
|
||||
CursorRead (row, col)
|
||||
unsigned short *row, *col;
|
||||
{
|
||||
|
||||
int count;
|
||||
|
|
@ -294,6 +333,8 @@ CursorRead(row, col) unsigned short* row, *col;
|
|||
*col = col2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define CRPLIM 4
|
||||
#define BACKLIM 16
|
||||
#define MARKER '%'
|
||||
|
|
@ -308,6 +349,8 @@ int *row, *col;
|
|||
wchar16_t Back[BACKLIM];
|
||||
int Back_count, count;
|
||||
|
||||
|
||||
|
||||
count = 0;
|
||||
Back_count = 0;
|
||||
c = '\0';
|
||||
|
|
@ -342,14 +385,16 @@ top:
|
|||
if (isdigit (c)) {
|
||||
*(sd ++) = c;
|
||||
*sd = '\0';
|
||||
} else if(c == *sa)
|
||||
}
|
||||
else if (c == *sa)
|
||||
break;
|
||||
else
|
||||
goto top;
|
||||
}
|
||||
if (c == SEPARA)
|
||||
sd = Cchar;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
c = CRI ();
|
||||
if (c == ESC)
|
||||
goto top;
|
||||
|
|
@ -365,6 +410,8 @@ top:
|
|||
return (SUCC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
unget_inkey2 (s, n)
|
||||
wchar16_t *s;
|
||||
int n;
|
||||
|
|
@ -379,7 +426,8 @@ int n;
|
|||
}
|
||||
}
|
||||
|
||||
unget_key(c) int c;
|
||||
unget_key (c)
|
||||
int c;
|
||||
{
|
||||
wchar16_t tmp[2];
|
||||
|
||||
|
|
@ -387,19 +435,26 @@ unget_key(c) int c;
|
|||
unget_inkey2 (tmp, 1);
|
||||
}
|
||||
|
||||
CRI() {
|
||||
|
||||
|
||||
CRI ()
|
||||
{
|
||||
wchar16_t c;
|
||||
|
||||
SJ_read (&c, 1);
|
||||
return (c);
|
||||
}
|
||||
|
||||
Clear_EOL() {
|
||||
|
||||
|
||||
Clear_EOL ()
|
||||
{
|
||||
reverse_out();
|
||||
tputs(CE, 1, outc);
|
||||
}
|
||||
|
||||
StartGuide(row, col) unsigned short* row, *col;
|
||||
StartGuide (row, col)
|
||||
unsigned short *row, *col;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -407,29 +462,34 @@ StartGuide(row, col) unsigned short* row, *col;
|
|||
master_flush_flag = 0;
|
||||
if (status_line) {
|
||||
tputs (tgoto (TS, 0, 0), 1, outc);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
CursorRead (row, col);
|
||||
CursorSet (cv->line + 1, 0);
|
||||
}
|
||||
Flush ();
|
||||
}
|
||||
|
||||
EndGuide(row, col) unsigned short row, col;
|
||||
EndGuide (row, col)
|
||||
unsigned short row, col;
|
||||
{
|
||||
if (status_line) {
|
||||
tputs (FS, 1, outc);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
CursorSet (row, col);
|
||||
}
|
||||
Flush ();
|
||||
master_flush_flag = 1;
|
||||
}
|
||||
|
||||
Flush() {
|
||||
Flush ()
|
||||
{
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
Cscroll() {
|
||||
Cscroll ()
|
||||
{
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
|
|
|||
93
douon.c
93
douon.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: douon.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1996/02/23 11:04:02 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "key.h"
|
||||
#include "wchar16.h"
|
||||
|
|
@ -37,7 +45,7 @@ static int Dpoint;
|
|||
static struct douon_sj3 HenkanDouon[DOUON_N];
|
||||
static wchar16_t Dkanji[BUFFLENGTH * 2];
|
||||
|
||||
void go_gakushuu();
|
||||
void go_gakusyuu();
|
||||
|
||||
SJ_getdouon (s, d, n, choice, reconv)
|
||||
wchar16_t *s;
|
||||
|
|
@ -50,6 +58,7 @@ int reconv;
|
|||
|
||||
Dcount = SJ2_getdouon (s, d, n, choice, reconv);
|
||||
|
||||
|
||||
if (Dcount < 0 && !dconnect(1))
|
||||
Dcount = SJ2_getdouon (s, d, n, choice, reconv);
|
||||
|
||||
|
|
@ -64,7 +73,10 @@ int reconv;
|
|||
return(1);
|
||||
}
|
||||
|
||||
exec_douon() {
|
||||
|
||||
|
||||
exec_douon ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int val;
|
||||
|
||||
|
|
@ -82,7 +94,8 @@ exec_douon() {
|
|||
Rdisp ();
|
||||
}
|
||||
|
||||
wrap_douon(back) int back;
|
||||
wrap_douon (back)
|
||||
int back;
|
||||
{
|
||||
Conversion *cv;
|
||||
int val;
|
||||
|
|
@ -103,11 +116,14 @@ wrap_douon(back) int back;
|
|||
Rdisp ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Cdouon (yomi, gnum)
|
||||
wchar16_t *yomi;
|
||||
int gnum;
|
||||
{
|
||||
|
||||
|
||||
int i, j;
|
||||
int len;
|
||||
wchar16_t *s;
|
||||
|
|
@ -118,13 +134,13 @@ int gnum;
|
|||
char tmp[BUFFLENGTH], tmp2[BUFFLENGTH * 2];
|
||||
wchar16_t wtmp[BUFFLENGTH], wtmp2[BUFFLENGTH * 2];
|
||||
|
||||
int gakushuu;
|
||||
int gakusyuu;
|
||||
unsigned short row, col;
|
||||
Conversion *cv;
|
||||
|
||||
cv = current_conversion;
|
||||
|
||||
gakushuu = SJ_getdouon(yomi, HenkanDouon, gnum, 0, 0);
|
||||
gakusyuu = SJ_getdouon (yomi, HenkanDouon, gnum, 0, 0);
|
||||
|
||||
dispnum = DNUM;
|
||||
if (dispnum > Dcount)
|
||||
|
|
@ -181,9 +197,11 @@ int gnum;
|
|||
Flush ();
|
||||
num = Dselect (j);
|
||||
|
||||
|
||||
if (num == 0)
|
||||
continue;
|
||||
|
||||
|
||||
else if (num == -1) {
|
||||
if ((i >= Dcount) && ((Dcount % dispnum) != 0))
|
||||
i = Dcount - (Dcount % dispnum);
|
||||
|
|
@ -196,17 +214,20 @@ int gnum;
|
|||
i = Dcount - dispnum;
|
||||
else
|
||||
i = Dcount - (Dcount % dispnum);
|
||||
} else
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
else if (num > j) {
|
||||
disp_mode ();
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
|
@ -221,7 +242,7 @@ int gnum;
|
|||
if (HenkanDouon[Dpoint].valid)
|
||||
PushGD (gnum, &HenkanDouon[Dpoint].dcid);
|
||||
|
||||
if(gakushuu)
|
||||
if (gakusyuu)
|
||||
if (HenkanDouon[Dpoint].valid)
|
||||
SJ2_study (&HenkanDouon[Dpoint].dcid);
|
||||
else
|
||||
|
|
@ -230,7 +251,8 @@ int gnum;
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
Dselect(lim) int lim;
|
||||
Dselect (lim)
|
||||
int lim;
|
||||
{
|
||||
extern int keyvalue;
|
||||
int c, num;
|
||||
|
|
@ -248,7 +270,8 @@ Dselect(lim) int lim;
|
|||
return (0);
|
||||
else if (c == ' ')
|
||||
return (0);
|
||||
else if(keyvalue == KEY_MUHENKAN || keyvalue == KEY_LEFT || is_bsdel(c))
|
||||
else if (keyvalue == KEY_MUHENKAN || keyvalue == KEY_LEFT
|
||||
|| is_bsdel (c))
|
||||
return (-1);
|
||||
else if (WcIsASCII(c) && isdigit (WcLowByte(c))) {
|
||||
*s = c;
|
||||
|
|
@ -256,7 +279,8 @@ Dselect(lim) int lim;
|
|||
num = atoi (s);
|
||||
if (num > 0 && num <= lim)
|
||||
return (num);
|
||||
} else if(keyvalue != KEY_NORMAL)
|
||||
}
|
||||
else if (keyvalue != KEY_NORMAL)
|
||||
break;
|
||||
else if (keyvalue == KEY_NORMAL && IsESC (c))
|
||||
break;
|
||||
|
|
@ -264,6 +288,7 @@ Dselect(lim) int lim;
|
|||
return (lim + 1);
|
||||
}
|
||||
|
||||
|
||||
Gdouon (yomi, num, choice, reconv)
|
||||
wchar16_t *yomi;
|
||||
int num;
|
||||
|
|
@ -271,6 +296,7 @@ int choice;
|
|||
int reconv;
|
||||
{
|
||||
|
||||
|
||||
int len;
|
||||
wchar16_t *s;
|
||||
|
||||
|
|
@ -285,7 +311,8 @@ int reconv;
|
|||
PushGD (num, &HenkanDouon[Dpoint].dcid);
|
||||
}
|
||||
|
||||
Sdouon(Choice) int Choice;
|
||||
Sdouon (Choice)
|
||||
int Choice;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
|
|
@ -306,14 +333,17 @@ top:
|
|||
cv->Pkettei[i] = MODE_ZHIRA;
|
||||
*Dkanji = '\0';
|
||||
goto null;
|
||||
} else if(len > DLEN) {
|
||||
}
|
||||
else if (len > DLEN) {
|
||||
cv->Bkettei[i] |= Bmuhenkan;
|
||||
cv->Bkettei[i] &= ~Bhenkan;
|
||||
*Dkanji = '\0';
|
||||
goto null;
|
||||
} else if(Choice == 0 && (cv->Bkettei[i] & Bmuhenkan)) {
|
||||
}
|
||||
else if (Choice == 0 && (cv->Bkettei[i] & Bmuhenkan)) {
|
||||
goto tail;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cv->Bkettei[i] |= Bhenkan;
|
||||
cv->Bkettei[i] &= ~Bmuhenkan;
|
||||
}
|
||||
|
|
@ -322,9 +352,11 @@ top:
|
|||
if (Cdouon (yomi, i) == FALSE)
|
||||
return (1);
|
||||
cv->Pkettei[i] = MODE_ZHIRA;
|
||||
} else if(Choice == 2) {
|
||||
}
|
||||
else if (Choice == 2) {
|
||||
Gdouon (yomi, i, 0, 0);
|
||||
} else if(Choice == 3)
|
||||
}
|
||||
else if (Choice == 3)
|
||||
Gdouon (yomi, i, count, 1);
|
||||
else
|
||||
Gdouon (yomi, i, count, 0);
|
||||
|
|
@ -338,7 +370,8 @@ null:
|
|||
cv->Edit[i] = j;
|
||||
cv->Epoint[j] = &(cv->Ebuff[cv->e_point]);
|
||||
cv->e_point += DLEN;
|
||||
} else
|
||||
}
|
||||
else
|
||||
j = cv->Edit[i];
|
||||
if (0 < len && len <= DLEN) {
|
||||
cv->Bkettei[i] |= Bedit;
|
||||
|
|
@ -357,7 +390,10 @@ tail:
|
|||
return (0);
|
||||
}
|
||||
|
||||
Rdouon(back) int back;
|
||||
|
||||
|
||||
Rdouon (back)
|
||||
int back;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
|
|
@ -370,7 +406,8 @@ Rdouon(back) int back;
|
|||
Dpoint --;
|
||||
if (Dpoint < 0)
|
||||
Dpoint = Dcount - 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Dpoint ++;
|
||||
if (Dpoint >= Dcount)
|
||||
Dpoint = 0;
|
||||
|
|
@ -412,13 +449,15 @@ Bkanji(kanji)
|
|||
|
||||
struct studyrec Gdata[BUFFLENGTH];
|
||||
|
||||
PushGD(num, wordid) int num;
|
||||
PushGD (num, wordid)
|
||||
int num;
|
||||
struct studyrec *wordid;
|
||||
{
|
||||
Gdata[num] = *wordid;
|
||||
}
|
||||
|
||||
cl_gakushuu() {
|
||||
cl_gakusyuu ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
int o_point, n_point;
|
||||
|
|
@ -436,13 +475,14 @@ cl_gakushuu() {
|
|||
break;
|
||||
}
|
||||
j--;
|
||||
check_and_gakushuu(i, j);
|
||||
check_and_gakusyuu (i, j);
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check_and_gakushuu(m, n) int m, n;
|
||||
check_and_gakusyuu (m, n)
|
||||
int m, n;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
|
|
@ -452,14 +492,15 @@ check_and_gakushuu(m, n) int m, n;
|
|||
j = i + 1;
|
||||
while (j <= n && j < cv->Bnum) {
|
||||
if (cv->Bkettei[i] & Bedit && !(cv->Bkettei[i] & Bmuhenkan))
|
||||
go_gakushuu(i);
|
||||
go_gakusyuu (i);
|
||||
i ++;
|
||||
j ++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
go_gakushuu(n) int n;
|
||||
go_gakusyuu (n)
|
||||
int n;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
|
|
@ -474,11 +515,13 @@ void
|
|||
if (cv->Pedited[i] == 1 || cv->Pedited[j] == 1)
|
||||
return;
|
||||
|
||||
|
||||
if ((len = load_bun(i, yomi1, MODE_ZHIRA)) <= 0 && len > DLEN)
|
||||
return;
|
||||
if ((len = load_bun(j, yomi2, MODE_ZHIRA)) > DLEN)
|
||||
return;
|
||||
|
||||
|
||||
if (len <= 0)
|
||||
gdatap = NULL;
|
||||
else
|
||||
|
|
|
|||
94
edit.c
94
edit.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: edit.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1997/01/23 11:09:36 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "key.h"
|
||||
|
||||
|
|
@ -36,7 +44,8 @@ static wchar16_t* jpoint;
|
|||
static int iedit, jedit;
|
||||
static int ilen, jlen;
|
||||
|
||||
push_obj(i, j) int i, j;
|
||||
push_obj (i, j)
|
||||
int i, j;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -48,7 +57,8 @@ push_obj(i, j) int i, j;
|
|||
jedit = cv->Bkettei[j];
|
||||
}
|
||||
|
||||
pop_obj(i, j) int i, j;
|
||||
pop_obj (i, j)
|
||||
int i, j;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -60,7 +70,10 @@ pop_obj(i, j) int i, j;
|
|||
cv->Bkettei[j] = jedit;
|
||||
}
|
||||
|
||||
Bbig() {
|
||||
|
||||
|
||||
Bbig ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j, k;
|
||||
int moji, last, val;
|
||||
|
|
@ -95,7 +108,8 @@ Bbig() {
|
|||
if (cv->Bkettei[i] & Bhenkan) {
|
||||
val = Sdouon (0);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cv->Bkettei[i] |= Bmuhenkan;
|
||||
cv->Bkettei[i] &= ~Bhenkan;
|
||||
cv->Bkettei[j] |= Bmuhenkan;
|
||||
|
|
@ -108,7 +122,8 @@ Bbig() {
|
|||
return (1);
|
||||
}
|
||||
break;
|
||||
} else
|
||||
}
|
||||
else
|
||||
j ++;
|
||||
}
|
||||
beep ();
|
||||
|
|
@ -117,7 +132,10 @@ Bbig() {
|
|||
return (0);
|
||||
}
|
||||
|
||||
Bsmall(small) int small;
|
||||
|
||||
|
||||
Bsmall (small)
|
||||
int small;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j, k, moji;
|
||||
|
|
@ -136,12 +154,14 @@ Bsmall(small) int small;
|
|||
cv->Pkettei[j] = cv->Pkettei[i];
|
||||
cv->Bkettei[j] |= Bmuhenkan;
|
||||
cv->Bkettei[j] &= ~Bhenkan;
|
||||
} else if(small) {
|
||||
}
|
||||
else if (small) {
|
||||
while (j < cv->Bnum - 1 && cv->Plen[j] == 0)
|
||||
j ++;
|
||||
if (j == cv->Bnum)
|
||||
j --;
|
||||
} else if(cv->Plen[j] != 0 && cv->Enum < MAXENUM) {
|
||||
}
|
||||
else if (cv->Plen[j] != 0 && cv->Enum < MAXENUM) {
|
||||
for (k = cv->Bnum ; k > j ; k --) {
|
||||
cv->Plen[k] = cv->Plen[k - 1];
|
||||
cv->Ppoint[k] = cv->Ppoint[k - 1];
|
||||
|
|
@ -159,12 +179,14 @@ Bsmall(small) int small;
|
|||
cv->Plen[j] = 0;
|
||||
cv->Bkettei[j] = Bmuhenkan;
|
||||
cv->Displen[j] = 0;
|
||||
} else if(cv->Plen[j] != 0) {
|
||||
}
|
||||
else if (cv->Plen[j] != 0) {
|
||||
while (j < cv->Bnum - 1 && cv->Plen[j] == 0)
|
||||
j ++;
|
||||
if (j == cv->Bnum)
|
||||
j --;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
while (j < cv->Bnum - 1 && cv->Plen[j] == 0 &&
|
||||
cv->Plen[j+1] == 0)
|
||||
j ++;
|
||||
|
|
@ -192,7 +214,8 @@ Bsmall(small) int small;
|
|||
if (cv->Bkettei[i] & Bhenkan) {
|
||||
val = Sdouon (0);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cv->Bkettei[i] |= Bmuhenkan;
|
||||
cv->Bkettei[i] &= ~Bhenkan;
|
||||
cv->Bkettei[j] |= Bmuhenkan;
|
||||
|
|
@ -206,13 +229,17 @@ Bsmall(small) int small;
|
|||
}
|
||||
beep ();
|
||||
pop_obj (i, j);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
beep ();
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void Bdelete() {
|
||||
|
||||
void
|
||||
Bdelete ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j, deletelen, val;
|
||||
|
||||
|
|
@ -253,14 +280,17 @@ void Bdelete() {
|
|||
beep ();
|
||||
pop_obj (i, j);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
beep ();
|
||||
all_set_up ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Chain(n, len) int n;
|
||||
Chain (n, len)
|
||||
int n;
|
||||
int len;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
|
@ -302,11 +332,13 @@ int len;
|
|||
|
||||
for (i = n + 1 ; i < cv->Bnum ; i ++)
|
||||
cv->Ppoint[i] -= len;
|
||||
|
||||
}
|
||||
|
||||
static int Elimit;
|
||||
static int Ehlimit;
|
||||
exec_edit() {
|
||||
exec_edit ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int edit, inc, i;
|
||||
wchar16_t *s;
|
||||
|
|
@ -338,6 +370,7 @@ exec_edit() {
|
|||
Zcol = 0;
|
||||
Flush ();
|
||||
|
||||
|
||||
cur = cv->Ppoint[bun] - cv->Ppoint[0];
|
||||
ncur = cur + cv->Plen[bun];
|
||||
s = cv->Ppoint[bun];
|
||||
|
|
@ -508,11 +541,14 @@ exec_edit() {
|
|||
if (iswdigit (inc)) {
|
||||
if (numpoint > 1) {
|
||||
|
||||
|
||||
number[0] = number[1];
|
||||
number[1] = inc;
|
||||
} else
|
||||
}
|
||||
else
|
||||
number[numpoint ++] = inc;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
num = getnum (number, &numpoint);
|
||||
beep ();
|
||||
}
|
||||
|
|
@ -579,8 +615,7 @@ int* numpoint;
|
|||
}
|
||||
|
||||
Replace(Hs, Zs, omode, cur, num)
|
||||
wchar16_t* Hs,
|
||||
*Zs;
|
||||
wchar16_t *Hs, *Zs;
|
||||
unsigned short *omode;
|
||||
int cur, num;
|
||||
{
|
||||
|
|
@ -656,9 +691,9 @@ int cur, num;
|
|||
return(num);
|
||||
}
|
||||
|
||||
|
||||
Substitute(Hs, Zs, omode, cur, num)
|
||||
wchar16_t* Hs,
|
||||
*Zs;
|
||||
wchar16_t *Hs, *Zs;
|
||||
unsigned short *omode;
|
||||
int *cur, num;
|
||||
{
|
||||
|
|
@ -686,8 +721,7 @@ int * cur, num;
|
|||
}
|
||||
|
||||
Insert(Hs, Zs, omode, cur)
|
||||
wchar16_t* Hs,
|
||||
*Zs;
|
||||
wchar16_t *Hs, *Zs;
|
||||
unsigned short *omode;
|
||||
int cur;
|
||||
{
|
||||
|
|
@ -718,8 +752,7 @@ int cur;
|
|||
if (iswcntrl(inc) && !is_bs(inc))
|
||||
beep ();
|
||||
else if (((len = wslen(ztmp)) >= limit ||
|
||||
(rlen = wslen(htmp)) >= hlimit) &&
|
||||
!is_bs(inc))
|
||||
(rlen = wslen(htmp)) >= hlimit) && !is_bs(inc))
|
||||
beep();
|
||||
else
|
||||
(void)exec_romaji2(inc, htmp, ztmp, otmp, len, rlen);
|
||||
|
|
@ -756,8 +789,7 @@ int cur;
|
|||
}
|
||||
|
||||
EditDel (Hs, Zs, omode, cur, num)
|
||||
wchar16_t* Hs,
|
||||
*Zs;
|
||||
wchar16_t *Hs, *Zs;
|
||||
unsigned short *omode;
|
||||
int cur, num;
|
||||
{
|
||||
|
|
@ -791,8 +823,7 @@ int cur, num;
|
|||
}
|
||||
|
||||
chhstr(Hs, Zs, omode, cur)
|
||||
wchar16_t* Hs,
|
||||
*Zs;
|
||||
wchar16_t *Hs, *Zs;
|
||||
unsigned short *omode;
|
||||
int cur;
|
||||
{
|
||||
|
|
@ -831,7 +862,8 @@ Print_EOL(s)
|
|||
backspace (wcbyte (s));
|
||||
}
|
||||
|
||||
backspace(n) int n;
|
||||
backspace (n)
|
||||
int n;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
|||
67
error.c
67
error.c
|
|
@ -27,6 +27,17 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: error.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:51 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -43,7 +54,10 @@ static FILE* errfp = NULL;
|
|||
static FILE *logfp = NULL;
|
||||
static FILE *dbgfp = NULL;
|
||||
|
||||
int open_error(void) {
|
||||
|
||||
int
|
||||
open_error(void)
|
||||
{
|
||||
extern char *error_file;
|
||||
int flg = 0;
|
||||
|
||||
|
|
@ -51,15 +65,20 @@ int open_error(void) {
|
|||
if (!strcmp(error_file, tty_name)) {
|
||||
errfp = stderr;
|
||||
flg = -1;
|
||||
} else if(!(errfp = fopen(error_file, "a")))
|
||||
}
|
||||
else if (!(errfp = fopen(error_file, "a")))
|
||||
fprintf(stderr, "Can't open \"%s\"\r\n", error_file);
|
||||
} else
|
||||
}
|
||||
else
|
||||
errfp = NULL;
|
||||
|
||||
return flg;
|
||||
}
|
||||
|
||||
void error_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
||||
|
||||
void
|
||||
error_out(char* s, int p1, int p2, int p3, int p4, int p5)
|
||||
{
|
||||
char tmp[BUFSIZ];
|
||||
|
||||
if (errfp) {
|
||||
|
|
@ -70,7 +89,10 @@ void error_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void warning_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
||||
|
||||
void
|
||||
warning_out(char* s, int p1, int p2, int p3, int p4, int p5)
|
||||
{
|
||||
char tmp[BUFSIZ];
|
||||
|
||||
if (errfp) {
|
||||
|
|
@ -80,7 +102,10 @@ void warning_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
|||
}
|
||||
}
|
||||
|
||||
int open_log(void) {
|
||||
|
||||
int
|
||||
open_log(void)
|
||||
{
|
||||
extern char *log_file;
|
||||
int flg = 0;
|
||||
|
||||
|
|
@ -88,7 +113,8 @@ int open_log(void) {
|
|||
if (!strcmp(log_file, tty_name)) {
|
||||
logfp = stderr;
|
||||
flg = -1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
logfp = fopen(log_file, "a");
|
||||
if (logfp) {
|
||||
time_t t;
|
||||
|
|
@ -97,15 +123,20 @@ int open_log(void) {
|
|||
fprintf(logfp, "%s: log started at %s\r",
|
||||
program_name, ctime(&t));
|
||||
fflush(logfp);
|
||||
} else
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Can't open \"%s\"\r\n", log_file);
|
||||
} else
|
||||
}
|
||||
else
|
||||
logfp = NULL;
|
||||
|
||||
return flg;
|
||||
}
|
||||
|
||||
void logging_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
||||
|
||||
void
|
||||
logging_out(char* s, int p1, int p2, int p3, int p4, int p5)
|
||||
{
|
||||
char tmp[BUFSIZ];
|
||||
|
||||
if (logfp) {
|
||||
|
|
@ -115,7 +146,10 @@ void logging_out(char* s, int p1, int p2, int p3, int p4, int p5) {
|
|||
}
|
||||
}
|
||||
|
||||
int open_debug(void) {
|
||||
|
||||
int
|
||||
open_debug(void)
|
||||
{
|
||||
extern char *debug_file;
|
||||
int flg = 0;
|
||||
|
||||
|
|
@ -123,15 +157,20 @@ int open_debug(void) {
|
|||
if (!strcmp(debug_file, tty_name)) {
|
||||
dbgfp = stderr;
|
||||
flg = -1;
|
||||
} else if(!(dbgfp = fopen(debug_file, "a")))
|
||||
}
|
||||
else if (!(dbgfp = fopen(debug_file, "a")))
|
||||
fprintf(stderr, "Can't open \"%s\"\r\n", debug_file);
|
||||
} else
|
||||
}
|
||||
else
|
||||
dbgfp = NULL;
|
||||
|
||||
return flg;
|
||||
}
|
||||
|
||||
void debug_out(int lvl, char* s, int p1, int p2, int p3, int p4, int p5) {
|
||||
|
||||
void
|
||||
debug_out(int lvl, char* s, int p1, int p2, int p3, int p4, int p5)
|
||||
{
|
||||
if (lvl <= debug_level && dbgfp) {
|
||||
fprintf(dbgfp, s, p1, p2, p3, p4, p5);
|
||||
fflush(dbgfp);
|
||||
|
|
|
|||
76
etc.c
76
etc.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: etc.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:15 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "key.h"
|
||||
|
||||
|
|
@ -37,7 +45,8 @@ static int dcflag = 0;
|
|||
|
||||
void disp_version();
|
||||
|
||||
exec_etc(key) int key;
|
||||
exec_etc (key)
|
||||
int key;
|
||||
{
|
||||
unsigned short row, col;
|
||||
int inc;
|
||||
|
|
@ -63,7 +72,8 @@ exec_etc(key) int key;
|
|||
return(KEY_NORMAL);
|
||||
cv = GetConversion ();
|
||||
etckey = etc_map (keyvalue);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
EndGuide (row, col);
|
||||
etckey = key;
|
||||
}
|
||||
|
|
@ -81,7 +91,7 @@ exec_etc(key) int key;
|
|||
break;
|
||||
case 's':
|
||||
if (!IsCflag ())
|
||||
chbun = exec_shoukyo();
|
||||
chbun = exec_syoukyo ();
|
||||
break;
|
||||
case 'v':
|
||||
case 'd':
|
||||
|
|
@ -101,9 +111,9 @@ exec_etc(key) int key;
|
|||
if (!IsCflag ())
|
||||
chbun = exec_toroku ();
|
||||
break;
|
||||
case KEY_SHOUKYO:
|
||||
case KEY_SYOUKYO:
|
||||
if (!IsCflag ())
|
||||
chbun = exec_shoukyo();
|
||||
chbun = exec_syoukyo ();
|
||||
break;
|
||||
case KEY_SJRC:
|
||||
if (IsCflag ())
|
||||
|
|
@ -149,7 +159,8 @@ exec_etc(key) int key;
|
|||
return(KEY_NORMAL);
|
||||
}
|
||||
|
||||
Ssbun(flag) int flag;
|
||||
Ssbun(flag)
|
||||
int flag;
|
||||
{
|
||||
Conversion *cv;
|
||||
static short ScurBun, SpreBun;
|
||||
|
|
@ -167,7 +178,8 @@ Ssbun(flag) int flag;
|
|||
}
|
||||
}
|
||||
|
||||
etc_map(key) int key;
|
||||
etc_map (key)
|
||||
int key;
|
||||
{
|
||||
extern int u_etckeys;
|
||||
extern int Uetckey[], Uetcval[];
|
||||
|
|
@ -184,7 +196,7 @@ etc_map(key) int key;
|
|||
val = KEY_TOROKU;
|
||||
break;
|
||||
case KEY_MUHENKAN:
|
||||
val = KEY_SHOUKYO;
|
||||
val = KEY_SYOUKYO;
|
||||
break;
|
||||
case KEY_ETC:
|
||||
val = KEY_HELP;
|
||||
|
|
@ -205,7 +217,8 @@ etc_map(key) int key;
|
|||
return (val);
|
||||
}
|
||||
|
||||
helplevel() {
|
||||
helplevel ()
|
||||
{
|
||||
wchar16_t wtmp[BUFFLENGTH];
|
||||
unsigned char mtmp[BUFFLENGTH];
|
||||
unsigned char tmp[BUFFLENGTH];
|
||||
|
|
@ -219,7 +232,8 @@ helplevel() {
|
|||
(void) wcstombs((char *)mtmp, WCMHelp, BUFFLENGTH);
|
||||
sprintf ((char *)tmp, (char *)mtmp, "on");
|
||||
(void) mbstowcs(wtmp, (char *)tmp, BUFFLENGTH);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HHlevel = 1;
|
||||
Hlevel = 1;
|
||||
(void) wcstombs((char *)mtmp, WCMHelp, BUFFLENGTH);
|
||||
|
|
@ -230,7 +244,8 @@ helplevel() {
|
|||
}
|
||||
|
||||
void
|
||||
disp_version(c) int c;
|
||||
disp_version (c)
|
||||
int c;
|
||||
{
|
||||
extern char *Version, *Copyright, *Date;
|
||||
char tmp[BUFFLENGTH];
|
||||
|
|
@ -247,25 +262,31 @@ void
|
|||
guide_print_pause (0, wtmp);
|
||||
}
|
||||
|
||||
exec_sjrc() {
|
||||
exec_sjrc ()
|
||||
{
|
||||
extern char RCfile[];
|
||||
char tmp[BUFFLENGTH];
|
||||
unsigned char SUCCorFAIL[BUFFLENGTH];
|
||||
wchar16_t wtmp[BUFFLENGTH];
|
||||
|
||||
|
||||
if (*RCfile == (char)NULL) {
|
||||
getsjrc();
|
||||
if(*RCfile == (char)NULL) {
|
||||
if (*RCfile == (char)NULL)
|
||||
{
|
||||
(void) wcstombs((char *)SUCCorFAIL, WCNOTHsjrc, BUFFLENGTH);
|
||||
sprintf((char *)tmp, (char *)SUCCorFAIL);
|
||||
(void) mbstowcs(wtmp, tmp, BUFFLENGTH);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) wcstombs((char *)SUCCorFAIL, WCSUCCsjrc, BUFFLENGTH);
|
||||
sprintf (tmp, "%s %s ", RCfile, SUCCorFAIL);
|
||||
(void) mbstowcs(wtmp, tmp, BUFFLENGTH);
|
||||
}
|
||||
} else {
|
||||
if(setrc() == TRUE) {
|
||||
if (setrc () == TRUE)
|
||||
{
|
||||
(void) wcstombs((char *)SUCCorFAIL, WCSUCCsjrc, BUFFLENGTH);
|
||||
} else {
|
||||
(void) wcstombs((char *)SUCCorFAIL, WCFAILsjrc, BUFFLENGTH);
|
||||
|
|
@ -279,7 +300,8 @@ exec_sjrc() {
|
|||
static int weight = 3;
|
||||
static int seed = 100000;
|
||||
|
||||
change_weight() {
|
||||
change_weight ()
|
||||
{
|
||||
int c;
|
||||
char s[2];
|
||||
char tmp[BUFFLENGTH];
|
||||
|
|
@ -298,16 +320,19 @@ change_weight() {
|
|||
}
|
||||
}
|
||||
|
||||
UsecWeight(sw) int sw;
|
||||
UsecWeight (sw)
|
||||
int sw;
|
||||
{
|
||||
|
||||
|
||||
if (sw)
|
||||
return (seed);
|
||||
else
|
||||
return (seed * weight);
|
||||
}
|
||||
|
||||
dconnect(aflag) int aflag;
|
||||
dconnect(aflag)
|
||||
int aflag;
|
||||
{
|
||||
int err;
|
||||
char tmp[BUFFLENGTH];
|
||||
|
|
@ -321,6 +346,7 @@ dconnect(aflag) int aflag;
|
|||
(void) mbstowcs(wtmp, tmp, BUFFLENGTH);
|
||||
guide_print_pause (0, wtmp);
|
||||
|
||||
|
||||
if (aflag && keyvalue == KEY_HENKAN) {
|
||||
if ((err = sj3_autocon()) == 0) {
|
||||
(void) wcstombs((char *)dtmp, WCRserv_OK, BUFFLENGTH);
|
||||
|
|
@ -338,16 +364,19 @@ dconnect(aflag) int aflag;
|
|||
return(dcflag);
|
||||
}
|
||||
|
||||
set_dcflag(flag) int flag;
|
||||
set_dcflag(flag)
|
||||
int flag;
|
||||
{
|
||||
dcflag = flag;
|
||||
}
|
||||
|
||||
IsDcflag() {
|
||||
IsDcflag()
|
||||
{
|
||||
return(dcflag);
|
||||
}
|
||||
|
||||
reconnect() {
|
||||
reconnect ()
|
||||
{
|
||||
int inc, err;
|
||||
char tmp[BUFFLENGTH], *hp;
|
||||
char newserv[SHORTLENGTH * 2], *nsp;
|
||||
|
|
@ -436,8 +465,7 @@ reconnect() {
|
|||
}
|
||||
|
||||
guide_print_pause (s1, s2)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
wchar16_t *s1, *s2;
|
||||
{
|
||||
int c;
|
||||
|
||||
|
|
@ -450,3 +478,5 @@ guide_print_pause(s1, s2)
|
|||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
243
eucmessage.c
243
eucmessage.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: eucmessage.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/12/09 11:27:08 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "wchar16.h"
|
||||
#include <locale.h>
|
||||
#include "kctype.h"
|
||||
|
|
@ -45,6 +53,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"\301\264\245\242\245\353\245\325\245\241",
|
||||
(unsigned char *)"\310\276\245\242\245\353\245\325\245\241",
|
||||
|
||||
|
||||
(unsigned char *)" \312\321\264\271 \314\265\312\321 etc. \267\350\304\352 code \310\276\245\242 \301\264\245\242 \310\276\245\253 \301\264\245\253 \244\253\244\312",
|
||||
(unsigned char *)"\244\275\244\316\302\276\241\241\241\241\241\241\241\241\241\241\241\241\241\241",
|
||||
|
||||
|
|
@ -53,6 +62,8 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"Help\241\241Mode",
|
||||
(unsigned char *)" \245\254\245\244\245\311\241\246\245\351\245\244\245\363 %s \244\313\244\312\244\352\244\336\244\267\244\277 ",
|
||||
|
||||
|
||||
|
||||
(unsigned char *)"ShiftJIS\241\241",
|
||||
(unsigned char *)"\241\241\243\305\243\325\243\303\241\241",
|
||||
(unsigned char *)"\243\305\243\325\243\303\312\344\275\365",
|
||||
|
|
@ -61,6 +72,8 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"\241\241\241\241\266\350\305\300\241\241",
|
||||
(unsigned char *)"\266\350\305\300\241\241\312\344\275\365",
|
||||
|
||||
|
||||
|
||||
(unsigned char *)"\305\320\317\277",
|
||||
(unsigned char *)" \310\317\260\317\244\362\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244 ",
|
||||
(unsigned char *)" \264\301\273\372 [%s] : \306\311\244\337\306\376\316\317 ",
|
||||
|
|
@ -80,6 +93,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)" \245\267\245\271\245\306\245\340\245\250\245\351\241\274\244\307\305\320\317\277\244\307\244\255\244\336\244\273\244\363",
|
||||
(unsigned char *)",",
|
||||
|
||||
|
||||
(unsigned char *)"\276\303\265\356",
|
||||
(unsigned char *)" \264\301\273\372 [%s] : \306\311\244\337 [%s] : \311\312\273\354 [%s]\244\362\276\303\265\356\244\267\244\336\244\267\244\277 ",
|
||||
(unsigned char *)" \273\330\304\352\244\265\244\354\244\277\306\311\244\337\241\246\264\301\273\372\244\317\305\320\317\277\244\265\244\354\244\306\244\244\244\336\244\273\244\363",
|
||||
|
|
@ -88,12 +102,17 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)" \244\263\244\316\264\301\273\372\312\270\273\372\316\363\244\317\276\303\265\356\244\307\244\255\244\336\244\273\244\363",
|
||||
(unsigned char *)" \245\267\245\271\245\306\245\340\245\250\245\351\241\274\244\307\276\303\265\356\244\307\244\255\244\336\244\273\244\363",
|
||||
|
||||
|
||||
|
||||
(unsigned char *)"\244\362\306\311\244\337\271\376\244\337\244\336\244\267\244\277",
|
||||
(unsigned char *)"\244\362\306\311\244\337\271\376\244\341\244\336\244\273\244\363\244\307\244\267\244\277",
|
||||
(unsigned char *)"\245\273\245\303\245\310\245\242\245\303\245\327\245\325\245\241\245\244\245\353\244\254\244\242\244\352\244\336\244\273\244\363 ",
|
||||
|
||||
|
||||
(unsigned char *)"Change weight (1-9) current weight %d ",
|
||||
|
||||
|
||||
|
||||
(unsigned char *)"\272\306\300\334\302\263 ",
|
||||
(unsigned char *)" \245\265\241\274\245\320\314\276 [%s] \244\362\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244 ",
|
||||
(unsigned char *)" \245\265\241\274\245\320 [%s] \244\313\300\334\302\263\244\267\244\336\244\267\244\277 ",
|
||||
|
|
@ -103,6 +122,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)" ",
|
||||
(unsigned char *)" \302\263\244\261\244\336\244\271\244\253? y",
|
||||
|
||||
|
||||
(unsigned char *)"\245\265\241\274\245\320\241\274\244\254\273\340\244\313\244\336\244\267\244\277\241\243",
|
||||
(unsigned char *)"\245\265\241\274\245\320\241\274\244\313\300\334\302\263\272\321\244\307\244\271\241\243",
|
||||
(unsigned char *)"\245\265\241\274\245\320\241\274\244\330\244\316\300\334\302\263\244\313\274\272\307\324\244\267\244\336\244\267\244\277\241\243",
|
||||
|
|
@ -113,21 +133,26 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"\263\330\275\254\245\325\245\241\245\244\245\353\244\316\300\270\300\256\244\313\274\272\307\324\244\267\244\336\244\267\244\277\241\243",
|
||||
(unsigned char *)"\263\330\275\254\245\325\245\241\245\244\245\353\244\362\245\252\241\274\245\327\245\363\244\307\244\255\244\336\244\273\244\363\241\243",
|
||||
|
||||
|
||||
|
||||
(unsigned char *)"\312\324\275\270 ",
|
||||
(unsigned char *)"\243\323\243\312\243\263\241\241\241\241\241\241\241\241\241\241\241\241\241\241",
|
||||
|
||||
(unsigned char *)" \312\324\275\270\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\336\244\271",
|
||||
(unsigned char *)"$$",
|
||||
|
||||
|
||||
(unsigned char *)"on",
|
||||
(unsigned char *)"off",
|
||||
|
||||
|
||||
(unsigned char *)"\314\276\273\354",
|
||||
(unsigned char *)"\314\276\273\372",
|
||||
(unsigned char *)"\314\276\301\260",
|
||||
(unsigned char *)"\303\317\314\276",
|
||||
(unsigned char *)"\245\265\312\321\306\260\273\354",
|
||||
|
||||
|
||||
(unsigned char *)"",
|
||||
(unsigned char *)"F1",
|
||||
(unsigned char *)"F2",
|
||||
|
|
@ -172,7 +197,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"right",
|
||||
(unsigned char *)"left",
|
||||
(unsigned char *)"kaku",
|
||||
(unsigned char*)"shuku",
|
||||
(unsigned char *)"syuku",
|
||||
(unsigned char *)"edit",
|
||||
(unsigned char *)"toggle",
|
||||
(unsigned char *)"wrapback",
|
||||
|
|
@ -180,7 +205,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"sjrc",
|
||||
(unsigned char *)"buffer",
|
||||
(unsigned char *)"toroku",
|
||||
(unsigned char*)"shoukyo",
|
||||
(unsigned char *)"syoukyo",
|
||||
(unsigned char *)"help",
|
||||
(unsigned char *)"ha-kettei",
|
||||
(unsigned char *)"flush",
|
||||
|
|
@ -193,6 +218,7 @@ unsigned char* EucMessages[] = {
|
|||
(unsigned char *)"reconnect",
|
||||
(unsigned char *)"kill",
|
||||
|
||||
|
||||
(unsigned char *)"key",
|
||||
(unsigned char *)"escape",
|
||||
(unsigned char *)"sjxkey",
|
||||
|
|
@ -244,13 +270,18 @@ unsigned char* EucMessages[] = {
|
|||
|
||||
};
|
||||
|
||||
|
||||
#define CURMESSAGES 182
|
||||
wchar16_t *WcMessages[CURMESSAGES];
|
||||
|
||||
#define CURWCVTKEY 29
|
||||
struct wcvtkey wcvtkeytbl[CURWCVTKEY];
|
||||
|
||||
int init_wcvtkey() {
|
||||
|
||||
|
||||
int
|
||||
init_wcvtkey()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < CURWCVTKEY; i++) {
|
||||
|
|
@ -289,59 +320,40 @@ int init_wcvtkey() {
|
|||
|
||||
wchar16_t *comstr[KEY_OTHER];
|
||||
|
||||
int init_comstr() {
|
||||
comstr[0] = WCStart;
|
||||
comstr[1] = WCHenkan;
|
||||
comstr[2] = WCMuhen;
|
||||
comstr[3] = WCKettei;
|
||||
comstr[4] = WCHira;
|
||||
comstr[5] = WCHalpha;
|
||||
comstr[6] = WCZalpha;
|
||||
comstr[7] = WCHkata;
|
||||
comstr[8] = WCZkata;
|
||||
comstr[9] = WCCode;
|
||||
comstr[10] = WCEtc;
|
||||
comstr[11] = WCRightl;
|
||||
comstr[12] = WCLeftl;
|
||||
comstr[13] = WCKaku;
|
||||
comstr[14] = WCSyuku;
|
||||
comstr[15] = WCEdit;
|
||||
comstr[16] = WCToggle;
|
||||
comstr[17] = WCWrapback;
|
||||
comstr[18] = WCWrap;
|
||||
comstr[19] = WCSjrc;
|
||||
comstr[20] = WCBuffer;
|
||||
comstr[21] = WCToroku;
|
||||
comstr[22] = WCShoukyo;
|
||||
comstr[23] = WCHelp;
|
||||
comstr[24] = WCHaKettei;
|
||||
comstr[25] = WCFlush;
|
||||
comstr[26] = WCDebug;
|
||||
comstr[27] = WCCancell;
|
||||
comstr[28] = WCSaihenkan;
|
||||
comstr[29] = WCIgnore;
|
||||
comstr[30] = WCTop;
|
||||
comstr[31] = WCEnd;
|
||||
comstr[32] = WCReconnect;
|
||||
comstr[33] = WCKill;
|
||||
comstr[34] = WCKara;
|
||||
|
||||
|
||||
int
|
||||
init_comstr()
|
||||
{
|
||||
comstr[0] = WCStart; comstr[1] = WCHenkan; comstr[2] = WCMuhen;
|
||||
comstr[3] = WCKettei; comstr[4] = WCHira; comstr[5] = WCHalpha;
|
||||
comstr[6] = WCZalpha; comstr[7] = WCHkata; comstr[8] = WCZkata;
|
||||
comstr[9] = WCCode; comstr[10] = WCEtc; comstr[11] = WCRightl;
|
||||
comstr[12] = WCLeftl; comstr[13] = WCKaku; comstr[14] = WCSyuku;
|
||||
comstr[15] = WCEdit; comstr[16] = WCToggle; comstr[17] = WCWrapback;
|
||||
comstr[18] = WCWrap; comstr[19] = WCSjrc; comstr[20] = WCBuffer;
|
||||
comstr[21] = WCToroku; comstr[22] = WCSyoukyo; comstr[23] = WCHelp;
|
||||
comstr[24] = WCHaKettei; comstr[25] = WCFlush; comstr[26] = WCDebug;
|
||||
comstr[27] = WCCancell; comstr[28] = WCSaihenkan; comstr[29] = WCIgnore;
|
||||
comstr[30] = WCTop; comstr[31] = WCEnd; comstr[32] = WCReconnect;
|
||||
comstr[33] = WCKill; comstr[34] = WCKara;
|
||||
}
|
||||
|
||||
struct valtbl hin_val[5];
|
||||
|
||||
int init_hin_val() {
|
||||
hin_val[0].keyword = WCMeishi;
|
||||
hin_val[0].ivalue = SJ3_H_NRMNOUN;
|
||||
hin_val[1].keyword = WCMyouji;
|
||||
hin_val[1].ivalue = SJ3_H_LNAME;
|
||||
hin_val[2].keyword = WCNamae;
|
||||
hin_val[2].ivalue = SJ3_H_FNAME;
|
||||
hin_val[3].keyword = WCTimei;
|
||||
hin_val[3].ivalue = SJ3_H_LOCNAME;
|
||||
hin_val[4].keyword = WCSahen;
|
||||
hin_val[4].ivalue = SJ3_H_SILVERB;
|
||||
|
||||
|
||||
int
|
||||
init_hin_val()
|
||||
{
|
||||
hin_val[0].keyword = WCMeishi; hin_val[0].ivalue = SJ3_H_NRMNOUN;
|
||||
hin_val[1].keyword = WCMyouji; hin_val[1].ivalue = SJ3_H_LNAME;
|
||||
hin_val[2].keyword = WCNamae; hin_val[2].ivalue = SJ3_H_FNAME;
|
||||
hin_val[3].keyword = WCTimei; hin_val[3].ivalue = SJ3_H_LOCNAME;
|
||||
hin_val[4].keyword = WCSahen; hin_val[4].ivalue = SJ3_H_SILVERB;
|
||||
}
|
||||
|
||||
|
||||
extern int set_func(), set_etckeys(), set_intr(),
|
||||
set_delkey(), set_goto(), set_trap(), set_init_mode(),
|
||||
set_helpmenu(), set_defcode(), set_muhenkan(), set_muedit(),
|
||||
|
|
@ -351,92 +363,70 @@ extern int set_func(), set_etckeys(), set_intr(),
|
|||
#define CURFUNCS 29
|
||||
struct functbl funcs[CURFUNCS];
|
||||
|
||||
int init_funcs() {
|
||||
funcs[0].keyword = WCKey;
|
||||
funcs[0].func = set_func;
|
||||
funcs[1].keyword = WCEscape;
|
||||
funcs[1].func = set_func;
|
||||
funcs[2].keyword = WCEtckey;
|
||||
funcs[2].func = set_etckeys;
|
||||
funcs[3].keyword = WCIntr;
|
||||
funcs[3].func = set_intr;
|
||||
funcs[4].keyword = WCDelkey;
|
||||
funcs[4].func = set_delkey;
|
||||
funcs[5].keyword = WCSetnormal;
|
||||
funcs[5].func = set_goto;
|
||||
funcs[6].keyword = WCThroughnext;
|
||||
funcs[6].func = set_trap;
|
||||
funcs[7].keyword = WCInitialmode;
|
||||
funcs[7].func = set_init_mode;
|
||||
funcs[8].keyword = WCHelpmode;
|
||||
funcs[8].func = set_helpmenu;
|
||||
funcs[9].keyword = WCDefaultcode;
|
||||
funcs[9].func = set_defcode;
|
||||
funcs[10].keyword = WCMuhenkanmode;
|
||||
funcs[10].func = set_muhenkan;
|
||||
funcs[11].keyword = WCMuhenkaninedit;
|
||||
funcs[11].func = set_muedit;
|
||||
funcs[12].keyword = WCMuhenkantoggle;
|
||||
funcs[12].func = set_m_toggle;
|
||||
funcs[13].keyword = WCGuide;
|
||||
funcs[13].func = set_guide;
|
||||
funcs[14].keyword = WCForkshell;
|
||||
funcs[14].func = set_forkshell;
|
||||
funcs[15].keyword = WCExecshell;
|
||||
funcs[15].func = set_forkshell;
|
||||
funcs[16].keyword = WCBstudy;
|
||||
funcs[16].func = set_bstudy;
|
||||
funcs[17].keyword = WCSilent;
|
||||
funcs[17].func = set_silent;
|
||||
funcs[18].keyword = WCFlushafterconversion;
|
||||
funcs[18].func = set_flush_conversion;
|
||||
funcs[19].keyword = WCRkerrbell;
|
||||
funcs[19].func = set_rkebell;
|
||||
funcs[20].keyword = WCServer;
|
||||
funcs[20].func = set_server;
|
||||
funcs[21].keyword = WCDictionary;
|
||||
funcs[21].func = set_dict;
|
||||
funcs[22].keyword = NULL;
|
||||
funcs[22].func = NULL;
|
||||
|
||||
|
||||
int
|
||||
init_funcs()
|
||||
{
|
||||
funcs[0].keyword = WCKey; funcs[0].func = set_func;
|
||||
funcs[1].keyword = WCEscape; funcs[1].func = set_func;
|
||||
funcs[2].keyword = WCEtckey; funcs[2].func = set_etckeys;
|
||||
funcs[3].keyword = WCIntr; funcs[3].func = set_intr;
|
||||
funcs[4].keyword = WCDelkey; funcs[4].func = set_delkey;
|
||||
funcs[5].keyword = WCSetnormal; funcs[5].func = set_goto;
|
||||
funcs[6].keyword = WCThroughnext; funcs[6].func = set_trap;
|
||||
funcs[7].keyword = WCInitialmode; funcs[7].func = set_init_mode;
|
||||
funcs[8].keyword = WCHelpmode; funcs[8].func = set_helpmenu;
|
||||
funcs[9].keyword = WCDefaultcode; funcs[9].func = set_defcode;
|
||||
funcs[10].keyword = WCMuhenkanmode; funcs[10].func = set_muhenkan;
|
||||
funcs[11].keyword = WCMuhenkaninedit; funcs[11].func = set_muedit;
|
||||
funcs[12].keyword = WCMuhenkantoggle; funcs[12].func = set_m_toggle;
|
||||
funcs[13].keyword = WCGuide; funcs[13].func = set_guide;
|
||||
funcs[14].keyword = WCForkshell; funcs[14].func = set_forkshell;
|
||||
funcs[15].keyword = WCExecshell; funcs[15].func = set_forkshell;
|
||||
funcs[16].keyword = WCBstudy; funcs[16].func = set_bstudy;
|
||||
funcs[17].keyword = WCSilent; funcs[17].func = set_silent;
|
||||
funcs[18].keyword = WCFlushafterconversion; funcs[18].func = set_flush_conversion;
|
||||
funcs[19].keyword = WCRkerrbell; funcs[19].func = set_rkebell;
|
||||
funcs[20].keyword = WCServer; funcs[20].func = set_server;
|
||||
funcs[21].keyword = WCDictionary; funcs[21].func = set_dict;
|
||||
funcs[22].keyword = NULL; funcs[22].func = NULL;
|
||||
}
|
||||
|
||||
struct valtbl mode_val[5];
|
||||
|
||||
int init_mode_val() {
|
||||
mode_val[0].keyword = WCHalpha;
|
||||
mode_val[0].ivalue = MODE_HALPHA;
|
||||
mode_val[1].keyword = WCZalpha;
|
||||
mode_val[1].ivalue = MODE_ZALPHA;
|
||||
mode_val[2].keyword = WCHkata;
|
||||
mode_val[2].ivalue = MODE_HKATA;
|
||||
mode_val[3].keyword = WCZkata;
|
||||
mode_val[3].ivalue = MODE_ZKATA;
|
||||
mode_val[4].keyword = WCHira;
|
||||
mode_val[4].ivalue = MODE_ZHIRA;
|
||||
|
||||
|
||||
int
|
||||
init_mode_val()
|
||||
{
|
||||
mode_val[0].keyword = WCHalpha; mode_val[0].ivalue = MODE_HALPHA;
|
||||
mode_val[1].keyword = WCZalpha; mode_val[1].ivalue = MODE_ZALPHA;
|
||||
mode_val[2].keyword = WCHkata; mode_val[2].ivalue = MODE_HKATA;
|
||||
mode_val[3].keyword = WCZkata; mode_val[3].ivalue = MODE_ZKATA;
|
||||
mode_val[4].keyword = WCHira; mode_val[4].ivalue = MODE_ZHIRA;
|
||||
}
|
||||
|
||||
struct valtbl code_val[8];
|
||||
|
||||
int init_code_val() {
|
||||
code_val[0].keyword = WCShiftjis;
|
||||
code_val[0].ivalue = CODE_SJIS;
|
||||
code_val[1].keyword = WCSjis;
|
||||
code_val[1].ivalue = CODE_SJIS;
|
||||
code_val[2].keyword = WCEuc;
|
||||
code_val[2].ivalue = CODE_EUC;
|
||||
code_val[3].keyword = WCEuc2;
|
||||
code_val[3].ivalue = CODE_EUC2;
|
||||
code_val[4].keyword = WCJis;
|
||||
code_val[4].ivalue = CODE_JIS;
|
||||
code_val[5].keyword = WCJis2;
|
||||
code_val[5].ivalue = CODE_JIS2;
|
||||
code_val[6].keyword = WCKuten;
|
||||
code_val[6].ivalue = CODE_KUTEN;
|
||||
code_val[7].keyword = WCKuten2;
|
||||
code_val[7].ivalue = CODE_KUTEN2;
|
||||
|
||||
|
||||
int
|
||||
init_code_val()
|
||||
{
|
||||
code_val[0].keyword = WCShiftjis; code_val[0].ivalue = CODE_SJIS;
|
||||
code_val[1].keyword = WCSjis; code_val[1].ivalue = CODE_SJIS;
|
||||
code_val[2].keyword = WCEuc; code_val[2].ivalue = CODE_EUC;
|
||||
code_val[3].keyword = WCEuc2; code_val[3].ivalue = CODE_EUC2;
|
||||
code_val[4].keyword = WCJis; code_val[4].ivalue = CODE_JIS;
|
||||
code_val[5].keyword = WCJis2; code_val[5].ivalue = CODE_JIS2;
|
||||
code_val[6].keyword = WCKuten; code_val[6].ivalue = CODE_KUTEN;
|
||||
code_val[7].keyword = WCKuten2; code_val[7].ivalue = CODE_KUTEN2;
|
||||
}
|
||||
|
||||
int init_messages() {
|
||||
int
|
||||
init_messages()
|
||||
{
|
||||
#define LOCALELEN 20
|
||||
char cur_loc[LOCALELEN];
|
||||
char *loc;
|
||||
|
|
@ -497,3 +487,4 @@ Fail:
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
45
file.c
45
file.c
|
|
@ -27,6 +27,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: file.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1995/02/03 07:38:32 $
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -43,7 +50,8 @@ typedef struct filelist {
|
|||
static FileList *flist = NULL;
|
||||
|
||||
static char*
|
||||
get_fname(FILE* fp) {
|
||||
get_fname(FILE* fp)
|
||||
{
|
||||
FileList *p;
|
||||
|
||||
for (p = flist ; p ; p = p -> next)
|
||||
|
|
@ -51,7 +59,9 @@ get_fname(FILE* fp) {
|
|||
return "some file";
|
||||
}
|
||||
|
||||
FILE* Fopen(char* filename, char* type) {
|
||||
FILE*
|
||||
Fopen(char* filename, char* type)
|
||||
{
|
||||
FILE *fp;
|
||||
FileList *fl;
|
||||
|
||||
|
|
@ -69,7 +79,9 @@ FILE* Fopen(char* filename, char* type) {
|
|||
return fp;
|
||||
}
|
||||
|
||||
void Fclose(FILE* fp) {
|
||||
void
|
||||
Fclose(FILE* fp)
|
||||
{
|
||||
FileList *p, *q;
|
||||
|
||||
if (fclose(fp) == EOF) {
|
||||
|
|
@ -90,19 +102,24 @@ void Fclose(FILE* fp) {
|
|||
}
|
||||
}
|
||||
|
||||
int Fseek(FILE* fp, long ofs, int ptr) {
|
||||
int
|
||||
Fseek(FILE* fp, long ofs, int ptr)
|
||||
{
|
||||
if (fseek(fp, ofs, ptr) == 0) return 0;
|
||||
|
||||
fprintf(stderr, "Seek error in %s\n", get_fname(fp));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
long Ftell(FILE* fp) {
|
||||
long
|
||||
Ftell(FILE* fp)
|
||||
{
|
||||
return ftell(fp);
|
||||
}
|
||||
|
||||
off_t /* XXX: just looked in FreeBSD's sys/stat.h, need to check SUS spec. */
|
||||
Fsize(char* filename) {
|
||||
Fsize(char* filename)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
|
|
@ -115,24 +132,32 @@ Fsize(char* filename) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
int Fread(char* p, int s, int n, FILE* fp) {
|
||||
int
|
||||
Fread(char* p, int s, int n, FILE* fp)
|
||||
{
|
||||
if (fread(p, s, n, fp) == n) return n;
|
||||
|
||||
fprintf(stderr, "Read error in %s\n", get_fname(fp));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int Fwrite(char* p, int s, int n, FILE* fp) {
|
||||
int
|
||||
Fwrite(char* p, int s, int n, FILE* fp)
|
||||
{
|
||||
if (fwrite(p, s, n, fp) == n) return n;
|
||||
|
||||
fprintf(stderr, "Write error in %s\n", get_fname(fp));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int Fgetc(FILE* fp) {
|
||||
int
|
||||
Fgetc(FILE* fp)
|
||||
{
|
||||
return fgetc(fp);
|
||||
}
|
||||
|
||||
void Fflush(FILE* fp) {
|
||||
void
|
||||
Fflush(FILE* fp)
|
||||
{
|
||||
fflush(fp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
clang-format --verbose -i *.c *.h
|
||||
72
funckey.c
72
funckey.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: funckey.c,v $
|
||||
* $SonyRevision: 1.3 $
|
||||
* $SonyDate: 1997/01/23 11:20:53 $
|
||||
*
|
||||
* $Id: funckey.c,v 1.3 2004/07/04 08:38:33 hiroo Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "wchar16.h"
|
||||
#include "sj2.h"
|
||||
|
|
@ -66,7 +75,8 @@ struct cvtkey {
|
|||
{ "Down", "" },
|
||||
{ "Right", "" },
|
||||
{ "Left", "" },
|
||||
{NULL, ""}};
|
||||
{ NULL, "" }
|
||||
};
|
||||
|
||||
extern struct wcvtkey wcvtkeytbl[];
|
||||
|
||||
|
|
@ -83,6 +93,7 @@ int u_etckeys = 0;
|
|||
int Uetckey[ETCKEYS];
|
||||
int Uetcval[ETCKEYS];
|
||||
|
||||
|
||||
extern wchar16_t *comstr[];
|
||||
|
||||
int comstrvalue[KEY_OTHER] = {
|
||||
|
|
@ -93,14 +104,18 @@ int comstrvalue[KEY_OTHER] = {
|
|||
KEY_LEFT, KEY_UP, KEY_DOWN,
|
||||
KEY_EDIT, KEY_TOGGLE, KEY_WRAPBACK,
|
||||
KEY_WRAP, KEY_SJRC, KEY_BUFFER,
|
||||
KEY_TOROKU, KEY_SHOUKYO, KEY_HELP,
|
||||
KEY_TOROKU, KEY_SYOUKYO, KEY_HELP,
|
||||
KEY_HA_KET, KEY_FLUSH, KEY_DEBUG,
|
||||
KEY_CANCEL, KEY_RECONV, KEY_IGNORE,
|
||||
KEY_TOP, KEY_END, KEY_RECONNECT,
|
||||
KEY_KILL,
|
||||
KEY_OTHER};
|
||||
KEY_OTHER
|
||||
};
|
||||
|
||||
void mk_cvtkey(char* term) {
|
||||
|
||||
void
|
||||
mk_cvtkey(char* term)
|
||||
{
|
||||
char *p;
|
||||
char line[MAXLINE], rstr[16];
|
||||
FILE *fd;
|
||||
|
|
@ -142,7 +157,9 @@ void mk_cvtkey(char* term) {
|
|||
}
|
||||
}
|
||||
|
||||
char* getkey2(char* istr, char* ostr) {
|
||||
char *
|
||||
getkey2(char* istr, char* ostr)
|
||||
{
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
|
|
@ -165,11 +182,17 @@ char* getkey2(char* istr, char* ostr) {
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
void clear_ukeys(void) {
|
||||
|
||||
void
|
||||
clear_ukeys (void)
|
||||
{
|
||||
Unumber = 0;
|
||||
}
|
||||
|
||||
void set_func(struct wordent word[]) {
|
||||
|
||||
void
|
||||
set_func (struct wordent word[])
|
||||
{
|
||||
int i, num;
|
||||
wchar16_t *p, *s;
|
||||
struct wcvtkey *ckeyp;
|
||||
|
|
@ -206,8 +229,10 @@ void set_func(struct wordent word[]) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
wchar16_t
|
||||
eval_keys(wchar16_t* s, wchar16_t* p) {
|
||||
eval_keys (wchar16_t* s, wchar16_t* p)
|
||||
{
|
||||
wchar16_t c, i;
|
||||
|
||||
if (wslen (s) > SEQLEN)
|
||||
|
|
@ -230,21 +255,30 @@ eval_keys(wchar16_t* s, wchar16_t* p) {
|
|||
return (i);
|
||||
}
|
||||
|
||||
void clear_key(void) {
|
||||
|
||||
void
|
||||
clear_key (void)
|
||||
{
|
||||
clear_commkeys ();
|
||||
clear_etckeys ();
|
||||
clear_ukeys ();
|
||||
}
|
||||
|
||||
void clear_commkeys(void) {
|
||||
|
||||
void
|
||||
clear_commkeys (void)
|
||||
{
|
||||
comnumber = 0;
|
||||
}
|
||||
|
||||
int eval_key(wchar16_t* s) {
|
||||
int
|
||||
eval_key (wchar16_t* s)
|
||||
{
|
||||
wchar16_t c;
|
||||
|
||||
c = *s;
|
||||
|
||||
|
||||
if (c == '^') {
|
||||
c = s[1];
|
||||
if ('@' <= c && c <= '_')
|
||||
|
|
@ -253,17 +287,24 @@ int eval_key(wchar16_t* s) {
|
|||
return (DEL);
|
||||
}
|
||||
|
||||
|
||||
else if (c <= '~')
|
||||
return (c);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void clear_etckeys(void) {
|
||||
|
||||
void
|
||||
clear_etckeys (void)
|
||||
{
|
||||
u_etckeys = 0;
|
||||
}
|
||||
|
||||
int set_etckeys(struct wordent word[]) {
|
||||
|
||||
int
|
||||
set_etckeys (struct wordent word[])
|
||||
{
|
||||
int i;
|
||||
|
||||
if (u_etckeys >= ETCKEYS)
|
||||
|
|
@ -288,8 +329,10 @@ int set_etckeys(struct wordent word[]) {
|
|||
return (0);
|
||||
}
|
||||
|
||||
|
||||
wchar16_t
|
||||
parse_command(wchar16_t* s, int* count) {
|
||||
parse_command (wchar16_t* s, int* count)
|
||||
{
|
||||
extern wchar16_t pars_seq[];
|
||||
extern int pars_n;
|
||||
int i, j;
|
||||
|
|
@ -309,3 +352,4 @@ parse_command(wchar16_t* s, int* count) {
|
|||
}
|
||||
return (KEY_NORMAL);
|
||||
}
|
||||
|
||||
|
|
|
|||
26
functbl.c
26
functbl.c
|
|
@ -27,36 +27,52 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: functbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:46 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_func.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
VFuncNT cvtnum_func[] = {
|
||||
num_type00, num_type01, num_type02, num_type03,
|
||||
num_type04, num_type05, num_type06, num_type07,
|
||||
num_type08, num_type09, num_type10, num_type11,
|
||||
num_type12, num_type13, num_type14};
|
||||
num_type12, num_type13, num_type14
|
||||
};
|
||||
|
||||
UCPFuncGK getkan_func[] = {
|
||||
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
|
||||
getkan_knj, getkan_ofs, getkan_norm, getkan_none,
|
||||
getkan_norm, getkan_norm, getkan_hira, getkan_kata,
|
||||
getkan_knj, getkan_ofs, getkan_norm, getkan_none};
|
||||
getkan_knj, getkan_ofs, getkan_norm, getkan_none
|
||||
};
|
||||
|
||||
IFuncSetj setjrec_func[] = {
|
||||
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
|
||||
setj_knj, setj_ofs, setj_norm2, setj_atrb,
|
||||
setj_norm2, setj_norm2, setj_norm1, setj_norm1,
|
||||
setj_knj, setj_ofs, setj_norm2, setj_atrb};
|
||||
setj_knj, setj_ofs, setj_norm2, setj_atrb
|
||||
};
|
||||
|
||||
IFuncHira hiraknj_func[] = {
|
||||
hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask,
|
||||
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb,
|
||||
hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask,
|
||||
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb};
|
||||
hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb
|
||||
};
|
||||
|
||||
|
||||
UCPFuncMK makekan_func[] = {
|
||||
makekan_norm, makekan_norm, makekan_1byte, makekan_1byte,
|
||||
makekan_knj, makekan_ofs, makekan_norm, makekan_none,
|
||||
makekan_norm, makekan_norm, makekan_1byte, makekan_1byte,
|
||||
makekan_knj, makekan_ofs, makekan_norm, makekan_none};
|
||||
makekan_knj, makekan_ofs, makekan_norm, makekan_none
|
||||
};
|
||||
|
|
|
|||
73
fuzoku.c
73
fuzoku.c
|
|
@ -27,14 +27,28 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: fuzoku.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:47 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinshi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_right.h"
|
||||
#include "sj_yomi.h"
|
||||
|
||||
|
||||
|
||||
CLREC *argclrec();
|
||||
int terminate();
|
||||
|
||||
|
||||
|
||||
static int fzkstrcmp(yptr, fzkp, saml)
|
||||
unsigned char *yptr;
|
||||
unsigned char *fzkp;
|
||||
|
|
@ -44,15 +58,20 @@ int* saml;
|
|||
|
||||
asklen = FzkAskLen(fzkp);
|
||||
|
||||
|
||||
if (*saml < asklen) return CONT;
|
||||
|
||||
|
||||
if (*saml > asklen) return OVER;
|
||||
|
||||
|
||||
nkrlen = FzkNkrLen(fzkp);
|
||||
|
||||
|
||||
yptr += asklen;
|
||||
fzkp ++;
|
||||
|
||||
|
||||
while (nkrlen--) {
|
||||
if (*yptr > *fzkp)
|
||||
return CONT;
|
||||
|
|
@ -72,69 +91,78 @@ int* saml;
|
|||
return MATCH;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setclrec(jrec, yptr, right)
|
||||
JREC *jrec;
|
||||
unsigned char *yptr;
|
||||
TypeCnct right;
|
||||
{
|
||||
CLREC *new;
|
||||
TypeGram hinshi;
|
||||
TypeGram hinsi;
|
||||
int len;
|
||||
|
||||
|
||||
if (!(len = yptr - cnvstart)) return;
|
||||
|
||||
|
||||
if (len > MaxClInputLen) return;
|
||||
|
||||
|
||||
if (!(new = argclrec(len))) return;
|
||||
|
||||
|
||||
new -> jnode = jrec;
|
||||
new -> gobiln = gobilen;
|
||||
new -> right = right;
|
||||
new -> fzk_ka = fzk_ka_flg;
|
||||
(jrec -> count)++;
|
||||
|
||||
hinshi = jrec->hinshi;
|
||||
|
||||
if(hinshi >= DO_SAHEN && hinshi <= SP_KA_ONB)
|
||||
hinsi = jrec -> hinsi;
|
||||
|
||||
if (hinsi >= DO_SAHEN && hinsi <= SP_KA_ONB)
|
||||
new -> kubun = K_DOUSHI;
|
||||
|
||||
else if((hinshi >= KEIYOUSHI_1 && hinshi <= KE_DOUSHI_9) ||
|
||||
(hinshi == SP_KEIYOUSHI)) {
|
||||
if(right == R_FZKMEISHI)
|
||||
else if ((hinsi >= KEIYOUSI_1 && hinsi <= KE_DOUSI_9) ||
|
||||
(hinsi == SP_KEIYOUSI)){
|
||||
if(right == R_FZKMEISI)
|
||||
new -> kubun = K_TAIGEN;
|
||||
else
|
||||
new -> kubun = K_YOUGEN;
|
||||
}
|
||||
|
||||
else if(hinshi == RENTAISHI)
|
||||
new->kubun = K_RENTAISHI;
|
||||
else if (hinsi == RENTAISI)
|
||||
new -> kubun = K_RENTAISI;
|
||||
|
||||
else if((hinshi >= FUKUSHI_1 && hinshi <= FUKUSHI_9) ||
|
||||
(hinshi == SP_FUKUSHI))
|
||||
new->kubun = K_FUKUSHI;
|
||||
else if ((hinsi >= FUKUSI_1 && hinsi <= FUKUSI_9) ||
|
||||
(hinsi == SP_FUKUSI))
|
||||
new -> kubun = K_FUKUSI;
|
||||
|
||||
else if(hinshi == SETSUZOKU || hinshi == KANDOUSHI ||
|
||||
hinshi == TANKANJI || hinshi == AISATSU)
|
||||
else if (hinsi == SETUZOKU || hinsi==KANDOUSI ||
|
||||
hinsi == TANKANJI || hinsi==AISATU)
|
||||
new -> kubun = K_SONOTA;
|
||||
|
||||
else if (gobilen) {
|
||||
if(hinshi >= MEISHI_5 && hinshi <= MEISHI_7)
|
||||
if (hinsi >= MEISI_5 && hinsi <= MEISI_7)
|
||||
new -> kubun = K_DOUSHI;
|
||||
|
||||
else if(hinshi == D_MEISHI_4)
|
||||
else if (hinsi == D_MEISI_4)
|
||||
new -> kubun = K_DOUSHI;
|
||||
|
||||
else if(hinshi == SETSUBI_7 || hinshi == SETSUBI_8)
|
||||
else if (hinsi == SETUBI_7 || hinsi == SETUBI_8)
|
||||
new -> kubun = K_DOUSHI;
|
||||
|
||||
else if(hinshi == D_MEISHI_5)
|
||||
|
||||
else if (hinsi == D_MEISI_5)
|
||||
new -> kubun = K_YOUGEN;
|
||||
|
||||
else if(hinshi == SETSUBI_5 || hinshi == SETSUBI_6)
|
||||
else if (hinsi == SETUBI_5 || hinsi == SETUBI_6)
|
||||
new -> kubun = K_YOUGEN;
|
||||
else
|
||||
new -> kubun = K_TAIGEN;
|
||||
} else if(hinshi >= MEISHI_5 && hinshi <= MEISHI_7) {
|
||||
}
|
||||
else if (hinsi >= MEISI_5 && hinsi <= MEISI_7) {
|
||||
if (right >= R_I && right <= R_ITADAKE)
|
||||
new -> kubun = K_DOUSHI;
|
||||
|
||||
|
|
@ -148,7 +176,8 @@ TypeCnct right;
|
|||
new -> kubun = K_DOUSHI;
|
||||
else
|
||||
new -> kubun = K_TAIGEN;
|
||||
} else
|
||||
}
|
||||
else
|
||||
new -> kubun = K_TAIGEN;
|
||||
}
|
||||
|
||||
|
|
@ -224,6 +253,7 @@ int level;
|
|||
|
||||
if (len) return;
|
||||
|
||||
|
||||
if (!(fzk = Fzkadr(*yptr - _XA))) return;
|
||||
|
||||
yptr++;
|
||||
|
|
@ -244,6 +274,7 @@ int level;
|
|||
else if ((cmp != MATCH) || isdpnd(*(yptr + len)))
|
||||
continue;
|
||||
|
||||
|
||||
fzktbl[fzkcount].yomip = yptr - 1;
|
||||
fzktbl[fzkcount].fzkp = fzk;
|
||||
fzkcount++;
|
||||
|
|
|
|||
186
fzkyomi.c
186
fzkyomi.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: fzkyomi.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:48 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "const.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
|
@ -37,7 +45,8 @@
|
|||
static unsigned char fzk_wo[] = {
|
||||
(0<<5)+0, L_WO, R_WO,
|
||||
(0<<5)+0, L_WO_S, R_WO_S,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_xtu[] = {
|
||||
(0<<5) + 1, _KE, L_KKE, R_SHUUJO,
|
||||
|
|
@ -48,7 +57,7 @@ static unsigned char fzk_xtu[] = {
|
|||
(4<<5) + 2, _RO, _U, L_TTARASII, R_KAROU,
|
||||
(3<<5) + 1, _KU, L_TTARASII, R_KRENYOU,
|
||||
(3<<5) + 2, _KE, _RE, L_TTARASII, R_KATEI1,
|
||||
(3 << 5) + 1, _SA, L_TTARASII, R_FZKMEISHI,
|
||||
(3<<5) + 1, _SA, L_TTARASII, R_FZKMEISI,
|
||||
(0<<5) + 1, _TE, L_TTE1, R_TTE1,
|
||||
(1<<5) + 0, L_TTE2, R_TTE2,
|
||||
(0<<5) + 3, _PA,_NA,_SI, L_PPANASI, R_PPANASI,
|
||||
|
|
@ -57,7 +66,8 @@ static unsigned char fzk_xtu[] = {
|
|||
(2<<5) + 2, _RO,_U, L_PPOI, R_KAROU,
|
||||
(1<<5) + 1, _KU, L_PPOI, R_KRENYOU,
|
||||
(1<<5) + 2, _KE,_RE, L_PPOI, R_KATEI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_a[] = {
|
||||
(0<<5) + 1, _GE, L_YOUGEN, R_AGE,
|
||||
|
|
@ -75,7 +85,8 @@ static unsigned char fzk_a[] = {
|
|||
(1<<5) + 0, L_ARE2, R_KATEI2,
|
||||
(1<<5) + 3, _BA,_KO,_SO, L_ARE1, R_CUT,
|
||||
(0<<5) + 2, _RO,_U, L_AROU, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_i[] = {
|
||||
(0<<5) + 0, L_IRU, R_I,
|
||||
|
|
@ -97,19 +108,22 @@ static unsigned char fzk_i[] = {
|
|||
(0<<5) + 1, _RU, L_IRU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_IRU, R_KATEI2,
|
||||
(0<<5) + 1, _RO, L_IRU, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_u[] = {
|
||||
(0<<5) + 1, _E, L_UE, R_UE,
|
||||
(0<<5) + 1, _TI, L_UTI, R_UTI,
|
||||
(0<<5) + 1, _RU, L_ERU, R_SHUUSI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_e[] = {
|
||||
(0<<5) + 0, L_ERU, R_E,
|
||||
(0<<5) + 1, _RU, L_ERU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_ERU, R_KATEI3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_o[] = {
|
||||
(0<<5) + 1, _I, L_YOUGEN, R_ONBIN8,
|
||||
|
|
@ -124,7 +138,8 @@ static unsigned char fzk_o[] = {
|
|||
(0<<5) + 1, _RI, L_ORI, R_ORI1,
|
||||
(1<<5) + 0, L_YOUGEN, R_ORI2,
|
||||
(0<<5) + 1, _RE, L_YOUGEN, R_KAMEI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ka[] = {
|
||||
(0<<5) + 0 + 8, L_KA1, R_KA1,
|
||||
|
|
@ -148,7 +163,8 @@ static unsigned char fzk_ka[] = {
|
|||
(1<<5) + 0, L_KARA2, R_KARA2,
|
||||
(1<<5) + 1, _ZU, L_KARAZU, R_ZU,
|
||||
(1<<5) + 1, _NU, L_KARAZU, R_NU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ga[] = {
|
||||
(0<<5) + 0, L_GA1, R_GA1,
|
||||
|
|
@ -167,12 +183,14 @@ static unsigned char fzk_ga[] = {
|
|||
(2<<5) + 1, _RA, L_GATIDA, R_KATEI1,
|
||||
(1<<5) + 1, _NI, L_GATIDA, R_DRENYOU2,
|
||||
(0<<5) + 2, _TE,_RA, L_GATERA, R_GATERA,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ki[] = {
|
||||
(0<<5) + 0, L_YOUGEN, R_FZKKI,
|
||||
(0<<5) + 1, _RI, L_KIRI, R_KIRI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ku[] = {
|
||||
(0<<5) + 2, _SE,_NI, L_KUSENI, R_KUSENI,
|
||||
|
|
@ -187,33 +205,38 @@ static unsigned char fzk_ku[] = {
|
|||
(0<<5) + 1, _RE, L_YOUGEN, R_KURE,
|
||||
(1<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
|
||||
(1<<5) + 1, _RE, L_YOUGEN, R_KATEI3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_gu[] = {
|
||||
(0<<5) + 2, _RA,_I, L_KURAI, R_KURAI,
|
||||
(0<<5) + 2, _RU,_MI, L_GURUMI, R_GURUMI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ke[] = {
|
||||
(0<<5) + 1, _DO, L_KEDO, R_KEDO,
|
||||
(1<<5) + 1, _MO, L_KEDO, R_KEDO,
|
||||
(0<<5) + 2, _RE,_DO, L_KEDO, R_KEDO,
|
||||
(2<<5) + 1, _MO, L_KEDO, R_KEDO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ko[] = {
|
||||
(0<<5) + 0, L_YOUGEN, R_KO,
|
||||
(0<<5) + 1, _I, L_YOUGEN, R_MEIREI1,
|
||||
(0<<5) + 1, _SO, L_KOSO, R_KOSO,
|
||||
(0<<5) + 1, _TO, L_KOTO, R_KOTO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_go[] = {
|
||||
(0<<5) + 2, _ZA,_I, L_GOZAI, R_GOZAI,
|
||||
(0<<5) + 2, _TO,_KI, L_GOTOSI, R_GOTOKI,
|
||||
(1<<5) + 1, _KU, L_GOTOSI, R_GOTOKU,
|
||||
(1<<5) + 1, _SI, L_GOTOSI, R_GOTOSI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_sa[] = {
|
||||
(0<<5) + 0, L_SA1, R_MIZEN1,
|
||||
|
|
@ -224,12 +247,14 @@ static unsigned char fzk_sa[] = {
|
|||
(1<<5) + 1, _RU, L_SASERU, R_SHUUSI,
|
||||
(1<<5) + 1, _RE, L_SASERU, R_KATEI2,
|
||||
(1<<5) + 1, _RO, L_SASERU, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_za[] = {
|
||||
(0<<5) + 1, _RU, L_ZARU, R_ZARU,
|
||||
(0<<5) + 1, _RE, L_ZARU, R_KATEI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_si[] = {
|
||||
(0<<5) + 0, L_SI1, R_SI1,
|
||||
|
|
@ -244,7 +269,8 @@ static unsigned char fzk_si[] = {
|
|||
(1<<5) + 1, _XTU, L_YOUGEN, R_ONBIN6,
|
||||
(1<<5) + 1, _WA, L_YOUGEN, R_MIZEN5,
|
||||
(0<<5) + 1, _RO, L_SIRO, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ji[] = {
|
||||
(0<<5) + 2, _MA,_I, L_JIMAU, R_IKI,
|
||||
|
|
@ -260,7 +286,8 @@ static unsigned char fzk_ji[] = {
|
|||
(1<<5) + 2, _O,_U, L_JYAU, R_AROU,
|
||||
(1<<5) + 1, _XTU, L_JYAU, R_ONBIN6,
|
||||
(1<<5) + 1, _WA, L_JYAU, R_MIZEN5,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_su[] = {
|
||||
(0<<5) + 1, _GI, L_SUGIRU, R_SUGI,
|
||||
|
|
@ -273,7 +300,8 @@ static unsigned char fzk_su[] = {
|
|||
(0<<5) + 1, _RA, L_SURA, R_SURA,
|
||||
(0<<5) + 1, _RU, L_SURU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_SURE, R_KATEI2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_zu[] = {
|
||||
(0<<5) + 0, L_ZU, R_ZU,
|
||||
|
|
@ -281,7 +309,8 @@ static unsigned char fzk_zu[] = {
|
|||
(0<<5) + 2, _NI,_I, L_ZU, R_I,
|
||||
(2<<5) + 1, _RU, L_ZU, R_SHUUSI,
|
||||
(0<<5) + 2, _NN,_BA, L_ZUNBA, R_CUT,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_se[] = {
|
||||
(0<<5) + 0, L_SE, R_MIZEN2,
|
||||
|
|
@ -291,11 +320,13 @@ static unsigned char fzk_se[] = {
|
|||
(0<<5) + 1, _RU, L_SERU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_SERU, R_KATEI2,
|
||||
(0<<5) + 1, _RO, L_SERU, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ze[] = {
|
||||
(0<<5) + 0, L_ZE, R_SHUUJO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_so[] = {
|
||||
(0<<5) + 1, _U, L_SOUDA, R_SOU,
|
||||
|
|
@ -311,11 +342,13 @@ static unsigned char fzk_so[] = {
|
|||
(2<<5) + 0, L_YOUTAI, R_SOUNA2,
|
||||
(2<<5) + 1, _RA, L_SOUDA, R_KATEI1,
|
||||
(1<<5) + 1, _NI, L_YOUTAI, R_SOUNI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_zo[] = {
|
||||
(0<<5) + 0, L_ZO, R_SHUUJO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ta[] = {
|
||||
(0<<5) + 0, L_TA, R_TA,
|
||||
|
|
@ -340,7 +373,8 @@ static unsigned char fzk_ta[] = {
|
|||
(0<<5) + 1, _RI, L_TA, R_TARI,
|
||||
(0<<5) + 1, _RU, L_TARU, R_CUT,
|
||||
(0<<5) + 2, _RO,_U, L_TA, R_KAROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_da[] = {
|
||||
(0<<5) + 0, L_DA1, R_TA,
|
||||
|
|
@ -352,7 +386,8 @@ static unsigned char fzk_da[] = {
|
|||
(1<<5) + 1, _KE, L_DARAKE, R_DARAKE,
|
||||
(0<<5) + 1, _RI, L_DA1, R_TARI,
|
||||
(0<<5) + 2, _RO,_U, L_DAROU, R_DAROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ti[] = {
|
||||
(0<<5) + 2, _MA,_I, L_TIMAU, R_IKI,
|
||||
|
|
@ -368,24 +403,28 @@ static unsigned char fzk_ti[] = {
|
|||
(1<<5) + 2, _O,_U, L_TYAU, R_AROU,
|
||||
(1<<5) + 1, _XTU, L_TYAU, R_ONBIN6,
|
||||
(1<<5) + 1, _WA, L_TYAU, R_MIZEN5,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_di[] = {
|
||||
(0<<5) + 1, _XYA, L_JYA, R_JYA,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_tu[] = {
|
||||
(0<<5) + 2, _I,_TE, L_TUITE, R_TUITE,
|
||||
(0<<5) + 1, _KI, L_TUKI, R_TUKI,
|
||||
(0<<5) + 1, _TU, L_TUTU, R_TUTU,
|
||||
(0<<5) + 2, _MO,_RI, L_TUMORI, R_TUMORI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_te[] = {
|
||||
(0<<5) + 0, L_TE1, R_TE1,
|
||||
(0<<5) + 0, L_TE2, R_TE2,
|
||||
(0<<5) + 1, _RU, L_TERU, R_TERU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_de[] = {
|
||||
(0<<5) + 0, L_DE, R_DE,
|
||||
|
|
@ -400,7 +439,8 @@ static unsigned char fzk_de[] = {
|
|||
(0<<5) + 1, _SU, L_DESU, R_DESU,
|
||||
(0<<5) + 1, _HA, L_DEHA, R_DEHA,
|
||||
(0<<5) + 1, _RU, L_DERU, R_TERU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_to[] = {
|
||||
(0<<5) + 0, L_TO1, R_TO1,
|
||||
|
|
@ -420,7 +460,8 @@ static unsigned char fzk_to[] = {
|
|||
(0<<5) + 1, _TE, L_TOTE, R_TOTE,
|
||||
(0<<5) + 3, _HA,_I,_E, L_TOHAIE, R_TOHAIE,
|
||||
(0<<5) + 1, _MO, L_TOMO, R_TOMO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_do[] = {
|
||||
(0<<5) + 0, L_DO, R_DO,
|
||||
|
|
@ -434,7 +475,8 @@ static unsigned char fzk_do[] = {
|
|||
(1<<5) + 1, _RO, L_DOKORO, R_DOKORO,
|
||||
(2<<5) + 1, _KA, L_DOKOROKA, R_DOKOROKA,
|
||||
(0<<5) + 1, _MO, L_DOMO, R_DOMO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_na[] = {
|
||||
(0<<5) + 0, L_NA1, R_SHUUJO,
|
||||
|
|
@ -470,7 +512,8 @@ static unsigned char fzk_na[] = {
|
|||
(0<<5) + 2, _NN,_KA, L_NANKA, R_NANKA,
|
||||
(1<<5) + 1, _ZO, L_NANZO, R_NANZO,
|
||||
(1<<5) + 1, _TE, L_NANTE, R_NANTE,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ni[] = {
|
||||
(0<<5) + 0, L_NI1, R_NI1,
|
||||
|
|
@ -481,21 +524,24 @@ static unsigned char fzk_ni[] = {
|
|||
(2<<5) + 2, _RO,_U, L_NIKUI, R_KAROU,
|
||||
(1<<5) + 1, _KU, L_NIKUI, R_TAKU,
|
||||
(1<<5) + 2, _KE,_RE, L_NIKUI, R_KATEI3,
|
||||
(1 << 5) + 1, _SA, L_NIKUI, R_FZKMEISHI,
|
||||
(1<<5) + 1, _SA, L_NIKUI, R_FZKMEISI,
|
||||
(0<<5) + 1, _TE, L_NITE, R_NITE,
|
||||
(0<<5) + 2, _DE,_MO, L_NI1, R_MO1,
|
||||
(0<<5) + 1, _MO, L_NIMO, R_NIMO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_nu[] = {
|
||||
(0<<5) + 0, L_NU, R_NU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ne[] = {
|
||||
(0<<5) + 0, L_NE1, R_SHUUJO,
|
||||
(0<<5) + 0, L_NE2, R_KATEI2,
|
||||
(0<<5) + 1, _E, L_NEE, R_SHUUJO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_no[] = {
|
||||
(0<<5) + 0, L_NO1, R_NO1,
|
||||
|
|
@ -504,13 +550,15 @@ static unsigned char fzk_no[] = {
|
|||
(0<<5) + 1, _NI, L_NONI, R_NONI,
|
||||
(0<<5) + 1, _MI, L_NOMI, R_NOMI,
|
||||
(1<<5) + 3, _NA,_RA,_ZU, L_NOMINRZ, R_NOMINRZ,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ha[] = {
|
||||
(0<<5) + 0, L_HA, R_HA,
|
||||
(0<<5) + 1, _SI, L_HA, R_HASI,
|
||||
(0<<5) + 1, _ZU, L_HAZU, R_HAZU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ba[] = {
|
||||
(0<<5) + 0, L_BA, R_BA,
|
||||
|
|
@ -518,7 +566,8 @@ static unsigned char fzk_ba[] = {
|
|||
(1<<5) + 1, _RI, L_BAKARI, R_BAKARI,
|
||||
(0<<5) + 3, _XTU,_KA,_SI, L_BAKARI, R_BAKARI,
|
||||
(2<<5) + 1, _RI, L_BAKARI, R_BAKARI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_hu[] = {
|
||||
(0<<5) + 2, _U,_DA, L_FUUDA, R_SOUDA,
|
||||
|
|
@ -532,24 +581,28 @@ static unsigned char fzk_hu[] = {
|
|||
(1<<5) + 1, _NA, L_FUUDA, R_SOUNA2,
|
||||
(2<<5) + 1, _RA, L_FUUDA, R_KATEI1,
|
||||
(1<<5) + 1, _NI, L_FUUDA, R_FUUNI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_he[] = {
|
||||
(0<<5)+0, L_HE, R_HE,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_be[] = {
|
||||
(0<<5) + 2, _KA,_RA, L_BESI, R_BEKARA,
|
||||
(0<<5) + 1, _KI, L_BESI, R_BEKI,
|
||||
(0<<5) + 1, _KU, L_BESI, R_BEKU,
|
||||
(0<<5) + 1, _SI, L_BESI, R_BESI,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ho[] = {
|
||||
(0<<5) + 1, _U, L_HOU, R_HOU,
|
||||
(0<<5) + 1, _KA, L_HOKA, R_HOKA,
|
||||
(0<<5) + 1, _DO, L_HODO, R_HODO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ma[] = {
|
||||
(0<<5) + 1, _I, L_MAI, R_MAI,
|
||||
|
|
@ -564,7 +617,8 @@ static unsigned char fzk_ma[] = {
|
|||
(1<<5) + 1, _NN, L_MASU, R_NN2,
|
||||
(0<<5) + 1, _DE, L_MADE, R_MADE,
|
||||
(0<<5) + 1, _MA, L_MAMA, R_MAMA,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_mi[] = {
|
||||
(0<<5) + 0, L_YOUGEN, R_MI,
|
||||
|
|
@ -584,7 +638,8 @@ static unsigned char fzk_mi[] = {
|
|||
(0<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_YOUGEN, R_KATEI2,
|
||||
(0<<5) + 1, _RO, L_YOUGEN, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_mo[] = {
|
||||
(0<<5) + 0, L_MO1, R_MO1,
|
||||
|
|
@ -599,7 +654,8 @@ static unsigned char fzk_mo[] = {
|
|||
(1<<5) + 1, _WA, L_YOUGEN, R_MIZEN5,
|
||||
(0<<5) + 1, _NN, L_WAYO, R_SHUUJO,
|
||||
(1<<5) + 1, _KA, L_WAYO, R_SHUUJO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ya[] = {
|
||||
(0<<5) + 0, L_YA1, R_YA1,
|
||||
|
|
@ -609,7 +665,7 @@ static unsigned char fzk_ya[] = {
|
|||
(2<<5) + 2, _RO,_U, L_YASUI, R_KAROU,
|
||||
(1<<5) + 1, _KU, L_YASUI, R_TAKU,
|
||||
(1<<5) + 2, _KE,_RE, L_YASUI, R_KATEI3,
|
||||
(1 << 5) + 1, _SA, L_YASUI, R_FZKMEISHI,
|
||||
(1<<5) + 1, _SA, L_YASUI, R_FZKMEISI,
|
||||
(0<<5) + 1, _XTU, L_YOUGEN, R_ONBIN2,
|
||||
(0<<5) + 1, _RA, L_YARA, R_YARA,
|
||||
(1<<5) + 0, L_YOUGEN, R_MIZEN5,
|
||||
|
|
@ -617,11 +673,13 @@ static unsigned char fzk_ya[] = {
|
|||
(0<<5) + 1, _RU, L_YOUGEN, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_YOUGEN, R_KATEI2,
|
||||
(0<<5) + 2, _RO,_U, L_YOUGEN, R_AROU,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_yu[] = {
|
||||
(0<<5) + 1, _E, L_YUE, R_YUE,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_yo[] = {
|
||||
(0<<5) + 0, L_YO, R_SHUUJO,
|
||||
|
|
@ -643,7 +701,7 @@ static unsigned char fzk_yo[] = {
|
|||
(1<<5) + 2, _RO,_U, L_YOI, R_KAROU,
|
||||
(0<<5) + 1, _KU, L_YOI, R_TAKU,
|
||||
(0<<5) + 2, _KE,_RE, L_YOI, R_KATEI3,
|
||||
(0 << 5) + 1, _SA, L_YOI, R_FZKMEISHI,
|
||||
(0<<5) + 1, _SA, L_YOI, R_FZKMEISI,
|
||||
(0<<5) + 2, _XTU,_TE, L_YORU, R_YOTTE,
|
||||
(0<<5) + 2, _NA,_XA, L_YO, R_SHUUJO,
|
||||
(1<<5) + 1, _A, L_YO, R_SHUUJO,
|
||||
|
|
@ -653,7 +711,8 @@ static unsigned char fzk_yo[] = {
|
|||
(1<<5) + 0, L_YORU, R_YORI2,
|
||||
(0<<5) + 1, _RU, L_YORU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_YORU, R_KATEI3,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_ra[] = {
|
||||
(0<<5) + 2, _SI,_I, L_RASII, R_RASII,
|
||||
|
|
@ -666,7 +725,8 @@ static unsigned char fzk_ra[] = {
|
|||
(1<<5) + 1, _RU, L_RARERU, R_SHUUSI,
|
||||
(1<<5) + 1, _RE, L_RARERU, R_KATEI2,
|
||||
(1<<5) + 1, _RO, L_RARERU, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_re[] = {
|
||||
(0<<5) + 0, L_RERU, R_RARE,
|
||||
|
|
@ -674,19 +734,24 @@ static unsigned char fzk_re[] = {
|
|||
(0<<5) + 1, _RU, L_RERU, R_SHUUSI,
|
||||
(0<<5) + 1, _RE, L_RERU, R_KATEI2,
|
||||
(0<<5) + 1, _RO, L_RERU, R_MEIREI1,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_wa[] = {
|
||||
(0<<5) + 0, L_WA, R_SHUUJO,
|
||||
(0<<5) + 1, _KE, L_WAKE, R_WAKE,
|
||||
(0<<5) + 1, _NE, L_WANE, R_SHUUJO,
|
||||
(0<<5) + 1, _YO, L_WAYO, R_SHUUJO,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
static unsigned char fzk_nn[] = {
|
||||
(0<<5) + 0, L_NN1, R_NN1,
|
||||
(0<<5) + 0, L_NN2, R_NN2,
|
||||
0xff};
|
||||
0xff
|
||||
};
|
||||
|
||||
|
||||
|
||||
unsigned char *fzkadr[] = {
|
||||
0, fzk_a, 0, fzk_i, 0,
|
||||
|
|
@ -705,4 +770,5 @@ unsigned char* fzkadr[] = {
|
|||
fzk_mo, 0, fzk_ya, 0, fzk_yu,
|
||||
0, fzk_yo, fzk_ra, 0, 0,
|
||||
fzk_re, 0, 0, fzk_wa, 0,
|
||||
0, fzk_wo, fzk_nn};
|
||||
0, fzk_wo, fzk_nn
|
||||
};
|
||||
|
|
|
|||
116
getkanji.c
116
getkanji.c
|
|
@ -27,36 +27,53 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: getkanji.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:49 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static unsigned char*
|
||||
code2kanji(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg);
|
||||
|
||||
unsigned char*
|
||||
getkan_none(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_none(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
getkan_hira(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_hira(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
int cnt, csize;
|
||||
|
||||
csize = codesize(*s);
|
||||
|
||||
cnt = (*s & KanjiCodeMask) + 1;
|
||||
|
||||
|
||||
if (flg && (s[csize] == KanjiStrEnd)) ym += (yl - cnt) * 2;
|
||||
|
||||
|
||||
cnt *= 2;
|
||||
while (cnt-- > 0) *d++ = *ym++;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
getkan_kata(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_kata(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
int cnt, csize;
|
||||
unsigned char ch;
|
||||
|
||||
|
|
@ -64,20 +81,24 @@ getkan_kata(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int f
|
|||
|
||||
cnt = (*s & KanjiCodeMask) + 1;
|
||||
|
||||
|
||||
if (flg && (s[csize] == KanjiStrEnd)) ym += (yl - cnt) * 2;
|
||||
|
||||
|
||||
while (cnt-- > 0) {
|
||||
|
||||
if (*ym == 0xa4) {
|
||||
ch = *++ym;
|
||||
if (0xa1 <= ch && ch <= 0xf3) {
|
||||
*d++ = 0xa5;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*d++ = 0xa4;
|
||||
}
|
||||
*d++ = ch;
|
||||
ym++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*d++ = *ym++;
|
||||
*d++ = *ym++;
|
||||
}
|
||||
|
|
@ -86,21 +107,27 @@ getkan_kata(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int f
|
|||
return d;
|
||||
}
|
||||
|
||||
unsigned char*
|
||||
getkan_knj(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
|
||||
return code2kanji(askknj[*s & KnjAsshukuMask], d, ym, yl, flg);
|
||||
unsigned char*
|
||||
getkan_knj(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
|
||||
return code2kanji(askknj[*s & KnjAssyukuMask], d, ym, yl, flg);
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
getkan_ofs(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_ofs(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
|
||||
return code2kanji(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
|
||||
d, ym, yl, flg);
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
getkan_norm(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_norm(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
if (*s != 0) {
|
||||
|
|
@ -115,8 +142,10 @@ getkan_norm(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int f
|
|||
return d;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
getkan_ascii(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
getkan_ascii(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
c = s[1];
|
||||
|
|
@ -127,67 +156,58 @@ getkan_ascii(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int
|
|||
return d;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char*
|
||||
code2kanji(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg) {
|
||||
code2kanji(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int flg)
|
||||
{
|
||||
int csize;
|
||||
|
||||
for ( ; ; ) {
|
||||
csize = codesize(*s);
|
||||
if (s[csize] == KanjiStrEnd) {
|
||||
switch(*s & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
d = getkan_hira(s, d, ym, yl, flg);
|
||||
break;
|
||||
case ZenHiraAssyuku:
|
||||
d = getkan_hira(s, d, ym, yl, flg); break;
|
||||
|
||||
case ZenKataAsshuku:
|
||||
d = getkan_kata(s, d, ym, yl, flg);
|
||||
break;
|
||||
case ZenKataAssyuku:
|
||||
d = getkan_kata(s, d, ym, yl, flg); break;
|
||||
|
||||
case OffsetAsshuku:
|
||||
d = getkan_ofs(s, d, ym, yl, flg);
|
||||
break;
|
||||
case OffsetAssyuku:
|
||||
d = getkan_ofs(s, d, ym, yl, flg); break;
|
||||
|
||||
case AiAttribute:
|
||||
d = getkan_none(s, d, ym, yl, flg);
|
||||
break;
|
||||
d = getkan_none(s, d, ym, yl, flg); break;
|
||||
|
||||
case LeadingHankaku:
|
||||
d = getkan_ascii(s, d, ym, yl, flg);
|
||||
break;
|
||||
d = getkan_ascii(s, d, ym, yl, flg); break;
|
||||
|
||||
case KanjiAsshuku:
|
||||
d = getkan_knj(s, d, ym, yl, flg);
|
||||
break;
|
||||
case KanjiAssyuku:
|
||||
d = getkan_knj(s, d, ym, yl, flg); break;
|
||||
|
||||
default:
|
||||
d = getkan_norm(s, d, ym, yl, flg);
|
||||
}
|
||||
break;
|
||||
} else
|
||||
}
|
||||
else
|
||||
switch(*s & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
d = getkan_hira(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
case ZenHiraAssyuku:
|
||||
d = getkan_hira(s, d, ym, yl, FALSE); break;
|
||||
|
||||
case ZenKataAsshuku:
|
||||
d = getkan_kata(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
case ZenKataAssyuku:
|
||||
d = getkan_kata(s, d, ym, yl, FALSE); break;
|
||||
|
||||
case OffsetAsshuku:
|
||||
d = getkan_ofs(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
case OffsetAssyuku:
|
||||
d = getkan_ofs(s, d, ym, yl, FALSE); break;
|
||||
|
||||
case AiAttribute:
|
||||
d = getkan_none(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
d = getkan_none(s, d, ym, yl, FALSE); break;
|
||||
|
||||
case LeadingHankaku:
|
||||
d = getkan_ascii(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
d = getkan_ascii(s, d, ym, yl, FALSE); break;
|
||||
|
||||
case KanjiAsshuku:
|
||||
d = getkan_knj(s, d, ym, yl, FALSE);
|
||||
break;
|
||||
case KanjiAssyuku:
|
||||
d = getkan_knj(s, d, ym, yl, FALSE); break;
|
||||
|
||||
default:
|
||||
d = getkan_norm(s, d, ym, yl, FALSE);
|
||||
|
|
@ -199,10 +219,14 @@ code2kanji(unsigned char* s, unsigned char* d, unsigned char* ym, int yl, int fl
|
|||
return d;
|
||||
}
|
||||
|
||||
int getkanji(unsigned char* ym, int yl, unsigned char* ptr, unsigned char* buf) {
|
||||
|
||||
int
|
||||
getkanji(unsigned char* ym, int yl, unsigned char* ptr, unsigned char* buf)
|
||||
{
|
||||
unsigned char *q;
|
||||
|
||||
q = code2kanji(ptr, buf, ym, yl, TRUE);
|
||||
|
||||
return q - buf;
|
||||
}
|
||||
|
||||
|
|
|
|||
49
getrank.c
49
getrank.c
|
|
@ -27,22 +27,39 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: getrank.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:50 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static void setstynum (void);
|
||||
static void setnspr (KHREC *kptr, STDYIN *sptr);
|
||||
static void regetrank (void);
|
||||
|
||||
void getrank(void) {
|
||||
|
||||
|
||||
void
|
||||
getrank (void)
|
||||
{
|
||||
trank = nrank = 1;
|
||||
|
||||
setstynum();
|
||||
regetrank();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setstynum(void) {
|
||||
setstynum (void)
|
||||
{
|
||||
KHREC *kptr;
|
||||
STDYIN *sptr;
|
||||
int count;
|
||||
|
|
@ -55,8 +72,11 @@ setstynum(void) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setnspr(KHREC* kptr, STDYIN* sptr) {
|
||||
setnspr (KHREC *kptr, STDYIN *sptr)
|
||||
{
|
||||
KHREC *ptr;
|
||||
int keepnm;
|
||||
TypeStyNum styno;
|
||||
|
|
@ -68,19 +88,22 @@ setnspr(KHREC* kptr, STDYIN* sptr) {
|
|||
if (styno < ptr -> styno) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
} else if(styno == ptr->styno) {
|
||||
}
|
||||
else if (styno == ptr -> styno) {
|
||||
if (kptr -> sttfg && kptr -> ka_fg) {
|
||||
if ((sptr -> sttkj == kptr -> sttkj) &&
|
||||
(sptr -> ka_kj == kptr -> ka_kj)) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
}
|
||||
} else if(kptr->sttfg) {
|
||||
}
|
||||
else if (kptr -> sttfg) {
|
||||
if (sptr -> sttkj == kptr -> sttkj) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
}
|
||||
} else if(kptr->ka_fg) {
|
||||
}
|
||||
else if (kptr -> ka_fg) {
|
||||
if (sptr -> ka_kj == kptr -> ka_kj) {
|
||||
ptr -> rank++;
|
||||
keepnm--;
|
||||
|
|
@ -95,8 +118,11 @@ setnspr(KHREC* kptr, STDYIN* sptr) {
|
|||
if (sptr -> nmflg && (nrank > keepnm)) nrank = keepnm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
regetrank(void) {
|
||||
regetrank (void)
|
||||
{
|
||||
KHREC *kptr;
|
||||
int count;
|
||||
int tmp;
|
||||
|
|
@ -104,7 +130,8 @@ regetrank(void) {
|
|||
if (nrank < trank) {
|
||||
tmp = nrank;
|
||||
trank += nkhcount;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
nkhcount = tmp = 0;
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +139,11 @@ regetrank(void) {
|
|||
if (!(kptr -> rank)) {
|
||||
if (tmp && kptr -> mode && !(kptr -> offs)) {
|
||||
kptr -> rank = (unsigned char)tmp++;
|
||||
} else
|
||||
}
|
||||
else
|
||||
kptr -> rank = (unsigned char)trank++;
|
||||
} else if((short)kptr->rank >= nrank)
|
||||
}
|
||||
else if ((short)kptr -> rank >= nrank)
|
||||
kptr -> rank += (unsigned char)nkhcount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
global.c
11
global.c
|
|
@ -27,6 +27,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: global.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:35 $
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "sj_struct2.h"
|
||||
|
|
@ -34,7 +41,7 @@
|
|||
DouonRec *douon_ptr = NULL;
|
||||
int douon_num = 0;
|
||||
int yomi_len = 0;
|
||||
int hinshi_num = 0;
|
||||
int hinsi_num = 0;
|
||||
int kanji_len = 0;
|
||||
|
||||
HindoRec *hindo[MaxHindoNumber];
|
||||
|
|
@ -43,7 +50,7 @@ int hindo_num = 0;
|
|||
OffsetRec *ofsrec[MaxOffsetNumber];
|
||||
int ofsrec_num = 0;
|
||||
|
||||
AsshukuRec* asshuku = NULL;
|
||||
AssyukuRec *assyuku = NULL;
|
||||
|
||||
HindoRec *askknj[MaxKnjAskNumber];
|
||||
int askknj_num = 0;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: global.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/12/09 11:27:06 $
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -46,3 +53,4 @@ Global* work_base;
|
|||
STDY *stdy_base;
|
||||
|
||||
int serv_errno;
|
||||
|
||||
|
|
|
|||
119
henkan.c
119
henkan.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: henkan.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1997/01/23 11:09:37 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "key.h"
|
||||
#include "wchar16.h"
|
||||
|
|
@ -36,7 +44,8 @@ void Rdisp();
|
|||
|
||||
int i_point;
|
||||
|
||||
exec_henkan() {
|
||||
exec_henkan ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i, j;
|
||||
wchar16_t *s, *p;
|
||||
|
|
@ -99,6 +108,7 @@ exec_henkan() {
|
|||
|
||||
bnum = SJ2_henkan(cv->yomiout, cv->Bun, cv->kanjiout, BUFFLENGTH*4);
|
||||
|
||||
|
||||
if (bnum < 0 && !dconnect(1))
|
||||
bnum = SJ2_henkan(cv->yomiout, cv->Bun, cv->kanjiout, BUFFLENGTH*4);
|
||||
|
||||
|
|
@ -216,7 +226,8 @@ exec_henkan() {
|
|||
cv->Kanji = 1;
|
||||
}
|
||||
|
||||
addBun(cur, end) int cur, end;
|
||||
addBun(cur, end)
|
||||
int cur, end;
|
||||
{
|
||||
int i;
|
||||
Conversion *cv;
|
||||
|
|
@ -230,7 +241,8 @@ addBun(cur, end) int cur, end;
|
|||
}
|
||||
}
|
||||
|
||||
delspan(cur) int cur;
|
||||
delspan(cur)
|
||||
int cur;
|
||||
{
|
||||
int i;
|
||||
Conversion *cv;
|
||||
|
|
@ -243,7 +255,8 @@ delspan(cur) int cur;
|
|||
}
|
||||
}
|
||||
|
||||
delBun(cur, end) int cur, end;
|
||||
delBun(cur, end)
|
||||
int cur, end;
|
||||
{
|
||||
int i;
|
||||
Conversion *cv;
|
||||
|
|
@ -259,6 +272,7 @@ delBun(cur, end) int cur, end;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
IsHex (c)
|
||||
wchar16_t c;
|
||||
{
|
||||
|
|
@ -266,8 +280,7 @@ IsHex(c)
|
|||
}
|
||||
|
||||
Getcode (in, out)
|
||||
wchar16_t* in,
|
||||
*out;
|
||||
wchar16_t *in, *out;
|
||||
{
|
||||
int c, i, j;
|
||||
unsigned char s[5];
|
||||
|
|
@ -334,9 +347,11 @@ Getcode(in, out)
|
|||
(void)sj_hantozen(out, in, strlen((char *)in));
|
||||
}
|
||||
|
||||
|
||||
static unsigned char load_mode;
|
||||
|
||||
load_bun(num, s, type) int num;
|
||||
load_bun (num, s, type)
|
||||
int num;
|
||||
wchar16_t *s;
|
||||
unsigned char type;
|
||||
{
|
||||
|
|
@ -403,11 +418,13 @@ unsigned char type;
|
|||
} else
|
||||
len = sj_zentohan(s, cv->Ppoint[num], len);
|
||||
}
|
||||
|
||||
}
|
||||
return(len);
|
||||
}
|
||||
|
||||
load_bun2(num, htmp, ztmp, omode) int num;
|
||||
load_bun2(num, htmp, ztmp, omode)
|
||||
int num;
|
||||
wchar16_t *htmp, *ztmp;
|
||||
unsigned short *omode;
|
||||
{
|
||||
|
|
@ -418,6 +435,7 @@ unsigned short* omode;
|
|||
unsigned char type;
|
||||
wchar16_t Ztmp[DLEN + 1];
|
||||
|
||||
|
||||
cv = GetConversion ();
|
||||
if (num < 0 || (len = cv->Plen[num]) == 0) {
|
||||
*ztmp = '\0';
|
||||
|
|
@ -453,8 +471,7 @@ unsigned short* omode;
|
|||
}
|
||||
|
||||
getistr(s, ostr, len)
|
||||
wchar16_t* s,
|
||||
*ostr;
|
||||
wchar16_t *s, *ostr;
|
||||
int len;
|
||||
{
|
||||
int ipos, opos;
|
||||
|
|
@ -475,7 +492,8 @@ int len;
|
|||
return(rlen);
|
||||
}
|
||||
|
||||
exec_muhenkan(first) int first;
|
||||
exec_muhenkan (first)
|
||||
int first;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -488,12 +506,15 @@ exec_muhenkan(first) int first;
|
|||
if (first) {
|
||||
cv->Bkettei[0] = Bmuhenkan;
|
||||
cv->Pkettei[0] = cv->Imode;
|
||||
} else if(cv->Bkettei[0] != Bmuhenkan) {
|
||||
}
|
||||
else if (cv->Bkettei[0] != Bmuhenkan) {
|
||||
cv->Bkettei[0] = Bmuhenkan;
|
||||
cv->Pkettei[0] = MODE_ZHIRA;
|
||||
} else if(cv->Pkettei[0] != MODE_ZHIRA) {
|
||||
}
|
||||
else if (cv->Pkettei[0] != MODE_ZHIRA) {
|
||||
cv->Pkettei[0] = MODE_ZHIRA;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cv->Pkettei[0] = MODE_ZKATA;
|
||||
}
|
||||
|
||||
|
|
@ -509,9 +530,12 @@ exec_muhenkan(first) int first;
|
|||
Bdisp (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned char Bstr_mode;
|
||||
|
||||
Bstr(bnum, s) int bnum;
|
||||
Bstr (bnum, s)
|
||||
int bnum;
|
||||
wchar16_t *s;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
|
@ -521,7 +545,8 @@ wchar16_t* s;
|
|||
if (cv->Bkettei[bnum] & Bmuhenkan) {
|
||||
len = load_bun (bnum, s, cv->Pkettei[bnum]);
|
||||
Bstr_mode = load_mode;
|
||||
} else if(cv->Bkettei[bnum] & Bedit) {
|
||||
}
|
||||
else if (cv->Bkettei[bnum] & Bedit) {
|
||||
i = cv->Edit[bnum];
|
||||
len = cv->Elen[i];
|
||||
if (len <= DLEN) {
|
||||
|
|
@ -531,10 +556,12 @@ wchar16_t* s;
|
|||
*s = '\0';
|
||||
} else
|
||||
len = -1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
len = load_bun (bnum, s, 0);
|
||||
Bstr_mode = 1;
|
||||
} else if(cv->Bkettei[bnum] & Bhenkan) {
|
||||
}
|
||||
else if (cv->Bkettei[bnum] & Bhenkan) {
|
||||
if (!(i = cv->Bpoint[bnum])) {
|
||||
len = -1;
|
||||
return len;
|
||||
|
|
@ -552,12 +579,16 @@ wchar16_t* s;
|
|||
} else
|
||||
len = -1;
|
||||
Bstr_mode = 1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
len = -1;
|
||||
return (len);
|
||||
}
|
||||
|
||||
mode_muhenkan(mod, bkettei) int mod, bkettei;
|
||||
|
||||
|
||||
mode_muhenkan (mod, bkettei)
|
||||
int mod, bkettei;
|
||||
{
|
||||
int def;
|
||||
|
||||
|
|
@ -573,7 +604,8 @@ mode_muhenkan(mod, bkettei) int mod, bkettei;
|
|||
return (KEY_ZHIRA);
|
||||
}
|
||||
|
||||
Bchange(mod) int mod;
|
||||
Bchange (mod)
|
||||
int mod;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i;
|
||||
|
|
@ -626,7 +658,10 @@ Bchange(mod) int mod;
|
|||
}
|
||||
}
|
||||
|
||||
Bdisp(redraw) {
|
||||
|
||||
|
||||
Bdisp (redraw)
|
||||
{
|
||||
Conversion *cv;
|
||||
int i;
|
||||
int len;
|
||||
|
|
@ -651,7 +686,8 @@ Bdisp(redraw) {
|
|||
}
|
||||
displen = wcbyte(BDtmp);
|
||||
tmpcol += displen;
|
||||
if((tmpcol > (unsigned int)cv->column) && (row == cv->line) && (row == cv->SavedRow) && (row > 0)) {
|
||||
if ((tmpcol > (unsigned int)cv->column) && (row == cv->line)
|
||||
&& (row == cv->SavedRow) && (row > 0)) {
|
||||
cv->SavedRow--;
|
||||
tmpcol -= cv->column;
|
||||
}
|
||||
|
|
@ -668,7 +704,10 @@ Bdisp(redraw) {
|
|||
Flush ();
|
||||
}
|
||||
|
||||
void Rdisp() {
|
||||
|
||||
void
|
||||
Rdisp ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i;
|
||||
int Total;
|
||||
|
|
@ -693,7 +732,8 @@ void Rdisp() {
|
|||
}
|
||||
displen = wcbyte(BDtmp);
|
||||
tmpcol += displen;
|
||||
if((tmpcol > (unsigned int)cv->column) && (row == cv->line) && (row == cv->SavedRow) && (row > 0)) {
|
||||
if ((tmpcol > (unsigned int)cv->column) && (row == cv->line)
|
||||
&& (row == cv->SavedRow) && (row > 0)) {
|
||||
cv->SavedRow--;
|
||||
tmpcol -= cv->column;
|
||||
}
|
||||
|
|
@ -715,7 +755,8 @@ void Rdisp() {
|
|||
Flush ();
|
||||
}
|
||||
|
||||
AfterAllPrint(from, Total) int from;
|
||||
AfterAllPrint (from, Total)
|
||||
int from;
|
||||
int Total;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
|
@ -741,7 +782,8 @@ int Total;
|
|||
}
|
||||
displen = wcbyte(BDtmp);
|
||||
tmpcol += displen;
|
||||
if((tmpcol > (unsigned int)cv->column) && (row == cv->line) && (row == cv->SavedRow) && (row > 0)) {
|
||||
if ((tmpcol > (unsigned int)cv->column) && (row == cv->line)
|
||||
&& (row == cv->SavedRow) && (row > 0)) {
|
||||
cv->SavedRow--;
|
||||
tmpcol -= cv->column;
|
||||
}
|
||||
|
|
@ -761,7 +803,10 @@ int Total;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
void Bright() {
|
||||
|
||||
void
|
||||
Bright ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int flag;
|
||||
|
||||
|
|
@ -781,7 +826,10 @@ void Bright() {
|
|||
Rdisp ();
|
||||
}
|
||||
|
||||
void Bleft() {
|
||||
|
||||
void
|
||||
Bleft ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int flag;
|
||||
|
||||
|
|
@ -801,7 +849,10 @@ void Bleft() {
|
|||
Rdisp ();
|
||||
}
|
||||
|
||||
void Blast() {
|
||||
|
||||
void
|
||||
Blast ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -813,9 +864,13 @@ void Blast() {
|
|||
return;
|
||||
}
|
||||
Rdisp();
|
||||
|
||||
}
|
||||
|
||||
void Btop() {
|
||||
|
||||
void
|
||||
Btop ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -828,3 +883,5 @@ void Btop() {
|
|||
}
|
||||
Rdisp();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
8
henkan.h
8
henkan.h
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: henkan.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:43 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#define ObjEnd 0
|
||||
#define ObjHenkan 1
|
||||
#define ObjMuhenkan 2
|
||||
|
|
|
|||
234
hindo.c
234
hindo.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: hindo.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/08/17 01:50:26 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -35,19 +44,23 @@
|
|||
|
||||
extern HindoRec *hindo[];
|
||||
extern int hindo_num;
|
||||
extern AsshukuRec* asshuku;
|
||||
extern AssyukuRec *assyuku;
|
||||
extern HindoRec *askknj[];
|
||||
extern int askknj_num;
|
||||
extern int kanji_num;
|
||||
|
||||
int check_hindo(unsigned char* ptr, int len) {
|
||||
|
||||
int
|
||||
check_hindo(unsigned char* ptr, int len)
|
||||
{
|
||||
int low, high, mid;
|
||||
int i;
|
||||
|
||||
|
||||
if (hindo_num <= 0) return 0;
|
||||
|
||||
low = 0;
|
||||
high = hindo_num - 1;
|
||||
|
||||
low = 0; high = hindo_num - 1;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, ptr, len);
|
||||
|
|
@ -62,16 +75,21 @@ int check_hindo(unsigned char* ptr, int len) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static AsshukuRec*
|
||||
makeasshuku(int num) {
|
||||
AsshukuRec* arec;
|
||||
|
||||
arec = (AsshukuRec*)Malloc(sizeof(AsshukuRec));
|
||||
|
||||
static AssyukuRec*
|
||||
makeassyuku (int num)
|
||||
{
|
||||
AssyukuRec *arec;
|
||||
|
||||
|
||||
arec = (AssyukuRec *)Malloc(sizeof(AssyukuRec));
|
||||
if (!arec) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
arec -> len = num;
|
||||
arec -> nrec = NULL;
|
||||
arec -> anext = NULL;
|
||||
|
|
@ -79,22 +97,30 @@ makeasshuku(int num) {
|
|||
return arec;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
asshuku_len(HindoRec* hrec) {
|
||||
assyuku_len(HindoRec* hrec)
|
||||
{
|
||||
int org;
|
||||
int old;
|
||||
int new;
|
||||
OffsetRec *p;
|
||||
|
||||
if(((*(hrec->kptr) & KanjiModeMask) == OffsetAsshuku) &&
|
||||
|
||||
if (((*(hrec->kptr) & KanjiModeMask) == OffsetAssyuku) &&
|
||||
(hrec->klen == 2)) {
|
||||
|
||||
p = real_ofsrec(hrec -> kptr);
|
||||
|
||||
|
||||
org = check_hindo(p -> kptr, p -> klen);
|
||||
|
||||
|
||||
|
||||
old = p->klen * org + 2 * (hrec->exist + hrec->hindo);
|
||||
|
||||
|
||||
|
||||
new = p->klen + (hrec->exist + hrec->hindo + org);
|
||||
}
|
||||
|
||||
|
|
@ -102,24 +128,31 @@ asshuku_len(HindoRec* hrec) {
|
|||
|
||||
old = hrec -> klen * (hrec -> exist + hrec -> hindo);
|
||||
|
||||
|
||||
new = hrec -> klen + (hrec -> exist + hrec -> hindo);
|
||||
}
|
||||
|
||||
|
||||
return (old - new);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_asshuku(HindoRec* hrec) {
|
||||
AsshukuRec* arec;
|
||||
AsshukuRec* aprev;
|
||||
set_assyuku(HindoRec* hrec)
|
||||
{
|
||||
AssyukuRec *arec;
|
||||
AssyukuRec *aprev;
|
||||
int len;
|
||||
|
||||
len = asshuku_len(hrec);
|
||||
|
||||
len = assyuku_len(hrec);
|
||||
|
||||
|
||||
if (len <= 0) return;
|
||||
|
||||
arec = asshuku;
|
||||
aprev = NULL;
|
||||
|
||||
arec = assyuku; aprev = NULL;
|
||||
while (arec) {
|
||||
|
||||
if (arec -> len == len) {
|
||||
|
|
@ -137,83 +170,104 @@ set_asshuku(HindoRec* hrec) {
|
|||
arec = arec -> anext;
|
||||
}
|
||||
|
||||
arec = makeasshuku(len);
|
||||
|
||||
arec = makeassyuku(len);
|
||||
|
||||
|
||||
hrec -> anext = NULL;
|
||||
hrec -> arec = arec;
|
||||
arec -> nrec = hrec;
|
||||
|
||||
|
||||
if (aprev) {
|
||||
arec -> anext = aprev -> anext;
|
||||
aprev -> anext = arec;
|
||||
} else {
|
||||
arec->anext = asshuku;
|
||||
asshuku = arec;
|
||||
}
|
||||
else {
|
||||
arec -> anext = assyuku;
|
||||
assyuku = arec;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
reset_asshuku(HindoRec* hrec) {
|
||||
AsshukuRec* arec;
|
||||
AsshukuRec* aptr;
|
||||
AsshukuRec* aprev;
|
||||
reset_assyuku(HindoRec* hrec)
|
||||
{
|
||||
AssyukuRec *arec;
|
||||
AssyukuRec *aptr;
|
||||
AssyukuRec *aprev;
|
||||
HindoRec *hptr;
|
||||
HindoRec *hprev;
|
||||
|
||||
arec = hrec -> arec;
|
||||
|
||||
|
||||
if (!arec) return;
|
||||
hrec -> arec = NULL;
|
||||
|
||||
hptr = arec->nrec;
|
||||
hprev = NULL;
|
||||
|
||||
hptr = arec -> nrec; hprev = NULL;
|
||||
while (hptr) {
|
||||
if (hptr == hrec) break;
|
||||
hprev = hptr;
|
||||
hptr = hptr -> anext;
|
||||
}
|
||||
|
||||
|
||||
if (!hptr) return;
|
||||
|
||||
|
||||
if (hprev) {
|
||||
hprev -> anext = hrec -> anext;
|
||||
hrec -> anext = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (hrec -> anext) {
|
||||
arec -> nrec = hrec -> anext;
|
||||
hrec -> anext = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!asshuku) return;
|
||||
aptr = asshuku;
|
||||
aprev = NULL;
|
||||
|
||||
|
||||
|
||||
if (!assyuku) return;
|
||||
aptr = assyuku; aprev = NULL;
|
||||
while (aptr) {
|
||||
if (aptr == arec) break;
|
||||
aprev = aptr;
|
||||
aptr = aptr -> anext;
|
||||
}
|
||||
|
||||
|
||||
if (!aptr) return;
|
||||
|
||||
|
||||
if (aprev)
|
||||
aprev -> anext = arec -> anext;
|
||||
|
||||
else
|
||||
asshuku = arec->anext;
|
||||
assyuku = arec -> anext;
|
||||
|
||||
|
||||
Free(arec);
|
||||
|
||||
|
||||
hrec -> anext = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static HindoRec*
|
||||
makehindo(unsigned char* ptr, int len, int alen) {
|
||||
makehindo(unsigned char* ptr, int len, int alen)
|
||||
{
|
||||
HindoRec *hrec;
|
||||
unsigned char *p;
|
||||
|
||||
|
||||
hrec = (HindoRec *)Malloc(sizeof(HindoRec));
|
||||
if (!hrec) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
|
||||
|
|
@ -231,7 +285,8 @@ makehindo(unsigned char* ptr, int len, int alen) {
|
|||
hrec -> hindo = 0;
|
||||
hrec -> exist = 1;
|
||||
hrec -> offset = ++kanji_num;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hrec -> hindo = 1;
|
||||
hrec -> exist = 0;
|
||||
hrec -> offset = 0;
|
||||
|
|
@ -243,24 +298,29 @@ makehindo(unsigned char* ptr, int len, int alen) {
|
|||
return hrec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_hindo(unsigned char* ptr, int len, int alen) {
|
||||
set_hindo(unsigned char* ptr, int len, int alen)
|
||||
{
|
||||
HindoRec *hrec;
|
||||
int low, high, mid;
|
||||
int i;
|
||||
|
||||
|
||||
if (hindo_num <= 0) {
|
||||
hrec = makehindo(ptr, len, alen);
|
||||
hindo[0]= hrec;
|
||||
hindo_num = 1;
|
||||
|
||||
set_asshuku(hrec);
|
||||
|
||||
set_assyuku(hrec);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
high = hindo_num - 1;
|
||||
|
||||
low = 0; high = hindo_num - 1;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, ptr, len);
|
||||
|
|
@ -272,14 +332,17 @@ set_hindo(unsigned char* ptr, int len, int alen) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if (i) {
|
||||
if (hindo_num >= MaxHindoNumber) {
|
||||
fprintf(stderr, "\311\321\305\331\245\306\241\274\245\326\245\353\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
hrec = makehindo(ptr, len, alen);
|
||||
|
||||
|
||||
for (i = hindo_num ; i > mid ; i--) hindo[i] = hindo[i - 1];
|
||||
hindo[mid] = hrec;
|
||||
hindo_num++;
|
||||
|
|
@ -288,33 +351,42 @@ set_hindo(unsigned char* ptr, int len, int alen) {
|
|||
else {
|
||||
hrec = hindo[mid];
|
||||
|
||||
reset_asshuku(hrec);
|
||||
|
||||
reset_assyuku(hrec);
|
||||
|
||||
|
||||
if (hrec -> exist > 0)
|
||||
hrec -> exist += 1;
|
||||
|
||||
|
||||
else if (len == alen && len > 2) {
|
||||
hrec -> exist = 1;
|
||||
hrec -> offset = ++kanji_num;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
hrec -> hindo += 1;
|
||||
}
|
||||
|
||||
set_asshuku(hrec);
|
||||
|
||||
set_assyuku(hrec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
reset_hindo(unsigned char* p, int l) {
|
||||
reset_hindo(unsigned char* p, int l)
|
||||
{
|
||||
HindoRec *hrec;
|
||||
int low, high, mid;
|
||||
int i;
|
||||
|
||||
|
||||
if (hindo_num <= 0) return;
|
||||
|
||||
low = 0;
|
||||
high = hindo_num - 1;
|
||||
|
||||
low = 0; high = hindo_num - 1;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
i = string_cmp(hindo[mid]->kptr, hindo[mid]->klen, p, l);
|
||||
|
|
@ -326,13 +398,15 @@ reset_hindo(unsigned char* p, int l) {
|
|||
else {
|
||||
hrec = hindo[mid];
|
||||
|
||||
reset_asshuku(hrec);
|
||||
|
||||
reset_assyuku(hrec);
|
||||
|
||||
if (hrec -> exist > 0)
|
||||
hrec -> exist -= 1;
|
||||
else if (hrec -> hindo > 0)
|
||||
hrec -> hindo -= 1;
|
||||
|
||||
|
||||
if (hrec -> exist + hrec -> hindo == 0) {
|
||||
while (++mid < hindo_num) {
|
||||
hindo[mid - 1] = hindo[mid];
|
||||
|
|
@ -340,9 +414,10 @@ reset_hindo(unsigned char* p, int l) {
|
|||
hindo_num--;
|
||||
Free(hrec -> kptr);
|
||||
Free(hrec);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
set_asshuku(hrec);
|
||||
set_assyuku(hrec);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -351,7 +426,10 @@ reset_hindo(unsigned char* p, int l) {
|
|||
}
|
||||
}
|
||||
|
||||
void knjhnd_set(unsigned char* p, int l) {
|
||||
|
||||
void
|
||||
knjhnd_set(unsigned char* p, int l)
|
||||
{
|
||||
unsigned char *kp1;
|
||||
unsigned char *kp2;
|
||||
int i;
|
||||
|
|
@ -360,10 +438,12 @@ void knjhnd_set(unsigned char* p, int l) {
|
|||
|
||||
for (kp1 = p, kl1 = l ; kl1 > 0 ; ) {
|
||||
|
||||
|
||||
for (i = 0, kp2 = kp1 ; i < kl1 ; ) {
|
||||
if (codesize(*kp2) == 1) {
|
||||
tmp[i++] = *kp2++;
|
||||
} else if(codesize(*kp2) == 2) {
|
||||
}
|
||||
else if (codesize(*kp2) == 2) {
|
||||
tmp[i++] = *kp2++;
|
||||
tmp[i++] = *kp2++;
|
||||
} else {
|
||||
|
|
@ -374,12 +454,16 @@ void knjhnd_set(unsigned char* p, int l) {
|
|||
set_hindo(tmp, i, l);
|
||||
}
|
||||
|
||||
|
||||
kl1 -= codesize(*kp1);
|
||||
kp1 += codesize(*kp1);
|
||||
}
|
||||
}
|
||||
|
||||
void knjhnd_reset(unsigned char* p, int l) {
|
||||
|
||||
void
|
||||
knjhnd_reset(unsigned char* p, int l)
|
||||
{
|
||||
unsigned char *kp1;
|
||||
unsigned char *kp2;
|
||||
int i;
|
||||
|
|
@ -388,10 +472,12 @@ void knjhnd_reset(unsigned char* p, int l) {
|
|||
|
||||
for (kp1 = p, kl1 = l ; kl1 > 0 ; ) {
|
||||
|
||||
|
||||
for (i = 0, kp2 = kp1 ; i < kl1 ; ) {
|
||||
if (codesize(*kp2) == 1) {
|
||||
tmp[i++] = *kp2++;
|
||||
} else if(codesize(*kp2) == 2) {
|
||||
}
|
||||
else if (codesize(*kp2) == 2) {
|
||||
tmp[i++] = *kp2++;
|
||||
tmp[i++] = *kp2++;
|
||||
} else {
|
||||
|
|
@ -402,51 +488,67 @@ void knjhnd_reset(unsigned char* p, int l) {
|
|||
reset_hindo(tmp, i);
|
||||
}
|
||||
|
||||
|
||||
kl1 -= codesize(*kp1);
|
||||
kp1 += codesize(*kp1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
check_asshuku(HindoRec* p, HindoRec* q) {
|
||||
check_assyuku(HindoRec* p, HindoRec* q)
|
||||
{
|
||||
unsigned char ptmp[128], qtmp[128];
|
||||
int plen;
|
||||
int qlen;
|
||||
|
||||
|
||||
plen = make_knjstr(p -> kptr, p -> klen, ptmp);
|
||||
|
||||
|
||||
qlen = make_knjstr(q -> kptr, q -> klen, qtmp);
|
||||
|
||||
|
||||
if (bubun_str(ptmp, plen, qtmp, qlen)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (overlap_str(ptmp, plen, qtmp, qlen))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int decide_knjask(void) {
|
||||
|
||||
int
|
||||
decide_knjask(void)
|
||||
{
|
||||
int i, j;
|
||||
AsshukuRec* p;
|
||||
AssyukuRec *p;
|
||||
HindoRec *q;
|
||||
unsigned char *r;
|
||||
int len = 0;
|
||||
|
||||
askknj_num = 0;
|
||||
|
||||
for(p = asshuku; p; p = p->anext) {
|
||||
|
||||
for (p = assyuku ; p ; p = p -> anext) {
|
||||
|
||||
|
||||
if (p -> len <= 0) break;
|
||||
|
||||
|
||||
for (q = p -> nrec ; q ; q = q -> anext) {
|
||||
|
||||
|
||||
i = q -> klen;
|
||||
r = q -> kptr;
|
||||
if (i > 2) {
|
||||
while (i > 0) {
|
||||
if((*r & KanjiModeMask) == OffsetAsshuku) {
|
||||
if ((*r & KanjiModeMask)
|
||||
== OffsetAssyuku) {
|
||||
break;
|
||||
}
|
||||
j = codesize(*r);
|
||||
|
|
@ -459,17 +561,19 @@ int decide_knjask(void) {
|
|||
if (askknj_num) {
|
||||
|
||||
for (i = 0 ; i < askknj_num ; i++) {
|
||||
if(check_asshuku(askknj[i], q))
|
||||
if (check_assyuku(askknj[i], q))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (i >= askknj_num) {
|
||||
askknj[askknj_num++] = q;
|
||||
len += p -> len;
|
||||
if (askknj_num >= MaxKnjAskNumber)
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
askknj[askknj_num++] = q;
|
||||
len += p -> len;
|
||||
}
|
||||
|
|
@ -485,7 +589,7 @@ end:
|
|||
p = askknj[i] -> kptr;
|
||||
if (len <= 2) continue;
|
||||
while (len > 0) {
|
||||
if((*p & KanjiModeMask) == OffsetAsshuku) {
|
||||
if ((*p & KanjiModeMask) == OffsetAssyuku) {
|
||||
printf("\245\252\245\325\245\273\245\303\245\310\260\265\275\314\244\362\264\336\244\340 %d\n", i);
|
||||
}
|
||||
j = codesize(*p);
|
||||
|
|
@ -497,7 +601,10 @@ end:
|
|||
return len;
|
||||
}
|
||||
|
||||
void clear_hindo(void) {
|
||||
|
||||
void
|
||||
clear_hindo(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < hindo_num ; i++) {
|
||||
|
|
@ -508,12 +615,15 @@ void clear_hindo(void) {
|
|||
kanji_num = 0;
|
||||
}
|
||||
|
||||
void clear_asshuku(void) {
|
||||
AsshukuRec* p;
|
||||
|
||||
while(asshuku) {
|
||||
p = asshuku;
|
||||
asshuku = asshuku->anext;
|
||||
void
|
||||
clear_assyuku(void)
|
||||
{
|
||||
AssyukuRec *p;
|
||||
|
||||
while (assyuku) {
|
||||
p = assyuku;
|
||||
assyuku = assyuku -> anext;
|
||||
Free(p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
249
hinshi.c
249
hinshi.c
|
|
@ -1,249 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sj_hinshi.h"
|
||||
|
||||
static struct hlist {
|
||||
int code;
|
||||
char* str;
|
||||
} hinshi[] = {
|
||||
{MEISHI_1, "\314\276\273\354"},
|
||||
{MEISHI_1, "\314\276\243\261"},
|
||||
{MEISHI_2, "\314\276\243\262"},
|
||||
{MEISHI_3, "\314\276\243\263"},
|
||||
{MEISHI_4, "\314\276\243\264"},
|
||||
{MEISHI_5, "\314\276\243\265"},
|
||||
{MEISHI_6, "\314\276\243\266"},
|
||||
{MEISHI_7, "\314\276\243\267"},
|
||||
{MEISHI_8, "\314\276\243\270"},
|
||||
{MEISHI_9, "\314\276\243\271"},
|
||||
{MEISHI_10, "\314\276\243\261\243\260"},
|
||||
{MEISHI_11, "\314\276\243\261\243\261"},
|
||||
{MEISHI_20, "\314\276\243\262\243\260"},
|
||||
{D_MEISHI_1, "\302\345\314\276\273\354"},
|
||||
{D_MEISHI_1, "\302\345\243\261"},
|
||||
{D_MEISHI_2, "\302\345\243\262"},
|
||||
{D_MEISHI_3, "\302\345\243\263"},
|
||||
{D_MEISHI_4, "\302\345\243\264"},
|
||||
{D_MEISHI_5, "\302\345\243\265"},
|
||||
{D_MEISHI_6, "\302\345\243\266"},
|
||||
{MYOUJI, "\311\304\273\372"},
|
||||
{NAMAE, "\314\276\301\260"},
|
||||
{KIGYOU, "\264\353\266\310"},
|
||||
{TIMEI, "\303\317\314\276"},
|
||||
{KEN_KU, "\270\251\241\277\266\350\314\276"},
|
||||
{KEN_KU, "\270\251\266\350"},
|
||||
{RENTAISHI, "\317\242\302\316\273\354"},
|
||||
{RENTAISHI, "\317\242\302\316"},
|
||||
{SETSUZOKU, "\300\334\302\263\273\354"},
|
||||
{SETSUZOKU, "\300\334\302\263"},
|
||||
{KANDOUSHI, "\264\266\306\260"},
|
||||
{JOSUUSHI, "\275\365\277\364\273\354"},
|
||||
{JOSUUSHI, "\275\365\277\364"},
|
||||
{SUUSHI, "\277\364\273\354"},
|
||||
{SETTOU_1, "\300\334\306\254\270\354"},
|
||||
{SETTOU_1, "\300\334\306\254\243\261"},
|
||||
{SETTOU_2, "\300\334\306\254\243\262"},
|
||||
{SETTOU_3, "\300\334\306\254\243\263"},
|
||||
{SETTOU_4, "\300\334\306\254\243\264"},
|
||||
{SETTOU_5, "\300\334\306\254\243\265"},
|
||||
{SETSUBI_1, "\300\334\310\370\270\354"},
|
||||
{SETSUBI_1, "\300\334\310\370\243\261"},
|
||||
{SETSUBI_2, "\300\334\310\370\243\262"},
|
||||
{SETSUBI_3, "\300\334\310\370\243\263"},
|
||||
{SETSUBI_4, "\300\334\310\370\243\264"},
|
||||
{SETSUBI_5, "\300\334\310\370\243\265"},
|
||||
{SETSUBI_6, "\300\334\310\370\243\266"},
|
||||
{SETSUBI_7, "\300\334\310\370\243\267"},
|
||||
{SETSUBI_8, "\300\334\310\370\243\270"},
|
||||
{SETSUBI_9, "\300\334\310\370\243\271"},
|
||||
{FUKUSHI_1, "\311\373\273\354"},
|
||||
{FUKUSHI_1, "\311\373\243\261"},
|
||||
{FUKUSHI_2, "\311\373\243\262"},
|
||||
{FUKUSHI_3, "\311\373\243\263"},
|
||||
{FUKUSHI_4, "\311\373\243\264"},
|
||||
{FUKUSHI_5, "\311\373\243\265"},
|
||||
{FUKUSHI_6, "\311\373\243\266"},
|
||||
{FUKUSHI_7, "\311\373\243\267"},
|
||||
{FUKUSHI_8, "\311\373\243\270"},
|
||||
{FUKUSHI_9, "\311\373\243\271"},
|
||||
{JOSUUSHI2, "\275\365\277\364\243\262"},
|
||||
{KEIYOUSHI_1, "\267\301\315\306\273\354"},
|
||||
{KEIYOUSHI_1, "\267\301\243\261"},
|
||||
{KEIYOUSHI_2, "\267\301\243\262"},
|
||||
{KEIYOUSHI_3, "\267\301\243\263"},
|
||||
{KEIYOUSHI_4, "\267\301\243\264"},
|
||||
{KEIYOUSHI_5, "\267\301\243\265"},
|
||||
{KEIYOUSHI_6, "\267\301\243\266"},
|
||||
{KEIYOUSHI_7, "\267\301\243\267"},
|
||||
{KEIYOUSHI_8, "\267\301\243\270"},
|
||||
{KEIYOUSHI_9, "\267\301\243\271"},
|
||||
{KEIYOUSHI_10, "\267\301\243\261\243\260"},
|
||||
{KEIYOUSHI_11, "\267\301\243\261\243\261"},
|
||||
{KE_DOUSHI_1, "\267\301\315\306\306\260\273\354"},
|
||||
{KE_DOUSHI_1, "\267\301\306\260\243\261"},
|
||||
{KE_DOUSHI_2, "\267\301\306\260\243\262"},
|
||||
{KE_DOUSHI_3, "\267\301\306\260\243\263"},
|
||||
{KE_DOUSHI_4, "\267\301\306\260\243\264"},
|
||||
{KE_DOUSHI_5, "\267\301\306\260\243\265"},
|
||||
{KE_DOUSHI_6, "\267\301\306\260\243\266"},
|
||||
{KE_DOUSHI_7, "\267\301\306\260\243\267"},
|
||||
{KE_DOUSHI_8, "\267\301\306\260\243\270"},
|
||||
{KE_DOUSHI_9, "\267\301\306\260\243\271"},
|
||||
{DO_SAHEN, "\306\260\241\246\245\265\312\321"},
|
||||
{DO_SAHEN, "\245\265\312\321"},
|
||||
{DO_ZAHEN, "\306\260\241\246\245\266\312\321"},
|
||||
{DO_ZAHEN, "\245\266\312\321"},
|
||||
{DO_1DAN_1, "\306\260\241\246\260\354\303\312"},
|
||||
{DO_1DAN_1, "\260\354\303\312\243\261"},
|
||||
{DO_KAGO_1, "\306\260\241\246\245\253\270\336"},
|
||||
{DO_KAGO_1, "\245\253\270\336\243\261"},
|
||||
{DO_GAGO_1, "\306\260\241\246\245\254\270\336"},
|
||||
{DO_GAGO_1, "\245\254\270\336\243\261"},
|
||||
{DO_SAGO_1, "\306\260\241\246\245\265\270\336"},
|
||||
{DO_SAGO_1, "\245\265\270\336\243\261"},
|
||||
{DO_TAGO_1, "\306\260\241\246\245\277\270\336"},
|
||||
{DO_TAGO_1, "\245\277\270\336\243\261"},
|
||||
{DO_NAGO_1, "\306\260\241\246\245\312\270\336"},
|
||||
{DO_NAGO_1, "\245\312\270\336"},
|
||||
{DO_BAGO_1, "\306\260\241\246\245\320\270\336"},
|
||||
{DO_BAGO_1, "\245\320\270\336\243\261"},
|
||||
{DO_MAGO_1, "\306\260\241\246\245\336\270\336"},
|
||||
{DO_MAGO_1, "\245\336\270\336\243\261"},
|
||||
{DO_RAGO_1, "\306\260\241\246\245\351\270\336"},
|
||||
{DO_RAGO_1, "\245\351\270\336\243\261"},
|
||||
{DO_WAGO_1, "\306\260\241\246\245\357\270\336"},
|
||||
{DO_WAGO_1, "\245\357\270\336\243\261"},
|
||||
{DO_1DAN_2, "\260\354\303\312\243\262"},
|
||||
{DO_KAGO_2, "\245\253\270\336\243\262"},
|
||||
{DO_GAGO_2, "\245\254\270\336\243\262"},
|
||||
{DO_SAGO_2, "\245\265\270\336\243\262"},
|
||||
{DO_TAGO_2, "\245\277\270\336\243\262"},
|
||||
{DO_BAGO_2, "\245\320\270\336\243\262"},
|
||||
{DO_MAGO_2, "\245\336\270\336\243\262"},
|
||||
{DO_RAGO_2, "\245\351\270\336\243\262"},
|
||||
{DO_WAGO_2, "\245\357\270\336\243\262"},
|
||||
{DO_KAGO_5, "\245\253\270\336\243\265"},
|
||||
{DO_GAGO_5, "\245\254\270\336\243\265"},
|
||||
{DO_SAGO_5, "\245\265\270\336\243\265"},
|
||||
{DO_TAGO_5, "\245\277\270\336\243\265"},
|
||||
{DO_BAGO_5, "\245\320\270\336\243\265"},
|
||||
{DO_MAGO_5, "\245\336\270\336\243\265"},
|
||||
{DO_RAGO_5, "\245\351\270\336\243\265"},
|
||||
{DO_WAGO_5, "\245\357\270\336\243\265"},
|
||||
{DO_KAGO_6, "\245\253\270\336\243\266"},
|
||||
{DO_GAGO_6, "\245\254\270\336\243\266"},
|
||||
{DO_SAGO_6, "\245\265\270\336\243\266"},
|
||||
{DO_TAGO_6, "\245\277\270\336\243\266"},
|
||||
{DO_BAGO_6, "\245\320\270\336\243\266"},
|
||||
{DO_MAGO_6, "\245\336\270\336\243\266"},
|
||||
{DO_RAGO_6, "\245\351\270\336\243\266"},
|
||||
{DO_WAGO_6, "\245\357\270\336\243\266"},
|
||||
{DO_1DAN_3, "\260\354\303\312\243\263"},
|
||||
{DO_KAGO_3, "\245\253\270\336\243\263"},
|
||||
{DO_GAGO_3, "\245\254\270\336\243\263"},
|
||||
{DO_SAGO_3, "\245\265\270\336\243\263"},
|
||||
{DO_TAGO_3, "\245\277\270\336\243\263"},
|
||||
{DO_BAGO_3, "\245\320\270\336\243\263"},
|
||||
{DO_MAGO_3, "\245\336\270\336\243\263"},
|
||||
{DO_RAGO_3, "\245\351\270\336\243\263"},
|
||||
{DO_WAGO_3, "\245\357\270\336\243\263"},
|
||||
{DO_1DAN_4, "\260\354\303\312\243\264"},
|
||||
{DO_KAGO_4, "\245\253\270\336\243\264"},
|
||||
{DO_GAGO_4, "\245\254\270\336\243\264"},
|
||||
{DO_SAGO_4, "\245\265\270\336\243\264"},
|
||||
{DO_TAGO_4, "\245\277\270\336\243\264"},
|
||||
{DO_BAGO_4, "\245\320\270\336\243\264"},
|
||||
{DO_MAGO_4, "\245\336\270\336\243\264"},
|
||||
{DO_RAGO_4, "\245\351\270\336\243\264"},
|
||||
{DO_WAGO_4, "\245\357\270\336\243\264"},
|
||||
{DO_KAGO_7, "\245\253\270\336\243\267"},
|
||||
{DO_GAGO_7, "\245\254\270\336\243\267"},
|
||||
{DO_SAGO_7, "\245\265\270\336\243\267"},
|
||||
{DO_TAGO_7, "\245\277\270\336\243\267"},
|
||||
{DO_BAGO_7, "\245\320\270\336\243\267"},
|
||||
{DO_MAGO_7, "\245\336\270\336\243\267"},
|
||||
{DO_RAGO_7, "\245\351\270\336\243\267"},
|
||||
{DO_WAGO_7, "\245\357\270\336\243\267"},
|
||||
{DO_KAGO_8, "\245\253\270\336\243\270"},
|
||||
{DO_GAGO_8, "\245\254\270\336\243\270"},
|
||||
{DO_SAGO_8, "\245\265\270\336\243\270"},
|
||||
{DO_TAGO_8, "\245\277\270\336\243\270"},
|
||||
{DO_BAGO_8, "\245\320\270\336\243\270"},
|
||||
{DO_MAGO_8, "\245\336\270\336\243\270"},
|
||||
{DO_RAGO_8, "\245\351\270\336\243\270"},
|
||||
{DO_WAGO_8, "\245\357\270\336\243\270"},
|
||||
{SP_SA_MI1, "\245\265\312\321\314\244\243\261"},
|
||||
{SP_SA_MI2, "\245\265\312\321\314\244\243\262"},
|
||||
{SP_SA_YOU, "\245\265\312\321\314\244\315\321"},
|
||||
{SP_SA_SHU, "\245\265\312\321\275\252\302\316"},
|
||||
{SP_SA_KAT, "\245\265\312\321\262\276"},
|
||||
{SP_SA_ME1, "\245\265\312\321\314\277\243\261"},
|
||||
{SP_SA_ME2, "\245\265\312\321\314\277\243\262"},
|
||||
{SP_KA_MIZ, "\245\253\312\321\314\244"},
|
||||
{SP_KA_YOU, "\245\253\312\321\315\321"},
|
||||
{SP_KA_SHU, "\245\253\312\321\275\252\302\316"},
|
||||
{SP_KA_KAT, "\245\253\312\321\262\276"},
|
||||
{SP_KA_MEI, "\245\253\312\321\314\277"},
|
||||
{TEINEI1, "\303\372\307\253\243\261"},
|
||||
{TEINEI2, "\303\372\307\253\243\262"},
|
||||
{SP_KA_ONB, "\245\253\270\336\262\273\312\330"},
|
||||
{SP_FUKUSHI, "\306\303\274\354\311\373"},
|
||||
{AISATSU, "\260\247\273\242"},
|
||||
{SP_KEIYOUSHI, "\306\303\274\354\267\301\315\306"},
|
||||
{TANKANJI, "\303\261\264\301\273\372"},
|
||||
{TANKANJI, "\303\261\264\301"},
|
||||
{IKKATU, "\260\354\263\347"},
|
||||
{0, 0}};
|
||||
|
||||
char* hns2str(code)
|
||||
int code;
|
||||
{
|
||||
struct hlist* p;
|
||||
|
||||
for(p = hinshi; p->code; p++) {
|
||||
if(p->code == code)
|
||||
return p->str;
|
||||
}
|
||||
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
int str2hns(str)
|
||||
char* str;
|
||||
{
|
||||
struct hlist* p;
|
||||
|
||||
for(p = hinshi; p->code; p++) {
|
||||
if(strcmp(p->str, str) == 0)
|
||||
return p->code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
259
hinsi.c
Normal file
259
hinsi.c
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* 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: hinsi.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:36 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "sj_hinsi.h"
|
||||
|
||||
static struct hlist {
|
||||
int code;
|
||||
char *str;
|
||||
} hinsi[] = {
|
||||
{MEISI_1, "\314\276\273\354"},
|
||||
{MEISI_1, "\314\276\243\261"},
|
||||
{MEISI_2, "\314\276\243\262"},
|
||||
{MEISI_3, "\314\276\243\263"},
|
||||
{MEISI_4, "\314\276\243\264"},
|
||||
{MEISI_5, "\314\276\243\265"},
|
||||
{MEISI_6, "\314\276\243\266"},
|
||||
{MEISI_7, "\314\276\243\267"},
|
||||
{MEISI_8, "\314\276\243\270"},
|
||||
{MEISI_9, "\314\276\243\271"},
|
||||
{MEISI_10, "\314\276\243\261\243\260"},
|
||||
{MEISI_11, "\314\276\243\261\243\261"},
|
||||
{MEISI_20, "\314\276\243\262\243\260"},
|
||||
{D_MEISI_1, "\302\345\314\276\273\354"},
|
||||
{D_MEISI_1, "\302\345\243\261"},
|
||||
{D_MEISI_2, "\302\345\243\262"},
|
||||
{D_MEISI_3, "\302\345\243\263"},
|
||||
{D_MEISI_4, "\302\345\243\264"},
|
||||
{D_MEISI_5, "\302\345\243\265"},
|
||||
{D_MEISI_6, "\302\345\243\266"},
|
||||
{MYOUJI, "\311\304\273\372"},
|
||||
{NAMAE, "\314\276\301\260"},
|
||||
{KIGYOU, "\264\353\266\310"},
|
||||
{TIMEI, "\303\317\314\276"},
|
||||
{KEN_KU, "\270\251\241\277\266\350\314\276"},
|
||||
{KEN_KU, "\270\251\266\350"},
|
||||
{RENTAISI, "\317\242\302\316\273\354"},
|
||||
{RENTAISI, "\317\242\302\316"},
|
||||
{SETUZOKU, "\300\334\302\263\273\354"},
|
||||
{SETUZOKU, "\300\334\302\263"},
|
||||
{KANDOUSI, "\264\266\306\260"},
|
||||
{JOSUUSI, "\275\365\277\364\273\354"},
|
||||
{JOSUUSI, "\275\365\277\364"},
|
||||
{SUUSI, "\277\364\273\354"},
|
||||
{SETTOU_1, "\300\334\306\254\270\354"},
|
||||
{SETTOU_1, "\300\334\306\254\243\261"},
|
||||
{SETTOU_2, "\300\334\306\254\243\262"},
|
||||
{SETTOU_3, "\300\334\306\254\243\263"},
|
||||
{SETTOU_4, "\300\334\306\254\243\264"},
|
||||
{SETTOU_5, "\300\334\306\254\243\265"},
|
||||
{SETUBI_1, "\300\334\310\370\270\354"},
|
||||
{SETUBI_1, "\300\334\310\370\243\261"},
|
||||
{SETUBI_2, "\300\334\310\370\243\262"},
|
||||
{SETUBI_3, "\300\334\310\370\243\263"},
|
||||
{SETUBI_4, "\300\334\310\370\243\264"},
|
||||
{SETUBI_5, "\300\334\310\370\243\265"},
|
||||
{SETUBI_6, "\300\334\310\370\243\266"},
|
||||
{SETUBI_7, "\300\334\310\370\243\267"},
|
||||
{SETUBI_8, "\300\334\310\370\243\270"},
|
||||
{SETUBI_9, "\300\334\310\370\243\271"},
|
||||
{FUKUSI_1, "\311\373\273\354"},
|
||||
{FUKUSI_1, "\311\373\243\261"},
|
||||
{FUKUSI_2, "\311\373\243\262"},
|
||||
{FUKUSI_3, "\311\373\243\263"},
|
||||
{FUKUSI_4, "\311\373\243\264"},
|
||||
{FUKUSI_5, "\311\373\243\265"},
|
||||
{FUKUSI_6, "\311\373\243\266"},
|
||||
{FUKUSI_7, "\311\373\243\267"},
|
||||
{FUKUSI_8, "\311\373\243\270"},
|
||||
{FUKUSI_9, "\311\373\243\271"},
|
||||
{JOSUUSI2, "\275\365\277\364\243\262"},
|
||||
{KEIYOUSI_1, "\267\301\315\306\273\354"},
|
||||
{KEIYOUSI_1, "\267\301\243\261"},
|
||||
{KEIYOUSI_2, "\267\301\243\262"},
|
||||
{KEIYOUSI_3, "\267\301\243\263"},
|
||||
{KEIYOUSI_4, "\267\301\243\264"},
|
||||
{KEIYOUSI_5, "\267\301\243\265"},
|
||||
{KEIYOUSI_6, "\267\301\243\266"},
|
||||
{KEIYOUSI_7, "\267\301\243\267"},
|
||||
{KEIYOUSI_8, "\267\301\243\270"},
|
||||
{KEIYOUSI_9, "\267\301\243\271"},
|
||||
{KEIYOUSI_10, "\267\301\243\261\243\260"},
|
||||
{KEIYOUSI_11, "\267\301\243\261\243\261"},
|
||||
{KE_DOUSI_1, "\267\301\315\306\306\260\273\354"},
|
||||
{KE_DOUSI_1, "\267\301\306\260\243\261"},
|
||||
{KE_DOUSI_2, "\267\301\306\260\243\262"},
|
||||
{KE_DOUSI_3, "\267\301\306\260\243\263"},
|
||||
{KE_DOUSI_4, "\267\301\306\260\243\264"},
|
||||
{KE_DOUSI_5, "\267\301\306\260\243\265"},
|
||||
{KE_DOUSI_6, "\267\301\306\260\243\266"},
|
||||
{KE_DOUSI_7, "\267\301\306\260\243\267"},
|
||||
{KE_DOUSI_8, "\267\301\306\260\243\270"},
|
||||
{KE_DOUSI_9, "\267\301\306\260\243\271"},
|
||||
{DO_SAHEN, "\306\260\241\246\245\265\312\321"},
|
||||
{DO_SAHEN, "\245\265\312\321"},
|
||||
{DO_ZAHEN, "\306\260\241\246\245\266\312\321"},
|
||||
{DO_ZAHEN, "\245\266\312\321"},
|
||||
{DO_1DAN_1, "\306\260\241\246\260\354\303\312"},
|
||||
{DO_1DAN_1, "\260\354\303\312\243\261"},
|
||||
{DO_KAGO_1, "\306\260\241\246\245\253\270\336"},
|
||||
{DO_KAGO_1, "\245\253\270\336\243\261"},
|
||||
{DO_GAGO_1, "\306\260\241\246\245\254\270\336"},
|
||||
{DO_GAGO_1, "\245\254\270\336\243\261"},
|
||||
{DO_SAGO_1, "\306\260\241\246\245\265\270\336"},
|
||||
{DO_SAGO_1, "\245\265\270\336\243\261"},
|
||||
{DO_TAGO_1, "\306\260\241\246\245\277\270\336"},
|
||||
{DO_TAGO_1, "\245\277\270\336\243\261"},
|
||||
{DO_NAGO_1, "\306\260\241\246\245\312\270\336"},
|
||||
{DO_NAGO_1, "\245\312\270\336"},
|
||||
{DO_BAGO_1, "\306\260\241\246\245\320\270\336"},
|
||||
{DO_BAGO_1, "\245\320\270\336\243\261"},
|
||||
{DO_MAGO_1, "\306\260\241\246\245\336\270\336"},
|
||||
{DO_MAGO_1, "\245\336\270\336\243\261"},
|
||||
{DO_RAGO_1, "\306\260\241\246\245\351\270\336"},
|
||||
{DO_RAGO_1, "\245\351\270\336\243\261"},
|
||||
{DO_WAGO_1, "\306\260\241\246\245\357\270\336"},
|
||||
{DO_WAGO_1, "\245\357\270\336\243\261"},
|
||||
{DO_1DAN_2, "\260\354\303\312\243\262"},
|
||||
{DO_KAGO_2, "\245\253\270\336\243\262"},
|
||||
{DO_GAGO_2, "\245\254\270\336\243\262"},
|
||||
{DO_SAGO_2, "\245\265\270\336\243\262"},
|
||||
{DO_TAGO_2, "\245\277\270\336\243\262"},
|
||||
{DO_BAGO_2, "\245\320\270\336\243\262"},
|
||||
{DO_MAGO_2, "\245\336\270\336\243\262"},
|
||||
{DO_RAGO_2, "\245\351\270\336\243\262"},
|
||||
{DO_WAGO_2, "\245\357\270\336\243\262"},
|
||||
{DO_KAGO_5, "\245\253\270\336\243\265"},
|
||||
{DO_GAGO_5, "\245\254\270\336\243\265"},
|
||||
{DO_SAGO_5, "\245\265\270\336\243\265"},
|
||||
{DO_TAGO_5, "\245\277\270\336\243\265"},
|
||||
{DO_BAGO_5, "\245\320\270\336\243\265"},
|
||||
{DO_MAGO_5, "\245\336\270\336\243\265"},
|
||||
{DO_RAGO_5, "\245\351\270\336\243\265"},
|
||||
{DO_WAGO_5, "\245\357\270\336\243\265"},
|
||||
{DO_KAGO_6, "\245\253\270\336\243\266"},
|
||||
{DO_GAGO_6, "\245\254\270\336\243\266"},
|
||||
{DO_SAGO_6, "\245\265\270\336\243\266"},
|
||||
{DO_TAGO_6, "\245\277\270\336\243\266"},
|
||||
{DO_BAGO_6, "\245\320\270\336\243\266"},
|
||||
{DO_MAGO_6, "\245\336\270\336\243\266"},
|
||||
{DO_RAGO_6, "\245\351\270\336\243\266"},
|
||||
{DO_WAGO_6, "\245\357\270\336\243\266"},
|
||||
{DO_1DAN_3, "\260\354\303\312\243\263"},
|
||||
{DO_KAGO_3, "\245\253\270\336\243\263"},
|
||||
{DO_GAGO_3, "\245\254\270\336\243\263"},
|
||||
{DO_SAGO_3, "\245\265\270\336\243\263"},
|
||||
{DO_TAGO_3, "\245\277\270\336\243\263"},
|
||||
{DO_BAGO_3, "\245\320\270\336\243\263"},
|
||||
{DO_MAGO_3, "\245\336\270\336\243\263"},
|
||||
{DO_RAGO_3, "\245\351\270\336\243\263"},
|
||||
{DO_WAGO_3, "\245\357\270\336\243\263"},
|
||||
{DO_1DAN_4, "\260\354\303\312\243\264"},
|
||||
{DO_KAGO_4, "\245\253\270\336\243\264"},
|
||||
{DO_GAGO_4, "\245\254\270\336\243\264"},
|
||||
{DO_SAGO_4, "\245\265\270\336\243\264"},
|
||||
{DO_TAGO_4, "\245\277\270\336\243\264"},
|
||||
{DO_BAGO_4, "\245\320\270\336\243\264"},
|
||||
{DO_MAGO_4, "\245\336\270\336\243\264"},
|
||||
{DO_RAGO_4, "\245\351\270\336\243\264"},
|
||||
{DO_WAGO_4, "\245\357\270\336\243\264"},
|
||||
{DO_KAGO_7, "\245\253\270\336\243\267"},
|
||||
{DO_GAGO_7, "\245\254\270\336\243\267"},
|
||||
{DO_SAGO_7, "\245\265\270\336\243\267"},
|
||||
{DO_TAGO_7, "\245\277\270\336\243\267"},
|
||||
{DO_BAGO_7, "\245\320\270\336\243\267"},
|
||||
{DO_MAGO_7, "\245\336\270\336\243\267"},
|
||||
{DO_RAGO_7, "\245\351\270\336\243\267"},
|
||||
{DO_WAGO_7, "\245\357\270\336\243\267"},
|
||||
{DO_KAGO_8, "\245\253\270\336\243\270"},
|
||||
{DO_GAGO_8, "\245\254\270\336\243\270"},
|
||||
{DO_SAGO_8, "\245\265\270\336\243\270"},
|
||||
{DO_TAGO_8, "\245\277\270\336\243\270"},
|
||||
{DO_BAGO_8, "\245\320\270\336\243\270"},
|
||||
{DO_MAGO_8, "\245\336\270\336\243\270"},
|
||||
{DO_RAGO_8, "\245\351\270\336\243\270"},
|
||||
{DO_WAGO_8, "\245\357\270\336\243\270"},
|
||||
{SP_SA_MI1, "\245\265\312\321\314\244\243\261"},
|
||||
{SP_SA_MI2, "\245\265\312\321\314\244\243\262"},
|
||||
{SP_SA_YOU, "\245\265\312\321\314\244\315\321"},
|
||||
{SP_SA_SYU, "\245\265\312\321\275\252\302\316"},
|
||||
{SP_SA_KAT, "\245\265\312\321\262\276"},
|
||||
{SP_SA_ME1, "\245\265\312\321\314\277\243\261"},
|
||||
{SP_SA_ME2, "\245\265\312\321\314\277\243\262"},
|
||||
{SP_KA_MIZ, "\245\253\312\321\314\244"},
|
||||
{SP_KA_YOU, "\245\253\312\321\315\321"},
|
||||
{SP_KA_SYU, "\245\253\312\321\275\252\302\316"},
|
||||
{SP_KA_KAT, "\245\253\312\321\262\276"},
|
||||
{SP_KA_MEI, "\245\253\312\321\314\277"},
|
||||
{TEINEI1, "\303\372\307\253\243\261"},
|
||||
{TEINEI2, "\303\372\307\253\243\262"},
|
||||
{SP_KA_ONB, "\245\253\270\336\262\273\312\330"},
|
||||
{SP_FUKUSI, "\306\303\274\354\311\373"},
|
||||
{AISATU, "\260\247\273\242"},
|
||||
{SP_KEIYOUSI, "\306\303\274\354\267\301\315\306"},
|
||||
{TANKANJI, "\303\261\264\301\273\372"},
|
||||
{TANKANJI, "\303\261\264\301"},
|
||||
{IKKATU, "\260\354\263\347"},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
char *hns2str(code)
|
||||
int code;
|
||||
{
|
||||
struct hlist *p;
|
||||
|
||||
for (p = hinsi ; p -> code ; p++) {
|
||||
if (p -> code == code)
|
||||
return p -> str;
|
||||
}
|
||||
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
int str2hns(str)
|
||||
char *str;
|
||||
{
|
||||
struct hlist *p;
|
||||
|
||||
for (p = hinsi ; p -> code ; p++) {
|
||||
if (strcmp(p -> str, str) == 0)
|
||||
return p -> code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
18
hzstrlen.c
18
hzstrlen.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: hzstrlen.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:52 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
|
@ -34,7 +43,9 @@
|
|||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
int euc_codesize(unsigned char c) {
|
||||
int
|
||||
euc_codesize (unsigned char c)
|
||||
{
|
||||
if ((c & KanjiModeMask) == 0x90) {
|
||||
return 1;
|
||||
} else if (isknj1(c)) {
|
||||
|
|
@ -46,9 +57,12 @@ int euc_codesize(unsigned char c) {
|
|||
}
|
||||
}
|
||||
|
||||
int hzstrlen(unsigned char* ptr, int len) {
|
||||
int
|
||||
hzstrlen (unsigned char *ptr, int len)
|
||||
{
|
||||
unsigned char *head;
|
||||
head = ptr;
|
||||
while (len-- > 0) ptr += euc_codesize(*ptr);
|
||||
return (ptr - head);
|
||||
}
|
||||
|
||||
|
|
|
|||
12
init.c
12
init.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: init.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:54 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
|
||||
void seg_count(dict)
|
||||
|
|
@ -70,7 +78,9 @@ void mkidxtbl(dict)
|
|||
}
|
||||
}
|
||||
|
||||
void initwork() {
|
||||
void initwork()
|
||||
{
|
||||
jrt1st = jrt2nd = maxjptr = (JREC *)0;
|
||||
clt1st = clt2nd = maxclptr = (CLREC *)0;
|
||||
}
|
||||
|
||||
|
|
|
|||
12
inkey.h
12
inkey.h
|
|
@ -27,6 +27,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: inkey.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:44 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define KEYBUFSIZ 520
|
||||
#define KEYBUFLIM 512
|
||||
#define AVLEN 3
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@
|
|||
#include "const.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
int istrcmp(unsigned char* yomip, unsigned char* idxp, int ylen, int ilen) {
|
||||
int
|
||||
istrcmp(unsigned char *yomip, unsigned char *idxp, int ylen, int ilen)
|
||||
{
|
||||
while (1) {
|
||||
if ((ilen | ylen) == 0)
|
||||
return MATCH;
|
||||
|
|
|
|||
11
kana.h
11
kana.h
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: kana.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:45 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#define ZKATA1 0xa5
|
||||
#define ZHIRA1 0xa4
|
||||
#define ZKATAF2 0xa1
|
||||
|
|
@ -38,6 +47,8 @@
|
|||
|
||||
#define ZKATAn (ZKATAE2-ZKATAF2+1)
|
||||
|
||||
|
||||
|
||||
#define ZEN_SPACE 0xa1a1
|
||||
#define ZEN_KTEN 0xa1a3
|
||||
#define ZEN_FKAKKO 0xa1d6
|
||||
|
|
|
|||
22
kanakan.h
22
kanakan.h
|
|
@ -38,14 +38,14 @@
|
|||
#include "Struct.h"
|
||||
|
||||
/* adddic.c */
|
||||
unsigned int adddic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi);
|
||||
unsigned int adddic(unsigned char *yomi, unsigned char *kanji, TypeGram hinsi);
|
||||
|
||||
/* addelcmn.c */
|
||||
void set_size(unsigned char *p, int size, int plen, int nlen);
|
||||
unsigned int addel_arg(unsigned char *yp, unsigned char *kp, TypeGram grm, unsigned char *nyp, int len);
|
||||
int cvtknj(unsigned char *yomi, unsigned char *knj, unsigned char *dst);
|
||||
int srchkana(unsigned char **ptr, int *saml);
|
||||
int srchgram(unsigned char* ptr, unsigned char** dst, TypeGram hinshi);
|
||||
int srchgram(unsigned char *ptr, unsigned char **dst, TypeGram hinsi);
|
||||
int srchkanji(unsigned char **dst, unsigned char *knj, int klen);
|
||||
TypeIdxOfs count_uidx(void);
|
||||
void chg_uidx(TypeDicSeg seg, unsigned char *yomi, int len);
|
||||
|
|
@ -81,7 +81,7 @@ void cvtkouho(KHREC* krec);
|
|||
void setstyrec(KHREC *krec);
|
||||
|
||||
/* deldic.c */
|
||||
unsigned int deldic(unsigned char* yomi, unsigned char* kanji, TypeGram hinshi);
|
||||
unsigned int deldic(unsigned char *yomi, unsigned char *kanji, TypeGram hinsi);
|
||||
|
||||
/* depend.c */
|
||||
DictFile *opendict(char *name, char *passwd);
|
||||
|
|
@ -124,12 +124,12 @@ void getrank(void);
|
|||
int euc_codesize(unsigned char c);
|
||||
int hzstrlen(unsigned char *ptr, int len);
|
||||
|
||||
/* mkbunsetsu.c */
|
||||
void mkbunsetsu(void);
|
||||
/* mkbunset.c */
|
||||
void mkbunsetu(void);
|
||||
CLREC* argclrec(int len);
|
||||
|
||||
/* mkjiritsu.c */
|
||||
void mkjiritsu(int mode);
|
||||
/* mkjiritu.c */
|
||||
void mkjiritu(int mode);
|
||||
JREC *argjrec(int len, JREC *rec);
|
||||
|
||||
/* mkkouho.c */
|
||||
|
|
@ -171,7 +171,7 @@ int ph2knj(unsigned char* zyomi, unsigned char* kanji, int knjlen);
|
|||
int ph_khtbl(CLREC *clrec);
|
||||
|
||||
/* setconj.c */
|
||||
int setconj(TypeGram hinshi, JREC* jrec, CREC* crec);
|
||||
int setconj(TypeGram hinsi, JREC *jrec, CREC *crec);
|
||||
|
||||
/* setjrec.c */
|
||||
int setj_atrb(unsigned char* p);
|
||||
|
|
@ -195,9 +195,9 @@ int hiraknj_kask(unsigned char*, int*);
|
|||
int hiraknj_norm(unsigned char*, int*);
|
||||
int hiraknj_hira(unsigned char*, int*);
|
||||
|
||||
/* setsubi.c */
|
||||
unsigned char* getstb(TypeGram hinshi);
|
||||
void setsubi(JREC* rec, unsigned char* stbtbl);
|
||||
/* setubi.c */
|
||||
unsigned char *getstb(TypeGram hinsi);
|
||||
void setubi(JREC *rec, unsigned char *stbtbl);
|
||||
|
||||
/* skipkstr.c */
|
||||
unsigned char* skipkstr(unsigned char* ptr);
|
||||
|
|
|
|||
9
kctype.h
9
kctype.h
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $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
|
||||
|
|
@ -104,3 +112,4 @@
|
|||
#define iskana iskana2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
15
key.h
15
key.h
|
|
@ -27,6 +27,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $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
|
||||
|
|
@ -50,7 +60,7 @@
|
|||
#define KEY_WRAPBACK 19
|
||||
#define KEY_HELP 20
|
||||
#define KEY_TOROKU 21
|
||||
#define KEY_SHOUKYO 22
|
||||
#define KEY_SYOUKYO 22
|
||||
#define KEY_SJRC 23
|
||||
|
||||
#define KEY_HA_KET 24
|
||||
|
|
@ -80,6 +90,9 @@
|
|||
|
||||
#define KEY_MORE 43
|
||||
|
||||
|
||||
|
||||
#define UKEYNUM 64
|
||||
#define SEQLEN 8
|
||||
#define COMNUM 64
|
||||
|
||||
|
|
|
|||
31
kigou.c
31
kigou.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: kigou.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:19 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "kctype.h"
|
||||
#include "key.h"
|
||||
|
|
@ -41,7 +49,8 @@ static unsigned short row, col;
|
|||
|
||||
void input_kigou();
|
||||
|
||||
kigou() {
|
||||
kigou ()
|
||||
{
|
||||
extern int keyvalue;
|
||||
int increse, code, basecode;
|
||||
int inc, ki, low;
|
||||
|
|
@ -161,7 +170,8 @@ kigou() {
|
|||
basecode = code & 0xfff0;
|
||||
guide_kigou(basecode, code, increse);
|
||||
}
|
||||
} else if(inc == ESC)
|
||||
}
|
||||
else if (inc == ESC)
|
||||
ki = 0;
|
||||
else if (inc == '\n' || inc == '\r' || inc == ' ')
|
||||
input_kigou (basecode, code, increse);
|
||||
|
|
@ -178,7 +188,8 @@ kigou() {
|
|||
return (rval);
|
||||
}
|
||||
|
||||
IsRedraw(c) int c;
|
||||
IsRedraw (c)
|
||||
int c;
|
||||
{
|
||||
if (c == 0x0c)
|
||||
return (1);
|
||||
|
|
@ -186,7 +197,8 @@ IsRedraw(c) int c;
|
|||
return (0);
|
||||
}
|
||||
|
||||
IsCKey(inc) int inc;
|
||||
IsCKey (inc)
|
||||
int inc;
|
||||
{
|
||||
switch (inc) {
|
||||
case 'l':
|
||||
|
|
@ -202,7 +214,8 @@ IsCKey(inc) int inc;
|
|||
}
|
||||
}
|
||||
|
||||
guide_kigou(bcode, code, increse) int bcode, code, increse;
|
||||
guide_kigou (bcode, code, increse)
|
||||
int bcode, code, increse;
|
||||
{
|
||||
int i;
|
||||
extern wchar16_t Mguide[];
|
||||
|
|
@ -233,7 +246,9 @@ guide_kigou(bcode, code, increse) int bcode, code, increse;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
pkigou(code) int code;
|
||||
|
||||
pkigou (code)
|
||||
int code;
|
||||
{
|
||||
wchar16_t tmp[3];
|
||||
unsigned short ccode;
|
||||
|
|
@ -255,8 +270,8 @@ pkigou(code) int code;
|
|||
}
|
||||
|
||||
void
|
||||
input_kigou(basecode, code, increse) int basecode,
|
||||
code, increse;
|
||||
input_kigou (basecode, code, increse)
|
||||
int basecode, code, increse;
|
||||
{
|
||||
wchar16_t s[2];
|
||||
unsigned short ccode, svlen;
|
||||
|
|
|
|||
68
knjcvt.c
68
knjcvt.c
|
|
@ -27,6 +27,17 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: knjcvt.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:37 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -43,8 +54,11 @@ typedef struct div_list {
|
|||
extern HindoRec *askknj[];
|
||||
extern int askknj_num;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
free_divlist(DivList* p) {
|
||||
free_divlist(DivList* p)
|
||||
{
|
||||
DivList *q;
|
||||
|
||||
while (p) {
|
||||
|
|
@ -54,8 +68,11 @@ free_divlist(DivList* p) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static DivList*
|
||||
make_divrec(void) {
|
||||
make_divrec(void)
|
||||
{
|
||||
DivList *p;
|
||||
|
||||
p = (DivList *)Malloc(sizeof(DivList));
|
||||
|
|
@ -68,8 +85,11 @@ make_divrec(void) {
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
make_divlist(DivList* parent, unsigned char* knj, int len) {
|
||||
make_divlist(DivList* parent, unsigned char *knj, int len)
|
||||
{
|
||||
int i, j;
|
||||
int num;
|
||||
int minlen;
|
||||
|
|
@ -77,8 +97,10 @@ make_divlist(DivList* parent, unsigned char* knj, int len) {
|
|||
DivList tmprec;
|
||||
DivList *minrec;
|
||||
|
||||
|
||||
minrec = make_divrec();
|
||||
|
||||
|
||||
if (len == 0) {
|
||||
free_divlist(minrec);
|
||||
|
||||
|
|
@ -95,6 +117,7 @@ make_divlist(DivList* parent, unsigned char* knj, int len) {
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
if (codesize(*knj) == 1) {
|
||||
minrec -> len = 1;
|
||||
minrec -> code[0] = *knj;
|
||||
|
|
@ -108,66 +131,86 @@ make_divlist(DivList* parent, unsigned char* knj, int len) {
|
|||
minlen = make_divlist(minrec, knj + 2, len - 2) + 2;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0 ; i < len ; i = j) {
|
||||
|
||||
j = i + codesize(*(knj + i));
|
||||
|
||||
|
||||
if (j <= 2 || !(num = isknjexist(knj, j))) continue;
|
||||
|
||||
|
||||
tmprec.len = 2;
|
||||
tmprec.code[0] = (OffsetAsshuku | ((num >> 8) & 0xff));
|
||||
tmprec.code[0] = (OffsetAssyuku | ((num >> 8) & 0xff));
|
||||
tmprec.code[1] = (num & 0xff);
|
||||
tmprec.child = NULL;
|
||||
tmplen = make_divlist(&tmprec, knj + j, len - j) + 2;
|
||||
|
||||
|
||||
if (tmplen < minlen) {
|
||||
|
||||
free_divlist(minrec -> child);
|
||||
|
||||
|
||||
*minrec = tmprec;
|
||||
minlen = tmplen;
|
||||
} else
|
||||
}
|
||||
else
|
||||
free_divlist(tmprec.child);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0 ; i < askknj_num ; i++) {
|
||||
|
||||
if ((j = askknj[i] -> klen) > len) continue;
|
||||
|
||||
|
||||
if (string_cmp(askknj[i]->kptr, j, knj, j)) continue;
|
||||
|
||||
|
||||
tmprec.len = 1;
|
||||
tmprec.code[0] = (KanjiAsshuku | i);
|
||||
tmprec.code[0] = (KanjiAssyuku | i);
|
||||
tmprec.child = NULL;
|
||||
tmplen = make_divlist(&tmprec, knj + j, len - j) + 1;
|
||||
|
||||
|
||||
if (tmplen < minlen) {
|
||||
|
||||
free_divlist(minrec -> child);
|
||||
|
||||
|
||||
*minrec = tmprec;
|
||||
minlen = tmplen;
|
||||
} else
|
||||
}
|
||||
else
|
||||
free_divlist(tmprec.child);
|
||||
}
|
||||
|
||||
|
||||
parent -> child = minrec;
|
||||
|
||||
|
||||
return minlen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned char*
|
||||
knjofscvt(unsigned char* ptr, int len, int* ret) {
|
||||
knjofscvt(unsigned char* ptr, int len, int* ret)
|
||||
{
|
||||
int i;
|
||||
unsigned char *p, *q;
|
||||
DivList parent, *dl;
|
||||
|
||||
|
||||
askknj_num = 0;
|
||||
|
||||
|
||||
parent.child = NULL;
|
||||
i = make_divlist(&parent, ptr, len);
|
||||
*ret = i;
|
||||
|
||||
|
||||
p = (unsigned char *)Malloc(i);
|
||||
if (!p) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
|
|
@ -185,19 +228,25 @@ knjofscvt(unsigned char* ptr, int len, int* ret) {
|
|||
|
||||
free_divlist(parent.child);
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned char*
|
||||
knjcvt(unsigned char* ptr, int len, int* ret) {
|
||||
knjcvt(unsigned char* ptr, int len, int* ret)
|
||||
{
|
||||
int i;
|
||||
unsigned char *p, *q;
|
||||
DivList parent, *dl;
|
||||
|
||||
|
||||
parent.child = NULL;
|
||||
i = make_divlist(&parent, ptr, len);
|
||||
*ret = i;
|
||||
|
||||
|
||||
p = (unsigned char *)Malloc(i);
|
||||
if (!p) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
|
|
@ -222,3 +271,4 @@ knjcvt(unsigned char* ptr, int len, int* ret) {
|
|||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
224
level1.c
224
level1.c
|
|
@ -69,8 +69,7 @@ static int INTLEN = sizeof(int);
|
|||
static int CMDLEN = sizeof(int);
|
||||
static int ReadErrorFlag = FALSE;
|
||||
|
||||
#define client_init(p) \
|
||||
{ \
|
||||
#define client_init(p) { \
|
||||
cliptr = (p); \
|
||||
if ((server_fd = cliptr -> fd) == -1) { \
|
||||
sj3_error_number = SJ3_NotOpened; \
|
||||
|
|
@ -79,7 +78,8 @@ static int ReadErrorFlag = FALSE;
|
|||
}
|
||||
|
||||
static int
|
||||
put_flush(void) {
|
||||
put_flush(void)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char *p;
|
||||
|
||||
|
|
@ -98,18 +98,21 @@ put_flush(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
put_byte(int c) {
|
||||
put_byte(int c)
|
||||
{
|
||||
putbuf[putpos++] = c;
|
||||
}
|
||||
|
||||
static void
|
||||
put_word(int c) {
|
||||
put_word(int c)
|
||||
{
|
||||
put_byte(c >> 8);
|
||||
put_byte(c & 0xff);
|
||||
}
|
||||
|
||||
static void
|
||||
put_int(int c) {
|
||||
put_int(int c)
|
||||
{
|
||||
put_byte(c >> (8 * 3));
|
||||
put_byte(c >> (8 * 2));
|
||||
put_byte(c >> (8 * 1));
|
||||
|
|
@ -117,7 +120,8 @@ put_int(int c) {
|
|||
}
|
||||
|
||||
static void
|
||||
put_cmd(int cmd) {
|
||||
put_cmd(int cmd)
|
||||
{
|
||||
ReadErrorFlag = FALSE;
|
||||
putpos = getlen = 0;
|
||||
put_int(cmd);
|
||||
|
|
@ -126,7 +130,8 @@ put_cmd(int cmd) {
|
|||
#define put_string put_ndata
|
||||
|
||||
static unsigned char *
|
||||
put_ndata(void* p, int n) {
|
||||
put_ndata(void *p, int n)
|
||||
{
|
||||
unsigned char *pp = (unsigned char *)p;
|
||||
|
||||
while (n-- > 0)
|
||||
|
|
@ -139,7 +144,8 @@ put_over(int buflen, int n,
|
|||
unsigned char *(*func1)(), void *str1, int len1,
|
||||
unsigned char *(*func2)(), void *str2, int len2,
|
||||
unsigned char *(*func3)(), void *str3, int len3,
|
||||
unsigned char* (*func4)(), void* str4, int len4) {
|
||||
unsigned char *(*func4)(), void *str4, int len4)
|
||||
{
|
||||
#define ARGNUM 4
|
||||
unsigned char *(*func[ARGNUM])();
|
||||
unsigned char *data[ARGNUM];
|
||||
|
|
@ -181,7 +187,8 @@ put_over(int buflen, int n,
|
|||
}
|
||||
|
||||
static int
|
||||
get_buffer(void) {
|
||||
get_buffer(void)
|
||||
{
|
||||
if (ReadErrorFlag)
|
||||
return ERROR;
|
||||
getpos = getlen = 0;
|
||||
|
|
@ -198,7 +205,8 @@ get_buffer(void) {
|
|||
}
|
||||
|
||||
static unsigned char
|
||||
get_byte(void) {
|
||||
get_byte(void)
|
||||
{
|
||||
if ((getpos >= getlen) && (get_buffer() == ERROR)) {
|
||||
ReadErrorFlag = TRUE;
|
||||
return 0;
|
||||
|
|
@ -207,7 +215,8 @@ get_byte(void) {
|
|||
}
|
||||
|
||||
static int
|
||||
get_word(void) {
|
||||
get_word(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = get_byte();
|
||||
|
|
@ -215,7 +224,8 @@ get_word(void) {
|
|||
}
|
||||
|
||||
static int
|
||||
get_int(void) {
|
||||
get_int(void)
|
||||
{
|
||||
int i0;
|
||||
int i1;
|
||||
int i2;
|
||||
|
|
@ -227,7 +237,8 @@ get_int(void) {
|
|||
}
|
||||
|
||||
static unsigned char *
|
||||
get_string(unsigned char* p) {
|
||||
get_string(unsigned char *p)
|
||||
{
|
||||
int c;
|
||||
|
||||
do {
|
||||
|
|
@ -238,7 +249,8 @@ get_string(unsigned char* p) {
|
|||
}
|
||||
|
||||
static int
|
||||
get_nstring(unsigned char* p, int n) {
|
||||
get_nstring(unsigned char *p, int n)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = get_byte();
|
||||
|
|
@ -255,7 +267,8 @@ get_nstring(unsigned char* p, int n) {
|
|||
}
|
||||
|
||||
static unsigned char *
|
||||
get_ndata(void* p, int n) {
|
||||
get_ndata(void *p, int n)
|
||||
{
|
||||
unsigned char *pp = (unsigned char *)p;
|
||||
while (n-- > 0)
|
||||
*pp++ = get_byte();
|
||||
|
|
@ -263,18 +276,22 @@ get_ndata(void* p, int n) {
|
|||
}
|
||||
|
||||
static void
|
||||
skip_string(void) {
|
||||
while(get_byte());
|
||||
skip_string(void)
|
||||
{
|
||||
while (get_byte())
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
skip_ndata(int n) {
|
||||
skip_ndata(int n)
|
||||
{
|
||||
while (n-- > 0)
|
||||
get_byte();
|
||||
}
|
||||
|
||||
static int
|
||||
open_unix(void) {
|
||||
open_unix(void)
|
||||
{
|
||||
int fd, len;
|
||||
struct sockaddr_un sunix;
|
||||
|
||||
|
|
@ -299,16 +316,20 @@ open_unix(void) {
|
|||
return fd;
|
||||
}
|
||||
|
||||
void sj3_set_timeout(int timeout) {
|
||||
void
|
||||
sj3_set_timeout(int timeout)
|
||||
{
|
||||
sj3_timeout = timeout;
|
||||
}
|
||||
|
||||
static void
|
||||
connect_timeout(void) {
|
||||
connect_timeout(void)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
open_inet(char* host) {
|
||||
open_inet(char *host)
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct servent *sp;
|
||||
int port;
|
||||
|
|
@ -352,10 +373,12 @@ open_inet(char* host) {
|
|||
return fd;
|
||||
}
|
||||
|
||||
int sj3_make_connection(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_make_connection(SJ3_CLIENT_ENV *client,
|
||||
char *serv,
|
||||
char *user,
|
||||
char* prog) {
|
||||
char *prog)
|
||||
{
|
||||
char host[MAXHOSTNAMELEN];
|
||||
int tmp;
|
||||
int hostlen, userlen, proglen, datalen, buflen;
|
||||
|
|
@ -447,7 +470,9 @@ int sj3_make_connection(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_erase_connection(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_erase_connection(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_DISCONNECT);
|
||||
|
|
@ -462,8 +487,10 @@ int sj3_erase_connection(SJ3_CLIENT_ENV* client) {
|
|||
return sj3_error_number ? ERROR : 0;
|
||||
}
|
||||
|
||||
long sj3_open_dictionary(SJ3_CLIENT_ENV* client,
|
||||
char* dictname, char* password) {
|
||||
long
|
||||
sj3_open_dictionary(SJ3_CLIENT_ENV *client,
|
||||
char *dictname, char *password)
|
||||
{
|
||||
int res;
|
||||
int dictlen, passlen;
|
||||
int datalen, buflen;
|
||||
|
|
@ -493,7 +520,9 @@ long sj3_open_dictionary(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : res;
|
||||
}
|
||||
|
||||
int sj3_close_dictionary(SJ3_CLIENT_ENV* client, long dicid) {
|
||||
int
|
||||
sj3_close_dictionary(SJ3_CLIENT_ENV *client, long dicid)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_CLOSEDICT);
|
||||
|
|
@ -506,8 +535,10 @@ int sj3_close_dictionary(SJ3_CLIENT_ENV* client, long dicid) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_open_study_file(SJ3_CLIENT_ENV* client,
|
||||
char* stdyname, char* password) {
|
||||
int
|
||||
sj3_open_study_file(SJ3_CLIENT_ENV *client,
|
||||
char *stdyname, char *password)
|
||||
{
|
||||
int stdylen, passlen;
|
||||
int datalen, buflen;
|
||||
|
||||
|
|
@ -535,7 +566,9 @@ int sj3_open_study_file(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_close_study_file(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_close_study_file(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_CLOSESTDY);
|
||||
|
|
@ -547,7 +580,9 @@ int sj3_close_study_file(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_get_id_size(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_get_id_size(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_STDYSIZE);
|
||||
|
|
@ -560,7 +595,9 @@ int sj3_get_id_size(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : cliptr->stdy_size;
|
||||
}
|
||||
|
||||
int sj3_lock_server(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_lock_server(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_LOCK);
|
||||
|
|
@ -572,7 +609,9 @@ int sj3_lock_server(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_unlock_server(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_unlock_server(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_UNLOCK);
|
||||
|
|
@ -584,11 +623,13 @@ int sj3_unlock_server(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_ikkatu_henkan(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_ikkatu_henkan(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *src,
|
||||
unsigned char *dst,
|
||||
int dstsiz,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int c;
|
||||
unsigned char *top;
|
||||
int result;
|
||||
|
|
@ -651,18 +692,21 @@ error1:
|
|||
do {
|
||||
skip_ndata(stysiz);
|
||||
error2:
|
||||
while(get_byte());
|
||||
while (get_byte())
|
||||
;
|
||||
} while (get_byte());
|
||||
|
||||
*top = 0;
|
||||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_henkan(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_bunsetu_henkan(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *yomi,
|
||||
int len,
|
||||
unsigned char *kanji,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int result;
|
||||
int buflen;
|
||||
|
||||
|
|
@ -692,10 +736,12 @@ int sj3_bunsetsu_henkan(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_jikouho(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_bunsetu_jikouho(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *kanji,
|
||||
int mode,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int result;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -716,8 +762,10 @@ int sj3_bunsetsu_jikouho(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_maekouho(SJ3_CLIENT_ENV* client,
|
||||
unsigned char* kanji, int mode, int mb_flag) {
|
||||
int
|
||||
sj3_bunsetu_maekouho(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *kanji, int mode, int mb_flag)
|
||||
{
|
||||
int result;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -738,10 +786,12 @@ int sj3_bunsetsu_maekouho(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_kouhosuu(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_bunsetu_kouhosuu(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *yomi,
|
||||
int len,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int result;
|
||||
int buflen;
|
||||
|
||||
|
|
@ -770,11 +820,13 @@ int sj3_bunsetsu_kouhosuu(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_zenkouho(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_bunsetu_zenkouho(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *yomi,
|
||||
int len,
|
||||
SJ3_DOUON *douon,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int cnt = 0;
|
||||
int buflen;
|
||||
|
||||
|
|
@ -810,7 +862,9 @@ int sj3_bunsetsu_zenkouho(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : cnt;
|
||||
}
|
||||
|
||||
int sj3_tango_gakushuu(SJ3_CLIENT_ENV* client, SJ3_STUDYREC* stdy) {
|
||||
int
|
||||
sj3_tango_gakusyuu(SJ3_CLIENT_ENV *client, SJ3_STUDYREC *stdy)
|
||||
{
|
||||
int buflen;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -831,11 +885,13 @@ int sj3_tango_gakushuu(SJ3_CLIENT_ENV* client, SJ3_STUDYREC* stdy) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_bunsetsu_gakushuu(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_bunsetu_gakusyuu(SJ3_CLIENT_ENV *client,
|
||||
unsigned char *yomi1,
|
||||
unsigned char *yomi2,
|
||||
SJ3_STUDYREC *stdy,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int yomilen1, yomilen2;
|
||||
int datalen, buflen;
|
||||
|
||||
|
|
@ -867,12 +923,14 @@ int sj3_bunsetsu_gakushuu(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_tango_touroku(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_tango_touroku(SJ3_CLIENT_ENV *client,
|
||||
long dicid,
|
||||
unsigned char *yomi,
|
||||
unsigned char *kanji,
|
||||
int code,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int yomilen, kanjilen;
|
||||
int datalen, buflen;
|
||||
|
||||
|
|
@ -905,12 +963,14 @@ int sj3_tango_touroku(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_tango_sakujo(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_tango_sakujo(SJ3_CLIENT_ENV *client,
|
||||
long dicid,
|
||||
unsigned char *yomi,
|
||||
unsigned char *kanji,
|
||||
int code,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
int yomilen, kanjilen;
|
||||
int datalen, buflen;
|
||||
|
||||
|
|
@ -943,10 +1003,12 @@ int sj3_tango_sakujo(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_tango_shutoku(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_tango_syutoku(SJ3_CLIENT_ENV *client,
|
||||
int dicid,
|
||||
unsigned char *buf,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -968,10 +1030,12 @@ int sj3_tango_shutoku(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_tango_jikouho(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_tango_jikouho(SJ3_CLIENT_ENV *client,
|
||||
int dicid,
|
||||
unsigned char *buf,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -993,10 +1057,12 @@ int sj3_tango_jikouho(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_tango_maekouho(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_tango_maekouho(SJ3_CLIENT_ENV *client,
|
||||
int dicid,
|
||||
unsigned char *buf,
|
||||
int mb_flag) {
|
||||
int mb_flag)
|
||||
{
|
||||
unsigned char *p;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -1018,11 +1084,13 @@ int sj3_tango_maekouho(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_make_dict_file(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_make_dict_file(SJ3_CLIENT_ENV *client,
|
||||
char *path,
|
||||
int idxlen,
|
||||
int seglen,
|
||||
int segnum) {
|
||||
int segnum)
|
||||
{
|
||||
int pathlen;
|
||||
int buflen, datalen;
|
||||
|
||||
|
|
@ -1051,11 +1119,13 @@ int sj3_make_dict_file(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_make_study_file(SJ3_CLIENT_ENV* client,
|
||||
int
|
||||
sj3_make_study_file(SJ3_CLIENT_ENV *client,
|
||||
char *path,
|
||||
int stynum,
|
||||
int clstep,
|
||||
int cllen) {
|
||||
int cllen)
|
||||
{
|
||||
int pathlen;
|
||||
int buflen, datalen;
|
||||
|
||||
|
|
@ -1084,7 +1154,9 @@ int sj3_make_study_file(SJ3_CLIENT_ENV* client,
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_make_directory(SJ3_CLIENT_ENV* client, char* path) {
|
||||
int
|
||||
sj3_make_directory(SJ3_CLIENT_ENV *client, char *path)
|
||||
{
|
||||
int pathlen;
|
||||
int buflen;
|
||||
|
||||
|
|
@ -1108,7 +1180,9 @@ int sj3_make_directory(SJ3_CLIENT_ENV* client, char* path) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_access(SJ3_CLIENT_ENV* client, char* path, int mode) {
|
||||
int
|
||||
sj3_access(SJ3_CLIENT_ENV *client, char *path, int mode)
|
||||
{
|
||||
int result;
|
||||
int pathlen;
|
||||
int buflen, datalen;
|
||||
|
|
@ -1135,7 +1209,9 @@ int sj3_access(SJ3_CLIENT_ENV* client, char* path, int mode) {
|
|||
return ReadErrorFlag ? ERROR : result;
|
||||
}
|
||||
|
||||
int sj3_who(SJ3_CLIENT_ENV* client, SJ3_WHO_STRUCT* ret, int num) {
|
||||
int
|
||||
sj3_who(SJ3_CLIENT_ENV *client, SJ3_WHO_STRUCT *ret, int num)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
client_init(client);
|
||||
|
|
@ -1168,7 +1244,9 @@ int sj3_who(SJ3_CLIENT_ENV* client, SJ3_WHO_STRUCT* ret, int num) {
|
|||
return ReadErrorFlag ? ERROR : ((i < num) ? i : num);
|
||||
}
|
||||
|
||||
int sj3_quit(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_quit(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_QUIT);
|
||||
|
|
@ -1180,7 +1258,9 @@ int sj3_quit(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_kill(SJ3_CLIENT_ENV* client) {
|
||||
int
|
||||
sj3_kill(SJ3_CLIENT_ENV *client)
|
||||
{
|
||||
client_init(client);
|
||||
|
||||
put_cmd(SJ3_KILL);
|
||||
|
|
@ -1192,7 +1272,9 @@ int sj3_kill(SJ3_CLIENT_ENV* client) {
|
|||
return ReadErrorFlag ? ERROR : 0;
|
||||
}
|
||||
|
||||
int sj3_version(SJ3_CLIENT_ENV* client, char* dst, int dstsiz) {
|
||||
int
|
||||
sj3_version(SJ3_CLIENT_ENV *client, char *dst, int dstsiz)
|
||||
{
|
||||
int c;
|
||||
|
||||
client_init(client);
|
||||
|
|
|
|||
68
libif.c
68
libif.c
|
|
@ -27,6 +27,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: libif.c,v $
|
||||
* $SonyRevision: 1.3 $
|
||||
* $SonyDate: 1996/02/23 11:04:02 $
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_sysvdef.h"
|
||||
#ifdef SVR4
|
||||
#include <sys/euc.h>
|
||||
|
|
@ -36,6 +43,7 @@
|
|||
#include "kctype.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
extern char user_name[];
|
||||
extern char *cur_serv, **serv_list;
|
||||
extern char **dict_list;
|
||||
|
|
@ -47,15 +55,21 @@ int sjislen(), euclen();
|
|||
|
||||
int (*len_func[3])() = {0, sjislen, euclen};
|
||||
|
||||
|
||||
#define YOMILEN 32
|
||||
#define KLEN 64
|
||||
|
||||
SJ2_henkan(yomiout, bun, kanjiout, kanjilen) struct bunsetsu_sj3* bun;
|
||||
|
||||
|
||||
|
||||
|
||||
SJ2_henkan (yomiout, bun, kanjiout, kanjilen)
|
||||
struct bunsetu_sj3 *bun;
|
||||
wchar16_t *yomiout, *kanjiout;
|
||||
int kanjilen;
|
||||
{
|
||||
int retv;
|
||||
SJ3_BUNSETSU sbun[BUFFLENGTH];
|
||||
SJ3_BUNSETU sbun[BUFFLENGTH];
|
||||
int i, sentou, saigo;
|
||||
unsigned char yomi[BUFFLENGTH * 3];
|
||||
unsigned char kanji[BUFFLENGTH * 6];
|
||||
|
|
@ -84,7 +98,8 @@ int kanjilen;
|
|||
|
||||
return(retv);
|
||||
}
|
||||
int sjislen(str, max)
|
||||
int
|
||||
sjislen(str, max)
|
||||
unsigned char *str;
|
||||
int max;
|
||||
{
|
||||
|
|
@ -106,7 +121,8 @@ int max;
|
|||
return len;
|
||||
}
|
||||
|
||||
euclen(str, max) unsigned char* str;
|
||||
euclen(str, max)
|
||||
unsigned char *str;
|
||||
int max;
|
||||
{
|
||||
int len = 0, bytes = 1;
|
||||
|
|
@ -135,6 +151,8 @@ int max;
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SJ2_getdouon (s, d, n, choice, reconv)
|
||||
wchar16_t *s;
|
||||
struct douon_sj3 *d;
|
||||
|
|
@ -157,7 +175,7 @@ int reconv;
|
|||
(void) memcpy(&(d[i].dcid),
|
||||
&(d_sjis[i].dcid), SJ3_WORD_ID_SIZE);
|
||||
d[i].wlen = (int) mbstowcs(d[i].ddata, (char *)d_sjis[i].ddata,
|
||||
SJ3_BUNSETSU_KANJI * 2);
|
||||
SJ3_BUNSETU_KANJI*2);
|
||||
d[i].dlen = wcbyte(d[i].ddata);
|
||||
d[i].valid = (char)1;
|
||||
}
|
||||
|
|
@ -174,14 +192,14 @@ int reconv;
|
|||
return(ret + 1);
|
||||
}
|
||||
|
||||
SJ2_study(dcid) struct studyrec* dcid;
|
||||
SJ2_study (dcid)
|
||||
struct studyrec *dcid;
|
||||
{
|
||||
sj3_gakushuu(dcid);
|
||||
sj3_gakusyuu(dcid);
|
||||
}
|
||||
|
||||
SJ2_clstudy (yomi1, yomi2, dcid)
|
||||
wchar16_t* yomi1,
|
||||
*yomi2;
|
||||
wchar16_t *yomi1, *yomi2;
|
||||
struct studyrec *dcid;
|
||||
{
|
||||
unsigned char y1[BUFFLENGTH*2];
|
||||
|
|
@ -191,15 +209,14 @@ struct studyrec* dcid;
|
|||
(void) wcstombs((char *) y2, yomi2, BUFFLENGTH*2);
|
||||
|
||||
if (current_locale == LC_CTYPE_SHIFTJIS) {
|
||||
sj3_gakushuu2(y1, y2, dcid);
|
||||
sj3_gakusyuu2(y1, y2, dcid);
|
||||
} else {
|
||||
sj3_gakushuu2_euc(y1, y2, dcid);
|
||||
sj3_gakusyuu2_euc(y1, y2, dcid);
|
||||
}
|
||||
}
|
||||
|
||||
SJ2_toroku (yomi, kanji, hinshi)
|
||||
wchar16_t* yomi,
|
||||
*kanji;
|
||||
wchar16_t *yomi, *kanji;
|
||||
int hinshi;
|
||||
{
|
||||
unsigned char y[(YOMILEN+1)*3];
|
||||
|
|
@ -216,9 +233,8 @@ int hinshi;
|
|||
return(ret);
|
||||
}
|
||||
|
||||
SJ2_shoukyo(yomi, kanji, hinshi)
|
||||
wchar16_t* yomi,
|
||||
*kanji;
|
||||
SJ2_syoukyo (yomi, kanji, hinshi)
|
||||
wchar16_t *yomi, *kanji;
|
||||
int hinshi;
|
||||
{
|
||||
unsigned char y[(YOMILEN+1)*3];
|
||||
|
|
@ -228,14 +244,15 @@ int hinshi;
|
|||
(void)wcstombs((char *) y, yomi, (YOMILEN+1)*3);
|
||||
(void)wcstombs((char *) k, kanji, (KLEN+1)*3);
|
||||
if (current_locale == LC_CTYPE_SHIFTJIS) {
|
||||
ret = sj3_shoukyo(y, k, hinshi);
|
||||
ret = sj3_syoukyo (y, k, hinshi);
|
||||
} else {
|
||||
ret = sj3_shoukyo_euc(y, k, hinshi);
|
||||
ret = sj3_syoukyo_euc (y, k, hinshi);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
sj_check_error(err) int err;
|
||||
sj_check_error (err)
|
||||
int err;
|
||||
{
|
||||
if (err & SJ3_SERVER_DEAD)
|
||||
SJ_warnning(WCServer_Dead);
|
||||
|
|
@ -257,7 +274,8 @@ sj_check_error(err) int err;
|
|||
SJ_warnning(WCNopen_Study);
|
||||
}
|
||||
|
||||
SJ2_reconnect() {
|
||||
SJ2_reconnect ()
|
||||
{
|
||||
int err;
|
||||
|
||||
sj3_close();
|
||||
|
|
@ -268,11 +286,14 @@ SJ2_reconnect() {
|
|||
return(err);
|
||||
}
|
||||
|
||||
SJ2_henkan_end() {
|
||||
|
||||
SJ2_henkan_end ()
|
||||
{
|
||||
sj3_close ();
|
||||
}
|
||||
|
||||
SJ2_henkan_init() {
|
||||
SJ2_henkan_init ()
|
||||
{
|
||||
int i, err;
|
||||
int *err_dict = NULL;
|
||||
int err_num = 0;
|
||||
|
|
@ -312,7 +333,8 @@ SJ2_henkan_init() {
|
|||
}
|
||||
}
|
||||
|
||||
sj3_autocon() {
|
||||
sj3_autocon()
|
||||
{
|
||||
int i, err;
|
||||
|
||||
if (dict_num && dict_list) {
|
||||
|
|
|
|||
31
main.c
31
main.c
|
|
@ -53,7 +53,8 @@ char* version_number = "2.08C";
|
|||
char *time_stamp = "Mon Mar 23 16:42:59 JST 1998";
|
||||
|
||||
static void
|
||||
opening(void) {
|
||||
opening(void)
|
||||
{
|
||||
printf("Kana-Kanji Conversion Server Version %s\r\n", version_number);
|
||||
printf("Copyright (c) 1990-1995 Sony Corporation\r\n");
|
||||
printf("Created at %s\r\n", time_stamp);
|
||||
|
|
@ -61,7 +62,9 @@ opening(void) {
|
|||
|
||||
#ifdef LOCK_FILE
|
||||
|
||||
int make_lockfile(void) {
|
||||
int
|
||||
make_lockfile(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open(lock_file, O_CREAT | O_EXCL, 0600);
|
||||
|
|
@ -71,18 +74,22 @@ int make_lockfile(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int erase_lockfile(void) {
|
||||
int
|
||||
erase_lockfile(void)
|
||||
{
|
||||
return unlink(lock_file);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
signal_handler(int sig) {
|
||||
signal_handler(int sig)
|
||||
{
|
||||
warning_out("signal %d catched.", sig);
|
||||
}
|
||||
|
||||
static int
|
||||
terminate_handler(int sig) {
|
||||
terminate_handler(int sig)
|
||||
{
|
||||
close_socket();
|
||||
sj_closeall();
|
||||
#ifdef LOCK_FILE
|
||||
|
|
@ -91,7 +98,9 @@ terminate_handler(int sig) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
void server_terminate(void) {
|
||||
void
|
||||
server_terminate(void)
|
||||
{
|
||||
close_socket();
|
||||
sj_closeall();
|
||||
#ifdef LOCK_FILE
|
||||
|
|
@ -101,7 +110,8 @@ void server_terminate(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
exec_fork(void) {
|
||||
exec_fork(void)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
if (fork_flag && (tmp = fork())) {
|
||||
|
|
@ -130,7 +140,8 @@ exec_fork(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
leave_tty(void) {
|
||||
leave_tty(void)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
tmp = open_error();
|
||||
|
|
@ -150,7 +161,9 @@ leave_tty(void) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
opening();
|
||||
#ifndef __NetBSD__
|
||||
if (setuid(geteuid())) {
|
||||
|
|
|
|||
59
makedict.c
59
makedict.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: makedict.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/12/09 11:27:05 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/* #include "sj_sysvdef.h" */ /* XXX: no more need it? */
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -44,7 +53,10 @@ FILE* outfp = NULL;
|
|||
|
||||
static char *idxtop = NULL;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
parse(argc, argv);
|
||||
|
||||
while (readline()) setline(makelist);
|
||||
|
|
@ -54,7 +66,10 @@ int main(int argc, char** argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
char* make_idxlist(char* name) {
|
||||
|
||||
char*
|
||||
make_idxlist(char* name)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
|
||||
|
|
@ -64,20 +79,26 @@ char* make_idxlist(char* name) {
|
|||
return p;
|
||||
}
|
||||
|
||||
char* get_idxlist(char* name) {
|
||||
char*
|
||||
get_idxlist(char* name)
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
char *p, *q, *r;
|
||||
|
||||
|
||||
fp = Fopen(name, "r");
|
||||
|
||||
|
||||
i = Fsize(name);
|
||||
|
||||
|
||||
p = Zalloc(i + 2);
|
||||
Fseek(fp, 0L, 0);
|
||||
Fread(p, 1, i, fp);
|
||||
Fclose(fp);
|
||||
|
||||
|
||||
for (q = r = p ; *q ; ) {
|
||||
while (*q <= ' ') q++;
|
||||
while (*q > ' ') *r++ = *q++;
|
||||
|
|
@ -86,6 +107,7 @@ char* get_idxlist(char* name) {
|
|||
}
|
||||
*r = 0;
|
||||
|
||||
|
||||
i = 0;
|
||||
for (q = p ; *q ; ) {
|
||||
if ((fp = fopen(q, "r"))!=NULL)
|
||||
|
|
@ -101,24 +123,33 @@ char* get_idxlist(char* name) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void parse(int argc, char** argv) {
|
||||
|
||||
void
|
||||
parse(int argc, char** argv)
|
||||
{
|
||||
char *progname = NULL;
|
||||
char *p;
|
||||
|
||||
|
||||
if ((progname = strrchr(argv[0], '/'))!=NULL)
|
||||
progname++;
|
||||
else
|
||||
progname = argv[0];
|
||||
|
||||
|
||||
if (argc != 3) usage(progname);
|
||||
|
||||
|
||||
p = argv[1];
|
||||
idxtop = (*p == '-') ? get_idxlist(p + 1) : make_idxlist(p);
|
||||
|
||||
outfp = Fopen(argv[2], "w");
|
||||
}
|
||||
|
||||
int get_number(char* ptr) {
|
||||
|
||||
int
|
||||
get_number(char* ptr)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (*ptr >= '0' && *ptr <= '9') {
|
||||
|
|
@ -128,13 +159,19 @@ int get_number(char* ptr) {
|
|||
return(i);
|
||||
}
|
||||
|
||||
void usage(char* name) {
|
||||
|
||||
void
|
||||
usage(char* name)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s text_file binary_file\n",
|
||||
name ? name : "encode");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int getch(void) {
|
||||
|
||||
int
|
||||
getch(void)
|
||||
{
|
||||
if (infp) {
|
||||
int c;
|
||||
|
||||
|
|
@ -158,7 +195,10 @@ int getch(void) {
|
|||
return EOF;
|
||||
}
|
||||
|
||||
void mark_file(FILE* out) {
|
||||
|
||||
void
|
||||
mark_file(FILE* out)
|
||||
{
|
||||
static char pathname[MAXPATHLEN];
|
||||
static long pos;
|
||||
|
||||
|
|
@ -176,7 +216,8 @@ void mark_file(FILE* out) {
|
|||
}
|
||||
fputc('\n', out);
|
||||
Fclose(fp);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
strcpy(pathname, idxtop);
|
||||
pos = infp ? Ftell(infp) : 0;
|
||||
}
|
||||
|
|
|
|||
220
makelist.c
220
makelist.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: makelist.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:39 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -41,68 +50,90 @@
|
|||
extern DouonRec *douon_ptr;
|
||||
extern int douon_num;
|
||||
extern int yomi_len;
|
||||
extern int hinshi_num;
|
||||
extern int hinsi_num;
|
||||
extern int kanji_len;
|
||||
extern HindoRec *hindo[];
|
||||
extern int hindo_num;
|
||||
extern HindoRec *askknj[];
|
||||
extern int askknj_num;
|
||||
extern HindoRec* asshuku;
|
||||
extern HindoRec *assyuku;
|
||||
|
||||
static DouonRec *drectmp = NULL;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
clearklist(KanjiRec* krec) {
|
||||
clearklist(KanjiRec* krec)
|
||||
{
|
||||
KanjiRec *p;
|
||||
|
||||
|
||||
while (krec) {
|
||||
|
||||
Free(krec -> kptr);
|
||||
Free(krec -> aptr);
|
||||
|
||||
|
||||
p = krec;
|
||||
krec = krec -> knext;
|
||||
|
||||
|
||||
Free(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
clearhlist(HinshiRec* hrec) {
|
||||
HinshiRec* p;
|
||||
clearhlist(HinsiRec* hrec)
|
||||
{
|
||||
HinsiRec *p;
|
||||
|
||||
|
||||
while (hrec) {
|
||||
|
||||
clearklist(hrec -> krec);
|
||||
|
||||
|
||||
p = hrec;
|
||||
hrec = hrec -> hnext;
|
||||
|
||||
|
||||
Free(p);
|
||||
}
|
||||
}
|
||||
|
||||
void clear_list(void) {
|
||||
|
||||
void
|
||||
clear_list(void)
|
||||
{
|
||||
DouonRec *p;
|
||||
DouonRec *drec = douon_ptr;
|
||||
|
||||
|
||||
while (drec) {
|
||||
|
||||
Free(drec -> yptr);
|
||||
|
||||
|
||||
clearhlist(drec -> hrec);
|
||||
|
||||
|
||||
p = drec;
|
||||
drec = drec -> dnext;
|
||||
|
||||
|
||||
Free(p);
|
||||
}
|
||||
|
||||
douon_ptr = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned char*
|
||||
makekanji(int* yomi, int* kanji, int* atr, int* len) {
|
||||
makekanji(int *yomi, int* kanji, int* atr, int* len)
|
||||
{
|
||||
int kana[MaxYomiLength + 1];
|
||||
unsigned char ktmp[MaxKanjiLength * 3 + MaxAtrNumber * 2 + 1];
|
||||
int i;
|
||||
|
|
@ -110,6 +141,7 @@ makekanji(int* yomi, int* kanji, int* atr, int* len) {
|
|||
int *p;
|
||||
unsigned char *q;
|
||||
|
||||
|
||||
for (p = yomi, i = 0 ; *p ; )
|
||||
kana[i++] = h2kcode(*p++);
|
||||
kana[i] = 0;
|
||||
|
|
@ -123,26 +155,28 @@ makekanji(int* yomi, int* kanji, int* atr, int* len) {
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
if ((i = top_strcmp(yomi, kanji))!=0) {
|
||||
kanji += i;
|
||||
ktmp[pos++] = (ZenHiraAsshuku | (i - 1));
|
||||
ktmp[pos++] = (ZenHiraAssyuku | (i - 1));
|
||||
}
|
||||
|
||||
else if ((i = top_strcmp(kana, kanji))!=0) {
|
||||
kanji += i;
|
||||
ktmp[pos++] = (ZenKataAsshuku | (i - 1));
|
||||
ktmp[pos++] = (ZenKataAssyuku | (i - 1));
|
||||
}
|
||||
|
||||
|
||||
while (*kanji) {
|
||||
|
||||
if ((i = last_strcmp(yomi, kanji))!=0) {
|
||||
kanji += i;
|
||||
ktmp[pos++] = (ZenHiraAsshuku | (i - 1));
|
||||
ktmp[pos++] = (ZenHiraAssyuku | (i - 1));
|
||||
}
|
||||
|
||||
else if ((i = last_strcmp(kana, kanji))!=0) {
|
||||
kanji += i;
|
||||
ktmp[pos++] = (ZenKataAsshuku | (i - 1));
|
||||
ktmp[pos++] = (ZenKataAssyuku | (i - 1));
|
||||
}
|
||||
|
||||
else if (((*kanji >> 8) & 0xff) == SS2 || *kanji < 0x100) {
|
||||
|
|
@ -171,6 +205,7 @@ makekanji(int* yomi, int* kanji, int* atr, int* len) {
|
|||
}
|
||||
*len = pos;
|
||||
|
||||
|
||||
q = (unsigned char *)Malloc(pos);
|
||||
if (!q) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
|
|
@ -181,26 +216,30 @@ makekanji(int* yomi, int* kanji, int* atr, int* len) {
|
|||
return q;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned char*
|
||||
makeyomi(int* yomi) {
|
||||
makeyomi(int* yomi)
|
||||
{
|
||||
unsigned char tmp[MaxYomiLength + 1];
|
||||
int i;
|
||||
int j;
|
||||
int *y = yomi;
|
||||
unsigned char *p;
|
||||
|
||||
|
||||
for (i = 0 ; *y ; ) {
|
||||
j = cnvyomi(*y++);
|
||||
if (j == 0) {
|
||||
fprintf(stderr, "\311\324\300\265\244\312\312\270\273\372\244\254\306\311\244\337\244\313\273\310\244\357\244\354\244\306\244\244\244\336\244\271\n");
|
||||
output_int(stderr, yomi);
|
||||
fputc('\n', stderr);
|
||||
output_int(stderr, yomi); fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
tmp[i++] = j;
|
||||
}
|
||||
tmp[i++] = 0;
|
||||
|
||||
|
||||
p = (unsigned char *)Malloc(i);
|
||||
if (!p) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
|
|
@ -211,16 +250,21 @@ makeyomi(int* yomi) {
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static KanjiRec*
|
||||
make_krec(unsigned char* kcode, int klen) {
|
||||
make_krec(unsigned char* kcode, int klen)
|
||||
{
|
||||
KanjiRec *krec;
|
||||
|
||||
|
||||
krec = (KanjiRec *)Malloc(sizeof(KanjiRec));
|
||||
if (!krec) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
krec -> klen = klen;
|
||||
krec -> kptr = kcode;
|
||||
krec -> alen = 0;
|
||||
|
|
@ -230,33 +274,43 @@ make_krec(unsigned char* kcode, int klen) {
|
|||
return krec;
|
||||
}
|
||||
|
||||
static HinshiRec*
|
||||
make_hrec(int hinshi) {
|
||||
HinshiRec* hrec;
|
||||
|
||||
hrec = (HinshiRec*)Malloc(sizeof(HinshiRec));
|
||||
|
||||
static HinsiRec*
|
||||
make_hrec(int hinsi)
|
||||
{
|
||||
HinsiRec *hrec;
|
||||
|
||||
|
||||
hrec = (HinsiRec *)Malloc(sizeof(HinsiRec));
|
||||
if (!hrec) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
hrec->hinshi = hinshi;
|
||||
|
||||
hrec -> hinsi = hinsi;
|
||||
hrec -> krec = NULL;
|
||||
hrec -> hnext = NULL;
|
||||
|
||||
return hrec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static DouonRec*
|
||||
make_drec(unsigned char* ycode) {
|
||||
make_drec(unsigned char* ycode)
|
||||
{
|
||||
DouonRec *drec;
|
||||
|
||||
|
||||
drec = (DouonRec *)Malloc(sizeof(DouonRec));
|
||||
if (!drec) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\311\324\302\255\244\267\244\336\244\267\244\277");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
drec -> yptr = ycode;
|
||||
drec -> hrec_num = 0;
|
||||
drec -> hrec = NULL;
|
||||
|
|
@ -265,16 +319,19 @@ make_drec(unsigned char* ycode) {
|
|||
return drec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
diff_ylen(DouonRec* drec) {
|
||||
diff_ylen(DouonRec *drec)
|
||||
{
|
||||
DouonRec *dptr;
|
||||
DouonRec *dprev;
|
||||
unsigned char *p1;
|
||||
unsigned char *p2;
|
||||
int ylen = 0;
|
||||
|
||||
dptr = douon_ptr;
|
||||
dprev = NULL;
|
||||
|
||||
dptr = douon_ptr; dprev = NULL;
|
||||
while (dptr) {
|
||||
dprev = dptr;
|
||||
dptr = dptr -> dnext;
|
||||
|
|
@ -282,68 +339,75 @@ diff_ylen(DouonRec* drec) {
|
|||
|
||||
if (dprev) {
|
||||
|
||||
p1 = dprev->yptr;
|
||||
p2 = drec->yptr;
|
||||
while(*p1 && (*p1 == *p2)) {
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
p1 = dprev -> yptr; p2 = drec -> yptr;
|
||||
while (*p1 && (*p1 == *p2)) { p1++; p2++; }
|
||||
|
||||
|
||||
if (*p1 == *p2) {
|
||||
fprintf(stderr, "\305\371\244\267\244\244\306\311\244\337\244\316\306\261\262\273\270\354\245\326\245\355\245\303\245\257\244\254\244\242\244\353\n");
|
||||
output_yomi(stderr, dprev->yptr);
|
||||
fputc('\n', stderr);
|
||||
output_yomi(stderr, dprev -> yptr); fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
else if (*p1 > *p2) {
|
||||
fprintf(stderr, "\306\311\244\337\244\316\275\347\275\370\244\254\244\252\244\253\244\267\244\244\n");
|
||||
output_yomi(stderr, dprev->yptr);
|
||||
fputc('\n', stderr);
|
||||
output_yomi(stderr, drec->yptr);
|
||||
fputc('\n', stderr);
|
||||
output_yomi(stderr, dprev->yptr); fputc('\n', stderr);
|
||||
output_yomi(stderr, drec->yptr); fputc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
while (*p2++) ylen++;
|
||||
}
|
||||
|
||||
return ylen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
douon_knj(DouonRec* drec) {
|
||||
douon_knj(DouonRec* drec)
|
||||
{
|
||||
int i;
|
||||
int len = 0;
|
||||
unsigned char *p;
|
||||
unsigned char *knjofscvt();
|
||||
HinshiRec* hrec;
|
||||
HinsiRec *hrec;
|
||||
KanjiRec *krec;
|
||||
|
||||
|
||||
for (hrec = drec -> hrec ; hrec ; hrec = hrec -> hnext) {
|
||||
|
||||
for (krec = hrec -> krec ; krec ; krec = krec -> knext) {
|
||||
|
||||
p = knjofscvt(krec -> kptr, krec -> klen, &i);
|
||||
|
||||
|
||||
len += i + 1;
|
||||
|
||||
|
||||
knjhnd_set(p, i);
|
||||
|
||||
|
||||
krec -> alen = i;
|
||||
krec -> aptr = p;
|
||||
|
||||
|
||||
set_ofsrec(krec -> kptr, krec -> klen, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
make_d_list(DouonRec* drec) {
|
||||
make_d_list(DouonRec* drec)
|
||||
{
|
||||
DouonRec *dptr, *dprev;
|
||||
HinshiRec* hptr;
|
||||
HinsiRec *hptr;
|
||||
KanjiRec *kptr;
|
||||
int ylen;
|
||||
int klen;
|
||||
|
|
@ -356,39 +420,45 @@ start:
|
|||
if (douon_ptr == NULL) {
|
||||
douon_num = 0;
|
||||
yomi_len = 0;
|
||||
hinshi_num = 0;
|
||||
hinsi_num = 0;
|
||||
kanji_len = 0;
|
||||
asshuku = NULL;
|
||||
assyuku = NULL;
|
||||
}
|
||||
|
||||
|
||||
klen = douon_knj(drec);
|
||||
|
||||
|
||||
ylen = diff_ylen(drec);
|
||||
|
||||
|
||||
hnum = drec -> hrec_num;
|
||||
|
||||
|
||||
i = 1 +
|
||||
MaxKnjAskNumber +
|
||||
|
||||
douon_num * DouonBlkSizeNumber + DouonBlkSizeNumber +
|
||||
yomi_len + ylen +
|
||||
hinshi_num + hnum +
|
||||
hinshi_num + hnum +
|
||||
hinsi_num + hnum +
|
||||
hinsi_num + hnum +
|
||||
kanji_len + klen;
|
||||
|
||||
|
||||
len = (i <= MainSegmentLength) ? 0 : decide_knjask();
|
||||
|
||||
|
||||
if ((i - len) <= MainSegmentLength) {
|
||||
|
||||
if (douon_ptr) {
|
||||
|
||||
dptr = douon_ptr;
|
||||
dprev = NULL;
|
||||
dptr = douon_ptr; dprev = NULL;
|
||||
while (dptr) {
|
||||
dprev = dptr;
|
||||
dptr = dptr -> dnext;
|
||||
}
|
||||
|
||||
|
||||
dprev -> dnext = drec;
|
||||
}
|
||||
|
||||
|
|
@ -398,13 +468,18 @@ start:
|
|||
}
|
||||
drec -> dnext = NULL;
|
||||
|
||||
|
||||
drec -> dlen = ylen;
|
||||
|
||||
|
||||
douon_num += 1;
|
||||
|
||||
|
||||
yomi_len += ylen;
|
||||
|
||||
hinshi_num += hnum;
|
||||
|
||||
hinsi_num += hnum;
|
||||
|
||||
|
||||
kanji_len += klen;
|
||||
|
||||
|
|
@ -416,34 +491,47 @@ start:
|
|||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
for (hptr = drec -> hrec ; hptr ; hptr = hptr -> hnext) {
|
||||
for (kptr = hptr -> krec ; kptr ; kptr = kptr -> knext) {
|
||||
|
||||
|
||||
knjhnd_reset(kptr -> aptr, kptr -> alen);
|
||||
|
||||
|
||||
Free(kptr -> aptr);
|
||||
kptr -> aptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
len = decide_knjask();
|
||||
|
||||
|
||||
makeseg();
|
||||
|
||||
|
||||
clear_list();
|
||||
|
||||
|
||||
clear_hindo();
|
||||
|
||||
|
||||
clear_ofsrec();
|
||||
|
||||
|
||||
askknj_num = 0;
|
||||
|
||||
clear_asshuku();
|
||||
|
||||
clear_assyuku();
|
||||
|
||||
goto start;
|
||||
}
|
||||
|
||||
void flush_douon(void) {
|
||||
|
||||
void
|
||||
flush_douon(void)
|
||||
{
|
||||
if (drectmp) {
|
||||
|
||||
make_d_list(drectmp);
|
||||
|
|
@ -455,29 +543,40 @@ void flush_douon(void) {
|
|||
|
||||
decide_knjask();
|
||||
|
||||
|
||||
makeseg();
|
||||
|
||||
|
||||
clear_list();
|
||||
|
||||
|
||||
clear_hindo();
|
||||
|
||||
|
||||
clear_ofsrec();
|
||||
|
||||
|
||||
askknj_num = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void makelist(int* yomi, int* kanji, int hinshi, int* atr) {
|
||||
|
||||
void
|
||||
makelist(int* yomi, int* kanji, int hinsi, int* atr)
|
||||
{
|
||||
unsigned char *ycode;
|
||||
unsigned char *kcode;
|
||||
int klen;
|
||||
HinshiRec* hrec;
|
||||
HinsiRec *hrec;
|
||||
KanjiRec *krec, *kprev;
|
||||
|
||||
|
||||
ycode = makeyomi(yomi);
|
||||
|
||||
|
||||
kcode = makekanji(yomi, kanji, atr, &klen);
|
||||
|
||||
|
||||
if (drectmp && strcmp(ycode, drectmp -> yptr)) {
|
||||
|
||||
make_d_list(drectmp);
|
||||
|
|
@ -485,24 +584,29 @@ void makelist(int* yomi, int* kanji, int hinshi, int* atr) {
|
|||
drectmp = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (!drectmp) {
|
||||
|
||||
drectmp = make_drec(ycode);
|
||||
|
||||
hrec = make_hrec(hinshi);
|
||||
|
||||
hrec = make_hrec(hinsi);
|
||||
drectmp -> hrec = hrec;
|
||||
drectmp -> hrec_num = 1;
|
||||
|
||||
|
||||
krec = make_krec(kcode, klen);
|
||||
hrec -> krec = krec;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for(hrec = drectmp->hrec; hrec->hnext; hrec = hrec->hnext)
|
||||
if(hrec->hinshi == hinshi) break;
|
||||
|
||||
if(hrec->hinshi == hinshi) {
|
||||
for (hrec = drectmp -> hrec ; hrec -> hnext ; hrec = hrec -> hnext)
|
||||
if (hrec -> hinsi == hinsi) break;
|
||||
|
||||
|
||||
if (hrec -> hinsi == hinsi) {
|
||||
|
||||
for (krec=hrec->krec ; krec ; krec=krec->knext) {
|
||||
|
||||
|
|
@ -516,6 +620,7 @@ void makelist(int* yomi, int* kanji, int hinshi, int* atr) {
|
|||
output_int(stderr, kanji);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
||||
Free(kcode);
|
||||
|
||||
return;
|
||||
|
|
@ -523,15 +628,18 @@ void makelist(int* yomi, int* kanji, int hinshi, int* atr) {
|
|||
kprev = krec;
|
||||
}
|
||||
|
||||
|
||||
kprev -> knext = make_krec(kcode, klen);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
hrec->hnext = make_hrec(hinshi);
|
||||
|
||||
hrec -> hnext = make_hrec(hinsi);
|
||||
hrec = hrec -> hnext;
|
||||
drectmp -> hrec_num += 1;
|
||||
|
||||
|
||||
krec = make_krec(kcode, klen);
|
||||
hrec -> krec = krec;
|
||||
}
|
||||
|
|
|
|||
139
makeseg.c
139
makeseg.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: makeseg.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/12/09 11:27:05 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -47,19 +56,22 @@ static unsigned char segindex[MainSegmentLength];
|
|||
static int idxpos = 0;
|
||||
static int idxnum = 0;
|
||||
|
||||
|
||||
static unsigned char*
|
||||
set_ofsask(unsigned char* src, unsigned char* dst) {
|
||||
set_ofsask(unsigned char* src, unsigned char* dst)
|
||||
{
|
||||
int len;
|
||||
unsigned char *ptr;
|
||||
OffsetRec *ofsrec;
|
||||
|
||||
|
||||
ofsrec = real_ofsrec(src);
|
||||
|
||||
for (len = ofsrec->klen, ptr = ofsrec->kptr ; len > 0 ; ) {
|
||||
switch (*ptr & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
case ZenKataAsshuku:
|
||||
case KanjiAsshuku:
|
||||
case ZenHiraAssyuku:
|
||||
case ZenKataAssyuku:
|
||||
case KanjiAssyuku:
|
||||
*dst++ = *ptr++;
|
||||
len -= 1;
|
||||
break;
|
||||
|
|
@ -73,7 +85,7 @@ set_ofsask(unsigned char* src, unsigned char* dst) {
|
|||
len -= 2;
|
||||
break;
|
||||
#endif
|
||||
case OffsetAsshuku:
|
||||
case OffsetAssyuku:
|
||||
fprintf(stderr, "\306\363\275\305\244\313\245\252\245\325\245\273\245\303\245\310\244\254\273\262\276\310\244\265\244\354\244\306\244\244\244\353\n");
|
||||
exit(1);
|
||||
case AiAttribute:
|
||||
|
|
@ -95,15 +107,17 @@ set_ofsask(unsigned char* src, unsigned char* dst) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
make_knjstr(unsigned char* src, int len, unsigned char* dst) {
|
||||
make_knjstr(unsigned char* src, int len, unsigned char* dst)
|
||||
{
|
||||
unsigned char *keep = dst;
|
||||
|
||||
while (len > 0) {
|
||||
switch (*src & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
case ZenKataAsshuku:
|
||||
case KanjiAsshuku:
|
||||
case ZenHiraAssyuku:
|
||||
case ZenKataAssyuku:
|
||||
case KanjiAssyuku:
|
||||
*dst++ = *src++;
|
||||
len -= 1;
|
||||
break;
|
||||
|
|
@ -117,7 +131,7 @@ make_knjstr(unsigned char* src, int len, unsigned char* dst) {
|
|||
len -= 2;
|
||||
break;
|
||||
#endif
|
||||
case OffsetAsshuku:
|
||||
case OffsetAssyuku:
|
||||
dst = set_ofsask(src, dst);
|
||||
src += 2;
|
||||
len -= 2;
|
||||
|
|
@ -140,40 +154,52 @@ make_knjstr(unsigned char* src, int len, unsigned char* dst) {
|
|||
return(dst - keep);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
make_knjask(void) {
|
||||
make_knjask(void)
|
||||
{
|
||||
int i;
|
||||
unsigned char *p;
|
||||
unsigned char buf[128];
|
||||
int len;
|
||||
int tlen = 0;
|
||||
|
||||
|
||||
for (i = 0 ; i < askknj_num ; i++) {
|
||||
|
||||
|
||||
len = make_knjstr(askknj[i] -> kptr, askknj[i] -> klen, buf);
|
||||
|
||||
|
||||
Free(askknj[i] -> kptr);
|
||||
|
||||
|
||||
p = (unsigned char *)Malloc(len);
|
||||
if (!p) {
|
||||
fprintf(stderr, "\245\341\245\342\245\352\244\254\302\255\244\352\244\336\244\273\244\363\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
memcpy(p, buf, len);
|
||||
askknj[i] -> kptr = p;
|
||||
askknj[i] -> klen = len;
|
||||
|
||||
|
||||
tlen += len + 1;
|
||||
}
|
||||
|
||||
return tlen;
|
||||
}
|
||||
|
||||
void makeseg(void) {
|
||||
|
||||
void
|
||||
makeseg(void)
|
||||
{
|
||||
unsigned char buf[MainSegmentLength];
|
||||
DouonRec *drec;
|
||||
HinshiRec* hrec;
|
||||
HinsiRec *hrec;
|
||||
KanjiRec *krec;
|
||||
int i, j, k;
|
||||
int slen;
|
||||
|
|
@ -182,93 +208,94 @@ void makeseg(void) {
|
|||
unsigned char *p, *q;
|
||||
|
||||
#ifndef HEHE
|
||||
#define datset(i) \
|
||||
{ \
|
||||
if(dst >= buf + sizeof(buf)) goto err; \
|
||||
*dst++ = i; \
|
||||
}
|
||||
#define datset(i) { if (dst >= buf+sizeof(buf)) goto err; *dst++ = i; }
|
||||
#else
|
||||
#define datset(i) \
|
||||
{ \
|
||||
*dst++; \
|
||||
i; \
|
||||
}
|
||||
#define datset(i) { *dst++; i; }
|
||||
#endif
|
||||
|
||||
|
||||
dst = buf;
|
||||
|
||||
|
||||
i = make_knjask();
|
||||
if (i >= 0x100) {
|
||||
fprintf(stderr, "\264\301\273\372\260\265\275\314\312\270\273\372\316\363\244\254\304\271\244\271\244\256\244\353\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
datset(i);
|
||||
for (i = 0 ; i < askknj_num ; i++) {
|
||||
p = askknj[i] -> kptr;
|
||||
j = askknj[i] -> klen;
|
||||
while (j > 0) {
|
||||
k = codesize(*p);
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p); p++;
|
||||
if (k > 2) {
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p); p++;
|
||||
datset(*p); p++;
|
||||
} else if (k > 1) {
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p); p++;
|
||||
}
|
||||
j -= k;
|
||||
}
|
||||
datset(KanjiStrEnd);
|
||||
}
|
||||
|
||||
|
||||
clear_ofsrec();
|
||||
|
||||
|
||||
for (drec = douon_ptr ; drec ; drec = drec->dnext) {
|
||||
|
||||
sdst = dst;
|
||||
dst += DouonBlkSizeNumber;
|
||||
|
||||
sdst = dst; dst += DouonBlkSizeNumber;
|
||||
|
||||
|
||||
p = drec -> yptr;
|
||||
slen = strlen(p) - drec -> dlen;
|
||||
p += slen;
|
||||
for (i = drec -> dlen ; i > 0 ; i--) {
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p); p++;
|
||||
}
|
||||
|
||||
for (hrec = drec->hrec ; hrec ; hrec = hrec->hnext) {
|
||||
|
||||
datset(hrec->hinshi);
|
||||
|
||||
datset(hrec -> hinsi);
|
||||
|
||||
|
||||
for (krec = hrec->krec ; krec ; krec = krec->knext) {
|
||||
|
||||
|
||||
p = q = knjcvt(krec -> kptr, krec -> klen, &i);
|
||||
|
||||
|
||||
set_ofsrec(krec->kptr, krec->klen, dst - buf);
|
||||
|
||||
|
||||
while (i-- > 0) {
|
||||
datset(*p);
|
||||
p++;
|
||||
datset(*p); p++;
|
||||
}
|
||||
datset(KanjiStrEnd);
|
||||
|
||||
Free(q);
|
||||
}
|
||||
|
||||
datset(HinshiBlkTerm);
|
||||
|
||||
datset(HinsiBlkTerm);
|
||||
}
|
||||
|
||||
|
||||
i = dst - sdst;
|
||||
*sdst = ((i >> 8) & 0x0f);
|
||||
*(sdst + 1) = (i & 0xff);
|
||||
|
||||
|
||||
if (drec -> dlen > 0x0f) *sdst |= 0x40;
|
||||
*(sdst + 2) = (drec -> dlen & 0x0f);
|
||||
|
||||
|
||||
if (slen > 0x0f) *sdst |= 0x80;
|
||||
*(sdst + 2) |= ((slen << 4) & 0xf0);
|
||||
}
|
||||
|
|
@ -277,10 +304,12 @@ void makeseg(void) {
|
|||
datset(DouonBlkTerm);
|
||||
}
|
||||
|
||||
|
||||
for (p = douon_ptr -> yptr ; ; ) {
|
||||
if (idxpos < MainIndexLength) {
|
||||
segindex[idxpos++] = *p;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "\245\244\245\363\245\307\245\303\245\257\245\271\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -288,17 +317,21 @@ void makeseg(void) {
|
|||
}
|
||||
if (idxpos < MainIndexLength) {
|
||||
segindex[idxpos] = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "\245\244\245\363\245\307\245\303\245\257\245\271\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
i = dst - buf;
|
||||
|
||||
while (dst < buf + sizeof(buf)) *dst++ = DouonBlkTerm;
|
||||
|
||||
|
||||
if (Fseek(outfp,
|
||||
(long)(HeaderLength + CommentLength + MainIndexLength + idxnum * MainSegmentLength),
|
||||
(long)(HeaderLength + CommentLength + MainIndexLength
|
||||
+ idxnum * MainSegmentLength),
|
||||
0) < 0) {
|
||||
fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\267\241\274\245\257\245\250\245\351\241\274\n");
|
||||
exit(1);
|
||||
|
|
@ -309,6 +342,7 @@ void makeseg(void) {
|
|||
}
|
||||
Fflush(outfp);
|
||||
|
||||
|
||||
printf("\245\273\245\260\245\341\245\363\245\310\310\326\271\346:%d:", idxnum++);
|
||||
output_yomi(stdout, douon_ptr -> yptr);
|
||||
printf("\t\245\273\245\260\245\341\245\363\245\310\304\271:%d", i);
|
||||
|
|
@ -341,18 +375,18 @@ err:
|
|||
}
|
||||
|
||||
static void
|
||||
put4byte(unsigned char* p, size_t n) {
|
||||
put4byte(unsigned char* p, size_t n)
|
||||
{
|
||||
p += 3;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n;
|
||||
n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p-- = n; n >>= 8;
|
||||
*p = n;
|
||||
}
|
||||
|
||||
void makehead(unsigned char* dict_name) {
|
||||
void
|
||||
makehead(unsigned char* dict_name)
|
||||
{
|
||||
unsigned char header[HeaderLength + CommentLength];
|
||||
long i;
|
||||
unsigned char *p;
|
||||
|
|
@ -366,10 +400,7 @@ void makehead(unsigned char* dict_name) {
|
|||
p = header + CommentPos;
|
||||
sprintf((char *)p, "%s : %s", dict_name, ctime(&curtime));
|
||||
while (*p) {
|
||||
if(*p == '\n') {
|
||||
*p = 0;
|
||||
break;
|
||||
}
|
||||
if (*p == '\n') { *p = 0; break; }
|
||||
p++;
|
||||
}
|
||||
|
||||
|
|
|
|||
21
memory.c
21
memory.c
|
|
@ -27,13 +27,24 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: memory.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:42 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "dicttool.h"
|
||||
|
||||
void* Malloc(size_t size) {
|
||||
void*
|
||||
Malloc(size_t size)
|
||||
{
|
||||
void* p;
|
||||
|
||||
p = malloc(size);
|
||||
|
|
@ -44,7 +55,9 @@ void* Malloc(size_t size) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void* Zalloc(size_t size) {
|
||||
void*
|
||||
Zalloc (size_t size)
|
||||
{
|
||||
void* p;
|
||||
|
||||
p = Malloc(size);
|
||||
|
|
@ -52,6 +65,8 @@ void* Zalloc(size_t size) {
|
|||
return p;
|
||||
}
|
||||
|
||||
void Free(void* p) {
|
||||
void
|
||||
Free(void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
|
|
|||
18
memory2.c
18
memory2.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: memory.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:01:58 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
|
||||
void free_jrec(), free_clrec();
|
||||
|
|
@ -82,9 +90,11 @@ int l;
|
|||
if (cp) {
|
||||
p -> clsort = cpk;
|
||||
cpk = p;
|
||||
} else
|
||||
}
|
||||
else
|
||||
cpk = cp = p;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (cp)
|
||||
cp -> clsort = p;
|
||||
else
|
||||
|
|
@ -130,10 +140,12 @@ void free_jall(p)
|
|||
}
|
||||
}
|
||||
|
||||
void freework() {
|
||||
void freework()
|
||||
{
|
||||
free_clall(maxclptr);
|
||||
clt1st = maxclptr = NULL;
|
||||
|
||||
free_jall(maxjptr);
|
||||
jrt1st = maxjptr = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
18
mk2claus.c
18
mk2claus.c
|
|
@ -27,11 +27,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mk2claus.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:00 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_right.h"
|
||||
|
||||
int terminate(), priority();
|
||||
void mkjiritsu(), mkbunsetsu(), wakachi(), pritiny();
|
||||
void mkjiritu(), mkbunsetu(), wakachi(), pritiny();
|
||||
void free_clall(), free_jall();
|
||||
|
||||
static int set2nd(clrec)
|
||||
|
|
@ -40,9 +48,9 @@ CLREC* clrec;
|
|||
|
||||
CLREC *rec2;
|
||||
|
||||
mkjiritsu(DO_IKKATU | DO_CLSTUDY);
|
||||
mkjiritu(DO_IKKATU | DO_CLSTUDY);
|
||||
|
||||
mkbunsetsu();
|
||||
mkbunsetu();
|
||||
|
||||
if (!maxclptr) {
|
||||
wakachi();
|
||||
|
|
@ -57,7 +65,8 @@ CLREC* clrec;
|
|||
return rec2 ? (clrec -> cllen + rec2 -> cllen) : (clrec -> cllen);
|
||||
}
|
||||
|
||||
void mk2claus() {
|
||||
void mk2claus()
|
||||
{
|
||||
unsigned char *keepptr;
|
||||
int keeplen;
|
||||
CLREC *clrec;
|
||||
|
|
@ -151,3 +160,4 @@ void mk2claus() {
|
|||
cnvstart = keepptr;
|
||||
cnvlen = keeplen;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,18 +27,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mkbunset.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:02 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinshi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
int terminate();
|
||||
void setclrec(), srchfzk();
|
||||
|
||||
void mkbunsetsu(void) {
|
||||
void
|
||||
mkbunsetu(void)
|
||||
{
|
||||
JREC *jrec;
|
||||
TypeGram hinshi;
|
||||
TypeGram hinsi;
|
||||
unsigned char *cnj;
|
||||
CREC crec[4];
|
||||
int count;
|
||||
|
|
@ -54,12 +65,12 @@ void mkbunsetsu(void) {
|
|||
|
||||
while (jrec) {
|
||||
|
||||
if(jrec->stbofs && (cnj = getstb(jrec->hinshi)))
|
||||
hinshi = StbHinshi(cnj + jrec->stbofs - 1);
|
||||
if (jrec -> stbofs && (cnj = getstb(jrec -> hinsi)))
|
||||
hinsi = StbHinsi(cnj + jrec -> stbofs - 1);
|
||||
else
|
||||
hinshi = jrec->hinshi;
|
||||
hinsi = jrec -> hinsi;
|
||||
|
||||
if((right = Connadr[hinshi]) != '\0') {
|
||||
if ((right = Connadr[hinsi]) != '\0') {
|
||||
gobilen = 0;
|
||||
next = cnvstart + jrec->jlen;
|
||||
|
||||
|
|
@ -71,7 +82,7 @@ void mkbunsetsu(void) {
|
|||
srchfzk(jrec, next, right, 0);
|
||||
}
|
||||
|
||||
else if((count = setconj(hinshi, jrec, crec)) != 0) {
|
||||
else if ((count = setconj(hinsi, jrec, crec)) != 0) {
|
||||
|
||||
for (i = count ; i-- > 0 ; ) {
|
||||
|
||||
|
|
@ -92,8 +103,10 @@ void mkbunsetsu(void) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
CLREC*
|
||||
argclrec(int len) {
|
||||
argclrec(int len)
|
||||
{
|
||||
CLREC *ptr;
|
||||
CLREC *rec;
|
||||
CLREC *child;
|
||||
|
|
@ -131,7 +144,7 @@ argclrec(int len) {
|
|||
|
||||
if (((int)ptr -> cllen < len) ||
|
||||
(((int)ptr -> cllen == len) &&
|
||||
(ptr->jnode->hinshi == TANKANJI))) {
|
||||
(ptr -> jnode -> hinsi == TANKANJI))) {
|
||||
rec -> clsort = maxclptr;
|
||||
maxclptr = rec;
|
||||
return rec;
|
||||
|
|
@ -140,14 +153,16 @@ argclrec(int len) {
|
|||
while ((child = ptr -> clsort) != NULL) {
|
||||
if ((int)child -> cllen < len ||
|
||||
((int)child -> cllen == len &&
|
||||
child->jnode->hinshi == TANKANJI)) {
|
||||
child->jnode->hinsi == TANKANJI)){
|
||||
ptr -> clsort = rec;
|
||||
rec -> clsort = child;
|
||||
return rec;
|
||||
} else
|
||||
}
|
||||
else
|
||||
ptr = child;
|
||||
}
|
||||
|
||||
ptr -> clsort = rec;
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mkjiritu.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:03 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
|
|
@ -37,7 +46,9 @@ int srchhead();
|
|||
static void dic_mu(int mode);
|
||||
static void dic_cl(void);
|
||||
|
||||
void mkjiritsu(int mode) {
|
||||
void
|
||||
mkjiritu(int mode)
|
||||
{
|
||||
unsigned char chkind1;
|
||||
unsigned char chkind2;
|
||||
JREC *jrec;
|
||||
|
|
@ -76,13 +87,14 @@ void mkjiritsu(int mode) {
|
|||
}
|
||||
|
||||
for (jrec = maxjptr ; jrec ; jrec = jrec -> jsort) {
|
||||
if((stb = getstb(jrec->hinshi)) != NULL)
|
||||
setsubi(jrec, stb);
|
||||
if ((stb = getstb(jrec -> hinsi)) != NULL)
|
||||
setubi(jrec, stb);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dic_mu(int mode) {
|
||||
dic_mu(int mode)
|
||||
{
|
||||
unsigned char *tagp;
|
||||
DICTL *dp;
|
||||
|
||||
|
|
@ -96,7 +108,9 @@ dic_mu(int mode) {
|
|||
}
|
||||
}
|
||||
|
||||
JREC* argjrec(int len, JREC* rec) {
|
||||
JREC*
|
||||
argjrec(int len, JREC* rec)
|
||||
{
|
||||
JREC *ptr;
|
||||
JREC *jrec;
|
||||
JREC *child;
|
||||
|
|
@ -153,7 +167,8 @@ JREC* argjrec(int len, JREC* rec) {
|
|||
}
|
||||
|
||||
static void
|
||||
dic_cl(void) {
|
||||
dic_cl(void)
|
||||
{
|
||||
unsigned char *p;
|
||||
unsigned short pos;
|
||||
int len;
|
||||
|
|
@ -178,3 +193,4 @@ dic_cl(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
171
mkkouho.c
171
mkkouho.c
|
|
@ -27,37 +27,56 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mkkouho.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:04 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_euc.h"
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinshi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_suuji.h"
|
||||
#include "sj_dict.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static void getkhtbl(CLREC* clrec);
|
||||
static void cl_kanji(JREC* jrec, CLREC* clrec);
|
||||
static unsigned char* makekan(unsigned char* s, unsigned char* d, int flg);
|
||||
static int diffknj(JREC* jrec, unsigned char* ptr, int num);
|
||||
static void cl_numcmn(JREC* jrec, CLREC* clrec);
|
||||
|
||||
void mkkouho(void) {
|
||||
|
||||
void
|
||||
mkkouho(void)
|
||||
{
|
||||
CLREC *clrec;
|
||||
int keeplen;
|
||||
|
||||
|
||||
khcount = nkhcount = 0;
|
||||
|
||||
|
||||
keeplen = clt1st -> cllen;
|
||||
|
||||
|
||||
clrec = clt1st;
|
||||
|
||||
|
||||
do {
|
||||
getkhtbl(clrec);
|
||||
clrec = clrec -> clsort;
|
||||
} while (clrec && (keeplen == clrec -> cllen));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
getkhtbl(CLREC* clrec) {
|
||||
getkhtbl(CLREC* clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
|
||||
jrec = clrec -> jnode;
|
||||
|
|
@ -80,7 +99,7 @@ getkhtbl(CLREC* clrec) {
|
|||
cl_numcmn(jrec, clrec);
|
||||
break;
|
||||
|
||||
case C_BUNSETSU:
|
||||
case C_BUNSETU:
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -91,63 +110,80 @@ getkhtbl(CLREC* clrec) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cl_kanji(JREC* jrec, CLREC* clrec) {
|
||||
cl_kanji(JREC* jrec, CLREC* clrec)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
int kcount = khcount;
|
||||
|
||||
|
||||
if (seldict(jrec -> dicid)) {
|
||||
(*curdict->getdic)(curdict, jrec -> jseg);
|
||||
ptr = dicbuf + jrec->jofsst + 1;
|
||||
|
||||
get_askknj();
|
||||
|
||||
while(*ptr != HinshiBlkTerm) {
|
||||
|
||||
while (*ptr != HinsiBlkTerm) {
|
||||
|
||||
|
||||
if (diffknj(jrec, ptr, kcount)) {
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)(ptr - dicbuf), 0);
|
||||
}
|
||||
|
||||
|
||||
ptr = skipkstr(ptr);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
makekan_none(unsigned char* s, unsigned char* d, int flg) {
|
||||
makekan_none(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
makekan_1byte(unsigned char* s, unsigned char* d, int flg) {
|
||||
if((*s & KanjiModeMask) == ZenHiraAsshuku)
|
||||
*d++ = 0x10 | (*s & KnjAsshukuMask);
|
||||
makekan_1byte(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
if ((*s & KanjiModeMask) == ZenHiraAssyuku)
|
||||
*d++ = 0x10 | (*s & KnjAssyukuMask);
|
||||
else
|
||||
*d++ = 0x90 | (*s & KnjAsshukuMask);
|
||||
*d++ = 0x90 | (*s & KnjAssyukuMask);
|
||||
|
||||
if (flg) *d++ = KanjiStrEnd;
|
||||
return d;
|
||||
}
|
||||
|
||||
unsigned char*
|
||||
makekan_knj(unsigned char* s, unsigned char* d, int flg) {
|
||||
|
||||
return makekan(askknj[*s & KnjAsshukuMask], d, flg);
|
||||
unsigned char*
|
||||
makekan_knj(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
|
||||
return makekan(askknj[*s & KnjAssyukuMask], d, flg);
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
makekan_ofs(unsigned char* s, unsigned char* d, int flg) {
|
||||
makekan_ofs(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
|
||||
return makekan(dicbuf + ((*s & KanjiCodeMask) << 8) + *(s + 1),
|
||||
d, flg);
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
makekan_norm(unsigned char* s, unsigned char* d, int flg) {
|
||||
makekan_norm(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
if (*s != 0) {
|
||||
|
|
@ -164,8 +200,10 @@ makekan_norm(unsigned char* s, unsigned char* d, int flg) {
|
|||
return d;
|
||||
}
|
||||
|
||||
|
||||
unsigned char*
|
||||
makekan_ascii(unsigned char* s, unsigned char* d, int flg) {
|
||||
makekan_ascii(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
c = s[1];
|
||||
|
|
@ -178,67 +216,58 @@ makekan_ascii(unsigned char* s, unsigned char* d, int flg) {
|
|||
return d;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char*
|
||||
makekan(unsigned char* s, unsigned char* d, int flg) {
|
||||
makekan(unsigned char* s, unsigned char* d, int flg)
|
||||
{
|
||||
int csize;
|
||||
|
||||
for ( ; ; ) {
|
||||
csize = codesize(*s);
|
||||
if (s[csize] == KanjiStrEnd) {
|
||||
switch(*s & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
d = makekan_1byte(s, d, flg);
|
||||
break;
|
||||
case ZenHiraAssyuku:
|
||||
d = makekan_1byte(s, d, flg); break;
|
||||
|
||||
case ZenKataAsshuku:
|
||||
d = makekan_1byte(s, d, flg);
|
||||
break;
|
||||
case ZenKataAssyuku:
|
||||
d = makekan_1byte(s, d, flg); break;
|
||||
|
||||
case OffsetAsshuku:
|
||||
d = makekan_ofs(s, d, flg);
|
||||
break;
|
||||
case OffsetAssyuku:
|
||||
d = makekan_ofs(s, d, flg); break;
|
||||
|
||||
case AiAttribute:
|
||||
d = makekan_none(s, d, flg);
|
||||
break;
|
||||
d = makekan_none(s, d, flg); break;
|
||||
|
||||
case LeadingHankaku:
|
||||
d = makekan_ascii(s, d, flg);
|
||||
break;
|
||||
d = makekan_ascii(s, d, flg); break;
|
||||
|
||||
case KanjiAsshuku:
|
||||
d = makekan_knj(s, d, flg);
|
||||
break;
|
||||
case KanjiAssyuku:
|
||||
d = makekan_knj(s, d, flg); break;
|
||||
|
||||
default:
|
||||
d = makekan_norm(s, d, flg);
|
||||
}
|
||||
break;
|
||||
} else
|
||||
}
|
||||
else
|
||||
switch(*s & KanjiModeMask) {
|
||||
case ZenHiraAsshuku:
|
||||
d = makekan_1byte(s, d, FALSE);
|
||||
break;
|
||||
case ZenHiraAssyuku:
|
||||
d = makekan_1byte(s, d, FALSE); break;
|
||||
|
||||
case ZenKataAsshuku:
|
||||
d = makekan_1byte(s, d, FALSE);
|
||||
break;
|
||||
case ZenKataAssyuku:
|
||||
d = makekan_1byte(s, d, FALSE); break;
|
||||
|
||||
case OffsetAsshuku:
|
||||
d = makekan_ofs(s, d, FALSE);
|
||||
break;
|
||||
case OffsetAssyuku:
|
||||
d = makekan_ofs(s, d, FALSE); break;
|
||||
|
||||
case AiAttribute:
|
||||
d = makekan_none(s, d, FALSE);
|
||||
break;
|
||||
d = makekan_none(s, d, FALSE); break;
|
||||
|
||||
case LeadingHankaku:
|
||||
d = makekan_ascii(s, d, FALSE);
|
||||
break;
|
||||
d = makekan_ascii(s, d, FALSE); break;
|
||||
|
||||
case KanjiAsshuku:
|
||||
d = makekan_knj(s, d, FALSE);
|
||||
break;
|
||||
case KanjiAssyuku:
|
||||
d = makekan_knj(s, d, FALSE); break;
|
||||
|
||||
default:
|
||||
d = makekan_norm(s, d, FALSE);
|
||||
|
|
@ -250,10 +279,12 @@ makekan(unsigned char* s, unsigned char* d, int flg) {
|
|||
return d;
|
||||
}
|
||||
|
||||
|
||||
#define PEND 2
|
||||
#define QEND 1
|
||||
static int
|
||||
sameknj(unsigned char* p, int plen, unsigned char* q, int qlen) {
|
||||
sameknj(unsigned char* p, int plen, unsigned char* q, int qlen)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int endf = 0;
|
||||
|
|
@ -310,15 +341,17 @@ sameknj(unsigned char* p, int plen, unsigned char* q, int qlen) {
|
|||
#undef PEND
|
||||
#undef QEND
|
||||
|
||||
|
||||
static int
|
||||
diffknj(JREC* jrec, unsigned char* ptr, int num) {
|
||||
diffknj(JREC* jrec, unsigned char* ptr, int num)
|
||||
{
|
||||
KHREC *kptr;
|
||||
JREC *jptr;
|
||||
int i;
|
||||
unsigned char kbuf1[MaxWdKanjiLen];
|
||||
unsigned char kbuf2[MaxWdKanjiLen];
|
||||
|
||||
if(jrec->hinshi == TANKANJI) return TRUE;
|
||||
if (jrec -> hinsi == TANKANJI) return TRUE;
|
||||
|
||||
makekan(ptr, kbuf1, TRUE);
|
||||
|
||||
|
|
@ -326,7 +359,7 @@ diffknj(JREC* jrec, unsigned char* ptr, int num) {
|
|||
if ((jptr = kptr -> clrec -> jnode) == jrec)
|
||||
return FALSE;
|
||||
|
||||
if(jptr->hinshi == TANKANJI) continue;
|
||||
if (jptr -> hinsi == TANKANJI) continue;
|
||||
|
||||
if (jptr -> class != jrec -> class) continue;
|
||||
|
||||
|
|
@ -347,8 +380,10 @@ diffknj(JREC* jrec, unsigned char* ptr, int num) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
chrck_numtbl(unsigned short flg, unsigned short cond) {
|
||||
chrck_numtbl(unsigned short flg, unsigned short cond)
|
||||
{
|
||||
unsigned short must;
|
||||
|
||||
if ((cond = SelNumCond(cond)) != 0) {
|
||||
|
|
@ -362,7 +397,10 @@ chrck_numtbl(unsigned short flg, unsigned short cond) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
int sel_sjmode(JREC* jrec) {
|
||||
|
||||
int
|
||||
sel_sjmode(JREC* jrec)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned short *p;
|
||||
unsigned short *q;
|
||||
|
|
@ -385,6 +423,7 @@ int sel_sjmode(JREC* jrec) {
|
|||
return SelArb;
|
||||
}
|
||||
|
||||
|
||||
while ((i = *p++) != SelNumTerm) {
|
||||
|
||||
if (chrck_numtbl(jrec -> flags, i)) break;
|
||||
|
|
@ -395,35 +434,44 @@ int sel_sjmode(JREC* jrec) {
|
|||
return SelNumFunc(i);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cl_numcmn(JREC* jrec, CLREC* clrec) {
|
||||
cl_numcmn(JREC* jrec, CLREC* clrec)
|
||||
{
|
||||
unsigned char *p;
|
||||
int i;
|
||||
unsigned short j;
|
||||
unsigned short *tbl;
|
||||
|
||||
|
||||
p = cnvstart;
|
||||
if ((i = jrec -> sttofs) == SETTOU_DAI)
|
||||
p += SttYomiLen(Settou_ptr(i));
|
||||
else if (i == SETTOU_KIGOU)
|
||||
p++;
|
||||
|
||||
|
||||
if (jrec -> jofsst) {
|
||||
|
||||
i = sel_sjmode(jrec);
|
||||
|
||||
|
||||
if (seldict(jrec -> dicid)) {
|
||||
(*curdict->getdic)(curdict, jrec -> jseg);
|
||||
|
||||
|
||||
p = dicbuf + jrec->jofsst + 1;
|
||||
|
||||
while(*p != HinshiBlkTerm) {
|
||||
|
||||
while (*p != HinsiBlkTerm) {
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)(p - dicbuf), i);
|
||||
|
||||
|
||||
p = skipkstr(p);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)1, i);
|
||||
}
|
||||
|
|
@ -436,6 +484,7 @@ cl_numcmn(JREC* jrec, CLREC* clrec) {
|
|||
|
||||
if (!chrck_numtbl(jrec -> flags, j)) continue;
|
||||
|
||||
|
||||
setkouho(clrec, (TypeDicOfs)0, (int)SelNumFunc(j));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
142
mknumber.c
142
mknumber.c
|
|
@ -27,14 +27,25 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mknumber.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:05 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "sj_suuji.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
static int
|
||||
word2char(unsigned short wd, unsigned char* tbl, int keta, int flg) {
|
||||
word2char(unsigned short wd, unsigned char* tbl, int keta, int flg)
|
||||
{
|
||||
int mask;
|
||||
int num;
|
||||
unsigned char* src;
|
||||
|
|
@ -63,14 +74,17 @@ word2char(unsigned short wd, unsigned char* tbl, int keta, int flg) {
|
|||
}
|
||||
if (keta) keta--;
|
||||
|
||||
|
||||
wd &= (mask - 1);
|
||||
}
|
||||
|
||||
return flg;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
words2num(unsigned short* wd, unsigned char* tbl, int flgc) {
|
||||
words2num(unsigned short* wd, unsigned char* tbl, int flgc)
|
||||
{
|
||||
int i;
|
||||
int keta;
|
||||
int flg;
|
||||
|
|
@ -79,7 +93,8 @@ words2num(unsigned short* wd, unsigned char* tbl, int flgc) {
|
|||
if (flgc) {
|
||||
keta = NumKetaLength - 1;
|
||||
flg = FALSE;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
keta = 0;
|
||||
flg = TRUE;
|
||||
}
|
||||
|
|
@ -89,6 +104,7 @@ words2num(unsigned short* wd, unsigned char* tbl, int flgc) {
|
|||
if (keta) keta -= 4;
|
||||
}
|
||||
|
||||
|
||||
if (kp == kanjitmp) {
|
||||
|
||||
*kanjitmp++ = *tbl++;
|
||||
|
|
@ -96,72 +112,114 @@ words2num(unsigned short* wd, unsigned char* tbl, int flgc) {
|
|||
}
|
||||
}
|
||||
|
||||
void num_type00(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type00(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, FALSE);
|
||||
}
|
||||
|
||||
void num_type01(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type01(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, FALSE);
|
||||
}
|
||||
|
||||
void num_type02(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type02(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num1tbl, TRUE);
|
||||
}
|
||||
|
||||
void num_type03(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type03(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, FALSE);
|
||||
}
|
||||
|
||||
void num_type04(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type04(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, FALSE);
|
||||
}
|
||||
|
||||
void num_type05(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type05(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num2tbl, TRUE);
|
||||
}
|
||||
|
||||
void num_type06(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type06(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num3tbl, FALSE);
|
||||
}
|
||||
|
||||
void num_type07(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type07(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
words2num(num, Num3tbl, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
||||
kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2)
|
||||
{
|
||||
int ii;
|
||||
unsigned short tmp;
|
||||
int mask;
|
||||
|
|
@ -172,11 +230,13 @@ kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
|||
unsigned char* src;
|
||||
unsigned char* keep = kanjitmp;
|
||||
|
||||
|
||||
kurai2 = Num6tbl - 2;
|
||||
mask = 0;
|
||||
wd += NumWordBuf - 1;
|
||||
flg = FALSE;
|
||||
|
||||
|
||||
for (ii = NumKetaLength ; ii-- > 0 ; ) {
|
||||
|
||||
if (!mask) {
|
||||
|
|
@ -184,7 +244,8 @@ kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
|||
if (flg) {
|
||||
*kanjitmp++ = *kurai2++;
|
||||
*kanjitmp++ = *kurai2++;
|
||||
} else
|
||||
}
|
||||
else
|
||||
kurai2 += 2;
|
||||
|
||||
mask = 0x1000;
|
||||
|
|
@ -193,6 +254,7 @@ kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
|||
kurai1 = tbl2;
|
||||
}
|
||||
|
||||
|
||||
if ((num = (unsigned int)tmp / mask) > _Num0) {
|
||||
|
||||
if ((num != _Num1) || !*kurai1) {
|
||||
|
|
@ -201,6 +263,7 @@ kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
|||
*kanjitmp++ = *src;
|
||||
}
|
||||
|
||||
|
||||
if (*kurai1) {
|
||||
*kanjitmp++ = *kurai1++;
|
||||
*kanjitmp++ = *kurai1++;
|
||||
|
|
@ -211,35 +274,51 @@ kan_num(unsigned short* wd, unsigned char* tbl1, unsigned char* tbl2) {
|
|||
else
|
||||
kurai1 += 2;
|
||||
|
||||
|
||||
tmp &= (mask - 1);
|
||||
mask >>= 4;
|
||||
}
|
||||
|
||||
|
||||
if (kanjitmp == keep) {
|
||||
*kanjitmp++ = *tbl1++;
|
||||
*kanjitmp++ = *tbl1;
|
||||
}
|
||||
}
|
||||
|
||||
void num_type08(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type08(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
kan_num(num, Num2tbl, Num4tbl);
|
||||
}
|
||||
|
||||
void num_type09(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type09(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned short num[NumWordBuf];
|
||||
|
||||
|
||||
setwdnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
kan_num(num, Num3tbl, Num5tbl);
|
||||
}
|
||||
|
||||
void num_type10(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type10(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = jrec -> numlen ; i > 0 ; i--) {
|
||||
|
||||
if (Chrtbl[*s1++] & NUMBER) {
|
||||
|
|
@ -252,13 +331,18 @@ void num_type10(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
|||
}
|
||||
}
|
||||
|
||||
void num_type11(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type11(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
i = j = jrec -> numlen;
|
||||
if (!(Chrtbl[*(s1 + j - 4)] & NUMBER)) j -= (j - 1) / 4;
|
||||
|
||||
|
||||
for ( ; i > 0 ; i--) {
|
||||
|
||||
if (Chrtbl[*s1++] & NUMBER) {
|
||||
|
|
@ -277,10 +361,14 @@ void num_type11(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
|||
}
|
||||
}
|
||||
|
||||
void num_type12(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type12(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
for (i = jrec -> numlen ; i > 0 ; i--) {
|
||||
|
||||
if (Chrtbl[j = *s1++] & NUMBER) {
|
||||
|
|
@ -291,8 +379,10 @@ void num_type12(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
num_kurai(unsigned char* p, int len, unsigned char* tbl) {
|
||||
num_kurai(unsigned char* p, int len, unsigned char* tbl)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
unsigned char tmp;
|
||||
|
|
@ -313,20 +403,30 @@ num_kurai(unsigned char* p, int len, unsigned char* tbl) {
|
|||
}
|
||||
}
|
||||
|
||||
void num_type13(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type13(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned char num[NumKetaLength];
|
||||
int len;
|
||||
|
||||
|
||||
len = setucnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
num_kurai(num, len, Num1tbl);
|
||||
}
|
||||
|
||||
void num_type14(unsigned char* s1, unsigned char* s2, JREC* jrec) {
|
||||
|
||||
void
|
||||
num_type14(unsigned char* s1, unsigned char* s2, JREC* jrec)
|
||||
{
|
||||
unsigned char num[NumKetaLength];
|
||||
int len;
|
||||
|
||||
|
||||
len = setucnum(s1, (int)jrec -> numlen, num);
|
||||
|
||||
|
||||
num_kurai(num, len, Num2tbl);
|
||||
}
|
||||
|
|
|
|||
12
mvmemd.c
12
mvmemd.c
|
|
@ -27,12 +27,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mvmemd.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:05 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
void mvmemd(src, dest, len) unsigned char* src;
|
||||
void mvmemd(src, dest, len)
|
||||
unsigned char *src;
|
||||
unsigned char *dest;
|
||||
int len;
|
||||
{
|
||||
while (len-- > 0) *(--dest) = *(--src);
|
||||
}
|
||||
|
||||
|
|
|
|||
12
mvmemi.c
12
mvmemi.c
|
|
@ -27,12 +27,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: mvmemi.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:06 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
void mvmemi(src, dest, len) unsigned char* src;
|
||||
void mvmemi(src, dest, len)
|
||||
unsigned char *src;
|
||||
unsigned char *dest;
|
||||
int len;
|
||||
{
|
||||
while (len-- > 0) *dest++ = *src++;
|
||||
}
|
||||
|
||||
|
|
|
|||
20
nmttyslot.c
20
nmttyslot.c
|
|
@ -27,18 +27,32 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: nmttyslot.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:20 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj2.h"
|
||||
#define LINESIZE 128
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
|
||||
static char *getttys();
|
||||
static char *ttys = "/etc/ttys";
|
||||
|
||||
#define NULL 0
|
||||
|
||||
nmttyslot(name) char* name;
|
||||
nmttyslot (name)
|
||||
char *name;
|
||||
{
|
||||
char *tp, *p;
|
||||
int s, tf;
|
||||
|
|
@ -76,7 +90,8 @@ top:
|
|||
if (*lp == '\n') {
|
||||
*lp = '\0';
|
||||
break;
|
||||
} else if(*lp == ' ' || *lp == '\t') {
|
||||
}
|
||||
else if (*lp == ' ' || *lp == '\t') {
|
||||
|
||||
while (1) {
|
||||
if (read (f, lp, 1) != 1)
|
||||
|
|
@ -95,3 +110,4 @@ top:
|
|||
goto top;
|
||||
return (lp);
|
||||
}
|
||||
|
||||
|
|
|
|||
55
offset.c
55
offset.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: offset.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1994/08/17 01:50:26 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -37,16 +46,22 @@
|
|||
extern OffsetRec *ofsrec[];
|
||||
extern int ofsrec_num;
|
||||
|
||||
|
||||
|
||||
static OffsetRec*
|
||||
makeoffset(unsigned char* ptr, int len, int ofs) {
|
||||
makeoffset(unsigned char* ptr, int len, int ofs)
|
||||
{
|
||||
OffsetRec *orec;
|
||||
unsigned char *p;
|
||||
|
||||
|
||||
orec = (OffsetRec *)Malloc(sizeof(OffsetRec));
|
||||
|
||||
|
||||
p = (unsigned char *)Malloc(len);
|
||||
memcpy(p, ptr, len);
|
||||
|
||||
|
||||
orec -> kptr = p;
|
||||
orec -> klen = len;
|
||||
if (ofs)
|
||||
|
|
@ -57,11 +72,15 @@ makeoffset(unsigned char* ptr, int len, int ofs) {
|
|||
return orec;
|
||||
}
|
||||
|
||||
void set_ofsrec(unsigned char* ptr, int len, int ofs) {
|
||||
|
||||
void
|
||||
set_ofsrec(unsigned char* ptr, int len, int ofs)
|
||||
{
|
||||
OffsetRec *orec;
|
||||
int low, high, mid;
|
||||
int i;
|
||||
|
||||
|
||||
if (ofsrec_num <= 0) {
|
||||
orec = makeoffset(ptr, len, ofs);
|
||||
ofsrec[0]= orec;
|
||||
|
|
@ -70,8 +89,8 @@ void set_ofsrec(unsigned char* ptr, int len, int ofs) {
|
|||
return;
|
||||
}
|
||||
|
||||
low = 0;
|
||||
high = ofsrec_num - 1;
|
||||
|
||||
low = 0; high = ofsrec_num - 1;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, ptr, len);
|
||||
|
|
@ -83,28 +102,35 @@ void set_ofsrec(unsigned char* ptr, int len, int ofs) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if (i) {
|
||||
if (ofsrec_num >= MaxOffsetNumber) {
|
||||
fprintf(stderr, "\245\252\245\325\245\273\245\303\245\310\241\246\245\306\241\274\245\326\245\353\244\254\244\242\244\325\244\354\244\336\244\267\244\277\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
orec = makeoffset(ptr, len, ofs);
|
||||
|
||||
|
||||
for (i = ofsrec_num ; i > mid ; i--) ofsrec[i] = ofsrec[i - 1];
|
||||
ofsrec[mid] = orec;
|
||||
ofsrec_num++;
|
||||
}
|
||||
}
|
||||
|
||||
int isknjexist(unsigned char* knj, int len) {
|
||||
|
||||
int
|
||||
isknjexist(unsigned char* knj, int len)
|
||||
{
|
||||
int low, high, mid;
|
||||
int i;
|
||||
|
||||
|
||||
if (ofsrec_num <= 0) return 0;
|
||||
|
||||
low = 0;
|
||||
high = ofsrec_num - 1;
|
||||
|
||||
low = 0; high = ofsrec_num - 1;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
i = string_cmp(ofsrec[mid]->kptr, ofsrec[mid]->klen, knj, len);
|
||||
|
|
@ -119,7 +145,10 @@ int isknjexist(unsigned char* knj, int len) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void clear_ofsrec(void) {
|
||||
|
||||
void
|
||||
clear_ofsrec(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < ofsrec_num ; i++) {
|
||||
|
|
@ -130,20 +159,26 @@ void clear_ofsrec(void) {
|
|||
ofsrec_num = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OffsetRec*
|
||||
real_ofsrec(unsigned char* ptr) {
|
||||
real_ofsrec(unsigned char* ptr)
|
||||
{
|
||||
int ofs;
|
||||
int i;
|
||||
OffsetRec **p;
|
||||
|
||||
ofs = (*ptr++ & KnjAsshukuMask);
|
||||
|
||||
ofs = (*ptr++ & KnjAssyukuMask);
|
||||
ofs <<= 8;
|
||||
ofs += *ptr;
|
||||
|
||||
|
||||
for (i = ofsrec_num, p = ofsrec ; i-- > 0 ; p++)
|
||||
if ((*p) -> offset == ofs)
|
||||
return *p;
|
||||
|
||||
|
||||
fprintf(stderr, "real_ofsrec() \244\307\260\333\276\357\244\312\276\365\302\326 %x\n", ofs);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
|||
135
peepdic.c
135
peepdic.c
|
|
@ -27,25 +27,39 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: peepdic.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1995/07/21 05:22:51 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
unsigned char *skiphblk();
|
||||
|
||||
static void add_yomi (void);
|
||||
static void cd2sjh_chr (unsigned char ch, unsigned char *dst);
|
||||
static int next_douon (void);
|
||||
static int next_hinshi(void);
|
||||
static int next_hinsi (void);
|
||||
static int next_kanji (void);
|
||||
static int prev_douon (void);
|
||||
static int prev_hinshi(void);
|
||||
static int prev_hinsi (void);
|
||||
static int prev_kanji (void);
|
||||
static void set_buf (unsigned char *buf);
|
||||
static void set_idxyomi (void);
|
||||
static void set_kanji (void);
|
||||
|
||||
int getusr(unsigned char* buf) {
|
||||
|
||||
|
||||
int
|
||||
getusr (unsigned char *buf)
|
||||
{
|
||||
int nlen;
|
||||
|
||||
peepyomi[0] = peepknj[0] = peepgrm = 0;
|
||||
|
|
@ -73,7 +87,11 @@ int getusr(unsigned char* buf) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int nextusr(unsigned char* buf) {
|
||||
|
||||
|
||||
int
|
||||
nextusr (unsigned char *buf)
|
||||
{
|
||||
(*curdict->getdic)(curdict, peepidx);
|
||||
get_askknj();
|
||||
|
||||
|
|
@ -86,7 +104,11 @@ int nextusr(unsigned char* buf) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int prevusr(unsigned char* buf) {
|
||||
|
||||
|
||||
int
|
||||
prevusr (unsigned char *buf)
|
||||
{
|
||||
(*curdict->getdic)(curdict, peepidx);
|
||||
get_askknj();
|
||||
|
||||
|
|
@ -99,8 +121,11 @@ int prevusr(unsigned char* buf) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_kanji(void) {
|
||||
set_kanji (void)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = getkanji(peepyomi, getnlen(peepdptr) + getplen(peepdptr),
|
||||
|
|
@ -108,8 +133,11 @@ set_kanji(void) {
|
|||
*(peepknj + len) = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_buf(unsigned char* buf) {
|
||||
set_buf (unsigned char *buf)
|
||||
{
|
||||
unsigned char *p;
|
||||
int i, csize;
|
||||
|
||||
|
|
@ -126,13 +154,16 @@ set_buf(unsigned char* buf) {
|
|||
*buf++ = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
prev_kanji(void) {
|
||||
prev_kanji (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
unsigned char *p2;
|
||||
|
||||
p1 = peephptr + 1;
|
||||
if(peepkptr <= p1) return prev_hinshi();
|
||||
if (peepkptr <= p1) return prev_hinsi();
|
||||
|
||||
p2 = peepkptr;
|
||||
while (p1 < p2) {
|
||||
|
|
@ -143,8 +174,11 @@ prev_kanji(void) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
prev_hinshi(void) {
|
||||
prev_hinsi (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
unsigned char *p2;
|
||||
int nlen;
|
||||
|
|
@ -163,7 +197,7 @@ prev_hinshi(void) {
|
|||
peepgrm = *peephptr;
|
||||
|
||||
p1 = peephptr + 1;
|
||||
while(*p1 != HinshiBlkTerm) {
|
||||
while (*p1 != HinsiBlkTerm) {
|
||||
peepkptr = p1;
|
||||
p1 = skipkstr(p1);
|
||||
}
|
||||
|
|
@ -171,8 +205,11 @@ prev_hinshi(void) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
prev_douon(void) {
|
||||
prev_douon (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
unsigned char *p2;
|
||||
int nlen;
|
||||
|
|
@ -191,7 +228,8 @@ prev_douon(void) {
|
|||
add_yomi();
|
||||
p1 = getntag(p1);
|
||||
} while (!segend(p1));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
set_idxyomi();
|
||||
|
||||
p1 = segtop();
|
||||
|
|
@ -218,23 +256,29 @@ prev_douon(void) {
|
|||
do {
|
||||
peepkptr = p1;
|
||||
p1 = skipkstr(p1);
|
||||
} while(*p1 != HinshiBlkTerm);
|
||||
} while (*p1 != HinsiBlkTerm);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
next_kanji(void) {
|
||||
next_kanji (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
|
||||
p1 = skipkstr(peepkptr);
|
||||
if(*p1 == HinshiBlkTerm) return next_hinshi();
|
||||
if (*p1 == HinsiBlkTerm) return next_hinsi();
|
||||
peepkptr = p1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
next_hinshi(void) {
|
||||
next_hinsi (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
|
||||
p1 = skiphblk(peephptr);
|
||||
|
|
@ -245,8 +289,11 @@ next_hinshi(void) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
next_douon(void) {
|
||||
next_douon (void)
|
||||
{
|
||||
unsigned char *p1;
|
||||
int nlen;
|
||||
|
||||
|
|
@ -259,9 +306,11 @@ next_douon(void) {
|
|||
peepdptr = segtop();
|
||||
|
||||
set_idxyomi();
|
||||
} else
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
peepdptr = p1;
|
||||
}
|
||||
|
||||
|
|
@ -277,8 +326,11 @@ next_douon(void) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_idxyomi(void) {
|
||||
set_idxyomi (void)
|
||||
{
|
||||
unsigned char *p1, *p2;
|
||||
|
||||
if ((p2 = get_idxptr(peepidx)) != NULL) {
|
||||
|
|
@ -291,8 +343,11 @@ set_idxyomi(void) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
add_yomi(void) {
|
||||
add_yomi (void)
|
||||
{
|
||||
int nlen;
|
||||
unsigned char *p1, *p2;
|
||||
|
||||
|
|
@ -308,36 +363,50 @@ add_yomi(void) {
|
|||
*p1 = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
cd2sjh_chr(unsigned char ch, unsigned char* dst) {
|
||||
cd2sjh_chr (unsigned char ch, unsigned char *dst)
|
||||
{
|
||||
if (ch == _TYOUON) {
|
||||
*dst++ = 0xa1;
|
||||
*dst++ = 0xbc;
|
||||
} else if(ch == _IGETA) {
|
||||
}
|
||||
else if (ch == _IGETA) {
|
||||
*dst++ = 0xa1;
|
||||
*dst++ = 0xf4;
|
||||
} else if(ch == _ATTO) {
|
||||
}
|
||||
else if (ch == _ATTO) {
|
||||
*dst++ = 0xa1;
|
||||
*dst++ = 0xf7;
|
||||
} else if(ch == _YUUBIN) {
|
||||
}
|
||||
else if (ch == _YUUBIN) {
|
||||
*dst++ = 0xa2;
|
||||
*dst++ = 0xa9;
|
||||
} else if(ch < N_0) {
|
||||
} else if(ch <= N_9) {
|
||||
}
|
||||
else if (ch < N_0) {
|
||||
}
|
||||
else if (ch <= N_9) {
|
||||
*dst++ = 0xa3;
|
||||
*dst++ = ch + 0xa0;
|
||||
} else if(ch <= A_Z) {
|
||||
}
|
||||
else if (ch <= A_Z) {
|
||||
*dst++ = 0xa3;
|
||||
*dst++ = ch + 0xa7;
|
||||
} else if(ch <= A_z) {
|
||||
}
|
||||
else if (ch <= A_z) {
|
||||
*dst++ = 0xa3;
|
||||
*dst++ = ch + 0xad;
|
||||
} else if(ch <= _NN) {
|
||||
}
|
||||
else if (ch <= _NN) {
|
||||
*dst++ = 0xa4;
|
||||
*dst++ = ch + 0x53;
|
||||
} else if(ch <= _XKE) {
|
||||
}
|
||||
else if (ch <= _XKE) {
|
||||
*dst++ = 0xa5;
|
||||
*dst++ = ch + 0x53;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
28
ph2knj.c
28
ph2knj.c
|
|
@ -27,11 +27,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: ph2knj.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:09 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_yomi.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
int sj2cd_chr();
|
||||
void mk2claus();
|
||||
void freework();
|
||||
|
|
@ -39,16 +49,17 @@ void selclrec();
|
|||
CLREC *free_clst();
|
||||
JREC *free_jlst();
|
||||
|
||||
int ph2knj(unsigned char* zyomi, unsigned char* kanji, int knjlen) {
|
||||
|
||||
|
||||
int ph2knj
|
||||
(unsigned char *zyomi, unsigned char *kanji, int knjlen)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
unsigned char *dst;
|
||||
int i;
|
||||
|
||||
for (ptr = zyomi, dst = hyomi, i = 0 ; *ptr ; ) {
|
||||
if(i++ >= MaxPhInputLen) {
|
||||
*kanji = 0;
|
||||
return 0;
|
||||
}
|
||||
if (i++ >= MaxPhInputLen) { *kanji = 0; return 0; }
|
||||
ptr += sj2cd_chr(ptr, dst++);
|
||||
}
|
||||
*dst = 0;
|
||||
|
|
@ -69,8 +80,8 @@ int ph2knj(unsigned char* zyomi, unsigned char* kanji, int knjlen) {
|
|||
|
||||
while (cnvlen && kanjilen) {
|
||||
if (!clt1st) {
|
||||
mkjiritsu(DO_CLSTUDY | DO_IKKATU);
|
||||
mkbunsetsu();
|
||||
mkjiritu(DO_CLSTUDY | DO_IKKATU);
|
||||
mkbunsetu();
|
||||
if (!maxclptr) wakachi();
|
||||
jrt1st = maxjptr;
|
||||
clt1st = maxclptr;
|
||||
|
|
@ -80,7 +91,7 @@ int ph2knj(unsigned char* zyomi, unsigned char* kanji, int knjlen) {
|
|||
|
||||
selclrec();
|
||||
|
||||
prevclgrm = selcl->jnode->hinshi;
|
||||
prevclgrm = selcl -> jnode -> hinsi;
|
||||
prevclrow = selcl -> right;
|
||||
|
||||
clt1st = free_clst(clt1st, (int)selcl -> cllen);
|
||||
|
|
@ -104,3 +115,4 @@ int ph2knj(unsigned char* zyomi, unsigned char* kanji, int knjlen) {
|
|||
|
||||
return(inputyomi - zyomi);
|
||||
}
|
||||
|
||||
|
|
|
|||
31
ph_khtbl.c
31
ph_khtbl.c
|
|
@ -27,11 +27,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: ph_khtbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:09 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "kanakan.h"
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ph_setsty(CLREC* clrec) {
|
||||
ph_setsty (CLREC *clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
TypeDicOfs offset;
|
||||
unsigned char *ptr;
|
||||
|
|
@ -46,7 +58,7 @@ ph_setsty(CLREC* clrec) {
|
|||
(*curdict->getdic)(curdict, jrec -> jseg);
|
||||
ptr = dicbuf + jrec->jofsst + 1;
|
||||
|
||||
for(; *ptr != HinshiBlkTerm; ptr = skipkstr(ptr)) {
|
||||
for ( ; *ptr != HinsiBlkTerm ; ptr = skipkstr(ptr)) {
|
||||
offset = ptr - dicbuf;
|
||||
sptr = srchstdy(jrec -> jseg, offset, jrec -> dicid);
|
||||
|
||||
|
|
@ -59,7 +71,8 @@ ph_setsty(CLREC* clrec) {
|
|||
|
||||
if (sptr -> styno < kouhotbl[0].styno) {
|
||||
ph_setkouho(clrec, offset, sptr);
|
||||
} else if(sptr->styno == kouhotbl->styno) {
|
||||
}
|
||||
else if (sptr -> styno == kouhotbl -> styno) {
|
||||
if (!(kouhotbl[0].ka_fg &&
|
||||
sptr -> ka_kj == kouhotbl[0].ka_kj)) {
|
||||
ph_setkouho(clrec, offset, sptr);
|
||||
|
|
@ -68,7 +81,11 @@ ph_setsty(CLREC* clrec) {
|
|||
}
|
||||
}
|
||||
|
||||
int ph_khtbl(CLREC* clrec) {
|
||||
|
||||
|
||||
int
|
||||
ph_khtbl (CLREC *clrec)
|
||||
{
|
||||
JREC *jrec;
|
||||
int flg = FALSE;
|
||||
|
||||
|
|
@ -90,9 +107,10 @@ int ph_khtbl(CLREC* clrec) {
|
|||
if (jrec -> jofsst) {
|
||||
ph_setsty(clrec);
|
||||
break;
|
||||
} else
|
||||
}
|
||||
else
|
||||
flg = TRUE;
|
||||
case C_BUNSETSU:
|
||||
case C_BUNSETU:
|
||||
case C_MINASI:
|
||||
case C_WAKACHI:
|
||||
if (!khcount) ph_setkouho(clrec, (TypeDicOfs)0, (STDYIN *)0);
|
||||
|
|
@ -101,3 +119,4 @@ int ph_khtbl(CLREC* clrec) {
|
|||
|
||||
return flg;
|
||||
}
|
||||
|
||||
|
|
|
|||
111
priority.c
111
priority.c
|
|
@ -27,17 +27,25 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: priority.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:10 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_kcnv.h"
|
||||
#include "sj_hinshi.h"
|
||||
#include "sj_hinsi.h"
|
||||
#include "sj_right.h"
|
||||
#include "sj_prty.h"
|
||||
|
||||
static int isfukusi(hinshi)
|
||||
TypeGram hinshi;
|
||||
static int isfukusi(hinsi)
|
||||
TypeGram hinsi;
|
||||
{
|
||||
if(FUKUSHI_1 <= hinshi && hinshi <= FUKUSHI_7)
|
||||
if (FUKUSI_1 <= hinsi && hinsi <= FUKUSI_7)
|
||||
return TRUE;
|
||||
else if(hinshi == MEISHI_11 || hinshi == D_MEISHI_6)
|
||||
else if (hinsi == MEISI_11 || hinsi == D_MEISI_6)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -45,49 +53,51 @@ TypeGram hinshi;
|
|||
static int istaigen(right)
|
||||
TypeCnct right;
|
||||
{
|
||||
if(right == R_MEISHI || right == R_DMEISHI || right == R_SMEISHI1)
|
||||
if (right == R_MEISI || right == R_DMEISI || right == R_SMEISI1)
|
||||
return TRUE;
|
||||
if(right == R_WO_MEISHI || right == R_DAIMEISHI || right == R_JOSUUSHI)
|
||||
if (right == R_WO_MEISI || right == R_DAIMEISI || right == R_JOSUUSI)
|
||||
return TRUE;
|
||||
if (right == R_RENYOU1 || (R_RENYOU3 <= right && right <= R_SA5RENYOU4))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int taicnt(hinshi1, hinshi2)
|
||||
TypeGram hinshi1;
|
||||
TypeGram hinshi2;
|
||||
static int taicnt(hinsi1, hinsi2)
|
||||
TypeGram hinsi1;
|
||||
TypeGram hinsi2;
|
||||
{
|
||||
if(hinshi2 == TANKANJI) return 0;
|
||||
if (hinsi2 == TANKANJI) return 0;
|
||||
|
||||
if(MYOUJI <= hinshi1 && hinshi1 <= KEN_KU) {
|
||||
if(MEISHI_1 <= hinshi2 && hinshi2 <= SETSUBI_9)
|
||||
return Taipri(hinshi1 - MYOUJI, hinshi2);
|
||||
if (MYOUJI <= hinsi1 && hinsi1 <= KEN_KU) {
|
||||
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
|
||||
return Taipri(hinsi1 - MYOUJI, hinsi2);
|
||||
else
|
||||
return 3;
|
||||
} else if((MEISHI_1 <= hinshi1 && hinshi1 <= MEISHI_11) ||
|
||||
hinshi1 == D_MEISHI_2) {
|
||||
if(MEISHI_1 <= hinshi2 && hinshi2 <= SETSUBI_9) {
|
||||
return Taipri(5, hinshi2);
|
||||
} else
|
||||
}
|
||||
else if ((MEISI_1 <= hinsi1 && hinsi1 <= MEISI_11) ||
|
||||
hinsi1 == D_MEISI_2) {
|
||||
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9) {
|
||||
return Taipri(5, hinsi2);
|
||||
}
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
|
||||
else {
|
||||
if(MEISHI_1 <= hinshi2 && hinshi2 <= SETSUBI_9)
|
||||
return Taipri(6, hinshi2);
|
||||
if (MEISI_1 <= hinsi2 && hinsi2 <= SETUBI_9)
|
||||
return Taipri(6, hinsi2);
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
static int sttcnt(hinshi1, hinshi2)
|
||||
TypeGram hinshi1;
|
||||
TypeGram hinshi2;
|
||||
static int sttcnt(hinsi1, hinsi2)
|
||||
TypeGram hinsi1;
|
||||
TypeGram hinsi2;
|
||||
{
|
||||
if(SETTOU_1 <= hinshi1 && hinshi1 <= SETTOU_5) {
|
||||
if(MEISHI_1 <= hinshi2 && hinshi2 <= SUUSHI)
|
||||
return Sttpri(hinshi1 - SETTOU_1, hinshi2);
|
||||
if (SETTOU_1 <= hinsi1 && hinsi1 <= SETTOU_5) {
|
||||
if (MEISI_1 <= hinsi2 && hinsi2 <= SUUSI)
|
||||
return Sttpri(hinsi1 - SETTOU_1, hinsi2);
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
|
@ -98,29 +108,30 @@ CLREC* clrec;
|
|||
int prty;
|
||||
CLREC *cl2rec;
|
||||
int keeplen;
|
||||
TypeGram hinshi1;
|
||||
TypeGram hinsi1;
|
||||
int i;
|
||||
int prev = 0;
|
||||
|
||||
if (clrec->cllen == clrec->cl2len) return 0xff;
|
||||
|
||||
if(clrec->jnode->class == C_BUNSETSU) {
|
||||
if (clrec->jnode->class == C_BUNSETU) {
|
||||
prty = Termtbl[clrec->right] & GETPRI;
|
||||
return(0xf0 + prty);
|
||||
}
|
||||
|
||||
hinshi1 = clrec->jnode->hinshi;
|
||||
|
||||
hinsi1 = clrec->jnode->hinsi;
|
||||
|
||||
if (prevclrow == R_WO || prevclrow == R_WO_S ||
|
||||
prevclrow == R_NI1 || prevclrow == R_DRENYOU2) {
|
||||
if(clrec->kubun == K_DOUSHI || isfukusi(hinshi1))
|
||||
if (clrec -> kubun == K_DOUSHI || isfukusi(hinsi1))
|
||||
prev = 5;
|
||||
}
|
||||
|
||||
else if (istaigen(prevclrow)) {
|
||||
|
||||
if (clrec -> kubun == K_TAIGEN)
|
||||
prev = taicnt(prevclgrm, hinshi1);
|
||||
prev = taicnt(prevclgrm, hinsi1);
|
||||
|
||||
else
|
||||
prev = 0;
|
||||
|
|
@ -130,10 +141,11 @@ CLREC* clrec;
|
|||
if (clrec -> jnode -> sttofs)
|
||||
prty = 2;
|
||||
else
|
||||
prty = sttcnt(prevclgrm, hinshi1);
|
||||
prty = sttcnt(prevclgrm, hinsi1);
|
||||
}
|
||||
|
||||
if(hinshi1 >= SETSUBI_1 && hinshi1 <= SETSUBI_9 && (!prev)) {
|
||||
|
||||
if (hinsi1 >= SETUBI_1 && hinsi1 <= SETUBI_9 && (!prev)) {
|
||||
prty = 1;
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -158,7 +170,7 @@ CLREC* clrec;
|
|||
if (cl2rec -> jnode -> sttofs )
|
||||
i = 2;
|
||||
else
|
||||
i = sttcnt(hinshi1, cl2rec->jnode->hinshi);
|
||||
i = sttcnt(hinsi1, cl2rec->jnode->hinsi);
|
||||
|
||||
if (i > prty)
|
||||
prty = i;
|
||||
|
|
@ -170,7 +182,7 @@ CLREC* clrec;
|
|||
else if (istaigen(clrec->right)) {
|
||||
prty = 0;
|
||||
while (cl2rec && (int)cl2rec->cllen == keeplen) {
|
||||
i = taicnt(hinshi1, cl2rec->jnode->hinshi);
|
||||
i = taicnt(hinsi1, cl2rec->jnode->hinsi);
|
||||
if (i > prty)
|
||||
prty = i;
|
||||
cl2rec = cl2rec->clsort;
|
||||
|
|
@ -181,8 +193,10 @@ CLREC* clrec;
|
|||
goto finish;
|
||||
}
|
||||
|
||||
|
||||
prty = Termtbl[clrec->right];
|
||||
|
||||
|
||||
if (prty & RENTAI) {
|
||||
while (cl2rec && (int)cl2rec->cllen == keeplen) {
|
||||
if (cl2rec -> kubun == K_TAIGEN) {
|
||||
|
|
@ -203,8 +217,9 @@ CLREC* clrec;
|
|||
if (cl2rec->kubun == K_DOUSHI) {
|
||||
prty = 6;
|
||||
goto finish;
|
||||
} else if(cl2rec->jnode->hinshi == SETSUBI_1 ||
|
||||
cl2rec->jnode->hinshi == SETSUBI_2) {
|
||||
}
|
||||
else if (cl2rec->jnode->hinsi == SETUBI_1 ||
|
||||
cl2rec->jnode->hinsi == SETUBI_2) {
|
||||
prty = 7;
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -214,19 +229,20 @@ CLREC* clrec;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
finish:
|
||||
cl2rec = maxclptr;
|
||||
|
||||
if(hinshi1 == SUUSHI) prty -= 4;
|
||||
if (hinsi1 == SUUSI) prty -= 4;
|
||||
|
||||
if(cl2rec->jnode->hinshi == SUUSHI) prty -= 3;
|
||||
if (cl2rec -> jnode -> hinsi == SUUSI) prty -= 3;
|
||||
|
||||
if (cl2rec->jnode->class == C_DICT &&
|
||||
cl2rec->jnode->jlen == 1 && (cl2rec->kubun != K_DOUSHI)) {
|
||||
prty -= 2;
|
||||
}
|
||||
|
||||
if((!istaigen(clrec->right)) && (cl2rec->jnode->hinshi == SETSUBI_2)) {
|
||||
if ((!istaigen(clrec->right)) && (cl2rec->jnode->hinsi == SETUBI_2)) {
|
||||
prty -= 4;
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +250,9 @@ finish:
|
|||
return(prty + prev);
|
||||
}
|
||||
|
||||
void pritiny() {
|
||||
|
||||
void pritiny()
|
||||
{
|
||||
CLREC *clrec;
|
||||
int keeplen;
|
||||
int i, prty = 0;
|
||||
|
|
@ -244,7 +262,7 @@ void pritiny() {
|
|||
|
||||
if (istaigen(prevclrow)) {
|
||||
while (clrec && (int)clrec -> cllen == keeplen) {
|
||||
i = taicnt(prevclgrm, clrec->jnode->hinshi);
|
||||
i = taicnt(prevclgrm, clrec -> jnode -> hinsi);
|
||||
if (i > prty) {
|
||||
selcl = clrec;
|
||||
prty = i;
|
||||
|
|
@ -256,11 +274,11 @@ void pritiny() {
|
|||
else {
|
||||
|
||||
while (clrec && (int)clrec -> cllen == keeplen) {
|
||||
if(clrec->jnode->hinshi >= MYOUJI &&
|
||||
clrec->jnode->hinshi <= KEN_KU)
|
||||
if (clrec -> jnode -> hinsi >= MYOUJI &&
|
||||
clrec -> jnode -> hinsi <= KEN_KU)
|
||||
clrec = clrec -> clsort;
|
||||
|
||||
else if(clrec->jnode->hinshi == TANKANJI)
|
||||
else if (clrec -> jnode -> hinsi == TANKANJI)
|
||||
return;
|
||||
else {
|
||||
selcl = clrec;
|
||||
|
|
@ -269,3 +287,4 @@ void pritiny() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
194
prtytbl.c
194
prtytbl.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: prtytbl.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:02:11 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
|
||||
|
|
@ -65,176 +73,30 @@ unsigned char taipri[7][45] = {
|
|||
{ 0, 5, 6, 6, 6, 6, 5, 6, 6, 6,
|
||||
6, 6, 3, 3, 3, 3, 3, 5, 0, 0,
|
||||
0, 3, 3, 3, 3, 3, 5, 5, 5, 5,
|
||||
4, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5}};
|
||||
4, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5}
|
||||
};
|
||||
|
||||
|
||||
|
||||
unsigned char sttpri[5][31] = {
|
||||
|
||||
{
|
||||
0,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
7,
|
||||
2,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
},
|
||||
{ 0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 2, 4, 4, 4, 4, 4, 0, 0,
|
||||
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, },
|
||||
|
||||
{
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
10,
|
||||
10,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
},
|
||||
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
|
||||
0, 4, 4, 4, 10, 10, 4, 4, 4, 4, 4, },
|
||||
|
||||
{
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
10,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
},
|
||||
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
|
||||
0, 10, 10, 4, 4, 4, 4, 4, 4, 4, 4, },
|
||||
|
||||
{
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
15,
|
||||
},
|
||||
{ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
|
||||
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, },
|
||||
|
||||
{
|
||||
0,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
12,
|
||||
9,
|
||||
9,
|
||||
9,
|
||||
9,
|
||||
9,
|
||||
9,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
}};
|
||||
{ 0, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 9, 9, 9, 9, 9, 9, 0, 0,
|
||||
0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }
|
||||
};
|
||||
|
|
|
|||
138
readline.c
138
readline.c
|
|
@ -27,6 +27,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: readline.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:44 $
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "sj_euc.h"
|
||||
|
|
@ -34,61 +43,73 @@
|
|||
#include "sj_macro.h"
|
||||
#include "dicttool.h"
|
||||
|
||||
|
||||
/* static long lineloc; */
|
||||
static int yomi[MaxYomiLength + 1];
|
||||
static int kanji[MaxKanjiLength + 1];
|
||||
static int hinshi[MaxHinshiNumber + 1];
|
||||
static int hinsi[MaxHinsiNumber + 1];
|
||||
static int atr[MaxAtrNumber + 1];
|
||||
|
||||
|
||||
|
||||
static void
|
||||
error(char* s) {
|
||||
error(char *s)
|
||||
{
|
||||
if (s) fprintf(stderr, "%s\n", s);
|
||||
mark_file(stderr);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
readchar(void) {
|
||||
readchar(void)
|
||||
{
|
||||
int c1;
|
||||
int c2;
|
||||
|
||||
c1 = getch();
|
||||
if(c1 == EOF) return EOF;
|
||||
|
||||
c1 = getch(); if (c1 == EOF) return EOF;
|
||||
|
||||
|
||||
if (c1 != SS3) {
|
||||
if (c1 & 0x80) {
|
||||
c2 = getch();
|
||||
if(c2 == EOF) error(NULL);
|
||||
c2 = getch(); if (c2 == EOF) error(NULL);
|
||||
c1 = ((c1 & 0xff) << 8) + (c2 & 0xff);
|
||||
}
|
||||
} else {
|
||||
c2 = getch();
|
||||
if(c2 == EOF) error(NULL);
|
||||
c2 = getch(); if (c2 == EOF) error(NULL);
|
||||
c1 = ((c1 & 0xff) << 8) + (c2 & 0xff);
|
||||
c2 = getch();
|
||||
if(c2 == EOF) error(NULL);
|
||||
c2 = getch(); if (c2 == EOF) error(NULL);
|
||||
c1 = ((c1 & 0xffff) << 8) + (c2 & 0xff);
|
||||
}
|
||||
|
||||
return c1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
skip_blank(void) {
|
||||
skip_blank(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = readchar();
|
||||
while (Isblank(c)) c = readchar();
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
readhinshi(void) {
|
||||
readhinsi(void)
|
||||
{
|
||||
static int c = 0;
|
||||
int i;
|
||||
unsigned char hinshi[128];
|
||||
unsigned char hinsi[128];
|
||||
int flg;
|
||||
|
||||
retry:
|
||||
|
|
@ -98,58 +119,63 @@ retry:
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
c = skip_blank();
|
||||
if (c == '\n') {
|
||||
c = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0 ; !Isblank(c) ; ) {
|
||||
if (c == '\n' || c == ':') break;
|
||||
if (Isillegal(c)) error(IllegalFormat);
|
||||
if (c > 0xffffff) {
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 24) & 0xff);
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 16) & 0xff);
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 8) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 24) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 16) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 8) & 0xff);
|
||||
} else if (c > 0xffff) {
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 16) & 0xff);
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 8) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 16) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 8) & 0xff);
|
||||
} else if (c > 0xff) {
|
||||
if(i >= 126) error(TooLongHinshi);
|
||||
hinshi[i++] = ((c >> 8) & 0xff);
|
||||
if (i >= 126) error(TooLongHinsi);
|
||||
hinsi[i++] = ((c >> 8) & 0xff);
|
||||
}
|
||||
if(i >= 127) error(TooLongHinshi);
|
||||
hinshi[i++] = (c & 0xff);
|
||||
if (i >= 127) error(TooLongHinsi);
|
||||
hinsi[i++] = (c & 0xff);
|
||||
c = readchar();
|
||||
}
|
||||
|
||||
|
||||
if (i == 0) return 0;
|
||||
|
||||
if(hinshi[0] == '[' && hinshi[i - 1] == ']') {
|
||||
hinshi[i - 1] = 0;
|
||||
i = cnvhinshi(hinshi + 1);
|
||||
|
||||
if (hinsi[0] == '[' && hinsi[i - 1] == ']') {
|
||||
hinsi[i - 1] = 0;
|
||||
i = cnvhinsi(hinsi + 1);
|
||||
if (i > 0) {
|
||||
fprintf(stderr, "\311\312\273\354 \"%s\" \244\313\263\347\270\314\244\254\244\304\244\244\244\306\244\244\244\353\n",
|
||||
hinshi + 1);
|
||||
} else if(!i) {
|
||||
hinsi + 1);
|
||||
}
|
||||
else if (!i) {
|
||||
|
||||
fprintf(stderr, "\"%s\" \244\254\245\263\241\274\245\311\262\275\244\307\244\255\244\336\244\273\244\363\n",
|
||||
hinshi + 1);
|
||||
hinsi + 1);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
hinshi[i] = 0;
|
||||
i = cnvhinshi(hinshi);
|
||||
hinsi[i] = 0;
|
||||
i = cnvhinsi(hinsi);
|
||||
if (!i) {
|
||||
|
||||
fprintf(stderr, "\"%s\" \244\254\245\263\241\274\245\311\262\275\244\307\244\255\244\336\244\273\244\363\n", hinshi);
|
||||
fprintf(stderr, "\"%s\" \244\254\245\263\241\274\245\311\262\275\244\307\244\255\244\336\244\273\244\363\n", hinsi);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,26 +183,35 @@ retry:
|
|||
return i;
|
||||
}
|
||||
|
||||
int* readline(void) {
|
||||
|
||||
|
||||
int*
|
||||
readline(void)
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
mark_file(NULL);
|
||||
|
||||
c = skip_blank();
|
||||
|
||||
|
||||
if (c == '#') {
|
||||
while (c != '\n') c = skip_blank();
|
||||
}
|
||||
|
||||
|
||||
if (c == EOF) return NULL;
|
||||
|
||||
|
||||
if (c != '\n') break;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0 ; !Isblank(c) ; ) {
|
||||
if (Isillegal(c)) error(IllegalFormat);
|
||||
if (i >= MaxYomiLength) error(TooLongYomi);
|
||||
|
|
@ -186,8 +221,10 @@ int* readline(void) {
|
|||
yomi[i] = 0;
|
||||
if (i == 0) error(NoYomiString);
|
||||
|
||||
|
||||
c = skip_blank();
|
||||
|
||||
|
||||
if (c != '"') {
|
||||
for (i = 0 ; !Isblank(c) ; ) {
|
||||
if (Isillegal(c)) error(IllegalFormat);
|
||||
|
|
@ -195,7 +232,8 @@ int* readline(void) {
|
|||
kanji[i++] = c;
|
||||
c = readchar();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
c = readchar();
|
||||
for (i = 0 ; c != '"' ; ) {
|
||||
if (Isillegal(c)) error(IllegalFormat);
|
||||
|
|
@ -207,25 +245,31 @@ int* readline(void) {
|
|||
kanji[i] = 0;
|
||||
if (i == 0) error(NoKanjiString);
|
||||
|
||||
|
||||
i = j = 0;
|
||||
while((c = readhinshi()) != 0) {
|
||||
while ((c = readhinsi())!=0) {
|
||||
if (c < 0) {
|
||||
if (i >= MaxAtrNumber) error(TooManyAtr);
|
||||
atr[i++] = -c;
|
||||
} else {
|
||||
if(j >= MaxHinshiNumber) error(TooManyHinshi);
|
||||
hinshi[j++] = c;
|
||||
}
|
||||
else {
|
||||
if (j >= MaxHinsiNumber) error(TooManyHinsi);
|
||||
hinsi[j++] = c;
|
||||
}
|
||||
}
|
||||
atr[i] = 0;
|
||||
if(j == 0) hinshi[j++] = HinshiTankan;
|
||||
hinshi[j] = 0;
|
||||
if (j == 0) hinsi[j++] = HinsiTankan;
|
||||
hinsi[j] = 0;
|
||||
|
||||
|
||||
return yomi;
|
||||
}
|
||||
|
||||
void setline(void (*func)(int*, int*, int, int*)) {
|
||||
|
||||
void
|
||||
setline(void (*func)(int*, int*, int, int*))
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; hinshi[i]; i++) (*func)(yomi, kanji, hinshi[i], atr);
|
||||
for (i = 0 ; hinsi[i] ; i++) (*func)(yomi, kanji, hinsi[i], atr);
|
||||
}
|
||||
|
|
|
|||
9
rk.h
9
rk.h
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: rk.h,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:48 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "wchar16.h"
|
||||
|
||||
|
|
@ -71,3 +79,4 @@ typedef struct rktable {
|
|||
unsigned char *r_str;
|
||||
struct rktable *next;
|
||||
} RkTabl;
|
||||
|
||||
|
|
|
|||
119
rk_conv.c
119
rk_conv.c
|
|
@ -27,10 +27,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: rk_conv.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:59 $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /export/work/contrib/sj3/sj3rkcv/RCS/rk_conv.c,v 1.14 1994/06/03 07:42:16 notanaka Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
#include "sj_sysvdef.h"
|
||||
#include "wchar16.h"
|
||||
#include <stdio.h>
|
||||
|
|
@ -88,6 +96,7 @@ typedef struct ymibufrec {
|
|||
struct ymibufrec *ymibufp;
|
||||
} YmibufRec;
|
||||
|
||||
|
||||
#define SJ3_NO -1
|
||||
#define SJ3_SJIS 0
|
||||
#define SJ3_EUC 1
|
||||
|
|
@ -106,6 +115,7 @@ static int rk_cflag;
|
|||
static int rk_klen;
|
||||
static int file_code = SJ3_NO;
|
||||
|
||||
|
||||
static RkbufRec rkpbuf, *rkpp = NULL;
|
||||
static RkTablW16 *rkhp;
|
||||
static StrbufRec strpbuf, *strpp;
|
||||
|
|
@ -113,20 +123,27 @@ static wchar16_t* shp;
|
|||
static YmibufRec ymipbuf, *ymipp;
|
||||
static unsigned short *yhp;
|
||||
|
||||
sj3_rkcode(code) int code;
|
||||
|
||||
sj3_rkcode(code)
|
||||
int code;
|
||||
{
|
||||
if (code)
|
||||
file_code = SJ3_NO;
|
||||
}
|
||||
|
||||
sj3_rkinit2(rkfile, erase) char* rkfile;
|
||||
|
||||
|
||||
|
||||
sj3_rkinit2(rkfile, erase)
|
||||
char *rkfile;
|
||||
int erase;
|
||||
{
|
||||
rk_erase = erase;
|
||||
return(sj3_rkinit_mb(rkfile));
|
||||
}
|
||||
|
||||
rcode_sjis_init() {
|
||||
rcode_sjis_init()
|
||||
{
|
||||
int i, rkeylen = 0, ryomilen = 0, rstrlen = 0;
|
||||
int klen, ylen, slen, tablnum = 0, tablsize;
|
||||
unsigned char *mbstr, *mptr, mtmp[BUFSIZ], mtmp2[BUFSIZ];
|
||||
|
|
@ -136,6 +153,7 @@ rcode_sjis_init() {
|
|||
|
||||
tablsize = sizeof(RkTabl);
|
||||
|
||||
|
||||
for (i = 0; i < MAXCODE; i++) {
|
||||
if (sj3_rcode_w16[i]) {
|
||||
tabl_w16 = sj3_rcode_w16[i];
|
||||
|
|
@ -282,9 +300,11 @@ rcode_sjis_init() {
|
|||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
rcode_euc_init() {
|
||||
rcode_euc_init()
|
||||
{
|
||||
int i, rkeylen = 0, ryomilen = 0, rstrlen = 0;
|
||||
int klen, ylen, slen, tablnum = 0, tablsize;
|
||||
unsigned char *mbstr, *mptr, mtmp[BUFSIZ], mtmp2[BUFSIZ];
|
||||
|
|
@ -294,6 +314,7 @@ rcode_euc_init() {
|
|||
|
||||
tablsize = sizeof(RkTabl);
|
||||
|
||||
|
||||
for (i = 0; i < MAXCODE; i++) {
|
||||
if (sj3_rcode_w16[i]) {
|
||||
tabl_w16 = sj3_rcode_w16[i];
|
||||
|
|
@ -440,19 +461,23 @@ rcode_euc_init() {
|
|||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
sj3_rkinit(rkfile) char* rkfile;
|
||||
sj3_rkinit(rkfile)
|
||||
char *rkfile;
|
||||
{
|
||||
return sj3_rkinit_sub(rkfile, rcode_sjis_init);
|
||||
}
|
||||
|
||||
sj3_rkinit_euc(rkfile) char* rkfile;
|
||||
sj3_rkinit_euc(rkfile)
|
||||
char *rkfile;
|
||||
{
|
||||
return sj3_rkinit_sub(rkfile, rcode_euc_init);
|
||||
}
|
||||
|
||||
sj3_rkinit_mb(rkfile) char* rkfile;
|
||||
sj3_rkinit_mb(rkfile)
|
||||
char *rkfile;
|
||||
{
|
||||
if (current_locale == LC_CTYPE_EUC)
|
||||
return sj3_rkinit_sub(rkfile, rcode_euc_init);
|
||||
|
|
@ -460,7 +485,8 @@ sj3_rkinit_mb(rkfile) char* rkfile;
|
|||
return sj3_rkinit_sub(rkfile, rcode_sjis_init);
|
||||
}
|
||||
|
||||
sj3_rkinit_sub(rkfile, mbfunc) char* rkfile;
|
||||
sj3_rkinit_sub(rkfile, mbfunc)
|
||||
char *rkfile;
|
||||
int (*mbfunc)();
|
||||
{
|
||||
char *p;
|
||||
|
|
@ -481,6 +507,7 @@ int (*mbfunc)();
|
|||
line[MAXLEN - 1] = EOL;
|
||||
retv = 0;
|
||||
|
||||
|
||||
while ((p = fgets(line, MAXLEN + 1, fp)) != NULL) {
|
||||
if (line[MAXLEN - 1] != EOL) {
|
||||
line[MAXLEN - 1] = EOL;
|
||||
|
|
@ -518,6 +545,7 @@ int (*mbfunc)();
|
|||
retv = FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
fclose(fp);
|
||||
if (!(*mbfunc)())
|
||||
|
|
@ -526,7 +554,10 @@ int (*mbfunc)();
|
|||
return(retv);
|
||||
}
|
||||
|
||||
char* getkey(istr, ostr, len)
|
||||
|
||||
|
||||
char *
|
||||
getkey(istr, ostr, len)
|
||||
char *istr;
|
||||
wchar16_t *ostr;
|
||||
int *len;
|
||||
|
|
@ -581,7 +612,10 @@ int* len;
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
char* rkgetyomi(istr, ostr, len)
|
||||
|
||||
|
||||
char *
|
||||
rkgetyomi(istr, ostr, len)
|
||||
char *istr;
|
||||
wchar16_t *ostr;
|
||||
int *len;
|
||||
|
|
@ -612,7 +646,8 @@ int* len;
|
|||
p++;
|
||||
} else if (iseuckana(c) && iskana2(*p)) {
|
||||
cc = *p++;
|
||||
} else if(IsEUCHojo(c) && iseuc(*p) && iseuc(p[1])) {
|
||||
}
|
||||
else if (IsEUCHojo(c) && iseuc(*p) && iseuc(p[1])) {
|
||||
cc = WcSetX0212(*p, p[1]);
|
||||
p += 2;
|
||||
}
|
||||
|
|
@ -622,7 +657,9 @@ int* len;
|
|||
p--;
|
||||
continue;
|
||||
}
|
||||
if((iseuc(c) && iseuc(*p)) || (iseuckana(c) && iskana2(*p)) || (IsEUCHojo(c) && iseuc(*p) && iseuc(p[1]))) {
|
||||
if ((iseuc(c) && iseuc(*p)) || (iseuckana(c) &&
|
||||
iskana2(*p)) || (IsEUCHojo(c) && iseuc(*p) &&
|
||||
iseuc(p[1]))) {
|
||||
file_code = SJ3_EUC;
|
||||
p--;
|
||||
continue;
|
||||
|
|
@ -641,7 +678,10 @@ int* len;
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
cltable() {
|
||||
|
||||
|
||||
cltable()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (rkpp != NULL) {
|
||||
|
|
@ -658,9 +698,10 @@ cltable() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
chk_rstr(rstr, rkey, rlen, klen)
|
||||
wchar16_t* rstr,
|
||||
*rkey;
|
||||
wchar16_t *rstr, *rkey;
|
||||
int rlen, klen;
|
||||
{
|
||||
int i;
|
||||
|
|
@ -678,8 +719,11 @@ int rlen, klen;
|
|||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
RkTablW16 *
|
||||
rkalloc() {
|
||||
rkalloc()
|
||||
{
|
||||
RkTablW16 *rkp;
|
||||
RkbufRec *rkbrp;
|
||||
|
||||
|
|
@ -711,6 +755,8 @@ rkalloc() {
|
|||
return(rkp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
stradd(cp, str, len)
|
||||
wchar16_t **cp;
|
||||
wchar16_t *str;
|
||||
|
|
@ -746,9 +792,10 @@ int len;
|
|||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
kstradd(cp, kstr, len)
|
||||
wchar16_t** cp,
|
||||
*kstr;
|
||||
wchar16_t **cp, *kstr;
|
||||
int len;
|
||||
{
|
||||
int i;
|
||||
|
|
@ -782,6 +829,8 @@ int len;
|
|||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
RkTablW16 *
|
||||
mktable(key, len)
|
||||
wchar16_t *key;
|
||||
|
|
@ -829,12 +878,18 @@ int len;
|
|||
return(rktp);
|
||||
}
|
||||
|
||||
sj3_rkebell(err) int err;
|
||||
|
||||
|
||||
sj3_rkebell(err)
|
||||
int err;
|
||||
{
|
||||
rk_errin = err;
|
||||
}
|
||||
|
||||
sj3_rkclear() {
|
||||
|
||||
|
||||
sj3_rkclear()
|
||||
{
|
||||
rline[0] = NSTR;
|
||||
lstr[0] = NSTR;
|
||||
rktblp = NULL;
|
||||
|
|
@ -842,10 +897,13 @@ sj3_rkclear() {
|
|||
sj3_rkreset();
|
||||
}
|
||||
|
||||
sj3_rkreset() {
|
||||
sj3_rkreset()
|
||||
{
|
||||
rk_cflag = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sj3_rkconvc(c, rkstr)
|
||||
wchar16_t c;
|
||||
unsigned int *rkstr;
|
||||
|
|
@ -917,6 +975,8 @@ unsigned int* rkstr;
|
|||
*rkstr = RKEND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sj3_rkconv2(wstr, kstr, wlen)
|
||||
wchar16_t *wstr;
|
||||
unsigned int *kstr;
|
||||
|
|
@ -1013,9 +1073,13 @@ int wlen;
|
|||
return(len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int sj3_rkconv_w16(wchar16_t *, wchar16_t *);
|
||||
|
||||
sj3_rkconv(romaji, kana) unsigned char* romaji;
|
||||
sj3_rkconv(romaji, kana)
|
||||
unsigned char *romaji;
|
||||
unsigned char *kana;
|
||||
{
|
||||
wchar16_t *wstr;
|
||||
|
|
@ -1060,7 +1124,8 @@ unsigned char* kana;
|
|||
}
|
||||
}
|
||||
|
||||
sj3_rkconv_euc(romaji, kana) unsigned char* romaji;
|
||||
sj3_rkconv_euc(romaji, kana)
|
||||
unsigned char *romaji;
|
||||
unsigned char *kana;
|
||||
{
|
||||
wchar16_t *wstr;
|
||||
|
|
@ -1105,7 +1170,8 @@ unsigned char* kana;
|
|||
}
|
||||
}
|
||||
|
||||
sj3_rkconv_mb(romaji, kana) unsigned char* romaji;
|
||||
sj3_rkconv_mb(romaji, kana)
|
||||
unsigned char *romaji;
|
||||
unsigned char *kana;
|
||||
{
|
||||
if (current_locale == LC_CTYPE_EUC)
|
||||
|
|
@ -1176,9 +1242,10 @@ wchar16_t* kstr;
|
|||
return(rlen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
rkmatch(s1, s2, len)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
wchar16_t *s1, *s2;
|
||||
int len;
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
41
romaji.c
41
romaji.c
|
|
@ -27,12 +27,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: romaji.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1997/01/23 11:09:37 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "rk.h"
|
||||
#include "key.h"
|
||||
|
||||
extern int rkerrbell;
|
||||
|
||||
|
||||
|
||||
exec_romaji(c)
|
||||
wchar16_t c;
|
||||
{
|
||||
|
|
@ -136,7 +146,8 @@ exec_romaji(c)
|
|||
vbackchar(2);
|
||||
op --;
|
||||
cv->out_point = op;
|
||||
len = cv->out_mode[op] + GetMojilen(c2);
|
||||
len = cv->out_mode[op]
|
||||
+ GetMojilen(c2);
|
||||
c2 = SetMojilen(len);
|
||||
}
|
||||
}
|
||||
|
|
@ -177,7 +188,8 @@ exec_romaji(c)
|
|||
SetCflag();
|
||||
buffers_clear();
|
||||
}
|
||||
} else if((len = op - cv->out_point) > 0) {
|
||||
}
|
||||
else if ((len = op - cv->out_point) > 0) {
|
||||
p = &cv->out_buf[cv->out_point];
|
||||
if (BuffYes() && IsCflag ()) {
|
||||
Csave ();
|
||||
|
|
@ -197,7 +209,8 @@ exec_romaji(c)
|
|||
return(i);
|
||||
}
|
||||
|
||||
move_cur(kval) int kval;
|
||||
move_cur(kval)
|
||||
int kval;
|
||||
{
|
||||
Conversion *cv;
|
||||
int i;
|
||||
|
|
@ -239,7 +252,8 @@ move_cur(kval) int kval;
|
|||
}
|
||||
}
|
||||
|
||||
addten(pos, c) unsigned short pos, c;
|
||||
addten(pos, c)
|
||||
unsigned short pos, c;
|
||||
{
|
||||
unsigned short prefix;
|
||||
Conversion *cv;
|
||||
|
|
@ -249,7 +263,8 @@ addten(pos, c) unsigned short pos, c;
|
|||
return(sj_addten(prefix, c));
|
||||
}
|
||||
|
||||
getipos(pos) unsigned short pos;
|
||||
getipos(pos)
|
||||
unsigned short pos;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -257,7 +272,8 @@ getipos(pos) unsigned short pos;
|
|||
return(getipos2(cv->out_mode, pos));
|
||||
}
|
||||
|
||||
getipos2(omode, pos) unsigned short* omode;
|
||||
getipos2(omode, pos)
|
||||
unsigned short *omode;
|
||||
unsigned short pos;
|
||||
{
|
||||
unsigned short ipos;
|
||||
|
|
@ -271,8 +287,7 @@ unsigned short pos;
|
|||
}
|
||||
|
||||
sj_rkconv(s1, s2, len)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
wchar16_t *s1, *s2;
|
||||
int len;
|
||||
{
|
||||
int i, rlen;
|
||||
|
|
@ -328,8 +343,7 @@ int len;
|
|||
}
|
||||
|
||||
sj_rkconv2(s1, s2, omode, len)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
wchar16_t *s1, *s2;
|
||||
unsigned short *omode;
|
||||
int len;
|
||||
{
|
||||
|
|
@ -443,9 +457,10 @@ int len;
|
|||
return(klen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
exec_romaji2(c, hbuf, kbuf, omode, cur, hcur)
|
||||
wchar16_t c,
|
||||
*hbuf, *kbuf;
|
||||
wchar16_t c, *hbuf, *kbuf;
|
||||
unsigned short *omode;
|
||||
int cur, hcur;
|
||||
{
|
||||
|
|
@ -531,3 +546,5 @@ int cur, hcur;
|
|||
vprintU(&kbuf[ocur], 1);
|
||||
return(retv);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
11
s2ctbl.c
11
s2ctbl.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: s2ctbl.c,v $
|
||||
* $SonyRevision: 1.2 $
|
||||
* $SonyDate: 1995/07/21 05:22:51 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "sj_rename.h"
|
||||
#include "sj_typedef.h"
|
||||
#include "sj_yomi.h"
|
||||
|
|
@ -139,4 +147,5 @@ unsigned char kigou[] = {
|
|||
Y_KIGOU,
|
||||
Y_KIGOU,
|
||||
Y_KIGOU,
|
||||
Y_KIGOU};
|
||||
Y_KIGOU
|
||||
};
|
||||
|
|
|
|||
113
screen.c
113
screen.c
|
|
@ -27,6 +27,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: screen.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:03:22 $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "key.h"
|
||||
|
||||
|
|
@ -37,7 +45,9 @@ static wchar16_t Nguide[LINE_LENGTH + 1];
|
|||
static wchar16_t Cguide[LINE_LENGTH + 1];
|
||||
wchar16_t Mguide[LINE_LENGTH + 1];
|
||||
|
||||
vbackchar(n) int n;
|
||||
|
||||
vbackchar (n)
|
||||
int n;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -50,7 +60,10 @@ vbackchar(n) int n;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
wrap_off() {
|
||||
|
||||
|
||||
wrap_off ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -58,7 +71,8 @@ wrap_off() {
|
|||
cv->PushCurrentVcol = cv->CurrentVcol;
|
||||
}
|
||||
|
||||
wrap_on() {
|
||||
wrap_on ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -66,7 +80,10 @@ wrap_on() {
|
|||
cv->CurrentVcol = cv->PushCurrentVcol;
|
||||
}
|
||||
|
||||
Vput_space() {
|
||||
|
||||
|
||||
Vput_space ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -78,7 +95,10 @@ Vput_space() {
|
|||
}
|
||||
}
|
||||
|
||||
VBackspace() {
|
||||
|
||||
|
||||
VBackspace ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int i;
|
||||
|
||||
|
|
@ -89,12 +109,16 @@ VBackspace() {
|
|||
if (cv->Vlen > 0 && i > 1) {
|
||||
CursorSet (
|
||||
cv->SavedRow + (cv->CurrentVcol / cv->column) - 1,
|
||||
cv->Vindex[cv->Vlen - 1] % cv->column);
|
||||
} else
|
||||
cv->Vindex[cv->Vlen - 1] % cv->column
|
||||
);
|
||||
}
|
||||
else
|
||||
CursorSet (
|
||||
cv->SavedRow + (cv->CurrentVcol / cv->column) - 1,
|
||||
cv->column);
|
||||
} else
|
||||
cv->column
|
||||
);
|
||||
}
|
||||
else
|
||||
Backspace ();
|
||||
if (cv->Vlen > 0)
|
||||
cv->CurrentVcol = cv->Vindex[--(cv->Vlen)];
|
||||
|
|
@ -104,6 +128,8 @@ VBackspace() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
master_out (s, n)
|
||||
wchar16_t *s;
|
||||
int n;
|
||||
|
|
@ -119,6 +145,8 @@ int n;
|
|||
SJ_write (s, n);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vprintU (s, mod)
|
||||
wchar16_t *s;
|
||||
char mod;
|
||||
|
|
@ -143,7 +171,8 @@ char mod;
|
|||
put_space (1);
|
||||
Backspace ();
|
||||
}
|
||||
if((mod == 1) && (oldcol + len > (unsigned int)cv->column) && ((col & 1) == 0)) {
|
||||
if ((mod == 1) && (oldcol + len > (unsigned int)cv->column)
|
||||
&& ((col & 1) == 0)) {
|
||||
cv->CurrentVcol ++;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,6 +182,8 @@ char mod;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
vprintR (s, mod)
|
||||
wchar16_t *s;
|
||||
char mod;
|
||||
|
|
@ -177,7 +208,8 @@ char mod;
|
|||
put_space (1);
|
||||
Backspace ();
|
||||
}
|
||||
if((mod == 1) && (oldcol + len > (unsigned int)cv->column) && ((col & 1) == 0)) {
|
||||
if ((mod == 1) && (oldcol + len > (unsigned int)cv->column)
|
||||
&& ((col & 1) == 0)) {
|
||||
cv->CurrentVcol ++;
|
||||
}
|
||||
}
|
||||
|
|
@ -187,6 +219,8 @@ char mod;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
IprintU (s, index)
|
||||
wchar16_t *s;
|
||||
int index;
|
||||
|
|
@ -196,6 +230,8 @@ int index;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
IprintR (s, index)
|
||||
wchar16_t *s;
|
||||
int index;
|
||||
|
|
@ -205,6 +241,8 @@ int index;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
printU (s)
|
||||
wchar16_t *s;
|
||||
{
|
||||
|
|
@ -213,6 +251,8 @@ printU(s)
|
|||
under_out ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
printR (s)
|
||||
wchar16_t *s;
|
||||
{
|
||||
|
|
@ -221,7 +261,10 @@ printR(s)
|
|||
reverse_out ();
|
||||
}
|
||||
|
||||
Csave() {
|
||||
|
||||
|
||||
Csave ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
|
|
@ -231,7 +274,8 @@ Csave() {
|
|||
cv->Vindex[cv->Vlen] = cv->MaxVcol = cv->CurrentVcol;
|
||||
}
|
||||
|
||||
SetVcol(index) int index;
|
||||
SetVcol (index)
|
||||
int index;
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
|
|
@ -240,14 +284,16 @@ SetVcol(index) int index;
|
|||
cv->CurrentVcol = cv->Vindex[cv->Vlen];
|
||||
}
|
||||
|
||||
Cload() {
|
||||
Cload ()
|
||||
{
|
||||
Conversion *cv;
|
||||
|
||||
cv = GetConversion ();
|
||||
CursorSet (cv->SavedRow, cv->SavedCol);
|
||||
}
|
||||
|
||||
Cclear(redraw) int redraw;
|
||||
Cclear (redraw)
|
||||
int redraw;
|
||||
{
|
||||
Conversion *cv;
|
||||
int spaces;
|
||||
|
|
@ -256,7 +302,8 @@ Cclear(redraw) int redraw;
|
|||
if (redraw) {
|
||||
cv = GetConversion ();
|
||||
CursorRead (&row, &col);
|
||||
spaces = (row - cv->SavedRow) * cv->column + (col - cv->SavedCol) + 1;
|
||||
spaces = (row - cv->SavedRow) * cv->column
|
||||
+ (col - cv->SavedCol) + 1;
|
||||
Cload ();
|
||||
put_space (spaces);
|
||||
}
|
||||
|
|
@ -264,7 +311,8 @@ Cclear(redraw) int redraw;
|
|||
Flush ();
|
||||
}
|
||||
|
||||
Cgoto(index) int index;
|
||||
Cgoto (index)
|
||||
int index;
|
||||
{
|
||||
Conversion *cv;
|
||||
int row, col;
|
||||
|
|
@ -276,7 +324,8 @@ Cgoto(index) int index;
|
|||
CursorSet (row, col);
|
||||
}
|
||||
|
||||
ClearToMax() {
|
||||
ClearToMax ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int space;
|
||||
|
||||
|
|
@ -285,7 +334,8 @@ ClearToMax() {
|
|||
put_space (space);
|
||||
}
|
||||
|
||||
Ccheck() {
|
||||
Ccheck ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int row, tmp, diff;
|
||||
|
||||
|
|
@ -313,7 +363,8 @@ spaceR(s)
|
|||
printR (tmp);
|
||||
t = tmp;
|
||||
put_space (1);
|
||||
} else
|
||||
}
|
||||
else
|
||||
*(t ++) = *s;
|
||||
s ++;
|
||||
}
|
||||
|
|
@ -322,7 +373,10 @@ spaceR(s)
|
|||
Flush ();
|
||||
}
|
||||
|
||||
clear_guide_line() {
|
||||
|
||||
|
||||
clear_guide_line ()
|
||||
{
|
||||
unsigned short row, col;
|
||||
|
||||
StartGuide (&row, &col);
|
||||
|
|
@ -331,7 +385,8 @@ clear_guide_line() {
|
|||
Flush ();
|
||||
}
|
||||
|
||||
print_guide_line() {
|
||||
print_guide_line ()
|
||||
{
|
||||
unsigned short row, col;
|
||||
|
||||
StartGuide (&row, &col);
|
||||
|
|
@ -341,9 +396,12 @@ print_guide_line() {
|
|||
Flush ();
|
||||
}
|
||||
|
||||
set_guide_line(mode) int mode;
|
||||
set_guide_line (mode)
|
||||
int mode;
|
||||
{
|
||||
|
||||
|
||||
|
||||
switch (mode) {
|
||||
case KEY_NORMAL:
|
||||
wscpy (Nguide, WCSJrun);
|
||||
|
|
@ -357,7 +415,8 @@ set_guide_line(mode) int mode;
|
|||
}
|
||||
}
|
||||
|
||||
disp_mode() {
|
||||
disp_mode ()
|
||||
{
|
||||
Conversion *cv;
|
||||
int c_code;
|
||||
wchar16_t *Pmode, *Bmode;
|
||||
|
|
@ -425,15 +484,15 @@ disp_mode() {
|
|||
print_guide_line ();
|
||||
}
|
||||
|
||||
TopGuide() {
|
||||
TopGuide ()
|
||||
{
|
||||
unsigned short row, col;
|
||||
|
||||
StartGuide (&row, &col);
|
||||
}
|
||||
|
||||
guide_print (s1, s2)
|
||||
wchar16_t* s1,
|
||||
*s2;
|
||||
wchar16_t *s1, *s2;
|
||||
{
|
||||
unsigned short row, col;
|
||||
|
||||
|
|
|
|||
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