Lisp HUG Maillist Archive

editor-pane, arrays of characters, simple-text-string, and errors

Hi,

I read a file character-by-character into a (make-array 0 :element-type 
:fill-pointer 0 :adjustable t) using vector-push-extend. What I get 
back behaves like a string, and actually passes the stringp test.

I set the text of an editor-pane using that result.

I get an error and the following (edited) backtrace:

Condition: Editor-Error Handler EDITOR::DEFAULT-EDITOR-ERROR-HANDLER 
returned.
Call to ERROR (offset 104)
   SYSTEM::ESTRING : "Editor-Error Handler ~S returned."
   SYSTEM::EARGS   : (EDITOR::DEFAULT-EDITOR-ERROR-HANDLER)

Call to EDITOR:EDITOR-ERROR (offset 244)
   EDITOR::ARGS : ("String ~S of wrong type for buffer ~S" "<a long 
string>" #<EDITOR:BUFFER the-boo-editor-BUFFER>)

Call to EDITOR::SET-BUFFER-CONTENTS (offset 764)
   EDITOR:BUFFER : #<EDITOR:BUFFER the-boo-editor-BUFFER>
   STRING        : "<a long string>"

Call to CAPI:MODIFY-EDITOR-PANE-BUFFER (offset 432)
   CAPI::PANE   : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>
   DBG::|rest-| : (:CONTENTS "<a long string>")

Call to (METHOD (SETF CAPI:EDITOR-PANE-TEXT) (T CAPI:EDITOR-PANE)) 
(offset 76)
   CAPI-INTERNALS:TEXT : "<a long string>"
   CAPI::SELF          : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>

Call to (SUBFUNCTION 8 (METHOD CAPI::INITIALIZE-INTERFACE :AFTER 
(BOO::BOO-EDITOR))) (offset 156)
   BOO::DATA      : #<BOO::CARD 12D70BCB>
   CAPI:INTERFACE : #<BOO::BOO-EDITOR "Boo Editor" 12DC38BF>
   ED             : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>
   BOO::TEXT      : "<a long string>"

Now, if I do the same thing but this time set the editor pane with 
(format nil "~A" <original text>) everything works.

If I use the inspector on the original and the formatted I see that one 
is an array of characters, the other is a simple-text-string.

So.

What is a simple-text-string? I see that it is in the lispworks 
package, but I can't see a whole lot of information about it anywhere.

Why does an editor-pane care? Why should *I* care?

Is format the best way to get one of these from something that is a 
string but not a text-string?

Am I reading the backtrace properly? is the editor-error method having 
its own error?

Once again, thanks for any help you can give me.

Cheers,
Bob


----
Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
Recursive Design Inc.  -- <http://www.recursive.ca/>


Re: editor-pane, arrays of characters, simple-text-string, and errors

Hi,

I didn't mean to send this -- thick fingers mailed this from my drafts 
rather than deleting it. Sorry. It it completely covered by the 
previous messages I've sent.

Cheers,
Bob

On Nov 26, 2004, at 9:34 AM, Bob Hutchison wrote:

>
> Hi,
>
> I read a file character-by-character into a (make-array 0 
> :element-type :fill-pointer 0 :adjustable t) using vector-push-extend. 
> What I get back behaves like a string, and actually passes the stringp 
> test.
>
> I set the text of an editor-pane using that result.
>
> I get an error and the following (edited) backtrace:
>
> Condition: Editor-Error Handler EDITOR::DEFAULT-EDITOR-ERROR-HANDLER 
> returned.
> Call to ERROR (offset 104)
>   SYSTEM::ESTRING : "Editor-Error Handler ~S returned."
>   SYSTEM::EARGS   : (EDITOR::DEFAULT-EDITOR-ERROR-HANDLER)
>
> Call to EDITOR:EDITOR-ERROR (offset 244)
>   EDITOR::ARGS : ("String ~S of wrong type for buffer ~S" "<a long 
> string>" #<EDITOR:BUFFER the-boo-editor-BUFFER>)
>
> Call to EDITOR::SET-BUFFER-CONTENTS (offset 764)
>   EDITOR:BUFFER : #<EDITOR:BUFFER the-boo-editor-BUFFER>
>   STRING        : "<a long string>"
>
> Call to CAPI:MODIFY-EDITOR-PANE-BUFFER (offset 432)
>   CAPI::PANE   : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>
>   DBG::|rest-| : (:CONTENTS "<a long string>")
>
> Call to (METHOD (SETF CAPI:EDITOR-PANE-TEXT) (T CAPI:EDITOR-PANE)) 
> (offset 76)
>   CAPI-INTERNALS:TEXT : "<a long string>"
>   CAPI::SELF          : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>
>
> Call to (SUBFUNCTION 8 (METHOD CAPI::INITIALIZE-INTERFACE :AFTER 
> (BOO::BOO-EDITOR))) (offset 156)
>   BOO::DATA      : #<BOO::CARD 12D70BCB>
>   CAPI:INTERFACE : #<BOO::BOO-EDITOR "Boo Editor" 12DC38BF>
>   ED             : #<CAPI:EDITOR-PANE BOO::EDITOR  12DC31BF>
>   BOO::TEXT      : "<a long string>"
>
> Now, if I do the same thing but this time set the editor pane with 
> (format nil "~A" <original text>) everything works.
>
> If I use the inspector on the original and the formatted I see that 
> one is an array of characters, the other is a simple-text-string.
>
> So.
>
> What is a simple-text-string? I see that it is in the lispworks 
> package, but I can't see a whole lot of information about it anywhere.
>
> Why does an editor-pane care? Why should *I* care?
>
> Is format the best way to get one of these from something that is a 
> string but not a text-string?
>
> Am I reading the backtrace properly? is the editor-error method having 
> its own error?
>
> Once again, thanks for any help you can give me.
>
> Cheers,
> Bob
>
>
> ----
> Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
> Recursive Design Inc.  -- <http://www.recursive.ca/>
>
>
----
Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
Recursive Design Inc.  -- <http://www.recursive.ca/>


Re: editor-pane, arrays of characters, simple-text-string, and errors

Bob Hutchison wrote:

> What is a simple-text-string? I see that it is in the lispworks package,
> but I can't see a whole lot of information about it anywhere.

I think this is explained in the documentation somewhere, but don't really
have the time to look this up right now.

As a simple workaround for your problem, you could try coercing your string
to a simple-text-string before passing it to the editor-pane.

Something like:

  (coerce my-home-made-string 'simple-text-string)

Regards,

Arthur


Updated at: 2020-12-10 08:54 UTC