Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
 
In a message dated 24/04/2008 00:38:28 GMT Daylight Time,  
[EMAIL PROTECTED] writes:

But  if you try to compile (Turbo or Liberator) some parser error will  
appear...




Hi Gerhard, its a codegen error : Duplicate Label Have you ever  seen that 
error?. Its not mentionned in the manual. The lines in question  compile in 
Qlib. Problems with IF END IF are identified with parser task. What I  am 
wondering is if teh error message indicates a clash between, procedure names  
and 
keywords or perhaps variable definitions although nothing is obvious  obviously.
 
Here are the lines : Its part of a SELect ON value Line 9480 is the  line 
codegen complains about.
 
 
9464=3
9466dv_POS=INT(((zone*12)/(dev_ht%-12))*(free%)):IF  
dv_POS1:dv_POS=1
9468IF  dv_POS=dv_start
9470  scrolls=dv_start-dv_POS
9472  FOR i=1 TO  scrolls
9474Dev_Scroll_down
9476IF dv_start=1 :END FOR  i
9478  END FOR i
9480END IF
9482   IF  dv_POS=dv_end
9484  scrolls=dv_POS-dv_end
9486  FOR i=1 TO  scrolls
9488Dev_Scroll_up
9490  END FOR i
9492   IF  free%-1dv_end:Dev_Scroll_up
9494END IF 
 
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Derek Stewart
Duncan,

Try putting NEXT i in line 9476

The compiler will be seeing two ends to the FOR loop/

Derek

[EMAIL PROTECTED] wrote:
  
 In a message dated 24/04/2008 00:38:28 GMT Daylight Time,  
 [EMAIL PROTECTED] writes:

   
 But  if you try to compile (Turbo or Liberator) some parser error will  
 appear...
 




 Hi Gerhard, its a codegen error : Duplicate Label Have you ever  seen that 
 error?. Its not mentionned in the manual. The lines in question  compile in 
 Qlib. Problems with IF END IF are identified with parser task. What I  am 
 wondering is if teh error message indicates a clash between, procedure names  
 and 
 keywords or perhaps variable definitions although nothing is obvious  
 obviously.
  
 Here are the lines : Its part of a SELect ON value Line 9480 is the  line 
 codegen complains about.
  
  
 9464=3
 9466dv_POS=INT(((zone*12)/(dev_ht%-12))*(free%)):IF  
 dv_POS1:dv_POS=1
 9468IF  dv_POS=dv_start
 9470  scrolls=dv_start-dv_POS
 9472  FOR i=1 TO  scrolls
 9474Dev_Scroll_down
 9476IF dv_start=1 :END FOR  i
 9478  END FOR i
 9480END IF
 9482   IF  dv_POS=dv_end
 9484  scrolls=dv_POS-dv_end
 9486  FOR i=1 TO  scrolls
 9488Dev_Scroll_up
 9490  END FOR i
 9492   IF  free%-1dv_end:Dev_Scroll_up
 9494END IF 
  
  
 Duncan




 ___
 QL-Users Mailing List
 http://www.q-v-d.demon.co.uk/smsqe.htm


   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread norman
Morning Duncan,

Hopefully I'm remembering my FOR..NEXT..END FOR syntax correctly, but the 
following looks remarkably suspicious :


9472 FOR i=1 TO scrolls
9474 Dev_Scroll_down
9476 IF dv_start=1 :END FOR i
9478 END FOR i 

I think it should be :

9472 FOR i=1 TO scrolls
9474 Dev_Scroll_down
9476 IF dv_start=1 TEHN NEXT i : END IF
9478 END FOR i 

I can't remember off hand if Turbo is happy with no end ifs on a single line 
IF, so I've always put them in myself, even in SuperBaisc interpreted programs.

I also assume that if DV_STARTS is 1 or less that you want to go around the 
loop again and not exit from the loop itself. If you did want to bale out 
early, then line 9467 would change to :

9476 IF dv_start=1 THEN EXIT i : END IF

Basically, and if I remember correctly, a For loop looks like this :

FOR variable = start TO finish STEP step
  do stuff
  IF condition THEN EXIT variable : END IF : REM - Early exit 
  IF other_condition THEN NEXT variable: END IF : REM - Reloop early
  do other stuff
