Author |
Topic: Syntax (Read 339 times) |
|
bruceoboast
New Member
member is offline


Gender: 
Posts: 6
|
 |
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
|
|
Logged
|
Bruce
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
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: 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.
|
|
Logged
|
|
|
|
bruceoboast
New Member
member is offline


Gender: 
Posts: 6
|
 |
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
|
|
Logged
|
Bruce
|
|
|
|