Jump to content

Recommended Posts

Posted

Hello.

 

Can somebody tell me whether the visual lisp debugger supports braking based on a conditional criterion? Say I want to break when the counter of a loop running reaches the nth iteration.

 

Thanks

Posted (edited)

You could build it into your lisp.

 

(setq i 0)
(setq rep "Yes")
(while (eq rep "Yes")
  
  ;code you want to loop

  (setq i (1+ i))
  (if (> i 500)      ;check to continue every 500 loops
    (progn
      (setq i 0)
      (initget "Yes No")
      (setq rep
        (cond
          ((getkword "\nContinue? [Yes/No]: ")) ( "Yes")
        )
      )
    )
  )
)

 

Edited by mhupp
Posted

Thanks but I want the debugger to let me continue with inspection of the code while running by using (shift+) F8, animate etc...

I guess this is not really an option with VL IDE like for instance Visual studio, right?

 

Posted

Take a look at this code. Click on the end of the indicated lines, next to the last ")" then press F9 to set the breakpoint.

Then run the code and when it stops, press ctrl+F8 to continue.

(setq i 1 s 0)
(while (<= i 20)
  (setq s (+ s i))
  (setq i (1+ i))
  (cond
    ((= i 10)
      (princ "\nFirst stop");<-- Breakpoint
    )
    ((= i 15)
     (princ "\nSecond stop");<-- Breakpoint
    )
  )
)

Following all steps above, this is what I got on the console

0 
First stop
_1_$ 

Second stop
_1_$ 

nil 
_$ i s
21
210
_$ 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...