Author: yamakenz
Date: Thu Jul 12 10:30:13 2007
New Revision: 4712

Modified:
   trunk/doc/COMPATIBILITY
   trunk/scm/im.scm
   trunk/scm/util.scm

Log:
* scm/util.scm
  - (writeln, compose): Simplify
  - (list-join, try-load, try-require, define-record): Cosmetic change
  - (context-update-preedit): Move to im.scm
* scm/im.scm
  - (context-update-preedit): Moved from util.scm

* doc/COMPATIBILITY
  - Complement "Renaming of integer-based char procedures"


Modified: trunk/doc/COMPATIBILITY
==============================================================================
--- trunk/doc/COMPATIBILITY     (original)
+++ trunk/doc/COMPATIBILITY     Thu Jul 12 10:30:13 2007
@@ -61,7 +61,7 @@
 Affects: uim developers, IM developers
 Updates: Scheme API
 Version: 1.5.0
-Revision: ac4708, ac4709
+Revision: ac4708, ac4709, ac4710
 Date: 2007-07-11
 Modifier: YamaKen
 Related: 

Modified: trunk/scm/im.scm
==============================================================================
--- trunk/scm/im.scm    (original)
+++ trunk/scm/im.scm    Thu Jul 12 10:30:13 2007
@@ -361,6 +361,17 @@
       (and c
            (context-im c)))))
 
+(define context-update-preedit
+  (lambda (context segments)
+    (im-clear-preedit context)
+    (for-each (lambda (segment)
+               (if segment
+                   (let ((attr (car segment))
+                         (str (cdr segment)))
+                     (im-pushback-preedit context attr str))))
+             segments)
+    (im-update-preedit context)))
+
 ;; Backward compatibility. The term 'commit' is incorrect. No commit
 ;; operation is performed by this. This actually instructs 'pass-through' the
 ;; input key. The key filtering interface will be replaced with 'filtered'

Modified: trunk/scm/util.scm
==============================================================================
--- trunk/scm/util.scm  (original)
+++ trunk/scm/util.scm  Thu Jul 12 10:30:13 2007
@@ -43,10 +43,9 @@
 ;;
 
 (define writeln
-  (lambda (obj . args)
-    (let-optionals* args ((port (current-output-port)))
-      (write obj port)
-      (newline))))
+  (lambda args
+    (apply write args)
+    (newline)))
 
 ;; Make escaped string literal to print a form.
 ;;
@@ -115,14 +114,15 @@
        '()
        (cdr (fold-right (lambda (kar kdr)
                           (cons* sep kar kdr))
-                        '()
-                        lst)))))
+                        '() lst)))))
 
 ;; downward compatible with SRFI-13 string-join
 (define string-join
   (lambda (str-list sep)
     (apply string-append (list-join str-list sep))))
 
+;; Split pattern has been changed from uim 1.5.0. See
+;; doc/COMPATIBILITY and test-util.scm.
 (define string-split
   (lambda (str sep)
     (let ((slen (string-length str))
@@ -146,13 +146,13 @@
 
 ;; only accepts single-arg functions
 ;; (define caddr (compose car cdr cdr))
+;; FIXME: remove the closure overhead
 (define compose
   (lambda funcs
-    (reduce (lambda (f g)
-             (lambda (arg)
-               (f (g arg))))
-           values
-           (reverse funcs))))
+    (reduce-right (lambda (f g)
+                   (lambda (x)
+                     (f (g x))))
+                 values funcs)))
 
 (define method-delegator-new
   (lambda (dest-getter method)
@@ -196,8 +196,7 @@
 (define try-load
   (lambda (file)
     (guard (err
-           (else
-            #f))
+           (else #f))
       ;; to suppress error message, check file existence first
       (and (file-readable? (make-scm-pathname file))
           (load file)))))
@@ -207,8 +206,7 @@
 (define try-require
   (lambda (file)
     (guard (err
-           (else
-            #f))
+           (else #f))
       ;; to suppress error message, check file existence first
       (and (file-readable? (make-scm-pathname file))
           (require file)))))
@@ -233,7 +231,8 @@
                       (getter-sym (symbol-append rec-sym hyphen-sym elem-sym))
                       (getter (lambda (rec)
                                 (list-ref rec index)))
-                      (setter-sym (symbol-append rec-sym hyphen-sym 'set- 
elem-sym '!))
+                      (setter-sym (symbol-append
+                                   rec-sym hyphen-sym 'set- elem-sym '!))
                       (setter (lambda (rec val)
                                 (set-car! (list-tail rec index)
                                           val))))
@@ -327,14 +326,3 @@
     (separator-background          . "")
     (reversed-separator-foreground . "black")
     (reversed-separator-background . "blue")))
-
-(define context-update-preedit
-  (lambda (context segments)
-    (im-clear-preedit context)
-    (for-each (lambda (segment)
-               (if segment
-                   (let ((attr (car segment))
-                         (str (cdr segment)))
-                     (im-pushback-preedit context attr str))))
-             segments)
-    (im-update-preedit context)))

Reply via email to