[uim-commit] r1413 - in trunk: doc scm test

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Sep 4 13:23:21 PDT 2005


Author: yamaken
Date: 2005-09-04 13:23:19 -0700 (Sun, 04 Sep 2005)
New Revision: 1413

Modified:
   trunk/doc/COMPATIBILITY
   trunk/scm/custom-rt.scm
   trunk/scm/custom.scm
   trunk/scm/hangul.scm
   trunk/scm/im-custom.scm
   trunk/scm/key.scm
   trunk/scm/util.scm
   trunk/test/test-util.scm
Log:
* scm/util.scm
  - (toplevel-env): Removed
  - (interaction-environment): New procedure
  - (bitwise-or): Rename to bitwise-ior to conform to final SRFI-60
  - (bitwise-ior): Renamed from bitwise-or
  - (enclose-another-env): Rename to %%enclose-another-env to indicate
    implementation-specific low level procedure
  - (%%enclose-another-env): Renamed from enclose-another-env
  - (define-record): Replace toplevel-env with interaction-environment
* scm/custom.scm
  - (define-custom, custom-set-value!): Replace toplevel-env with
    interaction-environment
* scm/im-custom.scm
  - (custom-installed-im-list): Ditto
* scm/key.scm
  - (define-key-internal): Ditto
* scm/custom-rt.scm
  - (custom-set-value!, define-custom): Ditto
* scm/hangul.scm
  - (hangul-proc-on-mode-with-preedit, hangul-proc-on-mode,
    hangul-key-press-handler): Replace enclose-another-env with
    %%enclose-another-env
* test/test-util.scm
  - (test toplevel-env): Removed
  - (test interaction-environment): New test
  - (test enclose-another-env): Removed
  - (test %%enclose-another-env): New test
* doc/COMPATIBILITY
  - Add new section "Obsolete some misc Scheme APIs"


Modified: trunk/doc/COMPATIBILITY
===================================================================
--- trunk/doc/COMPATIBILITY	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/doc/COMPATIBILITY	2005-09-04 20:23:19 UTC (rev 1413)
@@ -58,6 +58,25 @@
 The changes are described below in most recently updated order.
 
 ------------------------------------------------------------------------------
+Summary: Obsolete some misc Scheme APIs
+Affects: IM developers
+Updates: Scheme API
+Version: 0.5, 0.4.9
+Revision: ac1413
+Date: 2005-09-05
+Modifier: YamaKen
+Related:
+URL:
+Changes:
+  (removed) bitwise-or
+      (new) bitwise-ior
+  (removed) enclose-another-env
+      (new) %%enclose-another-env
+  (removed) toplevel-env
+      (new) interaction-environment
+Description:
+  Obsolete inappropriate or wrong API with new appropriate ones.
+------------------------------------------------------------------------------
 Summary: An experimental custom variable reloading API
 Affects: Helper program developers, Bridge developers
 Updates: C API, Helper protocol

Modified: trunk/scm/custom-rt.scm
===================================================================
--- trunk/scm/custom-rt.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/custom-rt.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -203,7 +203,7 @@
 	   (let ((key-val (custom-modify-key-predicate-names val)))
 	     (eval (list 'define (symbolconc sym '?)
 			 (list 'make-key-predicate (list 'quote key-val)))
-		   toplevel-env))
+		   (interaction-environment)))
 	   #t)
 	  ((custom-exist? sym #f)
 	   (set-symbol-value! sym val)
@@ -226,7 +226,7 @@
 				    (list 'quote default)
 				    default)))
 	    (eval (list 'define sym quoted-default)
-		  toplevel-env)
+		  (interaction-environment))
 	    (if (custom-key-exist? sym)
 		;; already define-key'ed in ~/.uim
 		(custom-call-hook-procs sym custom-set-hooks)
@@ -234,7 +234,7 @@
 		  (if (eq? (car type)
 			   'key)
 		      (eval (list 'define (symbolconc sym '?) list)
-			    toplevel-env))
+			    (interaction-environment)))
 		  (custom-set-value! sym default))))))))  ;; to apply hooks
 
 ;; lightweight implementation

Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/custom.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -511,7 +511,7 @@
 				    (list 'quote default)
 				    default)))
 	    (eval (list 'define sym quoted-default)
-		  toplevel-env)
+		  (interaction-environment))
 	    (custom-set-value! sym default)))  ;; to apply hooks
       (for-each (lambda (subgrp)
 		  (let ((registered (custom-group-subgroups primary-grp)))
@@ -564,7 +564,7 @@
 	       (let ((key-val (custom-modify-key-predicate-names val)))
 		 (eval (list 'define (symbolconc sym '?)
 			     (list 'make-key-predicate (list 'quote key-val)))
-		       toplevel-env)))
+		       (interaction-environment))))
 	   (custom-call-hook-procs sym custom-set-hooks)
 	   (custom-call-hook-procs sym custom-update-hooks)
 	   (let ((post-activities (map-activities)))

Modified: trunk/scm/hangul.scm
===================================================================
--- trunk/scm/hangul.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/hangul.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -40,8 +40,8 @@
 	 (generic-commit-key?
 	  (make-key-predicate '(" " generic-return-key?)))
 	 (generic-proc-input-state-with-preedit-with-this-env
-	  (enclose-another-env generic-proc-input-state-with-preedit
-	  		       (the-environment))))
+	  (%%enclose-another-env generic-proc-input-state-with-preedit
+				 (the-environment))))
     (lambda (gc key state rkc)  ;; "gc" stands for "generic-context"
       (generic-proc-input-state-with-preedit-with-this-env gc key state rkc))))
 
