Using Lexi and MyEditBR Tutorial

From Br Wiki
Jump to: navigation, search

MyEditBR

The first BR tutorial introduced you to the idea of an external editor. By now that should be your primary choice when it comes to editing your programs. Here we will discuss debugging capabilities of BR. The complete guide is available online at [1].

MyEditBR can be used to debug programs in several ways. To turn on the Debugger Engine, push the icon on the toolbar (resembles a No Ladybugs sign). And begin a session. Three helpful ways to debug are variable evaluation, conditional breakpoints, and STATUS Information tool window.

A. Variables can be evaluated in two different ways, unique to MyEditBR:

First, you can set a WATCH. This shows you the value of a variable as BR at each step as the Debugger processes your program. When used with breakpoints, you can trace the value of a variable at each point.

Second, in the evaluate expression window, you can check the value of and change the value of that variable in order to check different features of your program. Simply open it to see and change each value.

B. Conditional breakpoints are built on BR's standard capability to insert break points within the code. When BR breaks, you can then check variable's values and take other debugging steps. However, these breakpoints only pause the program if certain conditions are met. You can set the logic of these conditions to cause a break when you wish. Breakpoints are visible in the window in the bottom right of your screen.

C. The status information tool window can be opened to check the status of the following items: files, drives, stacks, substitutions, config, environment, and attributes.

Lexi

The first tutorial mentions how Lexi, combined with an external editor (MyEditBR is recommended, but Lexi can work with other text editors as well), can make programming and editing much simpler by removing line numbers during the editing process and adding them to your program only as you compile it into a .BR file and run it in BR. Without line numbers present, Lexi allows you to copy and paste code, rearrange code, and add and edit code without having to worry about or manually change any line numbers.

But Lexi also does a lot more. By preprocessing your code before it is passed on to BR, Lexi gives you access to many useful language features not normally found in Business Rules!. Lexi gives you access to additional programming statements common in other languages, like SELECT CASE and #DEFINE. These commands will make your code more readable and easier to maintain. Lexi Installation

Installation

Installation is simple and will only take a few minutes. Lexi works best with the latest version of MyEdit.
1. ) Download LEXI from http://www.sageax.com/downloads/Lexi.zip. Lexi is free.
2. ) Unzip Lexi.zip into "C:\Lexi". You must use this directory in order for the automatic installation to work.
3. ) Copy your own brserial.dat file into this directory (C:\Lexi).
4. ) Launch MyEdit.
5. ) Select Configure User Tools from the Tools menu. Then click the Import Tools button. Select the "Lexi.mut" file that came in Lexi.zip.
Thats all there is to it!

To edit your program in MyEditBR, first you will need to save your BR program, then save it as .BRS or source code for MyEdit to be able to open and work with like this:

LIST >program-name.brs

A few more tips:

Always save your changes before compiling or running your program in BR. If not saved, it will use the version it had at the time of the last save when it compiles and reloads, thereby losing all your changes.

If your program had line references which were just line numbers and not labels, in order to preserve the integrity of your program, Lexi will change them into labels made from the letter L and the line number. For example.

00340     Print #255, using 330: “This is great!”
00330     form: pos 5, C 25, skip 2

becomes

Print #255, using L330: “This is great!”
L330     form: pos 5, C 25, skip 2

You'll notice that when Lexi adds the line numbers back in, they count by one. If you would like your lines to go by 10's or any other increments, the autonumber command can do that.

In your editor, simply add the syntax ! #autonumber# starting-point, increment For example:

! #autonumber# 10,10 

To use Lexi in MyEditBR, under Tools, select Add or Strip line numbers, Compile BR program, or Run BR program (which will both compile and run your program).

If when you run your program in BR, it stops and states “PROC NO ECHO”, it means it encountered an error during its processing. Press F2 to see the last line it processed to begin to debug the problem.

Back: Table of Contents