BBC BASIC for Windows
« Lists in BB4W »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:03pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Lists in BB4W  (Read 652 times)
dje4816
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Lists in BB4W
« Thread started 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.
undecided
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Lists in BB4W
« Reply #1 on: Nov 15th, 2013, 5:34pm »

on Nov 15th, 2013, 3:49pm, dje4816 wrote:
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:

http://rosettacode.org/wiki/Doubly-linked_list/Element_definition#BBC_BASIC
http://rosettacode.org/wiki/Doubly-linked_list/Element_insertion#BBC_BASIC
http://rosettacode.org/wiki/Doubly-linked_list/Traversal#BBC_BASIC

Does that help?

Richard.
User IP Logged

dje4816
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Lists in BB4W
« Reply #2 on: Nov 16th, 2013, 08:36am »

Thanks, Richard, I knew you'd come up with something!

Dave.
laugh
User IP Logged

dje4816
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Lists in BB4W
« Reply #3 on: Nov 16th, 2013, 09:45am »

I tried to use the code linked at http://rosettacode.org/wiki/Doubly-linked_list/Traversal#BBC_BASIC.

In the code in the link the following lines appear:

a.pNext% = b{}
a.iData% = 123
b.pPrev% = a{}
b.iData% = 789
c.iData% = 456

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.





huh huh undecided sad huh smiley
User IP Logged

Malvern
Guest
xx Re: Lists in BB4W
« Reply #4 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.
User IP Logged

dje4816
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Lists in BB4W
« Reply #5 on: Nov 16th, 2013, 12:40pm »

Thanks, Malvern, it's working fine now.

Dave.
laugh
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls