About Break Loops (Visual LISP IDE)

Expressions are the basic structural units of AutoLISP, and Visual LISP works by repeatedly reading, evaluating, and printing expressions. This is commonly known as a read-eval-print loop in LISP programming.

Note: The Visual LISP IDE is available on Windows only.

Visual LISP executes an AutoLISP program in the Top-Level read-eval-print loop, unless the program has been interrupted or suspended to allow for debugging. When you evaluate an expression at the Console window prompt, and the normal prompt is displayed, you are also working at the Top-Level.

When an AutoLISP program is interrupted or suspended, the Console window is passed control and you enter a break loop. The break loop is a separate read-eval-print loop, and is nested underneath the original read-eval-print loop. It is possible to interrupt a break loop and start another read-eval-print loop beneath it. The nesting level of a break loop with respect to the Top-Level is called the break level.

When you enter a break loop, Visual LISP prefixes the Console window prompt with a number indicating the level where you are located.

For example, when you first enter a break loop in a program, the prompt indicates this with the number 1:

_1_$
Note: While in a break loop, you cannot switch to the AutoCAD window.

While in a break loop, you have read-write access to all variables that your program does at the location the break occurred. For example, if the break occurred within a function containing several local variable declarations, those and any global variables are accessible. The values of the variables can be changed by entering an expression with the setq function at the Console window prompt.

There are two types of break loops that Visual LISP supports

Continuable break loops

Continuable are the most commonly break loops, and are used when you want to step through and debug a program. You can enter a continuable break loop at the very first break in program execution by any of the following methods:

When stopped at a breakpoint, you can control subsequent program execution by:

After you exit the all break loops to the Top-Level, the Console window prompt returns to its original form (without a number prefix).

Non-Continuable break loops

A non-continuable break loop is activated when an error causes program interruption and the Break on Error option is enabled. In a non-continuable break loop, you can access all variables in the error environment, but you cannot continue program execution or execute any of the Step commands.

If you activate AutoCAD while in the midst of a non-continuable break loop, you will not be able to enter anything in the command window; in fact, the window will not contain a Command prompt. However, if you accidentally try typing anything in the AutoCAD Command window, your keyboard input will be queued until control is returned to the AutoCAD window (that is, after you exit the break loop and activate the AutoCAD window). At that point, anything you typed is evaluated by AutoCAD as if you had just entered it at the Command prompt.

Note: You can distinguish between continuable and non-continuable break loops by checking to see if Step Into and Continue are active on the Debug menu or toolbar.