Hi all,

I believe I have discovered a very good way of using the RET_STK function

DEFine FuNction bug(p1$, p2$, p3$, p4$, p5$)
LOCal n, x$
   PRINT #0,"PAUSEd at line" ! RET_STK !
   FOR n = 1 TO 5
      x$ = PICK$(n, p1$, p2$, p3$, p4$, p5$)
      IF PARNAM$(n)<>"" OR x$<>"": PRINT #0,!! PARNAM$(n) & " = " & x$ ! 
   END FOR n 
   CURSEN #0 : PAUSE : CURDIS #0 
   PRINT #0,"" : RETurn 0 
END DEFine bug 

Note that PICK$ is from DIY Toolkit VolE_CONTROL_code.  A function is used 
rather than a procedure so that RET_STK will always produce the correct line 
number. 

Suppose I wanted to stop my program under some condition at line 2885 and print 
out the values of the variables row, col and count.   The following line could 
be inserted 

2885 IF some_condition : ERT bug(row,col,count) 

Then what could appear in #0 is 

PAUSEd at line 2885   row = 19   col = 20   count = 156 

All the parameters are optional.   You can even supply expressions, although 
only their values would get printed. 

I have found this to be so useful.  There is no need to type in any line 
numbers – RET_STK is doing all the work.  Since using this, my debugging has 
become so much easier and less time-consuming. 

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

Reply via email to