Index: lang/elisp/pdicv-mode/trunk/README.utf8
===================================================================
--- lang/elisp/pdicv-mode/trunk/README.utf8 (revision 67)
+++ lang/elisp/pdicv-mode/trunk/README.utf8 (revision 67)
@@ -0,0 +1,37 @@
+■ PDICViewer for Emacs ----- PDIC形式の辞書を emacs (mule) から検索するツール
+
+　　Emacs 上で PDIC フォーマットの辞書ファイルを検索するためのプログラムです。
+
+　　アルク刊「英辞郎」赤本・黒本CD-ROMに収録されているPDIC形式の辞書データや、
+　　インターネット上で入手可能なPDIC形式の様々な辞書データリソースが利用できます。
+
+　　Unicode(BOCU)辞書にも対応しています。（要(?)Mule-UCS）
+
+◎ 著作権
+
+　　このプログラムは、GNU 一般公用許諾書の「バージョン2」或いは
+　　それ以降の適当なバージョンに従って、利用または再配布することを許可された
+　　フリーソフトウェアです。
+　　正確な再配布条件は COPYING に記載されています。
+
+◎ 免責事項
+
+　　このプログラムのご利用に際して発生した直接・間接の損害に対し、作者は
+　　いかなる責任も負いません。ご利用は、ユーザ自身の責任において行って下さい。
+
+◎ その他の情報
+
+　　インストール手順については、INSTALL を参照して下さい。
+
+　　バグ・感想などについては作者までご連絡ください。
+
+◎ 作者連絡先
+
+　　Naochan (Naoya TOZUKA) <pdicviewer@gmail.com>
+　　http://www.naochan.com/
+　　http://d.hatena.ne.jp/naoya_t/
+
+◎ 一次配布元
+
+　　http://pdicviewer.naochan.com/el/
+
Index: lang/elisp/pdicv-mode/trunk/pdicv-eijiro.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/pdicv-eijiro.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/pdicv-eijiro.el (revision 67)
@@ -0,0 +1,46 @@
+;;; pdicv-eijiro.el --- around eijiro
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 06 Feb 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.9.1
+;; Keywords: eijiro waeijiro
+
+(provide 'pdicv-eijiro)
+
+;;; Commentary:
+
+; (pdicv-eijiro-search WORD-TO-SEARCH [REGEXP-P])
+;   - �Ѽ�Ϻ/��Ѽ�Ϻ�������������ɽ������ġ�;
+; (pdicv-eijiro-search-interactive WORD-TO-SEARCH)
+;   - <interactive> �ߥ˥Хåե����������ñ������; (pdicv-eijiro-search-region FROM TO)
+;   - <interactive> ����Ϥ��������;; Code:
+
+(require 'pdicv-search)
+
+;
+; applied functions
+;
+(defun pdicv-eijiro-search (word-to-search &optional regexp-p)
+  "search in EIJIRO/WAEIJIRO"
+  (if (>= (aref word-to-search 0) 128)
+      (pdicv-search 'waeijiro word-to-search regexp-p)
+    (pdicv-search 'eijiro word-to-search regexp-p))
+  )
+
+(defun pdicv-eijiro-search-interactive (word-to-search)
+  (interactive "sWord to search: ")
+  (if (> (length word-to-search) 0)
+      (pdicv-eijiro-search word-to-search)))
+
+(defun pdicv-eijiro-search-region (from to)
+  ""
+  (interactive "r")
+  (pdicv-eijiro-search (buffer-substring from to)))
+
+;;; pdicv-search.el ends here
Index: lang/elisp/pdicv-mode/trunk/nt-string.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-string.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-string.el (revision 67)
@@ -0,0 +1,151 @@
+;;; nt-string.el --- NT's string utilities
+
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 16 Feb 2005
+;; Last modified: 15 Dec 2005
+;; Version: 1.0
+;; Keywords: replace-in-string strcmp trim
+
+(provide 'nt-string)
+
+;;; Commentary:
+;
+; (nt:strcmp S1 S2)
+; (nt:strncmp S1 S2 N)
+;   - C��� strcmp(), strncmp() �ؿ���ߥ����Ȥ�����;
+; (nt:replace-all STR REGEXP SUBST)
+; (nt:replace-in-string*DEPRECATED STR REGEXP SUBST)
+;   - ʸ��TR ��Ρ����ɽ�� REGEXP �˰�����ʬ�򤹤٤�;     ��ʸ��UBST ��ִ����롣
+;
+; (nt:rtrim STR)
+; (nt:ltrim STR)
+; (nt:trim STR)
+;   - ʸ��TR �α�¦����¦������ξ��ζ���롣
+
+;;; Code:
+(require 'nt-macros)
+
+(defmacro nt:strncmp (s1 s2 n)
+  "strncmp()"
+  `(nt:strcmp ,s1 ,s2 ,n))
+
+(defun nt:strcmp (s1 s2 &optional n)
+  "strcmp()"
+  (catch 'strcmp
+    (let* ((s1-length (length s1))
+           (s2-length (length s2))
+           (strncmp-p n) ; (not (null n))) ; t/nil
+           (i 0))
+
+      (if n
+          (if (or (> n s1-length) (> n s2-length))
+              (setq n nil strncmp-p nil)))
+      (if (null n) 
+          (setq n (min s1-length s2-length)))
+
+      (if (zerop n) (throw 'strcmp 0))
+
+
+      (while (< i n)
+        (let ((s1-i (aref s1 i))
+              (s2-i (aref s2 i)))
+          (if (/= s1-i s2-i) (throw 'strcmp (- s1-i s2-i)))
+          );let
+        (setq i (1+ i))
+        );wend
+
+      ;nʸ����1=s2
+      (if strncmp-p
+          ;; strncmp()
+          0
+        ;; strcmp()
+        (throw 'strcmp (- s1-length s2-length)))
+      );let
+    0
+    );caught
+  )
+
+(defun nt:replace-in-string*DEPRECATED (str r n)
+  "replace /r/ in str --> n"
+  (catch 'replace-in-string
+    (let* ((result "")
+           (s-len (length str))
+           (r-len (length r))
+           (till (- s-len r-len))
+           (i 0) (at 0))
+      (while (<= i till)
+        (setq at (string-match r str i))
+        (if (null at) (throw 'replace-in-string (concat result (substring str i))))
+
+        (setq result (concat result (substring str i at) n))
+        (setq i (+ at r-len))
+        ); wend
+      result
+      ); let
+    ); caught
+  )
+
+(defun nt:replace-all (str regex subst)
+  "replace /regex/ in str --> subst"
+  (let ((ofs 0)
+        (last (length str))
+        (result ""))
+    (catch 'while
+      (while (< ofs last)
+        (let ((found-at nil))
+          (if (setq found-at (string-match regex str ofs))
+              (progn
+                (setq result (concat result (substring str ofs found-at) subst))
+                (setq ofs (match-end 0))
+                )
+            (progn
+              (setq result (concat result (substring str ofs last)))
+              (throw 'while nil)
+              ))
+          );let
+        );wend
+      );caught
+    result
+    );let
+  )
+
+(defun nt:rtrim (str)
+  "rtrim"
+  (catch 'rtrim
+    (let ((i (1- (length str))))
+      (while (> i 0)
+        (if (> (aref str i) #x20) (throw 'rtrim (substring str 0 (1+ i))))
+        (-- i)
+        );wend
+      );let
+    );caught
+  )
+
+(defun nt:ltrim (str)
+  "ltrim"
+  (catch 'ltrim
+    (let ((len (length str)) (i 0))
+      (while (< i len)
+        (if (> (aref str i) #x20) (throw 'ltrim (substring str i len)))
+        (++ i)
+        );wend
+      );let
+    );caught
+  )
+
+;(defun nt:trim (str)
+;  "trim"
+;  (nt:ltrim (nt:rtrim str))
+;  )
+(defmacro nt:trim (str)
+  "trim"
+  `(nt:ltrim (nt:rtrim ,str))
+  )
+
+;;; nt-string.el ends here
Index: lang/elisp/pdicv-mode/trunk/pdicv-mode.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/pdicv-mode.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/pdicv-mode.el (revision 67)
@@ -0,0 +1,59 @@
+;; pdicviewer.el - PDIC Viewer for Emacs
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 14 Feb 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.9.1
+;; Keywords: PDIC dictionary search eijiro
+;;
+
+;;; Commentary:
+;;
+;; PDIC�ե����ޥåȤμ��񤫤鸡��ޤ���
+;; ���ڤӺ��ۤκݤϡ�GNU ����������ʥС������˽��äƲ�������
+;;
+;; �켡����
+;;    http://pdicviewer.naochan.com/el/
+
+(provide 'pdicv-mode)
+
+;;; Code:
+(require 'pdicv-core)
+(require 'pdicv-search)
+(require 'pdicv-eijiro)
+
+;; minor-mode
+(easy-mmode-define-minor-mode
+ ;; mode
+ pdicv-mode
+ ;; doc
+ "Toggle pdicv mode."
+ ;; init-value (���icv-mode �ν��)
+ nil ;;initial
+ ;; mode indicator
+ " pdicv"
+ ;; keymap
+ '(("\C-c\C-d" . pdicv-set-target-dictionary)
+   ("\C-c\C-a" . pdicv-search-current-word)
+   ("\C-c\C-c" . pdicv-search-next-word)
+   ("\C-c\C-b" . pdicv-search-previous-word))
+ )
+
+; (eword-encoding pron-encoding jword-encoding example-encoding) )
+(defvar pdicv-dictionary-list '()) ;; pdicviewer.el �ˤ���defvar pdicv-inited-p nil)
+
+;(pdicv-init)
+
+;;;###autoload
+(defun pdicviewer ()
+  ""
+  (interactive)
+  (pdicv-init)
+  )
+
+;;; pdicviewer.el ends here
Index: lang/elisp/pdicv-mode/trunk/pdicv-core.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/pdicv-core.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/pdicv-core.el (revision 67)
@@ -0,0 +1,537 @@
+;;; pdicv-core.el --- core functions for PDIC-formatted dictionaries
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 14 Feb 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.9.1
+;; Keywords: PDIC dictionary search
+
+(provide 'pdicv-core)
+;(put 'pdicv-core 'version "0.9.1")
+
+;;; Commentary:
+
+; (pdicv-get-header-info FILENAME)
+;    - �إå���߼�
+;
+; (pdicv-get-index-list FILENAME [WORD-ENCODING])
+;    - PDIC��������뤫�顢����å����ꥹ�Ȥ��;
+; (pdicv-scan-datablock FILENAME PHYS CRITERIA-FUNC)
+;    - �ǡ����֥����򥹥���
+;
+; (pdicv-core-search DICINFO CRITERIA [SIMPLE-MODE-P DONT-CLEAR-P])
+;    - PDIC��������롼���;
+
+;;; Code:
+(require 'nt-macros)
+(require 'nt-readval)
+(require 'nt-string)
+(require 'nt-bocu)
+(require 'nt-file)
+(require 'nt-english)
+
+; decoder
+(defvar pdicv-null-decoder (lambda (s) s))
+(defvar pdicv-sjis-decoder (lambda (s) (decode-coding-string s 'japanese-shift-jis-dos)))
+(defvar pdicv-latin1-decoder (lambda (s) (decode-coding-string s 'iso-latin-1-dos)))
+(defvar pdicv-bocu-decoder (lambda (s) (nt:bocu-decode s)))
+(defmacro pdicv-create-decoder (encoding)
+  "create a decoder from user-specified encoding"
+  `(lambda (s) (decode-coding-string s ,encoding)))
+
+(defvar pdicv-index-table-list ())
+
+(defvar pdicv-result-height 8)
+;
+; �إå���߼�
+;
+(defun pdicv-get-header-info (filename)
+  "[PDIC] Get Header Info"
+  (catch 'pdicv-get-header-info
+    (let* ((header-buf (nt:read-from-file filename 0 256))
+           ;
+           (headername nil);(substring header-buf 1 100))
+           (dictitle nil);(substring header-buf 101 140))
+           (version (nt:read-short header-buf 140))
+           (lword (nt:read-short header-buf 142))
+           (ljapa (nt:read-short header-buf 144))
+           (block-size (nt:read-short header-buf 146))
+           (index-block (nt:read-short header-buf 148))
+           (header-size (nt:read-short header-buf 150))
+           (index-size (nt:read-ushort header-buf 152))
+           (empty-block (nt:read-short header-buf 154))
+           (nindex (nt:read-short header-buf 156))
+           (nblock (nt:read-short header-buf 158))
+           (nword (nt:read-ulong header-buf 160))
+           (dicorder (nt:read-uchar header-buf 164))
+           (dictype (nt:read-uchar header-buf 165)) (dictype* nil)
+           (attrlen (nt:read-uchar header-buf 166))
+                                        ; NEWDIC2-
+           (olenumber 0) (os nil)
+           (lid-word 0) (lid-japa 0) (lid-exp 0) (lid-pron 0) (lid-other 0)
+                                        ; NEWDIC3-
+           (extheader 0) (index-blkbit 0) (cypt nil) (update-count 0)
+           (dicident nil)
+           ;;
+           (major-version (/ version 256))
+           (datablock-size (* nblock block-size))
+           (bocu nil)
+           )
+
+      (setq version
+            (nth major-version '(not-supported not-supported newdic1 newdic2 newdic3 newdic4)))
+
+      (setq dicorder
+            (nth (nt:read-uchar header-buf 164) '(code-order ignore-case dictionary-order order-descendant)))
+
+      (if (> (logand dictype 128) 0) (setq dictype* (cons 'tree-view-mode dictype*)))
+      (if (> (logand dictype 64) 0) (setq dictype* (cons 'crypted dictype*)))
+;     (if (> (logand dictype 32) 0) (setq dictype* (cons 'multilingual dictype*)))
+      (if (> (logand dictype 16) 0) (setq dictype* (cons 'unicode dictype*)))
+      (if (> (logand dictype 8) 0) (setq dictype* (cons 'bocu dictype*)))
+      (if (> (logand dictype 1) 0) (setq dictype* (cons 'ar-compressed dictype*)))
+
+      (if (= major-version 5)
+          (progn "HyperDIC, Ver 5.00"
+                 (setq os (nt:read-char header-buf 167))
+                 (setq os (cond ((= os 0) 'sjis-crlf)
+                                ((= os 1) 'sjis-cr)
+                                ((= os 2) 'sjis-lf)
+                                ((= os 3) 'euc-lf)
+                                ((= os 4) 'jis-lf)
+                                ((= os 32) 'bocu)
+                                ))
+                 (if (eq os 'bocu) (setq bocu t))
+                 (setq olenumber (nt:read-long header-buf 168))
+			       ;(setq lid-word (short header-buf 172))
+			       ;(setq lid-japa (short header-buf 174))
+				;(setq lid-exp (short header-buf 176))
+			       ;(setq lid-pron (short header-buf 178))
+			      ;(setq lid-other (short header-buf 180))
+                 (setq index-blkbit (if (= (nt:read-uchar header-buf 182) 1) 32 16))
+		 ; dummy0 @185
+                 (setq extheader (nt:read-ulong header-buf 184))
+                 (setq empty-block (nt:read-long header-buf 188)) ;overwrite
+                 (setq nindex (nt:read-long header-buf 192)) ;overwrite
+                 (setq nblock (nt:read-long header-buf 196)) ;overwrite
+                 (setq datablock-size (* nblock block-size))
+                 (setq cypt (substring header-buf 200 208)) ;- reserved[8]
+                 (setq update-count (nt:read-ulong header-buf 208))
+                                        ; dummy00 @212[4]
+                 (setq dicident (substring header-buf 216 224))
+                                        ;(setq dummy (substring header-buf 224 256))
+                 (setq index-size (* index-block block-size)) ;overwrite
+
+                 );progn
+        (progn "< 5.0"
+               (if (>= major-version 3)
+                   (progn "NEWDIC2-"
+                          (setq olenumber (nt:read-long header-buf 167))
+                                        ;(setq os (byte (substring header-buf 172 173)))
+                          (setq os (nth (nt:read-char header-buf 171) '(sjis-crlf)))
+                                        ;(setq lid-word (short header-buf 172))
+                                        ;(setq lid-japa (short header-buf 174))
+                                        ;(setq lid-exp (short header-buf 176))
+                                        ;(setq lid-pron (short header-buf 178))
+                                        ;(setq lid-other (short header-buf 180))
+                          ))
+               (if (>= major-version 4)
+                   (progn "NEWDIC3-"
+                          (setq extheader (nt:read-ulong header-buf 182))
+                          (setq empty-block (nt:read-long header-buf 186)) ;overwrite
+                          (setq nindex (nt:read-long header-buf 190)) ;overwrite
+                          (setq nblock (nt:read-long header-buf 194)) ;overwrite
+                          (setq datablock-size (* nblock block-size))
+                          (setq index-blkbit (if (= (nt:read-uchar header-buf 198) 1) 32 16))
+                          (setq cypt (substring header-buf 200 208))
+                          (setq update-count (nt:read-ulong header-buf 207))
+                                        ;(setq dummy (substring header-buf 212 256))
+                          (setq index-size (* index-block block-size)) ;overwrite
+                          ))
+	       ); < 5.0
+	);fi
+      
+      (list
+;       (cons 'headername headername)   ;
+;       (cons 'dictitle dictitle)       ;
+       (cons 'version version)         ;
+       (cons 'lword lword)             ;
+       (cons 'ljapa ljapa)             ;
+       (cons 'block-size block-size)   ;
+       (cons 'index-block index-block) ;
+       (cons 'header-size header-size) ;
+       (cons 'index-size index-size)   ;
+       (cons 'empty-block empty-block) ;
+       (cons 'nindex nindex)           ;
+       (cons 'nblock nblock)           ;
+       (cons 'nword nword)             ;
+       (cons 'dicorder dicorder)       ;
+       (cons 'dictype dictype*)        ;
+       (cons 'attrlen attrlen)         ;
+       (cons 'os os)                   ;
+                                        ;       (cons 'lid-word lid-word) ;
+                                        ;       (cons 'lid-japa lid-japa) ;
+                                        ;       (cons 'lid-exp lid-exp) ;
+                                        ;       (cons 'lid-pron lid-pron) ;
+                                        ;       (cons 'lid-other lid-other) ;
+       (cons 'extheader extheader) ;
+       (cons 'index-blkbit index-blkbit) ;(0=16,1=32)
+       (cons 'cypt cypt) ;
+       (cons 'update-count update-count) ;
+       
+       (cons 'index-begins-at (+ header-size extheader))
+       (cons 'datablock-begins-at (+ header-size extheader index-size))
+       (cons 'datablock-ends-at (+ header-size extheader index-size datablock-size))
+       (cons 'datablock-size datablock-size)
+       (cons 'bocu bocu)
+       ); list
+      ); let*
+    ); caught
+  )
+
+(defun pdicv-get-index-list (filename &optional word-encoding)
+  "[PDICV] Get the index list from PDIC file"
+  (let* (
+         (header (pdicv-get-header-info filename))
+         (index-buf (nt:read-from-file filename
+				    (-> header 'index-begins-at) (-> header 'index-size)))
+
+         (32bit-address-mode (if (= (-> header 'index-blkbit) 32) t nil))
+
+         (ix 0) (ix-max (-> header 'nindex))
+         (ofs 0)
+         (index-list ())
+         )
+
+    (while (< ix ix-max)
+      (let ((phys -1) (word "") (word* nil))
+        (if 32bit-address-mode
+            (progn (setq phys (nt:read-ulong index-buf ofs)) (setq ofs (+ ofs 4)))
+          (progn (setq phys (nt:read-ushort index-buf ofs)) (setq ofs (+ ofs 2)))
+          )
+        (setq word* (nt:read-cstring index-buf ofs)) (setq ofs (+ ofs (cdr word*) 1))
+        (setq word (car word*))
+;	(cond
+;	 ((eq word-encoding 'bocu)
+;	  (setq word (nt:bocu-decode word)))
+;	 ((eq word-encoding 'sjis)
+;	  (setq word (decode-coding-string word 'japanese-shift-jis-dos)))
+;	 (word-encoding
+;	  (setq word (decode-coding-string word word-encoding)))
+;	 (t nil))
+
+;	(setq index-list (cons (cons phys word) index-list))
+        (push (cons phys word) index-list)
+        (setq ix (1+ ix))
+        );let
+      )
+    (nreverse index-list)
+    )
+  )
+
+(defface pdicv-face-dummy
+  '((( (class color) (background light) )
+     (:foreground "green" :background "SlateGray1" :weight bold))
+    (t
+     (:foreground "red" :background "black"))) ; :weight bold
+    "Face for caption")
+(defface pdicv-face-caption-red
+  '((t (:foreground "red" :background "black")))
+  "Face for caption")
+(defface pdicv-face-caption-blue
+  '((t (:foreground "blue" :background "black")))
+  "Face for caption")
+(defface pdicv-face-caption-green
+  '((t (:foreground "green" :background "black")))
+  "Face for caption")
+(defface pdicv-face-gray
+  '((t (:foreground "gray")))
+  "Face for text")
+
+(defvar pdicv-default-inserter
+      (lambda (eword pron jword example)
+        (progn
+          (set-text-properties 0 (length eword) '(face bold) eword)
+                                        ;	(set-text-properties 0 (length eword) '(face pdicv-face-caption-green) eword)
+                                        ;	(set-text-properties 0 (length jword) '(face pdicv-face-caption-gray) jword)
+
+          (setq jword (nt:replace-all jword "����/ "))
+          (setq jword (nt:replace-all jword "\n" "\n  "))
+
+          (let ((buf ""))
+            (setq buf eword)
+            (if (string< "" pron) (setq buf (concat buf " [" pron "]")))
+                                        ;		(setq result (concat result " : " jword))
+            (setq buf (concat buf "\n  " jword))
+            (if (string< "" example) (setq buf (concat buf "\n  - " example))
+                                        ;	      (setq buf (concat buf "\n"))
+              )
+;            (setq buf (concat buf "\n\n"))
+            (setq buf (concat buf "\n"))
+
+            (insert buf)
+            ); let
+          ); progn
+        );lambda
+      )
+;;
+;;
+;;
+(defun pdicv-scan-datablock (filename phys criteria-func)
+  "[PDICV] scan a datablock"
+;  (insert (format "pdicv-scan-datablock (%s %d ...)\n" filename phys))
+  (catch 'pdicv-scan-datablock
+    (let* ((result ()) ;(match-count 0)
+           (header (pdicv-get-header-info filename))
+           (offset (+ (-> header 'datablock-begins-at) (lsh phys 8)))
+	   (aligned (if (eq (-> header 'version) 'newdic4) t nil))
+;	   (bocu (-> header 'bocu))
+           (head-word (nt:read-ushort (nt:read-from-file filename offset 2)))
+           (blocks (logand 32767 head-word))
+           (block-length (- (lsh blocks 8) 2))
+           (field-size (if (zerop (logand 32768 head-word)) 2 4))
+           (datablock (nt:read-from-file filename (+ offset 2) block-length))
+                                        ;    (list blocks field-size datablock)
+           (p 0)
+           (field-length 0)
+           (compress-length 0)
+           (rest nil)
+           (eword "") (eword-attrib 0)
+           )
+
+      (while (< p block-length) ;    (while (< p field-size)
+        (setq field-length
+              (if (= field-size 2) (nt:read-ushort datablock p) (nt:read-ulong datablock p)) )
+        (if (zerop field-length) (throw 'pdicv-scan-datablock (nreverse result))); sfield-list))
+        (setq p (+ p field-size)) ;2�ʤ���4�Х���        (setq compress-length (nt:read-uchar datablock p)) ; �����
+        (setq p (1+ p))
+
+        (if aligned (progn
+                      (setq eword-attrib (nt:read-uchar datablock p)) ; ���Ф����
+                      (setq p (1+ p))
+                      ))
+                                        ; ���Ф����ߤ�ꤢ���� rest �����
+        (setq rest (substring datablock p (+ p field-length)))
+        (setq p (+ p field-length))
+                                        ; ���Ф���NULL��ü)
+        (let* ((eword-cstr (nt:read-cstring rest))
+               (eword-compressed (car eword-cstr)) (eword-len (cdr eword-cstr))
+               (q 0)
+               (level 0)
+               (extended nil)
+               (jword-cstr nil) (jword "") (jword-len 0)
+               (ext-list nil)
+               (example "") (pron "") (link "")
+               )
+
+          (setq eword (if (zerop compress-length)
+                          eword-compressed
+                        (concat (substring eword 0 compress-length) eword-compressed)
+                        ))
+          (setq q (1+ eword-len))
+                                        ; ���Ф����
+          (if (not aligned) (progn
+                              (setq eword-attrib (nt:read-uchar rest q))
+                              (setq q (1+ q))
+                              ))
+          (setq level (logand eword-attrib 15))
+;	  (insert (format ": %s %d %d\n" eword eword-len eword-attrib))
+;;	  (if (zerop (logand eword-attrib 128))
+;;	      (throw 'pdicv-scan-datablock ()); 'illegal)
+          (setq eword-attrib (logand eword-attrib 127))
+
+          (setq extended (if (zerop (logand eword-attrib 16)) nil t))
+          (if extended
+              (progn ;���
+                (setq jword-cstr (nt:read-cstring rest q))
+                (setq jword (car jword-cstr)) (setq jword-len (cdr jword-cstr))
+                (setq q (+ q jword-len 1))
+                (setq ext-list nil)
+                (catch 'while
+                  (while (< q field-length)
+                    (let* ((ex-attrib (nt:read-uchar rest q))
+                           (ex-attrib-sub (logand ex-attrib 15))
+                           (exdata-cstr nil)
+                           (exdata "") (exdata-len 0) )
+                      (if (= (logand ex-attrib 128) 128) (throw 'while t))
+                      (setq q (1+ q))
+                      (setq exdata-cstr (nt:read-cstring rest q))
+                      (setq exdata (car exdata-cstr))
+                      (setq exdata-len (cdr exdata-cstr))
+                      (cond
+                       ((= ex-attrib-sub 1) (setq example exdata))
+                       ((= ex-attrib-sub 2) (setq pron exdata))
+                       ((= ex-attrib-sub 4) (setq link exdata))
+                       (t nil))
+                      (setq q (+ q exdata-len 1))
+                      ) ; let*
+                    ) ; while
+                  ) ; catch while2
+                ) ; progn
+            (progn ;ɸ��             (setq jword (substring rest q))
+              (setq pron "")
+              (setq example "")
+              ) ; progn
+            ) ; if extended
+
+                                        ;	  (insert (format "- %s\n" eword))
+          (if (funcall criteria-func eword pron jword example)
+              (push (list eword pron jword example) result))
+          );let
+        ); wend
+      (nreverse result)
+      ); let*
+    ) ;catch(0)
+  )
+
+(defun pdicv-core-search (dicinfo criteria &optional simple-mode-p dont-clear-p)
+  "search in PDIC"
+  (let* ((dicname (car dicinfo))
+         (dicfile (nth 1 dicinfo))
+         (encoding-list (nth 2 dicinfo))
+         (decoder-list ())
+         (index-table (-> pdicv-index-table-list dicname))
+         )
+;    (if (null index-table) (setq index-table (pdicv-get-index-list dicfile)))
+
+    (if (atom encoding-list) ;; expand encoding-list
+        (setq encoding-list (list encoding-list encoding-list encoding-list encoding-list)))
+ 
+    (while encoding-list ;; build the decoder-list
+      (let ((encoding (car encoding-list)))
+        (cond
+         ((eq encoding 'bocu) (push pdicv-bocu-decoder decoder-list))
+         ((eq encoding 'sjis) (push pdicv-sjis-decoder decoder-list))
+         ((eq encoding 'latin1) (push pdicv-latin1-decoder decoder-list))
+         (encoding (push (pdicv-create-decoder encoding) decoder-list))
+         (t (push pdicv-null-decoder decoder-list))
+         );cond
+        );let
+      (setq encoding-list (cdr encoding-list))
+      );wend
+    (setq decoder-list (nreverse decoder-list))
+
+    (catch 'pdicv-core-search
+;      (if (null original-word-to-search) (setq original-word-to-search word-to-search))
+      (let* (;(buffer-name (generate-new-buffer-name *buffer-name))
+                                        ;               (pdicv-buffer-name "*PDIC Viewer*")
+                                        ;               (dummy (if (get-buffer pdicv-buffer-name) (kill-buffer pdicv-buffer-name)))
+             (pdicv-buffer (get-buffer-create "*PDIC Viewer*"))
+                                        ;criteria
+             (word-to-search (car criteria))
+
+             (index-needles (nth 1 criteria))
+             (needle1 (car index-needles))
+             (needle2 (cdr index-needles))
+
+             (datablock-criteria-func (nth 2 criteria))
+
+             (ix index-table) (index-size (length ix)) (curr-size index-size)
+             (ix+ (cadr ix)); next one
+             (match-count 0)
+             )
+
+;	  (switch-to-buffer pdicv-buffer-name)
+        (save-current-buffer
+          (set-buffer pdicv-buffer)
+          (if (null dont-clear-p) (erase-buffer))
+
+          (if (not simple-mode-p)
+              (progn
+                                        ;(pop-to-buffer pdicv-buffer-name)
+                                        ;              (set-buffer pdicv-buffer-name)
+                (insert (format "�����%s\n" word-to-search))
+                (insert (format "�����: ????\n"))
+                (newline))
+                                        ;(insert "\n"))
+            )
+          (if index-needles
+              (setq ix
+                    (let ((p ix) (last-p nil))
+                      (catch 'pdicv-search-in-index
+                        (while p
+                          (let* ((elem (car p))
+                                        ;(phys (car elem))
+                                 (word (cdr elem)) )
+
+                            (if (string< needle1 word) (throw 'pdicv-search-in-index last-p))
+                                        ; (if (string< needle2 word) (throw 'pdicv-search-in-index last-p))
+
+                            (setq last-p p)
+                            (setq p (cdr p))
+                            ); let
+                          ); wend
+                        last-p
+                        ); caught
+
+                      ); let
+                    ))
+
+          (catch 'while
+            (while ix
+              (let* ((curr (car ix))
+                     (phys (car curr)) (word (cdr curr))
+                                        ; (x (insert (format "* current ix: (%d %s)\n" phys word)))
+                     (result (pdicv-scan-datablock dicfile phys datablock-criteria-func)); decoder-list nil))
+                     (result-count (length result))
+                     (inserter pdicv-default-inserter)
+                     )
+
+                (if index-needles
+                    (if (string>= word needle2) (throw 'while t)))
+                                        ;		    (if (not (string< word (cdr index-needles))) (throw 'while t)))
+
+                                        ;		(insert (format "(%s with index %s ... %s)\n" 
+                                        ;				word-to-search
+                                        ;				(funcall (nth 0 decoder-list) word) result))
+
+                (if result (progn
+                             (while result
+                               (let ((rec (pop result)))
+                                 (funcall inserter
+                                          (funcall (nth 0 decoder-list) (nth 0 rec)); eword
+                                          (funcall (nth 1 decoder-list) (nth 1 rec)); pron
+                                          (funcall (nth 2 decoder-list) (nth 2 rec)); jword
+                                          (funcall (nth 3 decoder-list) (nth 3 rec)); example
+                                          )
+                                 (setq match-count (1+ match-count))
+                                 )
+                               );wend
+                             (message "%5d/%5d:%7d" curr-size index-size match-count)
+                             (sit-for 0)
+                             )
+                  (progn ;else
+                    (if (zerop (% curr-size 128)) ;;128�����ʿ�                      (message "%5d/%5d:%7d" curr-size index-size match-count))
+                    ));fi
+                );let*
+              (setq ix (cdr ix))
+              (setq curr-size (1- curr-size))
+              );wend
+            );caught
+
+                                        ;(insert (pdicv-scan-datablock dicfile (car (car ix)) decoder-list nil needle1 needle2))
+          (goto-char 1)
+
+          (if (not simple-mode-p)
+              (if (re-search-forward ": [?][?][?][?]" nil t nil)
+                  (replace-match (format ": %d" match-count) t t nil 0))
+            );fi
+
+          ); save-current-buffer
+
+;      (pop-to-buffer (current-buffer))
+;        (setq split-height-threshold 6)
+        (if (one-window-p)
+            (set-window-buffer (split-window-vertically (- pdicv-result-height)) pdicv-buffer)
+          )
+        ); let*
+      ); caught
+    );let*
+  )
+
+;;; pdicv-core.el ends here
Index: lang/elisp/pdicv-mode/trunk/nt-readval.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-readval.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-readval.el (revision 67)
@@ -0,0 +1,297 @@
+;;; nt-readval.el --- read value or a string from buffer
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 06 Feb 2005
+;; Last modified: 15 Dec 2005 (defun --> defsubst)
+;; Version: 1.0.1
+;; Keywords: char uchar short ushort long ulong cstring pstring bcd
+
+(provide 'nt-readval)
+
+;;; Commentary:
+;; this package enables you to read an integer value
+;; such as (u)char,(u)short,(u)long, or a string value
+;; such as C-string, Pascal-string, from the specified buffer.
+
+;;; Code:
+;;============================================================
+;; uchar - read unsigned char value (1-byte) from buffer
+;;       /// 1�Х��ȤΥǡ�����signed char ��Ȥ���ɤ߼�
+;;============================================================
+(defsubst nt:read-uchar (s &optional index)
+  "1-byte string --> unsigned char"
+  (catch 'uchar
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (<= (length s) index)) (throw 'uchar 'out-of-bounds-exception))
+    (aref s index)
+    )
+  )
+
+;;===========================================================
+;; char - read (signed) char value (1-byte) from buffer
+;;      /// 1�Х��ȤΥǡ�����igned) char ��Ȥ���ɤ߼�
+;;===========================================================
+(defsubst nt:read-char (s &optional index)
+  "1-byte string --> signed char"
+  (catch 'char
+;    (let ((uc (uchar s index)))
+;      (if (eq uc 'out-of-bounds-exception) (throw 'char uc))
+;      (if (< uc 128) uc (- uc 256))
+;      ) ; let
+    (let ((c 0))
+      (if (not index) (setq index 0))
+      (if (or (< index 0) (<= (length s) index)) (throw 'char 'out-of-bounds-exception))
+      (setq c (aref s index))
+      (if (< c 128) c (- c 256)) ; =result
+      ); let
+    ); caught
+  )
+
+;;==============================================================
+;; ushort - read unsigned short value (2-byte) from buffer
+;;        /// 2�Х��ȤΥǡ�����signed short ��Ȥ���ɤ߼�
+;;==============================================================
+(defsubst nt:read-ushort (s &optional index)
+  "2-byte string (little-endian) --> unsigned short"
+  (catch 'ushort
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 2) index)) (throw 'ushort 'out-of-bounds-exception))
+    (+ (lsh (aref s (1+ index)) 8)
+       (aref s index))
+    )
+  )
+
+(defsubst nt:read-ushort-bigendian (s &optional index)
+  "2-byte string (big-endian) --> unsigned short"
+  (catch 'ushort
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 2) index)) (throw 'ushort 'out-of-bounds-exception))
+    (+ (lsh (aref s index) 8)
+       (aref s (1+ index)))
+    )
+  )
+
+(defmacro nt:read-ushort-littleendian (s &optional index)
+  "2-byte string (little-endian as default) --> unsigned short"
+  `(nt:read-ushort ,s ,index))
+
+;;==============================================================
+;; short - read (signed) short value (2-byte) from buffer
+;;        ///���Х��ȤΥǡ�����igned) short ��Ȥ���ɤ߼�
+;;==============================================================
+(defsubst nt:read-short (s &optional index)
+  "2-byte string (little-endian) --> signed short"
+  (catch 'short
+    (let ((us (nt:read-ushort s index)))
+      (if (eq us 'out-of-bounds-exception) (throw 'short us))
+      (if (< us 32768) us (- us 65536))
+      ) ; let
+    );caught
+  )
+
+(defsubst nt:read-short-bigendian (s &optional index)
+  "2-byte string (big-endian) --> signed short"
+  (catch 'short
+    (let ((us (nt:read-ushort-bigendian s index)))
+      (if (eq us 'out-of-bounds-exception) (throw 'short us))
+      (if (< us 32768) us (- us 65536))
+      ) ; let
+    )
+  )
+
+(defmacro nt:read-short-littleendian (s &optional index)
+  "2-byte string (little-endian as default) --> signed short"
+  `(nt:read-short ,s ,index))
+
+;;==============================================================
+;; long - read (signed) long int value (4-byte) from buffer
+;;        # emacs-lisp treates less than 28-bit value
+;;        # -268435456 <= x <= 268435455 (2^28-1)
+;;        ///���Х��ȤΥǡ�����igned) long ��Ȥ���ɤ߼�
+;;        ///��elisp�Ǥ�8�ӥåȤ��������ʤ��Τ��
+;;==============================================================
+(defsubst nt:read-long (s &optional index)
+  "4-byte string (little-endian) --> signed long
+-268435456 <= x <= 268435455 (2^28-1)"
+  (catch 'long
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 4) index)) (throw 'long 'out-of-bounds-exception))
+
+    (let* (
+           (hh (aref s (+ index 3)))
+           (h0 (lsh hh -4))
+           )
+
+      (cond ((zerop h0) nil) ; plus
+            ((= h0 15) nil) ; minus
+                                        ;      (t (setq hh (logand 15 hh)))
+            ((< h0 8) (throw 'long 'overflow-exception))
+            ((>= h0 8) (throw 'long 'underflow-exception))
+            )
+                                        ;      (logior (lsh (aref s (+ index 3)) 24)
+      (logior (lsh hh 24)
+              (lsh (aref s (+ index 2)) 16)
+              (lsh (aref s (1+ index)) 8)
+              (aref s index))
+      )
+    )
+  )
+
+(defsubst nt:read-long-bigendian (s &optional index)
+  "4-byte string (big-endian) --> signed long
+-268435456 <= x <= 268435455 (2^28-1)"
+  (catch 'long
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 4) index)) (throw 'long 'out-of-bounds-exception))
+
+    (let* (
+           (hh (aref s index))
+           (h0 (lsh hh -4))
+           )
+
+      (cond ((zerop h0) nil) ; plus
+            ((= h0 15) nil) ; minus
+                                        ;      (t (setq hh (logand 15 hh)))
+            ((< h0 8) (throw 'long 'overflow-exception))
+            ((>= h0 8) (throw 'long 'underflow-exception))
+            )
+                                        ;      (logior (lsh (aref s (+ index 3)) 24)
+      (logior (lsh hh 24)
+              (lsh (aref s (1+ index)) 16)
+              (lsh (aref s (+ index 2)) 8)
+              (aref s (+ index 3)))
+      )
+    )
+  )
+
+(defmacro nt:read-long-littleendian (s &optional index)
+  "4-byte string (little-endian as default) --> signed long"
+  `(nt:read-long ,s ,index))
+
+;;==============================================================
+;; ulong - read unsigned long int value (4-byte) from buffer
+;;        # emacs-lisp treates less than 28-bit value
+;;        # 0 <= x <= 268435455 (2^28-1)
+;;        ///���Х��ȤΥǡ�����signed long ��Ȥ���ɤ߼�
+;;        ///��elisp�Ǥ�8�ӥåȤ��������ʤ��Τ��
+;;==============================================================
+(defsubst nt:read-ulong (s &optional index)
+  "4-byte string (little-endian) --> unsigned long
+0 <= x <= 268435455 (2^28-1)"
+  (catch 'ulong
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 4) index)) (throw 'ulong 'out-of-bounds-exception))
+
+    (let* (
+           (hh (aref s (+ index 3)))
+           (h0 (lsh hh -4))
+           )
+
+      (cond ((zerop h0) nil) ; plus
+                                        ;      (t (setq hh (logand 15 hh)))
+            (t (throw 'ulong 'overflow-exception)))
+                                        ;      (logior (lsh (aref s (+ index 3)) 24)
+      (logior (lsh hh 24)
+              (lsh (aref s (+ index 2)) 16)
+              (lsh (aref s (1+ index)) 8)
+              (aref s index))
+      )
+    )
+
+;    (let ((sl (long s index)))
+;    (if (>= sl 0) sl 0)
+;    )
+  )
+
+(defsubst nt:read-ulong-bigendian (s &optional index)
+  "4-byte string (big-endian) --> unsigned long
+0 <= x <= 268435455 (2^28-1)"
+  (catch 'ulong
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (< (- (length s) 4) index)) (throw 'ulong 'out-of-bounds-exception))
+
+    (let* (
+           (hh (aref s index))
+           (h0 (lsh hh -4))
+           )
+
+      (cond ((zerop h0) nil) ; plus
+                                        ;      (t (setq hh (logand 15 hh)))
+            (t (throw 'ulong 'overflow-exception)))
+                                        ;      (logior (lsh (aref s (+ index 3)) 24)
+      (logior (lsh hh 24)
+              (lsh (aref s (1+ index)) 16)
+              (lsh (aref s (+ index 2)) 8)
+              (aref s (+ index 3)))
+      )
+    )
+
+;    (let ((sl (long s index)))
+;    (if (>= sl 0) sl 0)
+;    )
+  )
+
+(defmacro nt:read-ulong-littleendian (s &optional index)
+  "4-byte string (little-endian as default) --> unsigned long"
+  `(nt:read-ulong ,s ,index))
+
+;;==============================================================
+;; cstring - read a C-string (NULL-terminated) from buffer
+;;        # ie. read the data until just before '\0'
+;;        ///�Хåե��������NULL��ü�ˤ�߼�
+;;==============================================================
+(defsubst nt:read-cstring (s &optional index)
+  "pick up a C-string.
+returns (string . length)"
+  (catch 'cstring
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (>= index (length s))) (throw 'cstring 'out-of-bounds-exception))
+    (let ( (ofs 0) (ofs-max (- (length s) index)) )
+;     (if (> ofs-max 248) (setq ofs-max 248))
+      (while (< ofs ofs-max)
+        (if (zerop (aref s (+ index ofs))) 
+            (throw 'cstring (cons (substring s index (+ index ofs)) ofs) )
+          )
+        (setq ofs (1+ ofs))
+        )
+      (cons (substring s index nil) ofs-max)
+      )
+    )
+  )
+
+;;==============================================
+;; pstring - read a Pascal-string from buffer
+;;        ///�Хåե�����scalʸ����߼�
+;;==============================================
+(defsubst nt:read-pstring (s &optional index)
+  "pick up a Pascal-string.
+returns (string . length)"
+  (catch 'pstring
+    (if (not index) (setq index 0))
+    (if (or (< index 0) (>= index (length s))) (throw 'pstring 'out-of-bounds-exception))
+    (let ( (ofs 0) (ofs-max (- (length s) index))
+           (size (nt:read-uchar s index)) )
+      (if (> (1+ size) ofs-max) (throw 'pstring 'out-of-bounds-exception))
+      (throw 'pstring (cons (substring s (1+ index) (+ index 1 size)) size) )
+      ); let
+    ); caught
+  )
+
+(defsubst nt:read-bcd (s ofs bytes)
+  "read BCD value"
+  (let ((i 0) (n 0) (c 0))
+    (while (< i bytes)
+      (setq c (aref s (+ ofs i)))
+      (setq n (+ (* n 100) (* (lsh c -4) 10) (logand c #x0f)))
+      (setq i (1+ i)) ;; (++ i)
+      );wend
+    n
+    );let
+  )
+
+;;; nt-readval.el ends here
Index: lang/elisp/pdicv-mode/trunk/nt-file.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-file.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-file.el (revision 67)
@@ -0,0 +1,58 @@
+;;; nt-file.el --- file-related functions
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 16 Feb 2005 (formerly nt-utils)
+;; Last modified: 15 Dec 2005
+;; Version: 1.0
+;; Keywords: read-from-file
+
+(provide 'nt-file)
+
+;;; Commentary:
+
+; (read-from-file FNAME FROM LENGTH)
+;   - �ե�����NAME �Ρ��Ƭ�������FROM  ����     LENGTH �Х������߼���ʸ������֤���
+
+; (scan-latest-version PATHNAME-FMT MIN MAX)
+;   - �ե����ޥå�PATHNAME-FMT �ǻ�ꤵ�줿�ѥ�̾�Υե���������;     �С�������椬 MIN �ʾ�AX �ʲ���ϰ���Ǥ������������
+;     (�) (scan-latest-version "EIJIRO%d.DIC" 50 100)
+;   - ���Ĥ������� nil �����
+
+;;; Code:
+(defun nt:read-from-file (filename read-from read-length)
+  "read a part of file"
+  (save-current-buffer
+    (let ((buffer-name (generate-new-buffer-name "*read-from-file*"))
+          (my-buffer nil))
+      (generate-new-buffer buffer-name)
+      (set-buffer buffer-name)
+      (insert-file-contents-literally filename nil read-from (+ read-from read-length) nil)
+                                        ;    (setq buffer-read-only t)
+      (setq my-buffer (buffer-substring 1 (+ 1 read-length)))
+      (kill-buffer buffer-name)
+      my-buffer
+      ) ; let
+    ) ; save-current-buffer
+  )
+
+(defun nt:scan-latest-version (filename-format min max)
+  (catch 'scan-latest-version
+    (let ((version max))
+      (while (>= version min)
+        (let ((file (format filename-format version)))
+          (if (file-readable-p file) (throw 'scan-latest-version (list file version))
+            (setq version (1- version))
+            );fi
+          );let
+        );wend
+      nil
+      );let
+    );caught
+  )
+
+;;; nt-file.el ends here
Index: lang/elisp/pdicv-mode/trunk/pdicviewer.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/pdicviewer.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/pdicviewer.el (revision 67)
@@ -0,0 +1,55 @@
+;; pdicviewer.el - PDIC Viewer for Emacs
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 14 Feb 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.9.1
+;; Keywords: PDIC dictionary search eijiro
+;;
+
+;;; Commentary:
+;;
+;; PDIC�ե����ޥåȤμ��񤫤鸡��ޤ���
+;; ���ڤӺ��ۤκݤϡ�GNU ����������ʥС������˽��äƲ�������
+;;
+;; �켡����
+;;    http://pdicviewer.naochan.com/el/
+
+;;; Code:
+;(require 'pdicv-core)
+(require 'pdicv-search)
+;(require 'pdicv-eijiro)
+(require 'pdicv-mode)
+
+; ������󥹥ȡ�����ꤷ�ޤ�
+; (eword-encoding pron-encoding jword-encoding example-encoding) )
+(setq pdicv-dictionary-list
+      '(
+;        (sample "~/pdic/SAMPLE.DIC" ;
+;                (nil nil sjis sjis) t)
+        (cj2 "~/pdic/cj2.dic" ;
+             bocu nil)
+        (eijiro "~/pdic/eijiro81/EIJIRO81.DIC"
+                (nil nil sjis sjis))
+        (waeijiro "~/pdic/eijiro81/WAEIJI81.DIC"
+                  (sjis nil sjis sjis) t)
+        (fr "~/pdic/fr.dic"
+            (latin1 nil sjis latin1) nil)
+;        (ej
+;         (eijiro waeijiro))
+        )
+      )
+
+;;;###autoload
+(defun pdicv ()
+  ""
+  (interactive)
+  (pdicv-init)
+  )
+
+;;; pdicviewer.el ends here
Index: lang/elisp/pdicv-mode/trunk/nt-macros.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-macros.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-macros.el (revision 67)
@@ -0,0 +1,88 @@
+;;; nt-macros.el --- useful (at least for NT) macros
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 16 Feb 2005 (formerly nt-utils.el)
+;; Last modified: 15 Dec 2005
+;; Version: 1.0
+;; Keywords: ++ -- ->
+
+(provide 'nt-macros)
+
+;;; Commentary:
+
+; (++ VAR)
+;   - ���R ��ͤ���
+;     (setq VAR (1+ VAR)) �Υޥ��
+
+; (-- VAR)
+;   - ���R ��ͤ򣱸��餹��
+;     (setq VAR (1- VAR)) �Υޥ��
+
+; (string< S1 S2)
+; (string> S1 S2)
+; (string<= S1 S2)
+; (string>= S1 S2)
+;   - (string< S1 S2) ����ؿ��
+
+
+;;; Code:
+(defmacro ++ (var)
+  "increment the specified variable"
+  `(setq ,var (1+ ,var)))
+
+(defmacro -- (var)
+  "decrement the specified variable"
+  `(setq ,var (1- ,var)))
+
+(defmacro += (var num)
+  `(setq ,var (+ ,var ,num)))
+
+(defmacro -= (var num)
+  `(setq ,var (- ,var ,num)))
+
+(defmacro *= (var num)
+  `(setq ,var (* ,var ,num)))
+
+;(defmacro /= (var num)
+;  `(setq ,var (/ ,var ,num)))
+
+(defmacro != (a b)
+  "/="
+  `(not (= ,a ,b)))
+
+(defmacro <<= (var num)
+  `(setq ,var (lsh ,var ,num)))
+
+(defmacro >>= (var num)
+  `(setq ,var (lsh ,var (- ,num))))
+
+(defmacro cdr= (list-var)
+  `(setq ,list-var (cdr ,list-var)))
+
+(defmacro concat= (str-var str)
+  `(setq ,str-var (concat ,str-var ,str)))
+
+;;
+(defmacro -> (array key)
+  ""
+  `(cdr (assoc ,key ,array)))
+
+;;
+(defmacro string> (s1 s2)
+  "string>"
+  `(string< ,s2 ,s1))
+
+(defmacro string<= (s1 s2)
+  "string<="
+  `(not (string< ,s2 ,s1)))
+
+(defmacro string>= (s1 s2)
+  "string>="
+  `(not (string< ,s1 ,s2)))
+
+;;; nt-macros.el ends here
Index: lang/elisp/pdicv-mode/trunk/README.sjis
===================================================================
--- lang/elisp/pdicv-mode/trunk/README.sjis (revision 67)
+++ lang/elisp/pdicv-mode/trunk/README.sjis (revision 67)
@@ -0,0 +1,33 @@
+�� PDICViewer for Emacs ----- PDIC�`���̎�����acs (mule) ���猟����[��
+
+�@�@Emacs �� PDIC �t�H�[�}�b�g�̎����t�@�C�����邽�߂̃v���O�����ł��B
+
+�@�@�A���N���u�p���Y�v�Ԗ{�E���{CD-ROM�Ɏ�������IC�`���̎����f�[�^��
+�@�@�C���^�[�l�b�g����\��DIC�`���̗l�X�Ȏ����f�[�^���\�[�X�����p�ł��܂��B
+
+�@�@Unicode(BOCU)�����ɂ������Ă��܂��B�i�v(?)Mule-UCS�j
+
+�� ���쌠
+
+�@�@���̃v���O�����́AGNU ��������u�o�[�W����2�v�������@�@�����~�̓K���ȃo�[�W�����ɏ]��āA���p�܂��͍Ĕz�z���邱�Ƃ���ꂽ
+�@�@�t���[�\�t�g�E�F�A�ł��B
+�@�@���m�ȍĔz�z���COPYING �ɋL�ڂ������܂��B
+
+�� �Ɛӎ���
+
+�@�@���̃v���O�����̂����p�ɍۂ��Ĕ����������ځE�Ԑڂ̑��Q�ɑ΂��A�����@�@�����Ȃ��C�����܂�������p�́A���[�U���g�̐ӔC�ɂ����čs��ĉ������B
+
+�� ���̑��̏�
+
+�@�@�C���X�g�[���菇�ɂ��ẮAINSTALL ��Ƃ��ĉ������B
+
+�@�@�o�O�E���z�Ȃǂɂ��Ă͍��܂ł��A�����������B
+
+�� ���A�����@�@Naochan (Naoya TOZUKA) <pdicviewer@gmail.com>
+�@�@http://www.naochan.com/
+�@�@http://d.hatena.ne.jp/naoya_t/
+
+�� �ꎟ�z�z��
+
+�@�@http://pdicviewer.naochan.com/el/
+
Index: lang/elisp/pdicv-mode/trunk/nt-utf8.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-utf8.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-utf8.el (revision 67)
@@ -0,0 +1,120 @@
+;;; nt-utf8.el --- converter between utf-8 and rawcode
+;;;             some functions require Mule-UCS
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 14 Feb 2005
+;; Last modified: 15 Dec 2005
+;; Version: 1.0
+;; Keywords: UTF-8
+
+(provide 'nt-utf8)
+
+;;; Commentaries:
+;
+;; core functions
+; (nt:utf8-rawcode-to-utf8str CODE)
+; (nt:utf8-rawcode-list-to-utf8str LIST)
+; (nt:utf8-utf8str-to-rawcode-list STR)
+
+;; applied functions
+; (nt:utf8-mulestr-to-unicode-list STR)  - requires Mule-UCS
+;   - Mule��ʸ����ʸ���������ʸ��icode�����ɥꥹ�Ȥ�Ѵ�
+; (nt:utf8-unicode-list-to-mulestr LIST) - requires Mule-UCS
+;   - ʸ���������ʸ��icode�����ɥꥹ�Ȥ�ule��ʸ�����
+
+;;; Code:
+(defun nt:rawcode-to-utf8str (code)
+  "convert a raw-code to utf-8 string"
+  (cond
+   ((<= code #x007f) (string code))
+   ((<= code #x07ff) (string (logior #xc0 (lsh code -6))
+                             (logior #x80 (logand code #x3f))
+                             ))
+   ((<= code #xffff) (string (logior #xe0 (lsh code -12))
+                             (logior #x80 (logand (lsh code -6) #x3f))
+                             (logior #x80 (logand code #x3f))
+                             ))
+   ((<= code #x10ffff) (string (logior #xf0 1 (lsh code -18)
+                                       (logior #x80 2 (logand (lsh code -12) #x3f))
+                                       (logior #x80 3 (logand (lsh code -6) #x3f))
+                                       (logior #x80 4 (logand code #x3f))
+                                       ))
+    )
+   );cond
+  )
+
+(defun nt:rawcode-list-to-utf8str (l)
+  "convert raw-code list to utf-8 string"
+  (let ((s ""))
+    (while l
+      (setq s (concat s (nt:rawcode-to-utf8str (car l))))
+      (setq l (cdr l))
+      )
+    s
+    )
+  )
+
+(defun nt:utf8str-to-rawcode-list (s)
+  "convert utf-8 string to raw-code list"
+  (let ((result ())
+        (len (length s)) (i 0))
+    (while (< i len)
+      (let ((c (aref s i))
+            (code -1))
+        (setq i (1+ i))
+        (setq code
+              (cond
+               ((zerop (logand c #x80))   ; 0xxxxxxx
+                c)                        ;  > 000000000xxxxxxx : 0000-007F
+               ((= (logand c #xe0) #xc0)  ; 110yyyyy 10xxxxxx
+                (let ((t1 (aref s i)))    ;  > 00000yyyyyxxxxxx : 0080-07FF
+                  (setq i (1+ i))
+                  (+ (lsh (logand #x1f c) 6)
+                     (logand #x3f t1))
+                  ))
+               ((= (logand c #xf0) #xe0)  ; 1110zzzz 10yyyyyy 10xxxxxx
+                (let ((t1 (aref s i))     ;  > zzzzyyyyyyxxxxxx : 0800-FFFF
+                      (t2 (aref s (1+ i))))
+                  (setq i (+ i 2))
+                  (+ (lsh (logand #x0f c) 12)
+                     (lsh (logand #x3f t1) 6)
+                     (logand #x3f t2))
+                  ))
+               ((= (logand c #xf8) #xf0)  ; 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
+                (let ((t1 (aref s i))     ;  > 000uuuuuzzzzyyyyyyxxxxxx : 10000-10FFFF
+                      (t2 (aref s (1+ i)))
+                      (t3 (aref s (+ i 2))))
+                  (setq i (+ i 3))
+                  (+ (lsh (logand #x07 c) 16)
+                     (lsh (logand #x3f t1) 12)
+                     (lsh (logand #x3f t2) 6)
+                     (logand #x3f t3))
+                  ))
+               (t -1)
+               )); code
+        (setq result (cons code result))
+        );let
+      ); wend
+    (nreverse result)
+    ); let
+  )
+
+;
+; applied codes
+;
+(defun nt:mulestr-to-unicode-list (s)
+  "convert any Emacs-string to a Unicode raw-code list"
+  (nt:utf8str-to-rawcode-list (encode-coding-string s 'utf-8))
+  )
+
+(defun nt:unicode-list-to-mulestr (l)
+  "convert a Unicode raw-code list to an Emacs-string"
+  (decode-coding-string (nt:rawcode-list-to-utf8str l) 'utf-8)
+  )
+
+;;; nt-utf8.el ends here
Index: lang/elisp/pdicv-mode/trunk/INSTALL
===================================================================
--- lang/elisp/pdicv-mode/trunk/INSTALL (revision 67)
+++ lang/elisp/pdicv-mode/trunk/INSTALL (revision 67)
@@ -0,0 +1,58 @@
+�� PDICViewer for Emacs �̃C���X�g�[����  (1) �z�z�p�b�P�[�W�Ɋ܂܂� *.el �t�@�C����؂ȏꏊ�ɃR�s�[
+
+�@�@���ȉ��̗���~/site-lisp/pdicviewer/ �ɃC���X�g�[�����Ă��܂��B
+
+  (2) �����t�@�C���̃C���X�g�[��
+
+    �����t�@�C����ӂ̃f�B���N�g���ɔz�u���܂��B
+    �����t�@�C�����͔z�z���ꂽ���̂܂܂ɂ��Ă������Ƃ𐄏����܂��B
+
+  (3) pdicviewer.el ��W
+
+�@�@�C���X�g�[�����������̃t���p�X����icviewer.el �ɓo�^���܂��B
+
+  (4) ~/.emacs ��W
+
+�@�@�ȉ��̂悤�ȋL�q��macs �ɒǉ���܂��B
+
+    (setq load-path
+          (append (list (expand-file-name "~/site-lisp/pdicviewer")) load-path))
+          ; PDICViewer for Emacs �v���O�����ipdicviewer.el���j������TH���
+    (autoload 'pdicv "pdicviewer"
+      "\
+    PDIC��������     t)
+    ;; eijiro
+    (global-set-key "\C-c\C-e" 'pdicv-eijiro-search-interactive)
+    (global-set-key "\C-c\C-r" 'pdicv-eijiro-search-region)
+    ;; general
+    (global-set-key "\C-c\C-d" 'pdicv-set-current-dictionary)
+    (global-set-key "\C-c\C-i" 'pdicv-search-interactive)
+    (global-set-key "\C-c\C-j" 'pdicv-search-region)
+    (global-set-key "\C-c\C-p" 'pdicv-mode)
+
+  (5) *.el �t�@�C���̃o�C�g�R���p�C��
+
+    �t����Makefile ��X�C�����Ă���ake ���ĉ������B
+
+
+�� ���p�@
+
+�@�@�N�����AM-x pdicv �Ŏ����C���f�b�N�X�̓ǂݍ��݂��s���܂��B
+�@�@�i�p���Y/�a�p���Y��ݍ�����b�ł��B�j
+
+�@(1) �o�b�t�@���e�L�X�g���������Ȃ�����
+�@�@pdicv-mode ����܂��BC-c C-p ��pdicv-mode ��O�����܂��B
+�@�@pdicv-mode �̓}�C�i�[���[�h�ł��B
+
+�@�@�f�t�H���g�̃L�[�o�C���h�ł��@�@�@C-c C-a : �J�[�\���ʒu�̒P�������@�@C-c C-c : ���̒P�������@�@C-c C-b : �O�̒P�������@�ƂȂ�Ă��܂��B�ipdicv-mode.el �Őݒ肵�܂��j
+�@�@��������w���v���������̂ŁA�ieijiro �Ȃǁj�g������������肵�܂��B
+�@�@�i������C-c C-d �Ő����w���\�ł��j
+
+  (2) ���[�W�����w�����������@�ipdicv-mode �ɓ�v�͂�������
+�@�@��������P�����邢�͏n�����j��[�W�����w�肵�āAC-c C-j �Ō���܂��B
+�@�@�i�p���Y/�a�p���Y�Ō������ C-c C-r ����܂��j
+
+�@(3) �~�j�o�b�t�@�ŒP����Č����@�ipdicv-mode �ɓ�v�͂�������
+�@�@C-c C-i �ŁA�~�j�o�b�t�@�ɒP���̓v�����v�g���o�܂��̂ŒP����ĉ������B
+�@�@�i�p���Y/�a�p���Y�Ō������ C-c C-e ����܂��j
+
Index: lang/elisp/pdicv-mode/trunk/nt-bocu.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-bocu.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-bocu.el (revision 67)
@@ -0,0 +1,261 @@
+;;; nt-bocu.el --- decode/encode BOCU-1 string (via utf-8, so requires Mule-UCS)
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 12 Feb 2005
+;; Last modified: 15 Dec 2005 (defun --> defsubst)
+;; Version: 1.0.1
+;; Keywords: BOCU-1 encode decode
+
+(provide 'nt-bocu)
+
+;;; Commentaries:
+
+;; internal
+; (nt:bocu-decode-trail-char TR)
+; (nt:bocu-encode-trail-char NUM)
+
+; (nt:bocustr-to-rawcode-list STR)
+; (nt:diff-to-bocustr DIFF) - used by #'bocu-rawcode-list-to-bocustr
+; (nt:rawcode-list-to-bocustr STR)
+
+; (nt:bocu-decode STR)
+;   - BOCU-1 ʸ���ǥ����ɤ���ʸ��Mule������ˤ�Ѵ�
+; (nt:bocu-encode STR)
+;   - ʸ��Mule������ˤ�CU-1 ���󥳡���
+;;; Code:
+(require 'nt-utf8)
+
+(defsubst nt:bocu-decode-trail-char (tr)
+  "[BOCU] decode trail char"
+  (cond
+   ((>  tr #x20) (- tr 13)) ;21- >> 14-
+   ((>= tr #x1c) (- tr 12)) ;1C ... 1F >> 10 ... 13
+   ((>= tr #x10) (- tr 10)) ;10 ... 19 >> 06 ... 0F
+   (t (1- tr))              ;01 ... 06 >> 00 ... 05
+   ); cond
+  )
+(defsubst nt:bocu-encode-trail-char (c)
+  "[BOCU] encode trail char"
+  (cond
+   ((>  c #x13) (+ c 13)) ;14- >> 21-
+   ((>= c #x10) (+ c 12)) ;10 ... 13 >> 1C ... 1F
+   ((>= c #x06) (+ c 10)) ;06 ... 0F >> 10 ... 19
+   (t (1+ c))             ;00 ... 05 >> 01 ... 06
+   ); cond
+  )
+
+(defun nt:bocustr-to-rawcode-list (s)
+  "[BOCU] BOCU-1 string --> rawcode-list"
+  (let ((l ()) (len (length s)) (i 0)
+        (pc #x40) (lead 0) (tr 0) (code 0) (diff 0))
+    (while (< i len)
+      (setq lead (aref s i) i (1+ i))
+      (cond ((<= lead #x20) (setq code lead))
+            ((= lead #x21) ;21    (L T T T)
+             (setq diff (+ -187660 (* 243 243 243)))
+                                        ; trail 3
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243 243)))
+                                        ; trail 2
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((< lead #x25) ;22-24 (L T T)
+             (setq diff (+ -10513 (* (- lead #x25) 243 243)))
+                                        ; trail 2
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((< lead #x50) ;25-4f (L T)
+             (setq diff (+ -64 (* (- lead #x50) 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((< lead #xd0) ;50-cf (L)
+             (setq diff (- lead #x90))
+             )
+            ((< lead #xfb) ;d0-fa (L T)
+             (setq diff (+ 64 (* (- lead #xd0) 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((< lead #xfe) ;fb-fd (L T T)
+             (setq diff (+ 10513 (* (- lead #xfb) 243 243)))
+                                        ; trail 2
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((= lead #xfe) ;fe    (L T T T)
+             (setq diff 187660)
+                                        ; trail 3
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243 243)))
+                                        ; trail 2
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff (* tr 243)))
+                                        ; trail 1
+             (setq tr (nt:bocu-decode-trail-char (aref s i)) i (1+ i))
+             (setq diff (+ diff tr))
+             )
+            ((= lead #xff) ; reset
+             )
+            ); end of cond.
+
+      (cond
+       ((<= lead #x20)
+        (push lead l)
+                                        ;	(setq r (concat r (string lead)))
+        (if (< lead #x20) (setq pc #x40)) ;#x20�ʤ餽�Τޤ�        )
+       ((< lead #xff)
+        (progn
+          (setq code (+ pc diff))
+          (if (< code 0) (setq code 0));; error recovery
+
+          (push code l)
+                                        ;	  (setq r (concat r (if (> code 0) (code-to-utf8 code) "?")))
+
+          (setq pc (cond 
+                    ((< code #x20) #x40)
+                    ((= code #x20) pc) ; keep pc
+                    ((and (<= #x3040 code) (<= code #x309f)) #x3070)
+                    ((and (<= #x4e00 code) (<= code #x9fa5)) #x7711)
+                    ((and (<= #xac00 code) (<= code #xd7a3)) #xc1d1)
+                    (t (+ (logand code (lognot #x7f)) #x40))
+                    )); pc
+          ))
+       (t (setq pc #x40)); #xFF: reset
+       )
+      ); wend
+    (nreverse l)
+    ); let
+  )
+
+(defun nt:diff-to-bocustr (diff)
+  "[BOCU] diff --> BOCU-1 string"
+  (catch 'bocu-encode-diff
+    (let ((s "") (t0 0) (t1 0) (t2 0) (t3 0))
+      (cond
+       ((< diff -14536567) (throw 'bocu-encode-diff 'underflow-exception))
+       ((< diff -187660)  ; [-14536567,-187660) : 21
+        (progn
+          (setq diff (- diff -14536567))
+          (setq t3 (% diff 243)) (setq diff (/ diff 243))
+          (setq t2 (% diff 243)) (setq diff (/ diff 243))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+                                        ;(setq t0 diff)
+          (string #x21 (nt:bocu-encode-trail-char t1) (nt:bocu-encode-trail-char t2) (nt:bocu-encode-trail-char t3))
+          )
+        )
+       ((< diff -10513)   ; [-187660,-10513) : 22-24
+        (progn
+          (setq diff (- diff -187660))
+          (setq t2 (% diff 243)) (setq diff (/ diff 243))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+          (setq t0 diff)
+          (string (+ #x22 t0) (nt:bocu-encode-trail-char t1) (nt:bocu-encode-trail-char t2))
+          )
+        )
+       ((< diff -64)      ; [-10513,-64) : 25-4F
+        (progn
+          (setq diff (- diff -10513))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+          (setq t0 diff)
+          (string (+ #x25 t0) (nt:bocu-encode-trail-char t1))
+          )
+        )
+       ((< diff 64)       ; [-64,63) : 50-CF
+        (progn
+          (setq diff (- diff -64))
+          (setq t0 diff)
+          (string (+ #x50 t0))
+          )
+        )
+       ((< diff 10513)    ; [64,10513) : D0-FA
+        (progn
+          (setq diff (- diff 64))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+          (setq t0 diff)
+          (string (+ #xD0 t0) (nt:bocu-encode-trail-char t1))
+          )
+        )
+       ((< diff 187660)   ; [10513,187660) : FB-FD
+        (progn
+          (setq diff (- diff 10513))
+          (setq t2 (% diff 243)) (setq diff (/ diff 243))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+          (setq t0 diff)
+          (string (+ #xFB t0) (nt:bocu-encode-trail-char t1) (nt:bocu-encode-trail-char t2))
+          )
+        )
+       ((< diff 14536567) ; [187660,14536567) : FE
+        (progn
+          (setq diff (- diff 187660))
+          (setq t3 (% diff 243)) (setq diff (/ diff 243))
+          (setq t2 (% diff 243)) (setq diff (/ diff 243))
+          (setq t1 (% diff 243)) (setq diff (/ diff 243))
+                                        ;(setq t0 diff)
+          (string #xFE (nt:bocu-encode-trail-char t1) (nt:bocu-encode-trail-char t2) (nt:bocu-encode-trail-char t3))
+          )
+        )
+       (t (throw 'bocu-encode-diff 'overflow-exception))
+       ); cond
+      ); let
+    ); caught
+  )
+
+(defun nt:rawcode-list-to-bocustr (l) ; not tested much
+  "rawcode list --> BOCU-1 string"
+  (let* ((s "") (pc #x40))
+    (while l
+      (let* ((code (car l))
+             (diff (- code pc)) )
+        (setq l (cdr l))
+        (setq s (concat s (nt:diff-to-bocustr diff)))
+        (setq pc (cond
+                  ((< code #x20) #x40)
+                  ((= code #x20) pc) ;keep pc
+                  ((and (<= #x3040 code) (<= code #x309F)) #x3070)
+                  ((and (<= #x4E00 code) (<= code #x9FA5)) #x7711)
+                  ((and (<= #xAC00 code) (<= code #xD7A3)) #xC1D1)
+                  (t (+ (logand code #xffff80) #x40))))
+        ); let*
+      ); wend
+    s
+    ); let*
+  )
+
+(defsubst nt:bocu-decode (s)
+  "decode BOCU-1 string (via utf-8)"
+  (let* ((rawcode-list (nt:bocustr-to-rawcode-list s))
+         (utf8str (nt:rawcode-list-to-utf8str rawcode-list)))
+    (decode-coding-string utf8str 'utf-8)
+    )
+  )
+
+(defsubst nt:bocu-encode (s)
+  "encode a string into BOCU-1 (via utf-8)"
+  (let* ((utf8str (encode-coding-string s 'utf-8))
+         (rawcode-list (nt:utf8str-to-rawcode-list utf8str))
+         (bocustr (nt:rawcode-list-to-bocustr rawcode-list))
+         )
+    bocustr
+    )
+  )
+
+;;; nt-bocu.el ends here
Index: lang/elisp/pdicv-mode/trunk/nt-english.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/nt-english.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/nt-english.el (revision 67)
@@ -0,0 +1,339 @@
+;;; nt-english.el --- English
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 23 Dec 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.2
+;; Keywords:
+
+(provide 'nt-english)
+
+;;; Commentaries:
+
+; (nt:english-guess-original-form WORD)
+;    - ������ñ���������Ȥ��롣
+;      ������Υꥹ�Ȥˤ�WORD �ϴޤޤ�����
+;
+; (nt:skipit-p WORD)
+;    - �����åפ�����ñ����, �����Ǥʤ��� nil
+
+;; Code
+(defvar nt-skip-words '("the" "a" "an"
+                        "i" "you" "he" "she" "it" "we" "they"
+                        "am" "are" "is" "was" "were"
+                        "this" "that" "these" "those"
+                        "or" "and" "but"))
+
+(defvar nt-english-irreg-verbs-list
+      '(("abode" . "abide")
+        ("alit" . "alight")
+        ("arose" . "arise") ("arisen" . "arise")
+        ("awoke" . "awake") ("awoken" . "awake")
+        ("backbit" . "backbite") ("backbitten" . "backbite")
+        ("backslid" . "backslide")
+        ("was" . "be") ("were" . "be") ("been" . "be")
+        ("bore" . "bear") ("borne" . "bear") ("born" . "bear")
+        ("beaten" . "beat")
+        ("became" . "become")
+        ("befell" . "befall") ("befallen" . "befall")
+        ("begot" . "beget") ("begotten" . "beget")
+        ("began" . "begin") ("begun" . "begin")
+        ("beheld" . "behold")
+        ("bent" . "bend")
+        ("bereft" . "bereave")
+        ("besought" . "beseech")
+        ("bade" . "bid") ("bidden" . "bid")
+        ("bade" . "bide")
+        ("bound" . "bind")
+        ("bit" . "bite") ("bitten" . "bite")
+        ("bled" . "bleed")
+        ("blent" . "blend")
+        ("blest" . "bless")
+        ("blew" . "blow") ("blown" . "blow")
+        ("broke" . "break") ("broken" . "break")
+        ("bred" . "breed")
+        ("brought" . "bring")
+        ("built" . "build")
+        ("burnt" . "burn")
+        ("bought" . "buy")
+        ("caught" . "catch")
+        ("chose" . "choose") ("chosen" . "choose")
+        ("clove" . "cleave") ("cleft" . "cleave") ("cloven" . "cleave")
+        ("clung" . "cling")
+        ("clad" . "clothe")
+        ("came" . "come")
+        ("crept" . "creep")
+        ("crew" . "crow")
+        ("durst" . "dare")
+        ("dealt" . "deal")
+        ("dug" . "dig")
+        ("did" . "do") ("done" . "do")
+        ("drew" . "draw") ("drawn" . "draw")
+        ("dreamt" . "dream")
+        ("drank" . "drink") ("drunk" . "drink")
+        ("drove" . "drive") ("driven" . "drive")
+        ("dwelt" . "dwell")
+        ("ate" . "eat") ("eaten" . "eat")
+        ("fell" . "fall") ("fallen" . "fall")
+        ("fed" . "feed")
+        ("felt" . "feel")
+        ("fought" . "fight")
+        ("found" . "find")
+        ("fled" . "flee")
+        ("flung" . "fling")
+        ("flew" . "fly") ("flown" . "fly")
+        ("forbade" . "forbid") ("forbad" . "forbid") ("forbidden" . "forbid")
+        ("forgot" . "forget") ("forgotten" . "forget")
+        ("forgave" . "forgive") ("forgiven" . "forgive")
+        ("forsook" . "forsake") ("forsaken" . "forsake")
+        ("froze" . "freeze") ("frozen" . "freeze")
+        ("gelt" . "geld")
+        ("got" . "get") ("gotten" . "get")
+        ("gilt" . "gild")
+        ("girt" . "gird")
+        ("gave" . "give") ("given" . "give")
+        ("gnawn" . "gnaw")
+        ("went" . "go") ("gone" . "go")
+        ("graven" . "grave")
+        ("ground" . "grind")
+        ("gript" . "grip")
+        ("grew" . "grow") ("grown" . "grow")
+        ("hamstrung" . "hamstring")
+        ("hung" . "hang") ("hung" . "hang")
+        ("had" . "have")
+        ("heard" . "hear")
+        ("hove" . "heave")
+        ("hewn" . "hew")
+        ("hid" . "hide") ("hidden" . "hide")
+        ("held" . "hold")
+        ("inlaid" . "inlay")
+        ("kept" . "keep")
+        ("knelt" . "kneel")
+        ("knew" . "know") ("known" . "know")
+        ("laid" . "lay")
+        ("led" . "lead")
+        ("leant" . "lean")
+        ("leapt" . "leap")
+        ("learnt" . "learn")
+        ("left" . "leave")
+        ("lent" . "lend")
+        ("lay" . "lie") ("lain" . "lie")
+        ("lit" . "light")
+        ("lost" . "lose")
+        ("made" . "make")
+        ("meant" . "mean")
+        ("met" . "meet")
+        ("molten" . "melt")
+        ("misled" . "mislead")
+        ("mistook" . "mistake") ("mistaken" . "mistake")
+        ("misunderstood" . "misunderstand")
+        ("mowed" . "mow") ("mown" . "mow")
+        ("outdid" . "outdo") ("outdone" . "outdo")
+        ("outwent" . "outgo") ("outgone" . "outgo")
+        ("outgrew" . "outgrow") ("outgrown" . "outgrow")
+        ("outran" . "outrun")
+        ("overcame" . "overcome")
+        ("overdid" . "overdo") ("overdone" . "overdo")
+        ("overdrew" . "overdraw") ("overdrawn" . "overdraw")
+        ("overtook" . "overtake") ("overtaken" . "overtake")
+        ("overthrew" . "overthrow") ("overthrown" . "overthrow")
+        ("paid" . "pay")
+        ("pent" . "pen")
+        ("pled" . "plead")
+        ("proven" . "prove")
+        ("rent" . "rend")
+        ("repaid" . "repay")
+        ("retold" . "retell")
+        ("rewound" . "rewind")
+        ("rewrote" . "rewrite") ("rewritten" . "rewrite")
+        ("rode" . "ride") ("ridden" . "ride")
+        ("rang" . "ring") ("rung" . "ring")
+        ("rose" . "rise") ("risen" . "rise")
+        ("ran" . "run")
+        ("sawn" . "saw")
+        ("said" . "say")
+        ("saw" . "see") ("seen" . "see")
+        ("sought" . "seek")
+        ("sold" . "sell")
+        ("sent" . "send")
+        ("sewn" . "sew")
+        ("shook" . "shake") ("shaken" . "shake")
+        ("shaven" . "shave")
+        ("shorn" . "shear")
+        ("shone" . "shine") ("shone" . "shine")
+        ("shat" . "shit")
+        ("shod" . "shoe")
+        ("shot" . "shoot")
+        ("shown" . "show")
+        ("shrank" . "shrink") ("shrunk" . "shrink") ("shrunken" . "shrink")
+        ("shrove" . "shrive") ("shriven" . "shrive")
+        ("sang" . "sing") ("sung" . "sing")
+        ("sank" . "sink") ("sunk" . "sink") ("sunken" . "sink")
+        ("sat" . "sit")
+        ("slew" . "slay") ("slain" . "slay")
+        ("slept" . "sleep")
+        ("slid" . "slide")
+        ("slung" . "sling")
+        ("slunk" . "slink")
+        ("smelt" . "smell")
+        ("smote" . "smite") ("smitten" . "smite")
+        ("sown" . "sow")
+        ("spoke" . "speak") ("spoken" . "speak")
+        ("sped" . "speed")
+        ("spelt" . "spell")
+        ("spellbound" . "spellbind")
+        ("spent" . "spend")
+        ("spilt" . "spill")
+        ("spun" . "spin") ("span" . "spin")
+        ("spat" . "spit")
+        ("spoilt" . "spoil")
+        ("sprang" . "spring") ("sprung" . "spring")
+        ("stood" . "stand")
+        ("stove" . "stave")
+        ("stole" . "steal") ("stolen" . "steal")
+        ("stuck" . "stick")
+        ("stung" . "sting")
+        ("stank" . "stink") ("stunk" . "stink")
+        ("strewn" . "strew")
+        ("strode" . "stride") ("stridden" . "stride")
+        ("struck" . "strike") ("stricken" . "strike")
+        ("strung" . "string")
+        ("strove" . "strive") ("striven" . "strive")
+        ("swore" . "swear") ("sworn" . "swear")
+        ("swept" . "sweep")
+        ("swollen" . "swell")
+        ("swam" . "swim") ("swum" . "swim")
+        ("swung" . "swing")
+        ("took" . "take") ("taken" . "take")
+        ("taught" . "teach")
+        ("tore" . "tear") ("torn" . "tear")
+        ("telecasted" . "telecast")
+        ("told" . "tell")
+        ("thought" . "think")
+        ("throve" . "thrive") ("thriven" . "thrive")
+        ("threw" . "throw") ("thrown" . "throw")
+        ("thrust" . "thrust") ("thrust" . "thrust")
+        ("trod" . "tread") ("trodden" . "tread")
+        ("unbent" . "unbend")
+        ("unbound" . "unbind")
+        ("underwent" . "undergo") ("undergone" . "undergo")
+        ("understood" . "understand")
+        ("undertook" . "undertake") ("undertaken" . "undertake")
+        ("undid" . "undo") ("undone" . "undo")
+        ("woke" . "wake") ("woken" . "wake")
+        ("wore" . "wear") ("worn" . "wear")
+        ("wove" . "weave") ("woven" . "weave")
+        ("wept" . "weep")
+        ("won" . "win")
+        ("wound" . "wind")
+        ("withdrew" . "withdraw") ("withdrawn" . "withdraw")
+        ("withheld" . "withhold")
+        ("withstood" . "withstand")
+        ("wrought" . "work")
+        ("wrung" . "wring")
+        ("wrote" . "write") ("written" . "write")
+;;
+        ("does" . "do") ("did" "do")
+        ("could" . "can")
+        ("would" . "will")
+        ("should" . "shall")
+        ("might" . "may")
+;       ("ain't" "be")
+        ))
+
+(defvar nt-english-irreg-nouns-list
+      '(
+        ("children" . "child")
+        ("boxen" . "box") ("oxen" . "ox")
+        ("men" . "man") ("women" . "woman")
+        ("geese" . "goose") ("teeth" . "tooth") ("feet" . "foot") ("mice" . "mouse")
+                                        ; ("those" . "that") ("these" . "this")
+        ))
+
+(defun nt:english-guess-original-form (word)
+  (catch 'block
+    (cond
+     ((null word) (throw 'block nil))
+     ((string= word "") (throw 'block nil))
+     (t nil)
+     )
+    
+    (let* ((word-len (length word))
+           (body-1 nil) (suffix-1 nil)
+           (body-2 nil) (suffix-2 nil)
+           (body-3 nil) (suffix-3 nil)
+           (body-4 nil) (suffix-4 nil) (tmp))
+
+      (setq body-1 (substring word 0 -1))
+      (setq suffix-1 (substring word -1 nil))
+
+      (if (>= word-len 2)
+          (progn
+           (setq body-2 (substring word 0 -2))
+           (setq suffix-2 (substring word -2 nil))
+           
+           (if (>= word-len 3)
+               (progn
+                (setq body-3 (substring word 0 -3))
+                (setq suffix-3 (substring word -3 nil))
+                
+                (if (>= word-len 4)
+                    (progn
+                     (setq body-4 (substring word 0 -4))
+                     (setq suffix-4 (substring word -4 nil))
+                     ))
+                ))
+           ))
+      
+      ;; irregular verbs/nouns first.
+      (setq tmp (cdr (assoc word nt-english-irreg-verbs-list)))
+      (if tmp (throw 'block (list tmp)))
+      (setq tmp (cdr (assoc word nt-english-irreg-nouns-list)))
+      (if tmp (throw 'block (list tmp)))
+      
+      (cond
+       ((string= suffix-3 "ves") (list (concat body-3 "fe") (concat body-3 "f") body-1)) ;; -f > -ves
+       ((string= suffix-3 "ies") (list (concat body-3 "y") body-1)) ;; -y > -ies
+       ((string= suffix-3 "oes") (list body-2)) ;; o > o(e)s
+       ((string= suffix-2 "es") (list (concat body-2 "is") body-1 body-2)) ;; (e)s, -is
+       ((string= suffix-1 "s") (list body-1))
+       ((string= suffix-1 "i") (list (concat body-1 "us"))) ;; -us > -i
+       ((string= suffix-1 "a") (list (concat body-1 "um") (concat body-1 "on"))) ;; -um > -a
+       ((string= suffix-2 "ae") (list body-1)) ;; -a > -ae
+       
+                                        ; verb -ed
+       ((string= suffix-4 "nned") (list body-3)) ;; -n > -nned
+       ((string= suffix-4 "dded") (list body-3)) ;; -d > -dded
+       ((string= suffix-4 "tted") (list body-3)) ;; -t > -tted
+       ((string= suffix-4 "pped") (list body-3)) ;; -p > -pped
+       ((string= suffix-4 "gged") (list body-3)) ;; -g > -gged
+       ((string= suffix-4 "cked") (list body-2 body-3)) ;; -c[k] > -cked
+       ((string= suffix-3 "ied") (list (concat body-3 "y"))) ;; -�Ҳ�+y > -ied ��-���+y > yed
+       ((string= suffix-2 "ed") (list body-1 body-2)) ;; (default) -(e) > -ed
+       ((string= suffix-2 "id") (list (concat body-2 "y"))) ;; pay > paid, say > said
+                                        ; verb -ing
+       ((string= suffix-4 "ying") (list (concat body-4 "ie") body-3))
+       ((string= suffix-3 "ing") (list (concat body-3 "e") body-3))
+
+       ((string= suffix-3 "n't") (list body-3))
+       ((string= suffix-3 "'ll") (list body-3))
+       ((string= suffix-3 "'re") (list body-3))
+       ((string= suffix-2 "'m") (list body-2))
+       ((string= suffix-2 "'d") (list body-2))
+       ((string= suffix-2 "'s") (list body-2))
+      
+       (t nil) ;; ������ʤ���������������
+       ) ;cond
+      ) ;let
+    );caught
+  )
+
+(defmacro nt:skipit-p (word)
+  `(if (member (downcase ,word) nt-skip-words) t nil))
+
+;;; nt-english.el ends here
Index: lang/elisp/pdicv-mode/trunk/pdicv-search.el
===================================================================
--- lang/elisp/pdicv-mode/trunk/pdicv-search.el (revision 67)
+++ lang/elisp/pdicv-mode/trunk/pdicv-search.el (revision 67)
@@ -0,0 +1,240 @@
+;;; pdicv-search.el --- upper layer
+;;
+;; Copyright (C) 2005 Naoya TOZUKA. All Rights Reserved.
+;;
+;; Author: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Maintainer: Naoya TOZUKA <pdicviewer@gmail.com>
+;; Primary distribution site: http://pdicviewer.naochan.com/el/
+;;
+;; Created: 06 Feb 2005
+;; Last modified: 23 Dec 2005
+;; Version: 0.9.1
+;; Keywords: read-from-file
+
+(provide 'pdicv-search)
+
+;;; Copmmentary:
+;;
+; (pdicv-init)
+;   - ���������񥤥�å�����߹��������
+;
+; (pdicv-search-regexp DICNAME REGEXP-TO-SEARCH [FIELD-TO-SEARCH])
+;   - ���ɽ������(pdicv-search-just DICNAME WORD-TO-SEARCH [FIELD-TO-SEARCH])
+;   - exact����(pdicv-search DICNAME WORD-TO-SEARCH [JUST-P REGEXP-P FILED-TO-SEARCH])
+;   - ���񸡺�; (pdicv-search-interactive)
+;   - <interactive> �ߥ˥Хåե����������ñ������(pdicv-search-region FROM TO)
+;   - <interactive> ��ꤷ����Ϥ��������(pdicv-set-target-dictionary)
+;   - <interactive> ����ݼ����� (pdicv-search-current-word)
+;   - <interactive> ����������ˤ���������(pdicv-search-next-word)
+;   - <interactive> ���ĸ�ñ������(pdicv-search-previous-word)
+;   - <interactive> ��������������
+;;; Code:
+(require 'nt-macros)
+(require 'nt-bocu)
+(require 'nt-english)
+(require 'pdicv-core)
+
+(defvar pdicv-dictionary-list ())
+(defvar pdicv-index-table-list ())
+
+(defvar pdicv-target-dictionary nil)
+(defvar pdicv-inited-p nil)
+
+(defun pdicv-init ()
+  "preload index-tables"
+  (catch 'pdicv-init
+    (if pdicv-inited-p (throw 'pdicv-init nil))
+    (setq pdicv-index-table-list '())
+    (garbage-collect)
+    (let ((diclist pdicv-dictionary-list))
+      (while diclist
+        (let* ((dicinfo (car diclist))
+               (dicname (car dicinfo))
+               (path (nth 1 dicinfo))
+               (encoding-list (nth 2 dicinfo))
+               (word-encoding (if (atom encoding-list) encoding-list (car encoding-list)))
+               (index-table nil))
+          (if (atom path)
+              (progn
+                (message "Loading index-table for %s (\"%s\")..." dicname path)
+                (setq index-table (pdicv-get-index-list path word-encoding))
+                (push (cons dicname index-table) pdicv-index-table-list))
+            );fi
+          );let*
+        (setq diclist (cdr diclist))
+        );wend
+      (setq pdicv-inited-p t)
+      (message "Done.")
+      ); let
+    );caught
+  )
+
+(defun pdicv-search-regexp (dicname regexp-to-search &optional field-to-search)
+  ""
+;  (pdicv-search dicname nil regexp-to-search t field-to-search)
+  (pdicv-search dicname regexp-to-search nil t field-to-search)
+  )
+
+(defun pdicv-search-just (dicname word-to-search &optional field-to-search)
+  ""
+  (pdicv-search dicname word-to-search t nil field-to-search)
+  )
+
+(defun pdicv-search (dicname word-to-search &optional just-p regexp-p field-to-search)
+  ""
+  (if (null just-p) (setq just-p nil))
+  (if (null regexp-p) (setq regexp-p nil))
+  (if (null field-to-search) (setq field-to-search 'e))
+
+  (catch 'pdicv-search
+    (let ((candidates
+           (if just-p (cons (downcase word-to-search) (nt:english-guess-original-form word-to-search))))
+          (candidate word-to-search)
+          (first-round-p t)
+          (dicinfo (assoc dicname pdicv-dictionary-list)))
+
+      (if (null dicinfo) (throw 'pdicv-search 'dictionary-not-found))
+
+;      (push (downcase word-to-search) candidates)
+      (if (not (string= (downcase word-to-search) word-to-search))
+          (push word-to-search candidates))
+
+      (while (setq candidate (pop candidates))
+                                        ;path
+        (if (listp (cadr dicinfo))
+            (let ((dicname-list (cadr dicinfo)))
+              (while dicname-list
+                (pdicv-search (car dicname-list) candidate just-p regexp-p field-to-search)
+                (setq dicname-list (cdr dicname-list))
+                )
+              )
+                                        ;else...
+          (let* ((encoding-list (nth 2 dicinfo))
+                 (word-encoding (if (listp encoding-list) (car encoding-list) encoding-list))
+                 (word-in-dic-encoding (cond
+                                        ((eq word-encoding 'bocu)
+                                         (nt:bocu-encode candidate))
+                                        ((eq word-encoding 'sjis)
+                                         (encode-coding-string candidate 'japanese-shift-jis-dos))
+                                        ((eq word-encoding 'latin1)
+                                         (encode-coding-string candidate 'iso-latin-1-dos))
+                                        (word-encoding
+                                         (encode-coding-string candidate word-encoding))
+                                        (t candidate)))
+                 (needle1 word-in-dic-encoding)
+                 (needle1-len (length needle1))
+                 (needle2 (concat (substring needle1 0 -1)
+                                  (string (1+ (aref needle1 (1- needle1-len))))))
+                 (simple-mode-p just-p)
+
+                 (criteria
+                  (if regexp-p (list
+                                (concat "/" candidate "/")
+                                (if (string-match "^^[^[]" candidate) ; optimizable
+                                    (cons (substring candidate 1 2)
+                                          (string (1+ (aref candidate 1))))
+                                  nil)
+;				'(lambda (ix) (let ((word (cadr (car ix))))
+;						(string-match needle1 word)))
+;				)
+                                `(lambda (e p j x) (string-match ,needle1 ,field-to-search))
+                                );list
+                    (list
+                     candidate    ; �����������ɽ���ˤ���������ʤ���                     (cons needle1 needle2) ; index�����nil�ʤ�ʸ����                                      ;		   '(lambda (ix) (let ((word (cadr (car ix))))
+                                        ;				   (and (not (string< word needle1))
+                                       ;					(string< word needle2))))
+                     (if just-p
+                         `(lambda (e p j x) (zerop (nt:strcmp ,field-to-search ,needle1)))
+                       `(lambda (e p j x) (and (not (string< ,field-to-search ,needle1))
+                                               (string< ,field-to-search ,needle2))) ; �ǡ����֥��������
+                       );just-p
+                     );list
+                    ));fi,criteria
+
+                 );let*
+                                        ;	  (insert (format "%s" criteria))
+
+            (pdicv-core-search dicinfo criteria simple-mode-p (not first-round-p)) ; clear only at the first time
+            );let*
+          );fi
+        (setq first-round-p nil)
+        );wend
+      );let
+    );caught
+  )
+
+(defun pdicv-search-interactive ()
+  (interactive)
+  (catch 'block
+    (let ((dicname (completing-read "Target dictionary: " pdicv-dictionary-list nil t ""))
+          (word-to-search nil))
+;        (completing-read "Target dictionary:" (mapcar 'car pdicv-dictionary-list) nil t ""))
+      (if (null dicname) (throw 'block nil))
+
+      (setq word-to-search
+            (read-from-minibuffer "Word to search: "))
+      (if (> (length word-to-search) 0)
+          (pdicv-search (intern dicname) word-to-search))
+      );let
+    );caught
+  )
+
+
+(defun pdicv-search-region (from to)
+  ""
+  (interactive "r")
+  (let ((dicname (completing-read "Target dictionary: " pdicv-dictionary-list nil t "")))
+    (if dicname (pdicv-search (intern dicname) (buffer-substring from to)))
+    );let
+  )
+
+(defun pdicv-set-target-dictionary ()
+  ""
+  (interactive)
+  (let ((dicname (completing-read "Target dictionary: " pdicv-dictionary-list nil t "")))
+    (if dicname (setq pdicv-target-dictionary (intern dicname)))
+    );let
+  )
+
+(defun pdicv-search-current-word ()
+  ""
+  (interactive)
+  (if (null pdicv-target-dictionary) (pdicv-set-target-dictionary))
+
+  (let ((word (thing-at-point 'word)))
+    (if word;(and word (not (nt:skipit-p word-to-search)))
+        (pdicv-search-just pdicv-target-dictionary word)
+      (message "no word at cursor"))
+    );let
+  )
+
+(defun pdicv-search-next-word ()
+  ""
+  (interactive)
+  (if (null pdicv-target-dictionary) (pdicv-set-target-dictionary))
+
+  (forward-word 1) (forward-char)
+;  (pdicv-search-current-word)
+
+  (let ((word (thing-at-point 'word)))
+    (if (and word (not (nt:skipit-p word)))
+        (pdicv-search-just pdicv-target-dictionary word)
+      (progn
+        (forward-word 1) (forward-char)
+        (setq word (thing-at-point 'word))
+        (if (and word (not (nt:skipit-p word)))
+            (pdicv-search-just pdicv-target-dictionary word)
+          (message "no word at cursor"));fi
+        );progn
+      );fi
+    );let
+  )
+
+(defun pdicv-search-previous-word ()
+  ""
+  (interactive)
+  (forward-word -1) ; (backward-word 1)
+  (pdicv-search-current-word)
+  )
+
+;;; pdicv-search.el ends here
Index: lang/elisp/pdicv-mode/trunk/COPYING
===================================================================
--- lang/elisp/pdicv-mode/trunk/COPYING (revision 67)
+++ lang/elisp/pdicv-mode/trunk/COPYING (revision 67)
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: lang/elisp/pdicv-mode/trunk/Makefile
===================================================================
--- lang/elisp/pdicv-mode/trunk/Makefile (revision 67)
+++ lang/elisp/pdicv-mode/trunk/Makefile (revision 67)
@@ -0,0 +1,50 @@
+#
+# Makefile (to byte-compile)
+#
+EMACS=emacs
+#EMACS=/Applications/Emacs.app/Contents/MacOS/bin/emacs
+
+.SUFFIXES:
+.SUFFIXES: .el .elc
+.el.elc:
+	$(EMACS) -batch -q -no-site-file -f batch-byte-compile $<
+
+all: nt-macros.elc nt-readval.elc nt-string.elc nt-utf8.elc nt-bocu.elc nt-file.elc nt-english.elc \
+	pdicv-core.elc pdicv-search.elc pdicv-eijiro.elc pdicv-mode.elc pdicviewer.elc
+
+clean:
+	rm -f *.elc *~
+
+nt-macros.elc: nt-macros.el
+
+nt-readval.elc: nt-readval.el
+
+nt-string.elc: nt-string.el # requires nt-macros
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc  -f batch-byte-compile $<
+
+nt-utf8.elc: nt-utf8.el
+
+nt-bocu.elc: nt-bocu.el # requires nt-utf8
+	$(EMACS) -batch -q -no-site-file -l nt-utf8.elc  -f batch-byte-compile $<
+
+nt-file.elc: nt-file.el
+
+nt-english.elc: nt-english.el
+
+pdicv-core.elc: pdicv-core.el # nt-macros.elc nt-readval.elc nt-string.elc nt-bocu.elc nt-file.elc nt-english.elc
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc -l nt-readval.elc -l nt-string.elc -l nt-utf8.elc -l nt-bocu.elc -l nt-file.elc -l nt-english.elc  -f batch-byte-compile $<
+
+## defface may cause warnings on several environment; ignore them.
+
+pdicv-search.elc: pdicv-search.el # requires nt-macros, nt-bocu, pdicv-core
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc -l nt-readval.elc -l nt-string.elc -l nt-utf8.elc -l nt-bocu.elc -l nt-file.elc -l nt-english.elc -l pdicv-core.elc  -f batch-byte-compile $<
+
+pdicv-eijiro.elc: pdicv-eijiro.el # requires pdicv-search
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc -l nt-readval.elc -l nt-string.elc -l nt-utf8.elc -l nt-bocu.elc -l nt-file.elc -l nt-english.elc -l pdicv-core.elc -l pdicv-search.elc  -f batch-byte-compile $<
+
+pdicv-mode.elc: pdicv-mode.el  pdicv-core.elc pdicv-search.elc pdicv-eijiro.elc
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc -l nt-readval.elc -l nt-string.elc -l nt-utf8.elc -l nt-bocu.elc -l nt-file.elc -l nt-english.elc -l pdicv-core.elc -l pdicv-search.elc -l pdicv-eijiro.elc  -f batch-byte-compile $<
+
+pdicviewer.elc: pdicviewer.el  pdicv-core.elc pdicv-search.elc pdicv-eijiro.elc
+	$(EMACS) -batch -q -no-site-file -l nt-macros.elc -l nt-readval.elc -l nt-string.elc -l nt-utf8.elc -l nt-bocu.elc -l nt-file.elc -l nt-english.elc -l pdicv-core.elc -l pdicv-search.elc -l pdicv-eijiro.elc -l pdicv-mode.elc  -f batch-byte-compile $<
+
