gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: capturing output strings


From: Camm Maguire
Subject: [Gcl-devel] Re: capturing output strings
Date: 23 May 2005 14:35:18 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

This is an ANSI issue -- traditionally, GCL has used element-type
'string-char for strings, but this type was dropped by the ansi
committee.  We'll clear it up soon hopefully, but for now you can just
replace 'base-char with 'string-char and it will work.

Take care,

address@hidden writes:

> this seems to fail:
> 
> axiom
> 
> -> )lisp (setq result (make-array '(0) :element-type 'base-char :fill-pointer 
> 0 :adjustable t))
> 
> Value = #<vector 0894bde4>
> 
> -> )lisp (with-output-to-string (|$algebraOutputStream| result) 
> (|parseAndInterpret| "(x+1)^9"))
> 
>   >> System error:
>   #<vector 0894bde4> is not a string with a fill-pointer
> 
> This appears to be a bug as result certainly has a fill pointer.
> 
> 
> This is an attempt to capture the output sent to the 
> stream |$algebraOutputStream| in some more elegant form 
> (instead of this kludge):
> 
> )lisp (progn
>           ; we need a new output stream backed by a string
>         (setq tmpout (make-string-output-stream))
>           ; we hold on to the regular algebra output stream
>         (setq save |$algebraOutputStream|)
>           ; we capture the regular output into our string stream
>         (setq |$algebraOutputStream| tmpout)
>           ; we generate output
>         (|parseAndInterpret| "(x+1)^9")
>           ; we get the results from the algebra output stream
>         (setq result (get-output-stream-string |$algebraOutputStream|))
>           ; we restore the regular algebra output stream
>         (setq |$algebraOutputStream| save)
>           ; and return the result
>         result)
> 
> t
> 
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]