Merge egg-980220.
[elisp/egg.git] / egg / sj3.el
index cf05bfa..6f059a7 100644 (file)
 
 ;; This file will be part of GNU Emacs (in future).
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; EGG 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, or (at your option)
 ;; any later version.
 
-;; GNU Emacs is distributed in the hope that it will be useful,
+;; EGG 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.
@@ -29,6 +29,8 @@
 
 ;;; Code:
 
+(defconst sj3-support-languages '("Japanese"))
+
 (defconst sj3-conversion-backend
   [ sj3-init
 
 (defun sj3-init ()
   )
 
-(defun sj3-start-conversion (yomi)
+(defun sj3-start-conversion (yomi lang)
   "Convert YOMI string to kanji, and enter conversion mode.
 Return the list of bunsetsu."
   (let ((env (sj3-get-environment)))
@@ -220,10 +222,8 @@ Return the list of bunsetsu."
        (env (sj3bunsetsu-get-env b1))
        yomi1 yomi2
        bunsetsu1 bunsetsu2)
-    (save-match-data
-      (string-match (concat "^\\(" (make-string len ?.) "\\)\\(.*$\\)") yomi)
-      (setq yomi1 (match-string 1 yomi))
-      (setq yomi2 (match-string 2 yomi)))
+    (setq yomi1 (substring yomi 0 len)
+         yomi2 (substring yomi len))
     (setq bunsetsu1
          (sj3rpc-tanbunsetsu-conversion env yomi1))
     ;; Only set once.
@@ -240,7 +240,7 @@ Return the list of bunsetsu."
       (list bunsetsu1))))
 
 ;; XXX: Not implemented yet
-(defun sj3-fini ()
+(defun sj3-fini (lang)
   )
 
 ;;; setup
@@ -249,10 +249,12 @@ Return the list of bunsetsu."
 (load "egg/sj3rpc")
 
 ;;;###autoload
-(defun egg-activate-sj3 (&optional arg)
+(defun egg-activate-sj3 (&rest arg)
   "Activate SJ3 backend of Tamagotchy."
-  (setq egg-conversion-backend sj3-conversion-backend)
-  (egg-mode arg)
-  )
+  (egg-set-support-languages sj3-support-languages)
+  (egg-set-conversion-backend sj3-conversion-backend 
+                             sj3-support-languages
+                             nil)
+  (apply 'egg-mode arg))
 
 ;;; egg/sj3.el ends here.