Revision: 6470
Author: iratqq
Date: Mon Jun 21 09:36:33 2010
Log: * scm/annotation.scm (annotation-load):
- Add annotation- prefix.
* scm/im-custom.scm (eb-enable-for-annotation?)
(annotation-dict-server, annotation-dict-servname)
(annotation-dict-database, annotation-dict-cache-words):
* scm/annotation-eb.scm (annotation-eb-init)
(annotation-eb-get-text, annotation-eb-release):
* scm/annotation-dict.scm (annotation-dict-get-text-from-server)
(annotation-dict-get-text-with-cache, annotation-dict-get-text)
(annotation-dict-release):
- Ditto.
http://code.google.com/p/uim/source/detail?r=6470
Modified:
/trunk/scm/annotation-dict.scm
/trunk/scm/annotation-eb.scm
/trunk/scm/annotation.scm
/trunk/scm/im-custom.scm
=======================================
--- /trunk/scm/annotation-dict.scm Mon Jun 21 04:36:03 2010
+++ /trunk/scm/annotation-dict.scm Mon Jun 21 09:36:33 2010
@@ -34,35 +34,35 @@
(require "dict-socket.scm")
-(define dict-port #f)
-(define dict-cache-alist '())
-
-(define (dict-init)
+(define annotation-dict-port #f)
+(define annotation-dict-cache-alist '())
+
+(define (annotation-dict-init)
(and (provided? "socket")
- (set! dict-port (dict-server-open dict-server dict-servname))))
-
-(define (dict-get-text-from-server text enc)
- (apply string-append (dict-server-get-define dict-port dict-database
text)))
-
-(define (dict-get-text-with-cache text enc)
- (let ((ret (assoc text dict-cache-alist)))
+ (set! annotation-dict-port (dict-server-open annotation-dict-server
annotation-dict-servname))))
+
+(define (annotation-dict-get-text-from-server text enc)
+ (apply string-append (dict-server-get-define annotation-dict-port
annotation-dict-database text)))
+
+(define (annotation-dict-get-text-with-cache text enc)
+ (let ((ret (assoc text annotation-dict-cache-alist)))
(if ret
(cdr ret)
- (let ((new (dict-get-text-from-server text enc)))
+ (let ((new (annotation-dict-get-text-from-server text enc)))
(if (not (string=? new ""))
- (set! dict-cache-alist (append dict-cache-alist (list (cons
text new)))))
- (if (< dict-cache-words (length dict-cache-alist))
- (set! dict-cache-alist (cdr dict-cache-alist)))
+ (set! annotation-dict-cache-alist (append
annotation-dict-cache-alist (list (cons text new)))))
+ (if (< annotation-dict-cache-words (length
annotation-dict-cache-alist))
+ (set! annotation-dict-cache-alist (cdr
annotation-dict-cache-alist)))
new))))
-(define (dict-get-text text enc)
- (or (and dict-port
- (dict-get-text-with-cache text enc))
+(define (annotation-dict-get-text text enc)
+ (or (and annotation-dict-port
+ (annotation-dict-get-text-with-cache text enc))
""))
-(define (dict-release)
- (if dict-port
+(define (annotation-dict-release)
+ (if annotation-dict-port
(begin
- (dict-server-close dict-port)
- (set! dict-port #f))))
+ (dict-server-close annotation-dict-port)
+ (set! annotation-dict-port #f))))
=======================================
--- /trunk/scm/annotation-eb.scm Sun Jun 20 21:12:12 2010
+++ /trunk/scm/annotation-eb.scm Mon Jun 21 09:36:33 2010
@@ -35,21 +35,21 @@
;; eb-enable-for-annotation? exists only for compatibility.
;; You shouldn't add similar variables to other annotation agents.
-(define eb-init
+(define annotation-eb-init
(lambda ()
(and (provided? "eb")
eb-enable-for-annotation?
(not eb-ctx)
- (set! eb-ctx (eb-new eb-dic-path)))))
-
-(define eb-get-text
+ (set! eb-ctx (eb-new annotation-eb-dic-path)))))
+
+(define annotation-eb-get-text
(lambda (text enc)
(or (and eb-ctx
eb-enable-for-annotation?
(eb-search-text eb-ctx text enc))
"")))
-(define eb-release
+(define annotation-eb-release
(lambda ()
(if eb-ctx
(begin
=======================================
--- /trunk/scm/annotation.scm Sun Jun 20 21:12:12 2010
+++ /trunk/scm/annotation.scm Mon Jun 21 09:36:33 2010
@@ -55,11 +55,11 @@
(try-require (string-append "annotation-" name ".scm"))
(let ((env (interaction-environment)))
(set! annotation-init
- (eval (string->symbol (string-append name "-init")) env))
+ (eval (string->symbol (string-append "annotation-"
name "-init")) env))
(set! annotation-get-text
- (eval (string->symbol (string-append name "-get-text"))
env))
+ (eval (string->symbol (string-append "annotation-"
name "-get-text")) env))
(set! annotation-release
- (eval (string->symbol (string-append name "-release"))
env))
+ (eval (string->symbol (string-append "annotation-"
name "-release")) env))
#t)
(begin
(annotation-init)
=======================================
--- /trunk/scm/im-custom.scm Mon Jun 21 04:36:03 2010
+++ /trunk/scm/im-custom.scm Mon Jun 21 09:36:33 2010
@@ -597,19 +597,19 @@
(and enable-annotation?
(eq? annotation-agent 'eb))))
-(define-custom 'eb-dic-path
+(define-custom 'annotation-eb-dic-path
(string-append (sys-datadir) "/dict")
'(annotation eb)
'(pathname directory)
(N_ "The directory which contains EB dictionary file")
(N_ "long description will be here."))
-(custom-add-hook 'eb-dic-path
+(custom-add-hook 'annotation-eb-dic-path
'custom-activity-hooks
(lambda ()
eb-enable-for-annotation?))
-(custom-add-hook 'eb-dic-path
+(custom-add-hook 'annotation-eb-dic-path
'custom-activity-hooks
(lambda ()
(and enable-annotation?
@@ -620,53 +620,53 @@
(N_ "dict server")
(N_ "long description will be here."))
-(define-custom 'dict-server
+(define-custom 'annotation-dict-server
"dict.org"
'(annotation dict)
'(string ".*")
(N_ "Server address of dict")
(N_ "long description will be here."))
-(define-custom 'dict-servname
+(define-custom 'annotation-dict-servname
2628
'(annotation dict)
'(integer 0 65535)
(N_ "Server port of dict")
(N_ "long description will be here."))
-(define-custom 'dict-database
+(define-custom 'annotation-dict-database
"web1913"
'(annotation dict)
'(string ".*")
(N_ "Database name of dict")
(N_ "long description will be here."))
-(define-custom 'dict-cache-words
+(define-custom 'annotation-dict-cache-words
256
'(annotation dict)
'(integer 0 65535)
(N_ "Number of cache of annotation")
(N_ "long description will be here."))
-(custom-add-hook 'dict-server
+(custom-add-hook 'annotation-dict-server
'custom-activity-hooks
(lambda ()
(and enable-annotation?
(eq? annotation-agent 'dict))))
-(custom-add-hook 'dict-servname
+(custom-add-hook 'annotation-dict-servname
'custom-activity-hooks
(lambda ()
(and enable-annotation?
(eq? annotation-agent 'dict))))
-(custom-add-hook 'dict-database
+(custom-add-hook 'annotation-dict-database
'custom-activity-hooks
(lambda ()
(and enable-annotation?
(eq? annotation-agent 'dict))))
-(custom-add-hook 'dict-cache-words
+(custom-add-hook 'annotation-dict-cache-words
'custom-activity-hooks
(lambda ()
(and enable-annotation?