Commit d843ab89 authored by jjgarcia's avatar jjgarcia

In WITH-INPUT-FROM-STRING the index value can only be updated during a normal exit from the form

parent 172351b7
......@@ -201,6 +201,9 @@ ECL 1.0
- The default value of optional arguments in a DEFTYPE form "defaults" to '*
(ANSI 3.4.8).
- The value of the INDEX variable in WITH-INPUT-FROM-STRING is only updated
when exiting normally from the WITH-... form.
* MOP compliance:
- ADD-METHOD is now a generic function and implements most of the protocol in
......
......@@ -35,8 +35,10 @@ Possible keywords are :INDEX, :START, and :END."
`(LET ((,var (MAKE-STRING-INPUT-STREAM ,string ,start ,end)))
,@ds
(UNWIND-PROTECT
(PROGN ,@b)
(SETF ,index (SYS:GET-STRING-INPUT-STREAM-INDEX ,var)))))
(MULTIPLE-VALUE-PROG1
(PROGN ,@b)
(SETF ,index (SYS:GET-STRING-INPUT-STREAM-INDEX ,var)))
(CLOSE ,var))))
`(LET ((,var (MAKE-STRING-INPUT-STREAM ,string ,start ,end)))
,@body)))
......@@ -46,7 +48,10 @@ Evaluates FORMs with VAR bound to a string output stream to the string that is
the value of STRING-FORM. If STRING-FORM is not given, a new string is used.
The stream is automatically closed on exit and the string is returned."
(if string
`(LET ((,var (MAKE-STRING-OUTPUT-STREAM-FROM-STRING ,string)))
`(LET* ((,var (MAKE-STRING-OUTPUT-STREAM-FROM-STRING ,string))
(,(gensym) ,element-type))
;; We must evaluate element-type if it has been supplied by the user.
;; Even if we ignore the value afterwards.
,@body)
`(LET ((,var (MAKE-STRING-OUTPUT-STREAM ,@r)))
,@body
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment