BBC BASIC for Windows
« Syntax »

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



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: Syntax  (Read 339 times)
bruceoboast
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 6
xx Syntax
« Thread started on: Oct 26th, 2011, 7:06pm »

I’m trying to convert a QuickBASIC program I wrote many years ago to BBC BASIC for Windows. The program works running in FreeDOS, but I need to use com ports 4,5 or 6 and DOS just doesn’t support this and I would like to use a more modern OS . I used QB2BBC as a first blush in translation, but the program won’t run. I’ beating it into submission piece by piece, but there some constructs that I don’t understand. I can find no documentation on: Index_LBOUND_1 = 1. Here’s the code:

DIM Index1Type{ \
\ RecordNumber%,\
\ LastName&(20) \
\ }

Index_LBOUND_1 = 1
DIM Index{(100)} = IndexType{}

The original Quick BASIC code was:


TYPE Index1Type
RecordNumber AS INTEGER
LastName AS STRING * 20
END TYPE

DIM SHARED Index1(1 TO 100) AS Index1Type

Any Help would be appreciated.
Bruce
User IP Logged

Bruce
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Syntax
« Reply #1 on: Oct 26th, 2011, 9:31pm »

on Oct 26th, 2011, 7:06pm, bruceoboast wrote:
I’ beating it into submission piece by piece

If you spot an avoidable translation error, do please let me know because I will try to correct QB2BBC. The idea is that it should, when possible, translate a program from QBASIC into BBC BASIC perfectly; it defeats the object if you have to make any manual alterations afterwards.

Quote:
the program won’t run.

Can you explain what isn't working, or is it too deeply embedded in the program to work out?

Quote:
I can find no documentation on: Index_LBOUND_1 = 1.

QB2BBC inserts that code because otherwise there's no record of what the lower bound of the array index is. Unless your program uses the LBOUND function it's irrelevant and can be ignored.

Quote:
Any Help would be appreciated.

It's hard to say without seeing more of the program. The only likely cause of incompatibility I can think of is that the size of the structure Index1Type is different from what it is in QBASIC. In QBASIC it's 22 bytes long whereas in BBC BASIC it's 25 bytes long.

If the structure is used only internally to the program that ought not to matter, but if for example it gets transferred to or from another process (e.g. via a serial link) then obviously the different sizes will matter.

Richard.
User IP Logged

bruceoboast
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 6
xx Re: Syntax
« Reply #2 on: Oct 28th, 2011, 12:28am »

The Program in question was written almost 15 years ago, and while commented, I don’t recall why I did things the way I did. I didn’t find any avoidable translation errors. When I said the translated program would not run, I meant that there were numerous errors; “No such variable”, “Bad use of structure”,” Syntax error” … I am going through them one by one. So far, I have the main body of the program running and am working on some of the subroutines (PROC).

I had never encountered LBOUND before and since there is no keyword in the bb4w manual or in the wiki, I guess it has no meaning in this dialect of the language.

I understand the general principles of structures, but have a question. In QuickBASIC, you can define a TYPE and then define variables of that TYPE. Is there any equivalent in bb4w?

Bruce
User IP Logged

Bruce
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