[uim-commit] r2024 - in branches/r5rs: . scm test uim

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Nov 5 21:55:16 PST 2005


Author: yamaken
Date: 2005-11-05 21:55:12 -0800 (Sat, 05 Nov 2005)
New Revision: 2024

Modified:
   branches/r5rs/
   branches/r5rs/scm/uim-sh.scm
   branches/r5rs/test/uim-test-utils.scm
   branches/r5rs/uim/uim-scm.h
Log:
 r522 at deepblue (orig r2020):  jun0 | 2005-11-06 07:47:11 +0900
 * uim/uim-scm.h
   - (UIM_SCM_NOINLINE): use __noinline__ to workaround buggy linux
     kernel headers.
 
 r524 at deepblue (orig r2022):  yamaken | 2005-11-06 14:19:40 +0900
 * test/uim-test-utils.scm
   - (UIM-SH-MULTILINE-ERROR): New variable
   - Set environment variable LIBUIM_VERBOSE to 2 to enable backtrace
   - (uim-sh-read): Fix broken multi-line error receiving by replacing
     misused select(3)
   - (uim-sh-read-error): New procedure
 
 r525 at deepblue (orig r2023):  yamaken | 2005-11-06 14:42:02 +0900
 * scm/uim-sh.scm
   - (uim-sh-loop, activate-editline): Fix invalid eval form
 



Property changes on: branches/r5rs
___________________________________________________________________
Name: svk:merge
   - 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
74100eb5-a104-0410-9326-fdab01523867:/branches/r5rs:6
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:2005
   + 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
74100eb5-a104-0410-9326-fdab01523867:/branches/r5rs:6
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:2023

Modified: branches/r5rs/scm/uim-sh.scm
===================================================================
--- branches/r5rs/scm/uim-sh.scm	2005-11-06 05:42:02 UTC (rev 2023)
+++ branches/r5rs/scm/uim-sh.scm	2005-11-06 05:55:12 UTC (rev 2024)
@@ -53,7 +53,7 @@
 	      ((if uim-sh-opt-strict-batch
 		   (lambda (obj) #f)
 		   print)
-	       (eval expr '())))
+	       (eval expr (interaction-environment))))
 	    (uim-sh-loop))
 	  #f))))
 
@@ -118,7 +118,7 @@
 			      ((if uim-sh-opt-strict-batch
 				   (lambda () #f)
 				   print)
-			       (eval expr))
+			       (eval expr (interaction-environment)))
 			      (uim-sh-loop))
 			    #f)))))
 	#t))))

Modified: branches/r5rs/test/uim-test-utils.scm
===================================================================
--- branches/r5rs/test/uim-test-utils.scm	2005-11-06 05:42:02 UTC (rev 2023)
+++ branches/r5rs/test/uim-test-utils.scm	2005-11-06 05:55:12 UTC (rev 2024)
@@ -30,14 +30,19 @@
 (use gauche.process)
 (use gauche.selector)
 (use gauche.version)
+(use srfi-1)
 (use srfi-13)
 (use test.unit)
 
+;; Must be #t when LIBUIM_VERBOSE is set to 2. This enables receiving
+;; backtrace following an error.
+(define UIM-SH-MULTILINE-ERROR #t)
+
 (if (version<? *gaunit-version* "0.1.1")
     (error "GaUnit 0.1.1 is required"))
 
 (sys-putenv "LIBUIM_SCM_FILES" "./scm")
-(sys-putenv "LIBUIM_VERBOSE" "1")  ;; must be 1
+(sys-putenv "LIBUIM_VERBOSE" "2")  ;; must be 1 or 2 (2 enables backtrace)
 (sys-putenv "LIBUIM_VANILLA" "1")
 
 (set! (port-buffering (current-output-port)) :none)
@@ -71,11 +76,25 @@
                            #f)
                          (lambda ()
                            (read in)))))
-      (if (and (eq? 'Error: uim-sh-output)
-               (uim-sh-select in 3))
-        (error (string-trim-both (read-block 10000 in)))
-        uim-sh-output)))
+    (if (eq? 'Error: uim-sh-output)
+	(error (uim-sh-read-error in))
+	uim-sh-output)))
 
+(define (uim-sh-read-error in)
+  (let* ((blocks (if UIM-SH-MULTILINE-ERROR
+		     (unfold (lambda (in)
+			       (not (or (char-ready? in)
+					(begin
+					  (sys-nanosleep 100000000) ;; 0.1s
+					  (char-ready? in)))))
+			     (lambda (in)
+			       (read-block 4096 in))
+			     values
+			     in)
+		     (list (read-line in))))
+	 (msg (string-trim-both (string-concatenate blocks))))
+    msg))
+ 
 (define (uim sexp)
   (uim-sh-write sexp (process-input *uim-sh-process*))
   (uim-sh-read (process-output *uim-sh-process*)))

Modified: branches/r5rs/uim/uim-scm.h
===================================================================
--- branches/r5rs/uim/uim-scm.h	2005-11-06 05:42:02 UTC (rev 2023)
+++ branches/r5rs/uim/uim-scm.h	2005-11-06 05:55:12 UTC (rev 2024)
@@ -114,7 +114,7 @@
 
 #if UIM_SCM_GCC4_READY_GC
 #ifdef __GNUC__
-#define UIM_SCM_NOINLINE __attribute__((noinline))
+#define UIM_SCM_NOINLINE __attribute__((__noinline__))
 #else
 #define UIM_SCM_NOINLINE
 #endif /* __GNUC__ */



More information about the uim-commit mailing list