Overview

How To Get Help	Information on context-sensitive help
Editing	Editor description
Debugging	Debugger description
Controls	Description of the controls for the editor/debugger
BASIC	BASIC Language Reference


How to Get Help

There are several means to obtain help on the use of the Editor/Debugger and on the BASIC language.  Pressing the help key or help button (see Controls) displays context sensitive online help.  If the cursor is on a BASIC language keyword when the help key is pressed, information about that keyword is displayed.  Otherwise, the contents of this help file is displayed.

Help can also be obtained on BASIC language keywords using the Right Mouse Button.


Editing

The editor behaves in the standard MS Window's fashion.  Text entered from the keyboard or imported from a disk file can be selected, cut or copied to the clipboard, replaced by the contents of the clipboard, or cleared.  Edited scripts may then be written back to the disk file.


 	Checking Your BASIC Program for Errors

The two flavors of errors that occur in BASIC programs are Syntax errors and Execution errors.  You can scan for syntax errors in the currently viewed BASIC program by clicking on the [image] icon in the toolbar or by using the F6 function key.  Lines containing syntax errors in your BASIC program will be highlighted in red.  If there are syntax errors, you can scroll between them using the [image] and [image] toolbar icons or the Ctrl-N and Ctrl-P keyboard accelerators.

Execution errors are corrected using the debugger.


Debugging

The debugger assists you in locating and correcting execution errors in your BASIC program.  It allows you to slow or suspend execution of your program so that you can examine program flow and the contents of variables.

There are several ways to invoke the debugger:

o	When in edit mode, use the step into button ( [image]) to debug the execution of the main procedure in the current buffer.  Execution is suspended and the debugger is activated, highlighting the first line of the main procedure
o	Set breakpoints in the current buffer and begin execution by pressing the execute button ( [image]).  Execution is suspended when one of the lines that contains a breakpoint is about to be executed.  The debugger is activated and it highlights the line containing the breakpoint.
o	When a program is executing and the Editor/Debugger window is active, press the Pause ( [image]) button.  Execution is suspended,  the debugger is activated and it highlights the line that is about to be executed.
o	If an executing program encounters a runtime error, such as an unhandled BASIC error, Execution is suspended, the debugger is activated and it highlights the line containing the error.
The Call Stack control displays the series of BASIC subroutine and function calls that got you to the current line.  The Variable Window allows you to examine the contents of variables in the currently selected call frame.


Breakpoints

A breakpoint is a marker on a line of BASIC code that tells BASIC to suspend execution at that line so that the state of the program can be examined using the debugger.  There are two ways to set breakpoints on lines of BASIC code when Editing and there is an additional way to set a breakpoint when Debugging.

When editing, place the cursor on the line of code on which you wish to set a breakpoint by clicking on that line with the mouse or using the arrow keys.  Then press the F9 function key or the [image] toolbar icon to toggle the breakpoint.  The line's color will change to blue to indicate that when the program is run, BASIC will attempt to establish a breakpoint on that line.  If the line already had a breakpoint on it, pressing F9 or the [image] toolbar icon will clear the breakpoint and the line's color will revert to black.

When debugging, clicking on a line of BASIC code toggles a breakpoint on that line.  Lines with breakpoints appear in blue while debugging.


Variable Window

The variable window is used to examine the contents of the variables associated with a particular call frame when debugging.  Here is a description of the contents of the variable window:

+Globals -TYPES   +MType (NestedType) -main   i%: 0   -s (NestedType)     +tt (s2)     s$:      +t (s1)     -tt1 (s2)       +t (s1)       i%: 0       +t1 (s1)     i%: 0     +t1 (s1)	Lines in magenta indicate types or scopes that may be expanded or collapsed by pointing to them with the mouse and double clicking.  Those lines preceded with a + may be expanded, while those with a - may be collapsed. In this example, there are three scopes: Globals, TYPES and main corresponding to the Global, Module and Procedural scopes of this call frame. The Globals scope is not expanded, but when expanded the current global variables would be displayed. The TYPES scope is the scope of module variables for this module (TYPES).  There is one module variable in module TYPES: MType.  MType is of type NestedType and is not expanded. The procedure scope, main is expanded to list two local variables - i%, which is an integer and s, which is of type NestedType.  The local variable s has been expanded to reveal six members: tt of type s2, s of type string, t of type s1, tt1 of type s2 and i of type integer.


Call Stack Control

The call stack control contains a the list of BASIC subroutine and function calls that got you to the current line. The control is a drop-down list box which appears in the toolbar when you are running the debugger.  A typical call stack control looks like this:

This control indicates that we are currently suspended in the debugger in the BASIC routine CMPMOD on line 216 of the module testlib.  CMPMOD was called by RegisterModules on line 76 of module testmods, etc.  Selecting an entry in this list box will cause the current call frame to shift to that entry:  the debugger window will display the line of code that made the call and the Variable Window will display the variables that are associted with the procedure and that made the call.


Editor/Debugger Controls
Controls

Here is a brief description of the controls of the editor/debugger:

Icon	Accelerator	Action
	Ctrl-S	Save current macro to disk
	Ctrl-O	Open a new macro
	Ctrl-N	Create a blank macro
		Save current macro to disk with a new name
		Invoke the Dialog Editor to edit a BASIC dialog box.
	Ctrl-C	Copy current editor selection to the clipboard
	Ctrl-X	Cut current editor selection and put it on the clipboard
	Ctrl-V	Paste current editor selection with the contents of the clipboard
	Ctrl-Z	Undo the previous editor action
	Shift-F2	Toggle the Console window.
	F2	Toggle the Variable window.
	F5	Execute the main procedure of the current BASIC program if editing, or continue executing the current BASIC program if debugging.
	Esc (twice) Ctrl-Break (twice)	Stop executing current BASIC program.  If you were debugging the program, the debugging session is ended.
	Esc Ctrl-Break	Pause the currently executing BASIC program and activate the debugger on the current line of execution.
	Ctrl-F5	Execute in Animate mode
	F9	Toggle a Breakpoint on the current line.
	Ctrl-F8	Step out of current procedure in the debugger
	F8	Step into current line in the debugger or begin debugging current file at main procedure.
	F10	Step over current line in the debugger.  If the current line is a call to a BASIC subroutine or function, the debugger stops at the next line in the current procedure.
	F6	Check the syntax of the current BASIC program.
	Ctrl-N	Scroll edit window to next error returned from a syntax check.
	Ctrl-P	Scroll edit window to previous error returned from a syntax check.
	F7	Set a temporary breakpoint on the current line.  Execution continues until a breakpoint is encountered or the program finishes.  When either of these occurs, the temporary breakpoint is cleared.
	Ctrl-F	Find text in editor
	F3	Find next occurrence of last text searched for
	Shift-F3	Find previous occurrence
	Alt-F3	Find and Replace text
	F1	Display help.
Also see the discussion on the Right Mouse Button and the Variable Window  for other Editor/Debugger controls.


Right Mouse Button
The Right Mouse Button

The right mouse button is used in the editor to obtain help on BASIC language keywords.  Clicking on a BASIC language keyword (such as sub) will display the online help associated with that keyword.

While debugging, the right mouse button can be used to examine and modify the contents of variables in the running progrm.  Clicking on a variable with the right mouse button will create a pop-up menu near the mouse's position:

This popup menu describes an integer variable in the procedure main, whose value is zero.  Clicking on the Change Value... presents a dialog box that allows you to change cy's value.

Using the right mouse button in the edit window allows you to modify the value of variables of string, integer, single and double.  In the variable window, you can modify the value of any expanded field that is of type string, integer, single or double.  Application Datatype fields cannot be modified.


Console Window

The console window is used to display the output of the BASIC print statement.  It is a scrollable text display that appears at the bottom of the editor debugger window and remembers 100 lines of printed output.


Animate Mode

Animate mode causes the debugger to do repeated step into's.  It is useful for visually examining the flow of a BASIC program.


Step Into

Step into is used to execute one line of code in the debugger.  If the current line is a call to a BASIC subroutine or function, the debugger stops at the first line of that function.  Otherwise, the debugger stops at the next line of the current procedure.


Call Frame

A call frame is an entry on the Call Stack.  Changing the current call frame using the call stack control causes the debugger window to view and highlight the line of code associated with the call frame and causes the variable window to display the variables associated with the call frame.