END FOR variable


Cheers,
Norman.
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Wolfgang Lenerz
On 24 Apr 2008 at 2:57, [EMAIL PROTECTED] wrote:
(...)
 9476IF dv_start=1 :END FOR  i

This should probably be : EXIT i.


Wolfgang


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
Hi Derek,
 
Thanks that was the line. 
 
I used EXIT i as Wolfgang suggested to stop the loop. 
 
Program now compiles and now I have other bugs to fix
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
Hi Norman,
 
 
Thanks that was the line. 
 
I used EXIT i as Wolfgang suggested to stop the loop. 
 
Program now compiles and now I have other bugs to fix
 
Duncan




   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
Hi Wolfgang, Thanks that was the answer. 
 
 
Program now compiles and now I have other bugs to fix
 
Duncan




   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Malcolm Cadman
In message [EMAIL PROTECTED], [EMAIL PROTECTED] writes

In a message dated 23/04/2008 19:59:57 GMT Daylight Time,
[EMAIL PROTECTED] writes:

Are you  sure that every IF statement has an END IF ?

Particularly when  nested loops and conditions are coded


Hi Malcolm,
I am fairly sure that they do it is one of the first things I looked  for.

Duncan

Hi Duncan,

Now that I have seen the coding extract, I can see that you do have a 
matching IF and END IF.

However, you also have a FOR loop within the IF statement as a 
whole, so this could be where the error is being thrown up.

I do my FOR loops like this ( the long way )

FOR num%=1 TO 6
 READ an_option$(num%)
END FOR num%

Which is what you have done too.

9472  FOR i=1 TO  scrolls
9474Dev_Scroll_down
9476IF dv_start=1 :END FOR  i
9478  END FOR i
9480END IF

Although you may be better using the EXIT i, rather than as END FOR 
i

I also always use integers for loops with Turbo, so i% rather than 
just i

I use REPeat and END REPeat conditions as the main condition mode, 
which allows any number of IF and END IF conditions to be set up as 
well inside that.

Always use EXIT from a REPeat.

Which may achieve what you are intending to do much better, and allows 
for elegant looking coding.

In addition I find that the SELect ON num% and END SELect again 
gives an elegant listing with endless options from the value of the 
variable.

Another thing to do is to make any variables LOCal to a PROCedure, 
which avoids confusion when using i or i%.

I hope this helps.

-- 
Malcolm Cadman
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Gerhard Plavec
Hi Duncan :)

 9472  FOR i=1 TO  scrolls

=Beginning of the loop

 9474Dev_Scroll_down
 9476IF dv_start=1 :END FOR  i

=End of the loop

 9478  END FOR i

Here you have one more end of a loop (whitch never was beginning...)
so parser has a big problem dupicate label !!?!

 9480END IF

Wolfgang and some other guys are right, in line 9476 you have to use 
NEXT i or EXIT i instead of END FOR i

Have much fun further debuging

Gerhard

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
 
In a message dated 24/04/2008 20:57:28 GMT Daylight Time,  
[EMAIL PROTECTED] writes:

Wolfgang and some other guys are right, in line 9476 you have to  use 
NEXT i or EXIT i instead of END FOR i

Have much fun  further debuging







Thanks, I will
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Matrassyl
 
In a message dated 24/04/2008 20:33:21 GMT Daylight Time,  
[EMAIL PROTECTED] writes:

 I  hope this helps.



It does many thanks as I am now past the it wont compile stage to I  did not 
think there were so many bugs to sort out stage.
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Dilwyn Jones
 9472 FOR i=1 TO scrolls
 9474 Dev_Scroll_down
 9476 IF dv_start=1 TEHN NEXT i : END IF
 9478 END FOR i

 I can't remember off hand if Turbo is happy with no end ifs on a 
 single line IF, so I've always put them in myself, even in 
 SuperBaisc interpreted programs.

 I also assume that if DV_STARTS is 1 or less that you want to go 
 around the loop again and not exit from the loop itself. If you did 
 want to bale out early, then line 9467 would change to :
In my programs I tend to put a catch-all in for cases like this which 
allows this case to go around the loop again, but also to exit the 
loop if exhausted:

9476 IF dv_start = 1 THEN NEXT i : EXIT i

