Re: [Ql-Users] DEBUG

2012-02-22 Thread Michael Bulford
Hi George

 
There is an error in the Turbo parser at line 14490.  Here is this line:
 
14490  IF var%0
AND (struct%(var%)directive_mask%)=directive_mask%
 
Both sides of the AND get to be evaluated.  Although var% is tested for being 
non
negative on the left hand side, the right hand side will be evaluated in any
event.  Should var% happen to be
negative, then struct%(var%) would be outside of the array bounds and will
crash SuperBASIC.  The above line needs
to be re written so that the right hand side will only be evaluated if the left
hand side evaluates to true.  Here is my
suggested work-around:
 
1  LOCal both :
REMark (if needed)
14488  both = 0
14489  IF var%0:IF
(struct%(var%)directive_mask%)=directive_mask% : both = 1
14490  IF both
 
Michael
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] DEBUG

2012-02-22 Thread George Gwilt
Hi Michael

On 22 Feb 2012, at 13:31, Michael Bulford wrote:

 There is an error in the Turbo parser at line 14490.  Here is this line:
  
 14490  IF var%0
 AND (struct%(var%)directive_mask%)=directive_mask%
  
 Both sides of the AND get to be evaluated.  Although var% is tested for 
 being non
 negative on the left hand side, the right hand side will be evaluated in any
 event.  Should var% happen to be
 negative, then struct%(var%) would be outside of the array bounds and will
 crash SuperBASIC.

You are quite right. But how did you get var%=-3? Does this imply another 
mistake in Parser?

   The above line needs
 to be re written so that the right hand side will only be evaluated if the 
 left
 hand side evaluates to true.  Here is my
 suggested work-around:
  
 1  LOCal both :
 REMark (if needed)
 14488  both = 0
 14489  IF var%0:IF
 (struct%(var%)directive_mask%)=directive_mask% : both = 1
 14490  IF both
  

My solution is:

14490 IF var%0
14494  IF (struct%(var%)directive_mask%)=directive_mask%:Parse_Directive:ELSE 
Skip_Stmt

Cheers

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


Re: [Ql-Users] DEBUG

2012-02-22 Thread Michael Bulford
Hi George
 
On Wednesday, 22 February 2012, 14:24  George Gwilt wrote:
 
 You are quite right. But how did you get var%=-3? Does this imply another 
 mistake in Parser?

No, I don't think so.  -3 comes from for_flag% for an earlier occurence of p

Your solution looks the best - it's neater.

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


Re: [Ql-Users] DEBUG

2012-02-22 Thread Malcolm Cadman
In message 1329917514.17351.yahoomail...@web171518.mail.ir2.yahoo.com, 
Michael Bulford michaelbulf...@yahoo.co.uk writes



Hi George

 
There is an error in the Turbo parser at line 14490.  Here is this line:
 
14490  IF var%0
AND (struct%(var%)directive_mask%)=directive_mask%
 
Both sides of the AND get to be evaluated.  Although var% is tested 
for being non

negative on the left hand side, the right hand side will be evaluated in any
event.  Should var% happen to be
negative, then struct%(var%) would be outside of the array bounds and will
crash SuperBASIC.  The above line needs
to be re written so that the right hand side will only be evaluated if the left
hand side evaluates to true.  Here is my
suggested work-around:
 
1  LOCal both :
REMark (if needed)
14488  both = 0
14489  IF var%0:IF
(struct%(var%)directive_mask%)=directive_mask% : both = 1
14490  IF both
 
Michael


I use the logical method, of defining 'true' and 'false', as a global 
value in a program.


500 true=1 : false=NOT true

Then you can use

1000 IF true
1010 REMark Take an action ...
etc .

This makes the program easier to follow.


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