[futurebasic] Re: linked lists in FB

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Greg_Neagle@...
Date: Fri, 05 Dec 1997 10:15:57 -0800
On 12/4/97 at 6:59 PM, Chris <behmc@...> wrote:

:In your example code you had a new handle created each time you wanted to
:add an element to the linked list.  if I had a dimmed variable that was
:created in the image of the data structure (ie DIM someRec.ListElement) how
:would I add that to the linked list?  Would I have to create a new handle,
:put that handle into the nextElement of the tail (or wherever I'm adding it
:to) and then move the data from the record into the handle?

Yes, basically.

:Something like this:
:DIM someRec.ListElement
:LOCAL FN addToTail (aRec)
: newEle& = FN NEWHANDLE (_ListElement)
: [newEle&];8 = aRec
: 'or would that be [[newEle&]];8 = aRec?

I'd do BLOCKMOVE @aRec, [newEle&], 8 because I don't FB's shorthand syntax will
work the way you have it above (though it might)

: 'code to get to the tail
: 'for arguments sake say that it is in tail&
: tail&..nextElement& = newEle&

- via BulkRate 2.6.x