@@ -54,7 +54,7 @@
 	 (generic-proc-input-state-with-preedit
 	  hangul-proc-on-mode-with-preedit)
 	 (generic-proc-input-state-with-this-env
-	  (enclose-another-env generic-proc-input-state (the-environment))))
+	  (%%enclose-another-env generic-proc-input-state (the-environment))))
     (lambda (gc key state)  ;; "gc" stands for "generic-context"
       (generic-proc-input-state-with-this-env gc key state))))
 
@@ -62,7 +62,7 @@
 (define hangul-key-press-handler
   (let* ((generic-proc-input-state hangul-proc-on-mode)
 	 (generic-key-press-handler-with-this-env
-	  (enclose-another-env generic-key-press-handler (the-environment))))
+	  (%%enclose-another-env generic-key-press-handler (the-environment))))
     (lambda (gc key state)
       (generic-key-press-handler-with-this-env gc key state))))
 

Modified: trunk/scm/im-custom.scm
===================================================================
--- trunk/scm/im-custom.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/im-custom.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -197,9 +197,9 @@
 		  loaded-sym)
 		 ((try-load file)
 		  (eval (list 'define loaded-sym #t)
-			toplevel-env)
+			(interaction-environment))
 		  (eval (list 'define reloaded-sym #t)
-			toplevel-env)
+			(interaction-environment))
 		  loaded-sym)
 		 (else
 		  #f)))))

Modified: trunk/scm/key.scm
===================================================================
--- trunk/scm/key.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/key.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -307,7 +307,7 @@
     (let* ((modified-key-strs (modify-key-strs-implicitly key-strs))
 	   (predicate (make-key-predicate modified-key-strs)))
       (eval (list 'define key-predicate-sym predicate)
-	    toplevel-env))))
+	    (interaction-environment)))))
 
 (define valid-key-str?
   (lambda (key-str)

Modified: trunk/scm/util.scm
===================================================================
--- trunk/scm/util.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/scm/util.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -192,6 +192,11 @@
 ;; definition of 'else' has been moved into slib.c
 ;(define else #t)
 
+;; for eval
+(define interaction-environment
+  (lambda ()
+    ()))
+
 (define boolean?
   (lambda (x)
     (or (eq? x #t)
@@ -555,7 +560,7 @@
   (lambda xs
     (fold bit-and (bitwise-not 0) xs)))
 
-(define bitwise-or
+(define bitwise-ior
   (lambda xs
     (fold bit-or 0 xs)))
 
@@ -593,11 +598,8 @@
 	 (eq? (symbolconc '* (string->symbol file) '-loaded*)
 	      (*catch 'errobj (require file))))))
 
-;; for eval
-(define toplevel-env ())
-
 ;; used for dynamic environment substitution of closure
-(define enclose-another-env
+(define %%enclose-another-env
   (lambda (closure another-env)
     (let* ((code (%%closure-code closure))
 	   (args (car code))
@@ -621,9 +623,9 @@
 				 (set-car! (nthcdr index rec)
 					   val))))
 		  (eval (list 'define getter-sym getter)
-			toplevel-env)
+			(interaction-environment))
 		  (eval (list 'define setter-sym setter)
-			toplevel-env)))
+			(interaction-environment))))
 	      rec-spec
 	      (iota (length rec-spec)))
     (let ((creator-sym (symbolconc rec-sym '-new))
@@ -647,7 +649,7 @@
 			(else
 			 #f))))))
       (eval (list 'define creator-sym creator)
-	    toplevel-env))))
+	    (interaction-environment)))))
 
 ;; for direct candidate selection
 (define number->candidate-index

Modified: trunk/test/test-util.scm
===================================================================
--- trunk/test/test-util.scm	2005-09-04 19:35:08 UTC (rev 1412)
+++ trunk/test/test-util.scm	2005-09-04 20:23:19 UTC (rev 1413)
@@ -29,7 +29,7 @@
 ;;; SUCH DAMAGE.
 ;;;;
 
-;; This file is tested with revision 952 (new repository)
+;; This file is tested with revision 1413 (new repository)
 
 (use test.unit)
 
@@ -1315,10 +1315,17 @@
 		 (uim '(alist-delete 'three alist-sym eq?)))))
 
 (define-uim-test-case "test util Siod specific procedures"
-  ("test toplevel-env"
-   (assert-true (uim-bool '(eval '(symbol-bound? 'filter-map)
-				 toplevel-env))))
-  ("test enclose-another-env"
+  ("test interaction-environment"
+   (assert-true  (uim-bool '(eval '(symbol-bound? 'filter-map)
+				  (interaction-environment))))
+   (assert-false (uim-bool '(eval '(symbol-bound? 'filter-baz)
+				  (interaction-environment))))
+   (uim '(eval (list define 'filter-baz filter-map)
+	       (interaction-environment)))
+   (assert-true  (uim-bool '(eval '(symbol-bound? 'filter-baz)
+				  (interaction-environment))))
+   (assert-true  (uim-bool '(eq? filter-baz filter-map))))
+  ("test %%enclose-another-env"
    (assert-equal 3
 		 (uim '(let* ((x 1)
 			      (y 2)
@@ -1333,7 +1340,7 @@
 			      (another-env '((x . 4)
 					     (y . 6))))
 			 (set! closure
-			       (enclose-another-env closure another-env))
+			       (%%enclose-another-env closure another-env))
 			 (closure))))
    ;; causes error since z is not exist in the another-env
    (assert-error (lambda ()
@@ -1345,7 +1352,7 @@
 				(another-env '((x . 4)
 					       (y . 6))))
 			   (set! closure
-				 (enclose-another-env closure another-env))
+				 (%%enclose-another-env closure another-env))
 			   (closure)))))))
 
 (define-uim-test-case "test util define-record"



More information about the uim-commit mailing list