BBC BASIC for Windows
Programming >> Database and Files >> Lists in BB4W http://bb4w.conforums.com/index.cgi?board=database&action=display&num=1386770394 Lists in BB4W
Post by dje4816 on Nov 15th, 2013, 3:49pm
Several languages offer a List function. This is essentially an array which can be grown or shrunk on the fly without destroying its contents. Typically a structure would be used, one field holding data with a couple of other fields employed as pointers to the preceding and succeeding element in the list. A new element (structure) can be added anytime, and an existing structure can be deleted anytime without affecting the rest of the List.
I can't find a way to make BB4W structures generate new structures without providing a structure name on the fly, so I'm stuck. I want the List feature in a program I'm working on.
I'm sure someone has already solved this problem, so please give me some pointers (no pun intended!)
Dave. Re: Lists in BB4W
Post by admin on Nov 15th, 2013, 5:34pm
Typically a structure would be used, one field holding data with a couple of other fields employed as pointers to the preceding and succeeding element in the list.
What you seem to be describing there is a doubly-linked list. If so, these Rosetta Code pages contain BBC BASIC solutions for Element Definition, Element Insertion and Traversal:
When I copy and paste them in to BB4W, they appear like this: andpNext% = b{} andiData% = 123 bgetpPrev% = a{} bgetiData% = 789 colouriData% = 456
As you can see, BB4W changes the code after copying it in. So I tried typing it in directly into BB4W, with exactly the same effect.
What's going on here? Do those changes mean anything? Either way, the code doesn't run.
Any help and an explanation appreciated!
Dave.
Re: Lists in BB4W
Post by Malvern on Nov 16th, 2013, 12:32pm
Go to the IDE Options menu, select Customize and then uncheck the Accept Keyword Abbreviations option.
The effect you are getting is because you have lower case keywords selected and the IDE thinks you are trying to use abbreviated keywords.
Re: Lists in BB4W
Post by dje4816 on Nov 16th, 2013, 12:40pm