Hallo Sergey! Normally I am a quit reader of your questions. And I heve learned a lot from you by this - so this time I am glad that I can help you:
The fault is in : endl
There you use the word ! wich put a 10 at the end of a string (i.e
Lineend) but this 0 is four byte long so you destroyed the adress of
some other word.
(the eloquence of Bernds forth provides the code to crash by the first
occurence of endl.)
Use c! instead it will only store the byte 10 (0A).
Regards Martin
Am Donnerstag, den 16.02.2006, 18:06 -0700 schrieb Sergey Plis:
> Hi!
>
> I need to figure out some basic forth question in the way it deals with
> strings. I wrote a rudimentary DXF exporter (see attachment) and
> stumbled upon problems with strings. The problem is with 3dface word
> with is lengthy and I provide it here in a contracted view to
> demonstrate the point:
> : 3DFACE ( fid r1[ r2[ r3[ -- )
> { r1[ r2[ r3[ |
> dup [ s" 0 " 2dup endl ] sliteral dxf-write
> dup [ s" 3DFACE " 2dup endl ] sliteral dxf-write
> dup [ s" 8 " 2dup endl ] sliteral dxf-write
> dup [ s" shell00 " 2dup endl ] sliteral dxf-write
>
> ...
>
> dup [ s" 62 " 2dup endl ] sliteral dxf-write
> [ s" 0 " 2dup endl ] sliteral dxf-write } ;
>
> The firs version of this word looked like that:
> : 3DFACE ( fid r1[ r2[ r3[ -- )
> { r1[ r2[ r3[ |
> dup s" 0 " 2dup endl dxf-write
> dup s" 3DFACE " 2dup endl dxf-write
> dup s" 8 " 2dup endl dxf-write
> dup s" shell00 " 2dup endl dxf-write
>
> ...
>
> dup s" 62 " 2dup endl dxf-write
> s" 0 " 2dup endl dxf-write } ;
>
> However, this version could only be called once (that is saving just one
> face). Second call would always raise "Bus error" message. I concluded
> that I do not understand something very basic here. But I needed to get
> the job done so I came up with the version that uses sliteral trick.
> This version works, but lets me save only one file. Trying to save 2
> files during one bigforth session again raises "Bus error" message.
>
> Can somebody look and tell me what am I doing wrong?
>
> Thank you in advance.
>
> --
> Sergey
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
