programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Fun with comma...

From: Jos'h Fuller <josh_at_dkp.com>
Date: Mon, 11 Nov 2002 17:17:50 -0500 (EST)

Hi!

I'm setting up a simple linked list and it mostly works, but there seems
to be some problem with my initialization word.

Here's what a typical list might look like:

listheader >next data >next data >next data 0

The '>next' is a cell wide pointer to the next list entry. A zero instead
of a pointer terminates the list (until another value is added). The list
is defined in dictionary space, with the listheader built with create
does>:

: list: ( | name --) create does> 0 , ;

I comma in '0' at the start for an empty list. However, if I try to create
multiple lists, the zero gets stepped on with a random value. This causes
me great unhappiness... Here's a quick run:

\ This works...
list: paths paths ? _0_
list: path paths ? _0_ path ? _0_
\ This doesn't work!
list: u
list: v
u ? _1936291329_ v ? _0_

This is... bizarre. Does anybody have any good ideas why creating one list
after another should go wierd like that? I've tried align-ing after
creating the list, but it doesn't seem to help. A single list by itself
works great.

Thanks!

Jos'h

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Mon Nov 11 2002 - 14:17:22 PST

This archive was generated by hypermail 2.2.0 : Fri Nov 21 2008 - 03:04:25 PST