The exit gets ignored unless the loop is exhausted. Not sure if it's 
good programming style, but it does seem to work.

-- 
Dilwyn Jones

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-24 Thread Rich Mellor
Dilwyn Jones wrote:
 9472 FOR i=1 TO scrolls
 9474 Dev_Scroll_down
 9476 IF dv_start=1 TEHN NEXT i : END IF
 9478 END FOR i

 I can't remember off hand if Turbo is happy with no end ifs on a 
 single line IF, so I've always put them in myself, even in 
 SuperBaisc interpreted programs.

 I also assume that if DV_STARTS is 1 or less that you want to go 
 around the loop again and not exit from the loop itself. If you did 
 want to bale out early, then line 9467 would change to :
 
 In my programs I tend to put a catch-all in for cases like this which 
 allows this case to go around the loop again, but also to exit the 
 loop if exhausted:

 9476 IF dv_start = 1 THEN NEXT i : EXIT i

 The exit gets ignored unless the loop is exhausted. Not sure if it's 
 good programming style, but it does seem to work.

   
Actually Dilwyn uses the correct style here:

Try:

10 FOR i=1 TO 9
20   PRINT i;  ;
30   IF i MOD 2  THEN NEXT i
40   PRINT i^2
50 END FOR i

Output is: 1 2 43 4 165 6 367 8 649 81

The NEXT is ignored when i=9

It is fixed with
30   IF i MOD 2  THEN NEXT i: EXIT i

-- 
Rich Mellor
RWAP Services
URL:http://www.rwapsoftware.co.uk
URL:http://www.rwapservices.co.uk

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


[Ql-Users] Turbo Help Please

2008-04-23 Thread Matrassyl
Am trying to compile a program with turbo 5.06. I am getting a codegen  error 
message Duplicate Label line 9480. Line 9480 contains only END  IF of a 
properly constructed IF  END IF expression.
Duplicate Label is not mentioned in the manual as a codegen error report.  
Can anyone clarify what the error means exactly?
 
Thanks
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-23 Thread Malcolm Cadman
In message [EMAIL PROTECTED], [EMAIL PROTECTED] writes

Hi,

Are you sure that every IF statement has an END IF ?

Particularly when nested loops and conditions are coded.

I know that Turbo does insist on correct syntax, without any shortcuts 
that the BASIC parser may sometimes accept.

Which is all to the good, as it prevents an errors occurring later in 
the compiled code.


Am trying to compile a program with turbo 5.06. I am getting a codegen  error
message Duplicate Label line 9480. Line 9480 contains only END  IF of a
properly constructed IF  END IF expression.
Duplicate Label is not mentioned in the manual as a codegen error report.
Can anyone clarify what the error means exactly?

Thanks

Duncan

-- 
Malcolm Cadman
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-23 Thread Matrassyl
 
In a message dated 23/04/2008 19:59:57 GMT Daylight Time,  
[EMAIL PROTECTED] writes:

Are you  sure that every IF statement has an END IF ?

Particularly when  nested loops and conditions are coded


Hi Malcolm,
I am fairly sure that they do it is one of the first things I looked  for.
 
Duncan



   
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Turbo Help Please

2008-04-23 Thread Gerhard Plavec
In original SuperBASIC some (dubious) programm like

IF a=b then
   FOR i=a TO b STEP 0.1
ELSE
   FOR i=a TO b STEP -0.1
ENDIF
...
more commands
...
END FOR i

may run without any problem...
But if you try to compile (Turbo or Liberator) some parser error will 
appear...

you have to write something like

FOR i=a TO b STEP sign(b-a)*0.1
...
END FOR i

Give more information, so perhaps someone can help...

GP


[EMAIL PROTECTED] wrote:

  
 In a message dated 23/04/2008 19:59:57 GMT Daylight Time,  
 [EMAIL PROTECTED] writes:
 
 Are you  sure that every IF statement has an END IF ?
 
 Particularly when  nested loops and conditions are coded
 
 
 Hi Malcolm,
 I am fairly sure that they do it is one of the first things I looked  for.
  
 Duncan
 
 
 

 ___
 QL-Users Mailing List
 http://www.q-v-d.demon.co.uk/smsqe.htm
 
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm