;;	-*-Emacs-Lisp-*-
;; Standard Start Up File for EGG
;; Copyright (C) 1992 Free Software Foundation, Inc.
;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs).

;; Mule is free software distributed in the form of patches to GNU Emacs.
;; You can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 1, or (at your option)
;; any later version.

;; Mule is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

;;;	 Version 1.0
;;;      Written by Satoru.Tomura@etl.jp 1988
;;;      modified for LUNA'default  ryuji@nfa.ncl.omron.junet
;;;
;;;      modified for Wnn V4 - Use compatible library of Wnn v3
;;;	 Copyright 1989 OMRON Tateisi Electronics, Co.
;;;	 1989 7/12 by H.Kuribayashi kuri@frf.oron.junet

;;; 92.5.19  modified for Wnn V4 by T.Shingu <shingu@cpr.canon.co.jp>
;;;	Use non compatible library.
;;; 93.1.8   file names of frequency and private dictionary ware adjusted
;;;	to Wnn version 4.1.
;;; 93.4.2   dictianary, frequency files are set up on normal/reverse
;;;	environment individually.
;;; 93.6.30  specifying default user directory to make customize easily
;;;	suggested by K.Sakai <ksakai@mtl.t.u-tokyo.ac.jp>

;(defvar wnn-usr-dic-dir "usr/$USER")
(defvar wnn-usr-dic-dir (concat "usr/" (user-login-name)))

(defun wnn7-jserver-setup ()
       (set-wnn-reverse nil)
       ;; maindic
       (set-wnn-fuzokugo "system/kougo.fzk")
       (add-wnn-fisys-dict "system/fisd"
			   (concat wnn-usr-dic-dir "/fisd.h") t)
       (add-wnn-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil)
       (add-wnn-dict "system/kihon.dic"
		     (concat wnn-usr-dic-dir "/kihon.h") 6 nil t)
       (add-wnn-dict "system/symbol.dic"
		     (concat wnn-usr-dic-dir "/symbol.h") 1 nil t)
;       (add-wnn-dict "system/symbol_noat.dic"
;		     (concat wnn-usr-dic-dir "/symbol_noat.h") 1 nil t)
       (add-wnn-dict "system/tel.dic"
		     (concat wnn-usr-dic-dir "/tel.h") 1 nil t)
       (add-wnn-dict "system/zip.dic"
		     (concat wnn-usr-dic-dir "/zip.h") 1 nil t)
       (add-wnn-dict "system/tankan.dic" "" 1 nil nil)
       (add-wnn-dict "system/tankan2.dic" "" 1 nil nil)
       (add-wnn-dict "system/ikeiji.dic" "" 1 nil nil)
       (add-wnn-dict "system/rensou.dic" "" 1 nil nil)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t)

       ;; optiondic
       (add-wnn-dict "option/jinmei.dic"
		     (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t)
       (add-wnn-dict "option/chimei.dic"
		     (concat wnn-usr-dic-dir "/chimei.h") 1 nil t)
       (add-wnn-dict "option/address.dic"
		     (concat wnn-usr-dic-dir "/address.h") 1 nil t)
       (add-wnn-dict "option/station.dic"
		     (concat wnn-usr-dic-dir "/station.h") 1 nil t)
       (add-wnn-dict "option/kana_english.dic"
		     (concat wnn-usr-dic-dir "/kana_english.h") 1 nil t)
       (add-wnn-dict "option/enterprise.dic"
		     (concat wnn-usr-dic-dir "/enterprise.h") 1 nil t)
       (add-wnn-dict "option/airport.dic"
		     (concat wnn-usr-dic-dir "/airport.h") 1 nil t)
       (add-wnn-dict "option/university.dic"
		     (concat wnn-usr-dic-dir "/university.h") 1 nil t)
       (add-wnn-dict "option/zoo.dic"
		     (concat wnn-usr-dic-dir "/zoo.h") 1 nil t)
       (add-wnn-dict "option/botanical_garden.dic"
		     (concat wnn-usr-dic-dir "/botanical_garden.h") 1 nil t)
       (add-wnn-dict "option/aquarium.dic"
		     (concat wnn-usr-dic-dir "/aquarium.h") 1 nil t)
       (add-wnn-dict "option/conveni.dic"
		     (concat wnn-usr-dic-dir "/conveni.h") 1 nil t)
       (add-wnn-dict "option/amusement.dic"
		     (concat wnn-usr-dic-dir "/amusement.h") 1 nil t)

       ;; computerdic 2001/12/07
       (add-wnn-dict "option/computer.dic"
		     (concat wnn-usr-dic-dir "/computer.h") 1 nil t)

       (set-wnn-param  5 10 2 45 0  80 5 1 20  0 400 -100 400   80 200 2 200)

       (add-wnn-notrans-dict (concat wnn-usr-dic-dir "/muhenkan") 15 t)
       (add-wnn-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t)

       (set-last-is-first-mode t)
       (set-okuri-learn-mode t)
       (set-complex-conv-mode nil)
       (set-okuri-flag -1)
       (set-prefix-flag 0)
       (set-prefix-learn-mode t)
       (set-suffix-learn-mode t)
       (set-common-learn-mode t)
       (set-freq-func-mode 4)
       (set-numeric-mode -12)
       (set-alphabet-mode -30)
       (set-symbol-mode -40)
       (set-yuragi-mode nil)
       (wnn7-set-boin-kabusoku t)
       (wnn7-set-n-choka t)
       (wnn7-set-shiin-choka t)
       (wnn7-set-nihongo-kosei t)

       (set-wnn-reverse t)
       (set-wnn-fuzokugo "system/kougo.fzk")
       (add-wnn-dict "system/kihonR.dic" "" 1 nil nil)
       (add-wnn-dict "system/telR.dic" "" 1 nil nil)
       (add-wnn-dict "system/zipR.dic" "" 1 nil nil)
       (add-wnn-dict "system/tankanR.dic" "" 1 nil nil)
       (add-wnn-dict "system/tankan2R.dic" "" 1 nil nil)
       (add-wnn-dict "option/jinmeiR.dic" "" 1 nil nil)
       (add-wnn-dict "option/chimeiR.dic" "" 1 nil nil)
       (add-wnn-dict "option/addressR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/stationR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/enterpriseR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/airportR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/universityR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/zooR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/botanical_gardenR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/aquariumR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/conveniR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/amusementR.dic" "" 1 nil nil)
;       (add-wnn-dict "option/computerR.dic" "" 1 nil nil)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t)
       (set-wnn-param  2 10 2 45 1 80 5 1 50 -20 400 -10  100  -100 200 0 200)
       )

(defun wnn6-jserver-setup ()
       (set-wnn-reverse nil)
       (set-wnn-fuzokugo "iwanami/kougo.fzk")
       (add-wnn-fisys-dict "iwanami/fisd"
			   (concat wnn-usr-dic-dir "/fisd.h") t)
       (add-wnn-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil)
       (add-wnn-dict "iwanami/kihon.dic"
		     (concat wnn-usr-dic-dir "/kihon.h") 6 nil t)
       (add-wnn-dict "iwanami/symbol.dic"
		     (concat wnn-usr-dic-dir "/symbol.h") 1 nil t)
       (add-wnn-dict "iwanami/tankan.dic" "" 1 nil nil)
       (add-wnn-dict "iwanami/tankan2.dic" "" 1 nil nil)
       (add-wnn-dict "iwanami/tel.dic" "" 1 nil nil)
       (add-wnn-dict "iwanami/zip.dic" "" 1 nil nil)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t)
;       (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil)
;       (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil)
       (set-wnn-param  5 10 2 45 0  80 5 1 20  0 400 -100 400   80 200 2 200)

       (add-wnn-notrans-dict (concat wnn-usr-dic-dir "/katakana") 15 t)
       (add-wnn-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t)

       (set-last-is-first-mode t)
       (set-complex-conv-mode nil)
