Revision: 6106
Author: iratqq
Date: Mon Dec 7 02:48:20 2009
Log: * scm/sj3.scm:
- Use sj3v2-socket.scm.
* scm/sj3v2-socket.scm:
- New file.
* scm/sj3-custom.scm (sj3-unix-domain-socket-path):
- Add sj3-unix-domain-socket-path.
* scm/Makefile.am (SCM_FILES):
- Add sj3v2-socket.scm.
(module_names):
- Set to default.
* configure.ac:
- Remove SJ3.
* uim/Makefile.am:
- Ditto.
* uim/sj3.c:
- Bye bye.
http://code.google.com/p/uim/source/detail?r=6106
Added:
/trunk/scm/sj3v2-socket.scm
Deleted:
/trunk/uim/sj3.c
Modified:
/trunk/configure.ac
/trunk/scm/Makefile.am
/trunk/scm/sj3-custom.scm
/trunk/scm/sj3.scm
/trunk/uim/Makefile.am
=======================================
--- /dev/null
+++ /trunk/scm/sj3v2-socket.scm Mon Dec 7 02:48:20 2009
@@ -0,0 +1,443 @@
+;;; sj3v2-socket.scm: SJ3 protocol version 2 for uim.
+;;;
+;;; Copyright (c) 2009- uim Project http://code.google.com/p/uim/
+;;;
+;;; All rights reserved.
+;;;
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+;;; 1. Redistributions of source code must retain the above copyright
+;;; notice, this list of conditions and the following disclaimer.
+;;; 2. Redistributions in binary form must reproduce the above copyright
+;;; notice, this list of conditions and the following disclaimer in the
+;;; documentation and/or other materials provided with the distribution.
+;;; 3. Neither the name of authors nor the names of its contributors
+;;; may be used to endorse or promote products derived from this
software
+;;; without specific prior written permission.
+;;;
+;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND
+;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE
+;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
+;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY
+;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+;;; SUCH DAMAGE.
+;;;;
+
+(use srfi-1)
+(require "util.scm")
+(require "i18n.scm")
+(require "socket.scm")
+(require "lolevel.scm")
+(require "process.scm") ;; getpid
+
+;; sj3v2 protocol operators
+(define $SJ3_CONNECT 1)
+(define $SJ3_DISCONNECT 2)
+(define $SJ3_OPENDICT 11)
+(define $SJ3_CLOSEDICT 12)
+(define $SJ3_OPENSTDY 21)
+(define $SJ3_CLOSESTDY 22)
+(define $SJ3_STDYSIZE 23)
+(define $SJ3_STUDY 61)
+(define $SJ3_MAKEDICT 81)
+(define $SJ3_MAKESTDY 82)
+(define $SJ3_MAKEDIR 83)
+(define $SJ3_ACCESS 84)
+(define $SJ3_PH2KNJ_EUC 111)
+(define $SJ3_CL2KNJ_ALL_EUC 115)
+(define $SJ3_CL2KNJ_CNT_EUC 116)
+(define $SJ3_CLSTUDY_EUC 117)
+
+(define sj3-lib-error-str-alist
+ '((-1 . (N_ "Internal server error.")) ;; SJ3_InternalError
+ (0 . (N_ "No error.")) ;; SJ3_NormalEnd
+ (1 . (N_ "Serverdown.")) ;; SJ3_ServerDown
+ (2 . (N_ "Cannot open socket.")) ;; SJ3_OpenSocket
+ (3 . (N_ "Cannot connect socket.")) ;; SJ3_ConnectSocket
+ (4 . (N_ "Unknown hostname.")) ;; SJ3_GetHostByName
+ (5 . (N_ "Not opened.")) ;; SJ3_NotOpened
+ (6 . (N_ "Not enough memory.")) ;; SJ3_NotEnoughMemory
+ (7 . (N_ "Illegal command.")) ;; SJ3_IllegalCommand
+ (11 . (N_ "Different version.")) ;; SJ3_DifferentVersion
+ (12 . (N_ "No host name.")) ;; SJ3_NoHostName
+ (13 . (N_ "No user name.")) ;; SJ3_NoUserName
+ (14 . (N_ "User not allowd.")) ;; SJ3_NotAllowedUser
+ (15 . (N_ "Already connected.")) ;; SJ3_AlreadyConnected
+ (16 . (N_ "Not connected.")) ;; SJ3_NotConnected
+ (21 . (N_ "Too long parameter.")) ;; SJ3_TooLongParameter
+ (22 . (N_ "Illegal parameter.")) ;; SJ3_IllegalParameter
+ (31 . (N_ "Bad dictionary ID.")) ;; SJ3_BadDictID
+ (32 . (N_ "Illegal dictionary file.")) ;; SJ3_IllegalDictFile
+ (33 . (N_ "Illegal study file.")) ;; SJ3_IllegalStdyFile
+ (34 . (N_ "Incorrect password.")) ;; SJ3_IncorrectPasswd
+ (35 . (N_ "File not exist.")) ;; SJ3_FileNotExist
+ (36 . (N_ "Cannot access file.")) ;; SJ3_CannotAccessFile
+ (37 . (N_ "Cannot open file.")) ;; SJ3_CannotOpenFile
+ (38 . (N_ "Cannot create file.")) ;; SJ3_CannotCreateFile
+ (39 . (N_ "File read error.")) ;; SJ3_FileReadError
+ (40 . (N_ "File write error.")) ;; SJ3_FileWriteError
+ (41 . (N_ "File seek error.")) ;; SJ3_FileSeekError
+ (51 . (N_ "Study already opened.")) ;; SJ3_StdyAlreadyOpened
+ (52 . (N_ "Study file not opened.")) ;; SJ3_StdyFileNotOpened
+ (53 . (N_ "Too small study area.")) ;; SJ3_TooSmallStdyArea
+ (61 . (N_ "Locked by other.")) ;; SJ3_LockedByOther
+ (62 . (N_ "Not locked.")) ;; SJ3_NotLocked
+ (71 . (N_ "No such dictionary.")) ;; SJ3_NoSuchDict
+ (72 . (N_ "Dictionary is read only.")) ;; SJ3_ReadOnlyDict
+ (73 . (N_ "Dictionary is locked.")) ;; SJ3_DictLocked
+ (74 . (N_ "Yomi string is bad.")) ;; SJ3_BadYomiString
+ (75 . (N_ "Kanji string is bad.")) ;; SJ3_BadKanjiString
+ (76 . (N_ "Hinshi code is bad.")) ;; SJ3_BadHinsiCode
+ (81 . (N_ "Add dictionary failed.")) ;; SJ3_AddDictFailed
+ (82 . (N_ "Word is already exist.")) ;; SJ3_AlreadyExistWord
+ (83 . (N_ "No more douon word.")) ;; SJ3_NoMoreDouonWord
+ (84 . (N_ "No more user dictionary.")) ;; SJ3_NoMoreUserDict
+ (85 . (N_ "No more index block")) ;; SJ3_NoMoreIndexBlock
+ (91 . (N_ "Delete dictionary failed.")) ;; SJ3_DelDictFailed
+ (92 . (N_ "No such word.")) ;; SJ3_NoSuchWord
+ (101 . (N_ "Directory already exist.")) ;; SJ3_DirAlreadyExist
+ (102 . (N_ "Cannot create directory.")) ;; SJ3_CannotCreateDir
+ (111 . (N_ "No more dictionary data.")) ;; SJ3_NoMoreDictData
+ (121 . (N_ "User connected.")) ;; SJ3_UserConnected
+ (131 . (N_ "Too long password.")) ;; SJ3_TooLongPasswd
+ (132 . (N_ "Too long comment.")) ;; SJ3_TooLongComment
+ (133 . (N_ "Cannot code convert.")))) ;; SJ3_CannotCodeConvert
+
+
+(define sj3-protocol-version 2)
+
+;; helper functions
+(define (sj3-lib-get-string-with-terminate socket)
+ (let loop ((c (file-read socket 1))
+ (rest '()))
+ (cond ((eof-object? c)
+ (uim-notify-fatal (N_ "unexpected terminate string."))
+ "")
+ ((eq? (car c) #\nul)
+ (file-buf->string (reverse rest)))
+ (else
+ (loop (file-read socket 1) (cons (car c) rest))))))
+
+
+;;
+;; sj3 protocol api
+;;
+(define (sj3-lib-connect socket user)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 u32 s8 s8 s8)
+ $SJ3_CONNECT sj3-protocol-version
+ "unix" user (format "~a.uim-sj3"
(current-process-id)))))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= -2 result))))
+
+(define (sj3-lib-disconnect socket)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32) $SJ3_DISCONNECT)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= 0 result))))
+
+(define (sj3-lib-opendict socket dictionary-name passwd)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 s8) $SJ3_OPENDICT
+ dictionary-name passwd)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (and (= result 0)
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result))))))
+
+(define (sj3-lib-closedict socket dict-id)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 u32) $SJ3_CLOSEDICT dict-id)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= 0 result))))
+
+(define (sj3-lib-openstdy socket stdy-name)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 s8) $SJ3_OPENSTDY stdy-name "")))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result)))
+
+(define (sj3-lib-closestdy socket)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32) $SJ3_CLOSESTDY)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result)))
+
+(define (sj3-lib-stdy-size socket)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32) $SJ3_STDYSIZE)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (and (= result 0)
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result))))))
+
+(define (sj3-lib-study socket stdy)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 u8list) $SJ3_STUDY stdy)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result)))
+
+(define (sj3-lib-makedict socket dictionary-name)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 u32 u32 u32) $SJ3_MAKEDICT
+ dictionary-name
+ 2048 ; Index length
+ 2048 ; Length
+ 256 ; Number
+ )))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= 0 result))))
+
+(define (sj3-lib-makestdy socket stdy-name)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 u32 u32 u32) $SJ3_MAKESTDY
+ stdy-name
+ 2048 ; Number
+ 1 ; Step
+ 2048 ; Length
+ )))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= 0 result))))
+
+(define (sj3-lib-makedir socket directory-name)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8) $SJ3_MAKEDIR directory-name)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result)))
+
+(define (sj3-lib-access? socket directory-name mode)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 u32) $SJ3_ACCESS
+ directory-name
+ mode)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (= 0 result))))
+
+(define (sj3-lib-ph2knj-euc socket stdy-size yomi)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8) $SJ3_PH2KNJ_EUC yomi)))
+ (call-with-u8list-unpack
+ '(u32 u32) (string-buf->u8list (file-read socket 8))
+ (lambda (result yomi-length)
+ (and (= result 0)
+ (let loop ((yomi-len (cons (car (string-buf->u8list (file-read
socket 1)))
+ '()))
+ (rest-stdy '())
+ (rest-kouho '()))
+ (if (<= (car yomi-len) 0)
+ (values (reverse yomi-len) (reverse rest-stdy) (reverse
rest-kouho))
+ (let* ((new-stdy (string-buf->u8list (file-read socket
stdy-size)))
+ (new-kouho (sj3-lib-get-string-with-terminate
socket)))
+ (loop (cons (car (string-buf->u8list (file-read socket
1)))
+ yomi-len)
+ (cons new-stdy rest-stdy)
+ (cons new-kouho rest-kouho)))))))))
+
+(define (sj3-lib-cl2knj-all-euc socket stdy-size len yomi)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 u32 s8) $SJ3_CL2KNJ_ALL_EUC len yomi)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (and (= result 0)
+ (let loop ((yomi-len
+ (cons (u8list->u32 (string-buf->u8list (file-read
socket 4)))
+ '()))
+ (rest-stdy '())
+ (rest-kouho '()))
+ (if (<= (car yomi-len) 0)
+ (values (reverse yomi-len) (reverse rest-stdy) (reverse
rest-kouho))
+ (let* ((new-stdy (string-buf->u8list (file-read socket
stdy-size)))
+ (new-kouho (sj3-lib-get-string-with-terminate
socket)))
+ (loop (cons (u8list->u32 (string-buf->u8list (file-read
socket 4)))
+ yomi-len)
+ (cons new-stdy rest-stdy)
+ (cons new-kouho rest-kouho)))))))))
+
+(define (sj3-lib-cl2knj-cnt-euc socket stdy-size len yomi)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 u32 s8) $SJ3_CL2KNJ_CNT_EUC len yomi)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ (and (= result 0)
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result))))))
+
+(define (sj3-lib-clstudy-euc socket yomi1 yomi2 stdy)
+ (file-write socket
+ (u8list->string-buf
+ (u8list-pack '(u32 s8 s8 u8list) $SJ3_CLSTUDY_EUC
+ yomi1 yomi2 stdy)))
+ (call-with-u8list-unpack
+ '(u32) (string-buf->u8list (file-read socket 4))
+ (lambda (result)
+ result)))
+
+
+;;
+;; helper functions
+;;
+(define (sj3-lib-mkdir-p socket path)
+ (let ((entries (string-split path "/")))
+ (fold (lambda (acc rest)
+ (let ((new-path (if (string=? rest "")
+ acc
+ (string-append rest "/" acc))))
+ (if (not (sj3-lib-access? socket acc 0))
+ (sj3-lib-makedir socket new-path))
+ new-path))
+ ""
+ entries)))
+
+(define (sj3-lib-split-yomi yomi yomi-length-list)
+ (let loop ((yomi yomi)
+ (yomi-length-list yomi-length-list)
+ (rest '()))
+ (if (= (car yomi-length-list) 0)
+ (reverse rest)
+ (loop (substring yomi (car yomi-length-list) (string-length yomi))
+ (cdr yomi-length-list)
+ (cons (substring yomi 0 (car yomi-length-list)) rest)))))
+
+
+;;
+;; sj3lib compatible functions
+;;
+
+(define *sj3-lib-socket* #f)
+(define *sj3-lib-stdy-size* 20)
+(define *sj3-lib-main-dict* #f)
+(define *sj3-lib-user-dict* #f)
+
+(define (sj3-lib-get-private-path user-name)
+ (format "user/~a" user-name))
+(define (sj3-lib-get-private-dicionary-name user-name)
+ (format "~a/private.dic" (sj3-lib-get-private-path user-name)))
+(define (sj3-lib-get-private-study-name user-name)
+ (format "~a/study.dat" (sj3-lib-get-private-path user-name)))
+
+(define (sj3-lib-open-with-server server)
+ (let ((server-name (if (equal? server "")
+ "localhost")))
+ (if sj3-use-remote-server?
+ (tcp-connect server-name 3086)
+ (unix-domain-socket-connect sj3-unix-domain-socket-path))))
+
+(define (sj3-lib-open server user-name)
+ (set! *sj3-lib-socket* (sj3-lib-open-with-server server))
+ (if *sj3-lib-socket*
+ (begin
+ (sj3-lib-connect *sj3-lib-socket* user-name)
+ (set! *sj3-lib-main-dict* (sj3-lib-opendict
*sj3-lib-socket* "sj3main.dic" ""))
+ (if (not (sj3-lib-access? *sj3-lib-socket*
(sj3-lib-get-private-path user-name) 0))
+ (begin
+ (sj3-lib-mkdir-p *sj3-lib-socket* (sj3-lib-get-private-path
user-name))
+ (sj3-lib-makedict *sj3-lib-socket*
(sj3-lib-get-private-dicionary-name user-name))
+ (uim-notify-info (N_ "SJ3: create new dictionary"))))
+ (if (not (sj3-lib-access? *sj3-lib-socket*
(sj3-lib-get-private-study-name user-name) 0))
+ (sj3-lib-makestdy *sj3-lib-socket*
(sj3-lib-get-private-study-name user-name)))
+ (set! *sj3-lib-user-dict*
+ (sj3-lib-opendict *sj3-lib-socket*
(sj3-lib-get-private-dicionary-name user-name) ""))
+ (sj3-lib-openstdy *sj3-lib-socket* (sj3-lib-get-private-study-name
user-name))
+ (set! *sj3-lib-stdy-size* (sj3-lib-stdy-size *sj3-lib-socket*))))
+ *sj3-lib-socket*)
+
+(define (sj3-lib-close)
+ (if *sj3-lib-socket*
+ (begin
+ (sj3-lib-closestdy *sj3-lib-socket*)
+ (sj3-lib-closedict *sj3-lib-socket* *sj3-lib-user-dict*)
+ (sj3-lib-closedict *sj3-lib-socket* *sj3-lib-main-dict*)
+ (sj3-lib-disconnect *sj3-lib-socket*)
+ (file-close *sj3-lib-socket*))))
+
+(define (sj3-lib-getkan yomi)
+ (receive (yomi-len stdy cands)
+ (sj3-lib-ph2knj-euc *sj3-lib-socket* *sj3-lib-stdy-size* yomi)
+ (cons (apply string-append cands)
+ (zip (sj3-lib-split-yomi yomi yomi-len)
+ cands
+ stdy))))
+
+(define (sj3-lib-douoncnt yomi)
+ (sj3-lib-cl2knj-cnt-euc *sj3-lib-socket* *sj3-lib-stdy-size*
+ (length (string->list yomi)) ;; byte length
+ yomi))
+
+(define (sj3-lib-getdouon yomi)
+ (receive (yomi-len stdy cand)
+ (sj3-lib-cl2knj-all-euc *sj3-lib-socket* *sj3-lib-stdy-size*
+ (length (string->list yomi)) ;; byte length
+ yomi)
+ (zip cand stdy)))
+
+(define (sj3-lib-get-nth-douon yomi nth)
+ (receive (yomi-len stdy cand)
+ (sj3-lib-cl2knj-all-euc *sj3-lib-socket* *sj3-lib-stdy-size*
+ (length (string->list yomi)) ;; byte length
+ yomi)
+ (list (list-ref cand nth)
+ (list-ref stdy nth))))
+
+(define (sj3-lib-gakusyuu stdy)
+ (sj3-lib-study *sj3-lib-socket* stdy))
+
+(define (sj3-lib-gakusyuu2 yomi1 yomi2 stdy)
+ (let ((new-yomi1 (and yomi1 ""))
+ (new-yomi2 (and yomi2 "")))
+ (sj3-lib-clstudy-euc *sj3-lib-socket*
+ new-yomi1 new-yomi2
+ stdy)))
+
=======================================
--- /trunk/uim/sj3.c Tue Jan 20 18:11:15 2009
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- Copyright (c) 2008-2009 uim Project http://uim.freedesktop.org/
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of authors nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-
-#include <sj3lib.h>
-
-#include "uim.h"
-#include "uim-scm.h"
-#include "uim-scm-abbrev.h"
-#include "uim-helper.h"
-#include "uim-notify.h"
-#include "gettext.h"
-#include "dynlib.h"
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif
-#ifndef MAXLOGNAME
-#define MAXLOGNAME 32
-#endif
-
-static int uim_sj3_is_open = 0;
-
-struct uim_sj3_error {
- int errno;
- char *error_sym;
- char *error_str;
-};
-
-static uim_lisp
-uim_sj3_make_error_pair(char *sym, char *str)
-{
- char error_str[BUFSIZ];
-
- snprintf(error_str, sizeof(error_str), "%s%s", _("In uim-sj3, "),
_(str));
- uim_notify_fatal(error_str);
- return MAKE_SYM(sym);
-}
-
-static uim_lisp
-uim_sj3_make_single_error(char *sym, char *str)
-{
- return CONS(MAKE_SYM("error"), LIST1(uim_sj3_make_error_pair(sym, str)));
-}
-
-#define uim_sj3_server_down_error()
uim_sj3_make_single_error("*SJ3-SERVER-DOWN-ERROR*" , N_("Serverdown."))
-#define uim_sj3_undefined_error()
uim_sj3_make_single_error("*SJ3-UNDEFINED-ERROR*" , N_("Undefined
error."))
-#define uim_sj3_internal_error()
uim_sj3_make_single_error("*SJ3-UIM-INTERNAL-ERROR*", N_("Internal error."))
-
-static uim_lisp
-uim_sj3_select_error(int errno, const struct uim_sj3_error *error)
-{
- uim_lisp ret_ = uim_scm_null();
-
- while (error->error_sym != NULL) {
- if (errno & error->errno)
- ret_ = CONS(uim_sj3_make_error_pair(error->error_sym,
error->error_str), ret_);
- error++;
- }
-
- if (NULLP(ret_))
- return uim_sj3_internal_error();
-
- return ret_ = CONS(MAKE_SYM("error"),
- uim_scm_callf("reverse", "o", ret_));
-}
-
-
-const static struct uim_sj3_error uim_sj3_open_error[] = {
- { SJ3_NORMAL_END, "*SJ3-NORMAL-END*" , N_("Normal end.") },
- { SJ3_SERVER_DEAD, "*SJ3-SERVER-DEAD*" , N_("Server is
dead.") },
- { SJ3_CONNECT_ERROR, "*SJ3-CONNECT-ERROR*" , N_("Connect
failed.") },
- { SJ3_ALREADY_CONNECTED, "*SJ3-ALREADY-CONNECTED*", N_("Already
connected.") },
- { SJ3_CANNOT_OPEN_MDICT, "*SJ3-CANNOT-OPEN-MDICT*", N_("Cannot open main
dictionary file.") },
- { SJ3_CANNOT_OPEN_UDICT, "*SJ3-CANNOT-OPEN-UDICT*", N_("Cannot open user
dictionary file.") },
- { SJ3_CANNOT_OPEN_STUDY, "*SJ3-CANNOT-OPEN-STUDY*", N_("Cannot open
study file.") },
- { SJ3_CANNOT_MAKE_UDIR, "*SJ3-CANNOT-MAKE-UDIR*", N_("Cannot make user
dictionary directory.") },
- { SJ3_CANNOT_MAKE_UDICT, "*SJ3-CANNOT-MAKE-UDICT*", N_("Cannot make user
dictionary file.") },
- { SJ3_CANNOT_MAKE_STUDY, "*SJ3-CANNOT-MAKE-STUDY*", N_("Cannot make
study file.")},
- { -1, NULL, NULL }
-};
-
-static uim_lisp
-uim_sj3_open(uim_lisp sname_, uim_lisp uname_)
-{
- char sname[MAXHOSTNAMELEN];
- char uname[MAXLOGNAME];
- int ret;
-
- if (strlcpy(sname, REFER_C_STR(sname_), sizeof(sname)) >= sizeof(sname))
- return uim_sj3_make_single_error("*SJ3-SERVER-NAME-TOO-LONG*",
N_("Server name is too long."));
-
- if (strlcpy(uname, REFER_C_STR(uname_), sizeof(uname)) >= sizeof(uname))
- return uim_sj3_make_single_error("*SJ3-USER-NAME-TOO-LONG*", N_("User
name is too long."));
-
- ret = sj3_open(sname, uname);
-
- if (ret == 0) {
- uim_sj3_is_open = 1;
- return uim_scm_t();
- }
-
- return uim_sj3_select_error(ret, uim_sj3_open_error);
-}
-
-static uim_lisp
-uim_sj3_open_with_list(uim_lisp sname_, uim_lisp uname_, uim_lisp
dict_list_)
-{
- char sname[MAXHOSTNAMELEN];
- char uname[MAXLOGNAME];
- int dict_num;
- char **dict_list;
- int *err_num = NULL;
- int **err_index = NULL;
- int i;
- int ret;
- uim_lisp ret_;
-
- if (strlcpy(sname, REFER_C_STR(sname_), sizeof(sname)) >= sizeof(sname))
- return uim_sj3_make_single_error("*SJ3-SERVER-NAME-TOO-LONG*",
N_("Server name is too long."));
-
- if (strlcpy(uname, REFER_C_STR(uname_), sizeof(uname)) >= sizeof(uname))
- return uim_sj3_make_single_error("*SJ3-USER-NAME-TOO-LONG*", N_("User
name is too long."));
-
- dict_num = uim_scm_length(dict_list_);
-
- dict_list = uim_malloc(sizeof(char *) * dict_num);
-
- for (i = 0; i < dict_num; i++) {
- dict_list[i] = uim_strdup(REFER_C_STR(CAR(dict_list_)));
- dict_list_ = CDR(dict_list_);
- }
-
- ret = sj3_open_with_list(sname, uname, dict_num, dict_list, err_num,
err_index);
-
- if (ret != 0) {
- for (i = 0; i < dict_num; i++)
- free(dict_list[i]);
- free(dict_list);
- return uim_sj3_select_error(ret, uim_sj3_open_error);
- }
-
- ret_ = uim_scm_null();
- for (i = 0; i < *err_num; i++)
- ret_ = CONS(MAKE_STR(dict_list[*err_index[i]]), ret_);
-
- for (i = 0; i < dict_num; i++)
- free(dict_list[i]);
- free(dict_list);
-
- return uim_scm_callf("reverse", "o", ret_);
-}
-
-
-const static struct uim_sj3_error uim_sj3_close_error[] = {
- { SJ3_NORMAL_END, "*SJ3-NORMAL-END*" , N_("Normal end.") },
- { SJ3_SERVER_DEAD, "*SJ3-SERVER-DEAD*" , N_("Server is
dead.") },
- { SJ3_DISCONNECT_ERROR, "*SJ3-DISCONNECT-ERROR*" , N_("Server is
disconnected.") },
- { SJ3_NOT_CONNECTED, "*SJ3-NOT-CONNECTED*" , N_("Server is not
connected.") },
- { SJ3_NOT_OPENED_MDICT, "*SJ3-NOT-OPENED-MDICT*" , N_("Main dictionary
file is not opened.") },
- { SJ3_NOT_OPENED_UDICT, "*SJ3-NOT-OPENED-UDICT*" , N_("User dictionary
file is not opened.") },
- { SJ3_NOT_OPENED_STUDY, "*SJ3-NOT-OPENED-STUDY*" , N_("Study file is
not opened.") },
- { SJ3_CLOSE_MDICT_ERROR, "*SJ3-CLOSE-MDICT-ERROR*", N_("Main dictionary
file cannot close.") },
- { SJ3_CLOSE_UDICT_ERROR, "*SJ3-CLOSE-UDICT-ERROR*", N_("User dictionary
file cannot close.") },
- { SJ3_CLOSE_STUDY_ERROR, "*SJ3-CLOSE-STUDY-ERROR*", N_("Study file
cannot close.") },
- { 0, NULL, NULL }
-};
-
-static uim_lisp
-uim_sj3_close(void)
-{
- int ret;
-
- ret = sj3_close();
-
- if (ret == 0) {
- uim_sj3_is_open = 0;
- return uim_scm_t();
- }
-
- return uim_sj3_select_error(ret, uim_sj3_close_error);
-}
-
-/*
- * return: (kanji ((bunsetu-yomi1 bunsetu-kanji1) (bunsetu-yomi2
bunsetu-kanji2) ...))
- */
-static uim_lisp
-uim_sj3_getkan(uim_lisp yomi_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- int bunsetu_cnt;
- struct bunsetu bun[BUFSIZ / 2];
- char kanji[BUFSIZ];
- int i;
- uim_lisp ret_ = uim_scm_f();
-
- if (255 < strlen(yomi))
- return uim_sj3_make_single_error("*SJ3-YOMI-STRING-TOO-LONG*",
N_("Yomi string is too long."));
-
- bunsetu_cnt = sj3_getkan_euc((unsigned char *)yomi, bun, (unsigned char
*)kanji, sizeof(kanji));
-
- if (bunsetu_cnt == -1)
- return uim_sj3_server_down_error();
-
- if (bun[bunsetu_cnt - 1].destlen == 0) /* too large? */
- return uim_sj3_make_single_error("*SJ3-TOO-SHORT-BUFFER-SIZE*",
N_("Buffer size is too short."));
-
- if (bunsetu_cnt == 0)
- return MAKE_STR("");
-
- ret_ = uim_scm_null();
- for (i = 0; i < bunsetu_cnt; i++) {
- char *yomi_str;
- char *kanji_str;
-
- yomi_str = uim_malloc(bun[i].srclen + 1);
- strlcpy(yomi_str, (const char *)bun[i].srcstr, bun[i].srclen + 1);
-
- kanji_str = uim_malloc(bun[i].destlen + 1);
-
- strlcpy(kanji_str, (const char *)bun[i].deststr, bun[i].destlen + 1);
-
- ret_ = CONS(LIST3(MAKE_STR(yomi_str),
- MAKE_STR(kanji_str),
- MAKE_PTR(&bun[i].dcid)),
- ret_);
-
- free(yomi_str);
- free(kanji_str);
- }
-
- ret_ = uim_scm_callf("reverse", "o", ret_);
- return CONS(MAKE_STR(kanji), ret_);
-}
-
-static uim_lisp
-uim_sj3_douoncnt(uim_lisp yomi_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- int ret;
-
- if (63 < strlen(yomi))
- return uim_sj3_make_single_error("*SJ3-YOMI-STRING-TOO-LONG*",
N_("Yomi string is too long."));
-
- ret = sj3_douoncnt_euc((unsigned char *)yomi);
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- return MAKE_INT(ret);
-}
-
-static uim_lisp
-uim_sj3_getdouon(uim_lisp yomi_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- int douon_cnt;
- struct douon douon[BUFSIZ];
- int i;
- uim_lisp ret_ = uim_scm_f();
-
- if (255 < strlen(yomi))
- return uim_sj3_make_single_error("*SJ3-YOMI-STRING-TOO-LONG*",
N_("Yomi string is too long."));
-
- douon_cnt = sj3_getdouon_euc((unsigned char *)yomi, douon);
- if (douon_cnt == -1)
- return uim_sj3_server_down_error();
-
- ret_ = uim_scm_null();
- for (i = 0; i < douon_cnt; i++)
- ret_ = CONS(LIST2(MAKE_STR((char *)douon[i].ddata),
MAKE_PTR(&douon[i].dcid)), ret_);
- return uim_scm_callf("reverse", "o", ret_);
-}
-
-static uim_lisp
-uim_sj3_getnthdouon(uim_lisp yomi_, uim_lisp nth_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- int douon_cnt;
- struct douon douon[BUFSIZ];
- int nth = C_INT(nth_);
-
- if (255 < strlen(yomi))
- return uim_sj3_make_single_error("*SJ3-YOMI-STRING-TOO-LONG*",
N_("Yomi string is too long."));
-
- douon_cnt = sj3_getdouon_euc((unsigned char *)yomi, douon);
- if (douon_cnt == -1)
- return uim_sj3_server_down_error();
-
- if (douon_cnt < nth)
- return uim_scm_f();
- return LIST2(MAKE_STR((char *)douon[nth].ddata),
MAKE_PTR(&douon[nth].dcid));
-}
-
-static uim_lisp
-uim_sj3_gakusyuu(uim_lisp dcid_)
-{
- struct studyrec *dcid = C_PTR(dcid_);
- int ret;
-
- ret = sj3_gakusyuu(dcid);
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_undefined_error();
-}
-
-static uim_lisp
-uim_sj3_gakusyuu2(uim_lisp yomi1_, uim_lisp yomi2_, uim_lisp dcid_)
-{
- const char *yomi1 = REFER_C_STR(yomi1_);
- const char *yomi2;
- struct studyrec *dcid;
- int ret;
-
- if (STRP(yomi2_)) {
- /* split bunsetu |yomi1yomi2| -> |yomi1|yomi2| */
- yomi2 = REFER_C_STR(yomi2_);
- dcid = C_PTR(dcid_);
- } else {
- /* merge bunsetu |yomi1|yomi2| -> |yomi1| */
- yomi2 = NULL;
- dcid = NULL;
- }
-
- ret = sj3_gakusyuu2_euc((unsigned char *)yomi1, (unsigned char *)yomi2,
dcid);
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_undefined_error();
-}
-
-
-const static struct {
- char *name;
- int val;
-} uim_sj3_hinsi[] = {
- { "sj3-hinshi-nrmnoun", SJ3_H_NRMNOUN },
- { "sj3-hinshi-pronoun", SJ3_H_PRONOUN },
- { "sj3-hinshi-lname", SJ3_H_LNAME },
- { "sj3-hinshi-fname", SJ3_H_FNAME },
- { "sj3-hinshi-locname", SJ3_H_LOCNAME },
- { "sj3-hinshi-prefic", SJ3_H_PREFIC },
- { "sj3-hinshi-rentai", SJ3_H_RENTAI },
- { "sj3-hinshi-conjunc", SJ3_H_CONJUNC },
- { "sj3-hinshi-subnum", SJ3_H_SUBNUM },
- { "sj3-hinshi-numeral", SJ3_H_NUMERAL },
- { "sj3-hinshi-prefix", SJ3_H_PREFIX },
- { "sj3-hinshi-postfix", SJ3_H_POSTFIX },
- { "sj3-hinshi-adverb", SJ3_H_ADVERB },
- { "sj3-hinshi-adject", SJ3_H_ADJECT },
- { "sj3-hinshi-adjverb", SJ3_H_ADJVERB },
- { "sj3-hinshi-silverb", SJ3_H_SILVERB },
- { "sj3-hinshi-zilverb", SJ3_H_ZILVERB },
- { "sj3-hinshi-oneverb", SJ3_H_ONEVERB },
- { "sj3-hinshi-kaverb", SJ3_H_KAVERB },
- { "sj3-hinshi-gaverb", SJ3_H_GAVERB },
- { "sj3-hinshi-saverb", SJ3_H_SAVERB },
- { "sj3-hinshi-taverb", SJ3_H_TAVERB },
- { "sj3-hinshi-naverb", SJ3_H_NAVERB },
- { "sj3-hinshi-baverb", SJ3_H_BAVERB },
- { "sj3-hinshi-maverb", SJ3_H_MAVERB },
- { "sj3-hinshi-raverb", SJ3_H_RAVERB },
- { "sj3-hinshi-waverb", SJ3_H_WAVERB },
- { "sj3-hinshi-single", SJ3_H_SINGLE },
- { NULL, 0 }
-};
-
-const static struct uim_sj3_error uim_sj3_touroku_syoukyo_error[] = {
- { SJ3_DICT_ERROR, "*SJ3-DICT-ERROR*" , N_("Dictionary error.") },
- { SJ3_DICT_LOCKED, "*SJ3-DICT-LOCKED*" , N_("Dictionary is
locked.") },
- { SJ3_BAD_YOMI_STR, "*SJ3-BAD-YOMI-STR*" , N_("Invalid yomi string.")
},
- { SJ3_BAD_KANJI_STR, "*SJ3-BAD-KANJI-STR*" , N_("Invalid kanji
string.") },
- { SJ3_BAD_HINSI_CODE, "*SJ3-BAD-HINSI-CODE*", N_("Invalid hinsi code.")
},
- { SJ3_WORD_EXIST, "*SJ3-WORD-EXIST*" , N_("Word exist.") },
- { SJ3_DOUON_FULL, "*SJ3-DOUON-FULL*" , N_("Douon is full.") },
- { SJ3_DICT_FULL, "*SJ3-DICT-FULL*" , N_("Dictionary is full.")
},
- { SJ3_INDEX_FULL, "*SJ3-INDEX-FULL*" , N_("Index is full.") },
- { SJ3_TOUROKU_FAILED, "*SJ3-TOUROKU-FAILED*", N_("Touroku failed.") },
- { SJ3_WORD_NOT_EXIST, "*SJ3-WORD-NOT-EXIST*", N_("Word does not exist.")
},
- { SJ3_SYOUKYO_FAILED, "*SJ3-SYOUKYO-FAILED*", N_("Syoukyo failed.") },
- { 0, NULL, NULL }
-};
-
-static uim_lisp
-uim_sj3_touroku(uim_lisp yomi_, uim_lisp kanji_, uim_lisp hinsi_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- const char *kanji = REFER_C_STR(kanji_);
- const char *hinsi_str = REFER_C_STR(hinsi_);
- int i = 0;
- int ret;
-
- if (31 < strlen(yomi) || 31 < strlen(kanji))
- return uim_sj3_make_single_error("*SJ3-KANJI-STRING-TOO-LONG*",
N_("Kanji string is too long."));
-
- while (1) {
- if (uim_sj3_hinsi[i].name == NULL)
- return uim_sj3_internal_error();
- if (strcmp(uim_sj3_hinsi[i].name, hinsi_str) == 0)
- break;
- i++;
- }
-
- ret = sj3_touroku_euc((unsigned char*)yomi, (unsigned char*)kanji,
uim_sj3_hinsi[i].val);
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_select_error(ret, uim_sj3_touroku_syoukyo_error);
-}
-
-static uim_lisp
-uim_sj3_syoukyo(uim_lisp yomi_, uim_lisp kanji_, uim_lisp hinsi_)
-{
- const char *yomi = REFER_C_STR(yomi_);
- const char *kanji = REFER_C_STR(kanji_);
- const char *hinsi_str = REFER_C_STR(hinsi_);
- int i = 0;
- int ret;
-
- if (31 < strlen(yomi) || 31 < strlen(kanji))
- return uim_sj3_make_single_error("*SJ3-KANJI-STRING-TOO-LONG*",
N_("Kanji string is too long."));
-
- while (1) {
- if (uim_sj3_hinsi[i].name == NULL)
- return uim_sj3_internal_error();
- if (strcmp(uim_sj3_hinsi[i].name, hinsi_str) == 0)
- break;
- i++;
- }
-
- ret = sj3_syoukyo_euc((unsigned char*)yomi, (unsigned char*)kanji,
uim_sj3_hinsi[i].val);
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_select_error(ret, uim_sj3_touroku_syoukyo_error);
-}
-
-static uim_lisp
-uim_sj3_lockserv(void)
-{
- int ret;
-
- ret = sj3_lockserv();
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_undefined_error();
-}
-
-static uim_lisp
-uim_sj3_unlockserv(void)
-{
- int ret;
-
- ret = sj3_unlockserv();
-
- if (ret == -1)
- return uim_sj3_server_down_error();
-
- if (ret == 0)
- return uim_scm_t();
-
- return uim_sj3_undefined_error();
-}
-
-void
-uim_plugin_instance_init(void)
-{
- uim_scm_init_proc2("sj3-lib-open", uim_sj3_open);
- uim_scm_init_proc3("sj3-lib-open-with-list", uim_sj3_open_with_list);
- uim_scm_init_proc0("sj3-lib-close", uim_sj3_close);
- uim_scm_init_proc1("sj3-lib-getkan", uim_sj3_getkan);
- uim_scm_init_proc1("sj3-lib-douoncnt", uim_sj3_douoncnt);
- uim_scm_init_proc1("sj3-lib-getdouon", uim_sj3_getdouon);
- uim_scm_init_proc2("sj3-lib-get-nth-douon", uim_sj3_getnthdouon);
- uim_scm_init_proc1("sj3-lib-gakusyuu", uim_sj3_gakusyuu);
- uim_scm_init_proc3("sj3-lib-gakusyuu2", uim_sj3_gakusyuu2);
- uim_scm_init_proc3("sj3-lib-touroku", uim_sj3_touroku);
- uim_scm_init_proc3("sj3-lib-syoukyo", uim_sj3_syoukyo);
- uim_scm_init_proc0("sj3-lib-lockserv", uim_sj3_lockserv);
- uim_scm_init_proc0("sj3-lib-unlockserv", uim_sj3_unlockserv);
-}
-
-void
-uim_plugin_instance_quit(void)
-{
- if (uim_sj3_is_open)
- sj3_close();
- uim_sj3_is_open = 0;
-}
=======================================
--- /trunk/configure.ac Sun Oct 25 21:49:46 2009
+++ /trunk/configure.ac Mon Dec 7 02:48:20 2009
@@ -187,22 +187,6 @@
use_wnn="no"
])
-# *********************
-# *** Tests for SJ3 ***
-# *********************
-AC_ARG_WITH(sj3,
- AS_HELP_STRING([--with-sj3], [Build with sj3lib
- @<:@default=no@:>@]),
- [
- if test "x$with_sj3" = "xyes"; then
- PKG_CHECK_MODULES(SJ3, sj3lib >= 2.0.1.21,
use_sj3="yes",use_sj3="no")
- else
- use_sj3="no"
- fi
- ],[
- use_sj3="no"
-])
-
# ***********************
# *** Tests for Mana ***
# ***********************
@@ -1083,7 +1067,6 @@
AM_CONDITIONAL(ANTHY_UTF8, test x$use_anthy_utf8 = xyes)
AM_CONDITIONAL(CANNA, test x$use_canna = xyes)
AM_CONDITIONAL(WNN, test x$use_wnn = xyes)
-AM_CONDITIONAL(SJ3, test x$use_sj3 = xyes)
AM_CONDITIONAL(MANA, test x$use_mana = xyes)
AM_CONDITIONAL(PRIME, test x$use_prime = xyes)
AM_CONDITIONAL(SKK, true)
@@ -1756,7 +1739,6 @@
Anthy (UTF-8) : ${use_anthy_utf8}
Canna : ${use_canna}
Wnn : ${use_wnn}
- SJ3 : ${use_sj3}
Mana : ${use_mana}
PRIME : ${use_prime}
m17n-lib : ${use_m17nlib}
=======================================
--- /trunk/scm/Makefile.am Fri Nov 20 02:25:44 2009
+++ /trunk/scm/Makefile.am Mon Dec 7 02:48:20 2009
@@ -64,9 +64,6 @@
if WNN
module_names += "wnn"
endif
-if SJ3
- module_names += "sj3"
-endif
if MANA
module_names += "mana"
endif
@@ -76,7 +73,7 @@
if SKK
module_names += "skk"
endif
-module_names
+= "canna" "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin"
+module_names
+= "canna" "sj3" "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin"
if M17NLIB
module_names += "m17nlib"
endif
=======================================
--- /trunk/scm/sj3-custom.scm Wed Nov 4 08:13:55 2009
+++ /trunk/scm/sj3-custom.scm Mon Dec 7 02:48:20 2009
@@ -329,6 +329,17 @@
(N_ "SJ3 user name")
(N_ "long description will be here."))
+(define-custom 'sj3-unix-domain-socket-path "/var/sj3/run/sj3serv.socket"
+ '(sj3-advanced sj3server)
+ '(string ".*")
+ (N_ "SJ3 server socket path")
+ (N_ "long description will be here."))
+
+(custom-add-hook 'sj3-unix-domain-socket-path
+ 'custom-activity-hooks
+ (lambda ()
+ (not sj3-use-remote-server?)))
+
(define-custom 'sj3-use-with-vi? #f
'(sj3-advanced special-op)
'(boolean)
=======================================
--- /trunk/scm/sj3.scm Wed Nov 4 08:13:55 2009
+++ /trunk/scm/sj3.scm Mon Dec 7 02:48:20 2009
@@ -36,6 +36,7 @@
(require "japanese-kana.scm")
(require "japanese-azik.scm")
(require "generic-predict.scm")
+(require "sj3v2-socket.scm")
(require-custom "generic-key-custom.scm")
(require-custom "sj3-custom.scm")
(require-custom "sj3-key-custom.scm")
=======================================
--- /trunk/uim/Makefile.am Fri Nov 20 02:25:44 2009
+++ /trunk/uim/Makefile.am Mon Dec 7 02:48:20 2009
@@ -101,14 +101,6 @@
libuim_wnn_la_CPPFLAGS = -I$(top_srcdir) $(WNN_CPPFLAGS)
endif
-if SJ3
-uim_plugin_LTLIBRARIES += libuim-sj3.la
-libuim_sj3_la_SOURCES = sj3.c
-libuim_sj3_la_LIBADD = @SJ3_LIBS@ libuim.la
-libuim_sj3_la_LDFLAGS = -rpath $(uim_plugindir) -avoid-version -module
-libuim_sj3_la_CPPFLAGS = -I$(top_srcdir) @SJ3_CFLAGS@
-endif
-
if ANTHY
if ENABLE_ANTHY_STATIC
libuim_la_SOURCES += anthy.c