Author Topic: Programming errors on QB64  (Read 6996 times)

0 Members and 1 Guest are viewing this topic.

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Programming errors on QB64
« on: September 24, 2021, 10:35:38 am »
Tell me, please, what is the error? 
 [ You are not allowed to view this attachment ]  
Error in line 124

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Programming errors on QB64
« Reply #1 on: September 24, 2021, 10:53:12 am »
In your source code is not SUB named as zaglavie:

here is your source code
...
..
..
..
..

here is your SUBs and FUNCTIONs

SUB zaglavie
...
... next source code in this SUB
...
END SUB

FellippeHeitor

  • Guest
Re: Programming errors on QB64
« Reply #2 on: September 24, 2021, 10:54:33 am »
You didn't separate the Call from the comment:

Code: QB64: [Select]
  1. Call zaglavie1(): rem ...

Notice:
1- Call is optional:
Code: QB64: [Select]
  1.  zaglavie1: rem ...

2- rem is optional, if you use the apostrophe - and if you don't use rem, you don't have to separate the comment from the main line with a colon:
Code: QB64: [Select]
  1. zaglavie1 'some comment

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Programming errors on QB64
« Reply #3 on: September 24, 2021, 11:00:07 am »
Here is example:
@FellippeHeitor  it works also without : separator with REM :)

Code: QB64: [Select]
  1.     CLS
  2.     CALL ShowTime REM here is something wrong!
  3.     _DISPLAY
  4.     _LIMIT 20
  5.  
  6. SUB ShowTime
  7.     LOCATE 1
  8.     PRINT TIME$
  9.  
  10.  
  11.  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Programming errors on QB64
« Reply #4 on: September 24, 2021, 11:08:31 am »
@kservice

Next option is, if zagalvie1 SUB exists in your source code, remove brackets from CALL statement.

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Re: Programming errors on QB64
« Reply #5 on: September 24, 2021, 12:20:34 pm »
In your source code is not SUB named as zaglavie:

All called functions are in a separate file.
  [ You are not allowed to view this attachment ]  

After separating the function of the function and the comment has not changed
  [ You are not allowed to view this attachment ]  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Programming errors on QB64
« Reply #6 on: September 24, 2021, 02:06:16 pm »
So zaglavie1 is not SUB, because if is, then you must have this error message:

(SUB must be included at the end the source code)

  [ You are not allowed to view this attachment ]  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Programming errors on QB64
« Reply #7 on: September 24, 2021, 02:17:05 pm »
Can you call a sub with blank parameters?  If it’s blank, shouldn’t it just be omitted?

CALL X()

SUB X
  PRINT “foo”
END
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Programming errors on QB64
« Reply #8 on: September 24, 2021, 02:31:38 pm »
Hi
Fine behaviour...

Code: QB64: [Select]
  1. Print "1"
  2. Call print2 Rem ' it is a modern comment
  3. print2 Rem it is a classical comment
  4.  
  5. Sub print2 ()
  6.     Print "Hi I'm SUB print2 and I do this...";
  7.     Print 2

  [ You are not allowed to view this attachment ]  
yes I can confirm that the error is NOT related to the absence of : between  print2 and Rem
moreover also if I type : the error stays there.
If I erase the () all become ok.

Are there some differences with QB45?  I dunno.
Programming isn't difficult, only it's  consuming time and coffee

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Programming errors on QB64
« Reply #9 on: September 24, 2021, 02:39:22 pm »
It’s the blank parameters.

Call x()

Sub x()
   PRINT “foo”
End Sub

  [ You are not allowed to view this attachment ]  
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Programming errors on QB64
« Reply #10 on: September 24, 2021, 09:18:56 pm »
Yes trying the same code in QBasic
this last warns the user to put arguments between ( )
Moreover it doesn't tolerate a REM without a : before it!

Programming isn't difficult, only it's  consuming time and coffee

FellippeHeitor

  • Guest
Re: Programming errors on QB64
« Reply #11 on: September 24, 2021, 11:19:29 pm »
Yeah, today I learned QB64 doesn't mind if there's a colon before a REM comment.

It's only mandatory in DATA lines.

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Re: Programming errors on QB64
« Reply #12 on: September 25, 2021, 06:54:45 am »
Thanks to all for participation and advice. The program is large, many different functions that I combined into the plug-in file.
       Advise how to better make functions from this file? Can there be 2-3 connected files?
The program was created for many years ago for QB45 and now, when there is free time, trying to transfer to QB64. On QB45 everything worked. Here, apparently, checking over compiling more careful.
I'm trying to figure it out. So far not everything turns out. So I take a break. I am free from other cases - I will continue.
   Checked such a test variant - works without errors
  [ You are not allowed to view this attachment ]  

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Re: Programming errors on QB64
« Reply #13 on: September 26, 2021, 11:51:47 am »
In the  QB45 program i am used the FRE(-1) command. In QB64, this keyword is not supported. Something can be replaced?
Or here it is not necessary?

     And another question. I repeatedly use the functions of the form
Sub Chtenie1 (SKLSUM#, U$, f$, NB$, NE$, DT$, FRM$, RR, C, PP, tov() As Tovar).
Variable tov () AS Tovar is read from the f$ file. This is an array, in each row of which 4 pemet. But at the same time an
"IncorRect Array Type Passed to Sub" error occurs.
     How can this problem be solved?
« Last Edit: September 26, 2021, 12:18:05 pm by kservice »

FellippeHeitor

  • Guest
Re: Programming errors on QB64
« Reply #14 on: September 26, 2021, 12:18:01 pm »
There's no direct equivalent to FRE() in QB64. You will have to query the operating system (research the API) to check how much free memory is available.

Unless your program relied directly on knowing how much free memory there was, you can probably safely remove the FRE() occurrences.