;       (set-okuri-flag -1)
       (set-prefix-flag 0)
       
       (set-okuri-learn-mode t)
       (set-prefix-learn-mode t)
       (set-suffix-learn-mode t)
       (set-common-learn-mode t)
       (set-yuragi-mode nil)

       (set-freq-func-mode 4)

;       (set-numeric-mode -12)
;       (set-alphabet-mode -30)
;       (set-symbol-mode -40)
       
       (set-wnn-reverse t)
       (set-wnn-fuzokugo "iwanami/kougo.fzk")
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t)
       (set-wnn-param  2 10 2 45 1 80 5 1 50 -20 400 -10  100  -100 200 0 200)

       )


(defun wnn4-jserver-setup ()
       (set-wnn-reverse nil)
       (set-wnn-fuzokugo "pubdic/full.fzk")
       (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t)
       (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t)
       (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t)
       (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t)
       (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t)
       (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t)
       (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t)
       (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t)
       (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil)
       (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
;       (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil)
;       (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil)
       (set-wnn-param  2 10 2 45 5  80 5 1 40  0 400 -100 400   80 200 2 200)
       (set-wnn-reverse t)
       (set-wnn-fuzokugo "pubdic/full.fzk")
       (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t)
       (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t)
       (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t)
       (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t)
       (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t)
       (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t)
       (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t)
;       (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t)
       (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil)
       (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
;       (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil)
;       (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil)
       (set-wnn-param  2 10 2 45 1 80 5 1 50 -20 400 -10  100  -100 200 0 200)

)

(cond ((eq wnn-server-type 'jserver)
       (cond ((and (fboundp 'is-wnn7-server)
		   (is-wnn7-server))
	      (wnn7-jserver-setup))
	     ((and (fboundp 'is-wnn6-server)
		   (is-wnn6-server))
	      (wnn6-jserver-setup))
	     (t
	      (wnn4-jserver-setup))))
      ((eq wnn-server-type 'cserver)
       (set-wnn-reverse nil)
       (set-wnn-fuzokugo "sys/full.con")
       (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t)
       (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t)
       (add-wnn-dict "sys/basic.dic"	(concat wnn-usr-dic-dir "/basic.h") 7 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
       (set-wnn-param 1 5  2 750 10 80 10 5 1000 50  0  -200  0  0  0  16  0)
       (set-wnn-reverse t)
       (set-wnn-fuzokugo "sys/full.con")
       (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t)
       (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t)
       (add-wnn-dict "sys/basic.dic"	(concat wnn-usr-dic-dir "/basic.h") 7 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
       (set-wnn-param 1 5  2 750 10 80 10 5 1000 50  0  -200  0  0  0  16  0)
       )
      ((eq wnn-server-type 'tserver)
       (set-wnn-reverse nil)
       (set-wnn-fuzokugo "sys/full.con")
       (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t)
       (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
       (set-wnn-param 1 5 2 750 10 80 10 5 1000 50  0 -200 0 0 0 16 0)
       (set-wnn-reverse t)
       (set-wnn-fuzokugo "sys/full.con")
       (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t)
       (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
       (set-wnn-param 1 5 2 750 10 80 10 5 1000 50  0 -200 0 0 0 16 0)
       )
      ((eq wnn-server-type 'kserver)
       (set-wnn-reverse nil)
       (set-wnn-fuzokugo "sys/full.fzk")
					;       (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t)
       (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
					;       (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t)
					;       (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t)
       (set-wnn-param 1 5 2 750 10 80 10 5 1000 50  0 -200 0 0 0 16 0)
       (set-wnn-reverse t)
       (set-wnn-fuzokugo "sys/full.fzk")
					;       (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t)
       (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t)
       (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t)
					;       (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t)
					;       (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t)
       (set-wnn-param 1 5 2 750 10 80 10 5 1000 50  0 -200 0 0 0 16 0)
       )
      )

;;       N nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt suuji kana eisuu kigou toji_kakko fuzokogo kaikakko

