Blob Blame Raw
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 gcl (2.6.12-15) unstable; urgency=medium
   * Version_2_6_13pre18
Author: Camm Maguire <>

The information above should follow the Patch Tagging Guidelines, please
checkout to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.12.orig/lsp/gcl_iolib.lsp
+++ gcl-2.6.12/lsp/gcl_iolib.lsp
@@ -38,23 +38,28 @@
 (defmacro with-input-from-string ((var string &key index start end) . body)
-  (multiple-value-bind (ds b)
-      (find-declarations body)
-    `(let ((,var (make-string-input-stream ,string ,start ,end)))
-       ,@ds
-       (unwind-protect
-	   (progn ,@b)
-	 (when ,index (setf ,index (si:get-string-input-stream-index ,var)))
-	 (when ,var (close ,var))))))
+  (let ((x (sgen "X")))
+    (multiple-value-bind (ds b)
+	(find-declarations body)
+      `(let ((,var (make-string-input-stream ,string ,start ,end)))
+	 ,@ds
+	 (unwind-protect
+	     ,(let ((f `(progn ,@b)))
+		(if index
+		    `(let ((,x (multiple-value-list ,f))) (setf ,index (get-string-input-stream-index ,var)) (values-list ,x))
+		  f))
+	 (close ,var))))))
 (defmacro with-output-to-string ((var &optional string &key element-type) . body)
-  (multiple-value-bind (ds b)
-      (find-declarations body)
-    `(let ((,var ,(if string `(make-string-output-stream-from-string ,string) `(make-string-output-stream))))
-       ,@ds
-       (unwind-protect
-	   (progn ,@b ,@(unless string `((get-output-stream-string ,var))))
-	 (when ,var (close ,var))))))
+  (let ((s (sgen "STRING"))(bl (sgen "BLOCK"))(e (sgen "ELEMENT-TYPE"))(x (sgen "X")))
+    (multiple-value-bind (ds b)
+	(find-declarations body)
+      `(let* ((,s ,string)(,e ,element-type)
+	      (,var (if ,s (make-string-output-stream-from-string ,s) (make-string-output-stream :element-type ,e))))
+	 ,@ds
+	 (unwind-protect
+	     (let ((,x (multiple-value-list (progn ,@b)))) (if ,s (values-list ,x) (get-output-stream-string ,var)))
+	   (close ,var))))))
 (defun read-from-string (string
--- gcl-2.6.12.orig/o/file.d
+++ gcl-2.6.12/o/file.d
@@ -1668,12 +1668,11 @@ for the string ~S.",
 		3, istart, iend, strng);
-static void
-	check_arg(0);
-	vs_push(make_string_output_stream(64));
+@(static defun make_string_output_stream (&k element_type)
+        element_type=Cnil;/*FIXME*/
+        @(return `make_string_output_stream(64)`)