Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected end of file error
#1
Hi all

Sorry to bother you twice in the same day :? I'm falling back to the safe land of BASIC but I'm still struggling with problems. I'm getting an "Unexpected end of file. Compilation failed" error. I'm searching for a lost bracket, lost END IF or similar (another post suggests that could be a lost parenthesis but I can't find any). What others symbols/codes/etc must I look for?

I'm compiling with tha last version and with the following options:
zxb.exe oc_UTF8.bor -S 27000 -t -B -a -o oc_UTF8.tap -O 0 --heap-size=1024

Thanks and regards


Attached Files
.rar   oc_UTF8.rar (Size: 3.66 KB / Downloads: 167)
Reply
#2
Remember you can attach this file in a *private* message if you don't want to disclose your source code to the other (e.g. a game surprise!) :wink:
Reply
#3
Thanks, but I have no problem with share the code (well, at least for this) :wink: Nevertheless, I've just found four END IF that were lost. Nothing is better that to post to find the question by yourself Confusedhock:

Cheers
Reply
#4
The problem is on lines 1790..1820:

These lines have two *nested* if (one if inside another one). So a 2nd END IF is needed at the end of every line. That is, there are two ifs in those lines, so close them with END IF: END IF.
Code:
1790 IF dp = 4 AND c(ox+1, oy)>0 AND c(ox+1, oy)<10 THEN LET dpf=dpf+1: IF dpf=8 THEN LET fpf = 0: LET oy=oy -1: END IF: END IF
Remember you can break lines for better clarification:
Code:
1790 IF dp = 4 AND c(ox+1, oy)>0 AND c(ox+1, oy)<10 THEN
        LET dpf=dpf+1
        IF dpf=8 THEN
            LET fpf = 0
            LET oy=oy -1
        END IF
     END IF : REM  <== this END IF is missing in your code! Add the missing :END IFs to fix it
Reply
#5
Yep, thanks, those were the 'rogues' END IFs. Nevertheless, the obtained code doesn't work (all I can get is a blank screen and no more) but I can assure you the BASIC code works (extremely slow but works) Using the Spectaculator debugger I can see that all the instructions are being executed... great, more Sunday code debug :lol:

Cheers
Reply
#6
oblo Wrote:Yep, thanks, those were the 'rogues' END IFs. Nevertheless, the obtained code doesn't work (all I can get is a blank screen and no more) but I can assure you the BASIC code works (extremely slow but works) Using the Spectaculator debugger I can see that all the instructions are being executed... great, more Sunday code debug :lol:

Cheers
Hmm, your'e POKEin directly into the UDG zone :?: Try using USR "a" + xxx to poke "A" UDG, and so on (as explained in the manual). Or use PEEK (Uinteger, 23675), as ZX BASIC might need to reallocate UDG mem zone.

I will later tell you a trick to create UDG in a faster/efficient way Wink
Reply
#7
Thanks, that will be apprecciated Smile But I'm seeing that the problem is if the loop at 350. When it finished to print the screen, the code freeze... still searching the cause.

Cheers

EDIT: vars, vars, vars... all the vars need the EXACT kind of var it will be. Also, I've found that mark a var as uInteger and make it through the last number (65535) in a FOT statement, it bakcs again to be 1! So, the FOR statament never ends because when it reach its last value, it goes back again to 1 before the NEXT instruction. Maybe I'm missing something? :?
Reply
#8
No, you are RIGHT!!
The construction is FOR <var> = <lower> TO <upper> STEP <step>. The <var> needs to reach a value GREATER than <upper>. Uinteger won't ever be larger than 65535 (due to overflow). Better use DO ... UNTIL <var> == <limit>.
You can also use ULong type (DIM f As ULong somewhere before f is being used for the first time).

This has been discused here: <!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/bug-reports/topic423.html">bug-reports/topic423.html</a><!-- l -->
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)