Editing and Debugging Mumps with VistA and the Eclipse IDE

Download Report

Transcript Editing and Debugging Mumps with VistA and the Eclipse IDE

Editing and Debugging Mumps
with VistA and the Eclipse IDE
Joel L. Ivey, Ph.D.
Dept. of Veteran Affairs
OI&T, Veterans Health IT
Infrastructure & Security Service
Objectives
• What is Eclipse?
• Do I need to know any Java? (NO!)
• A functional MUMPS (or M) editor with
syntax coloring.
• Setting it up
• Options & Features
• Examples of its use
6/15/2007
15th VistA Community Meeting
2
What Is Eclipse?
• Eclipse is an Integrated Development
Environment (IDE).
• It is written in Java, and was originally a
Java development environment.
• It uses a plug-in architecture to provide for
extension of the capabilities.
• It is now used as an editor and
development environment for many
languages.
6/15/2007
15th VistA Community Meeting
3
Do I have to know any Java?
NO!!
6/15/2007
15th VistA Community Meeting
4
How do I get and Install Eclipse?
• Eclipse was originally developed by IBM, but
was converted to an open source project.
• The most recent version can be downloaded as
a zip file from http://www.eclipse.org.
• Simply unziping the file (with ‘use folder names’
checked) into a desired directory such as C:\ or
C:\Prog results in Eclipse being put into
C:\Eclipse or C:\Prog\Eclipse.
• Start Eclipse by double clicking on the
Eclipse.exe program in the Eclipse directory.
6/15/2007
15th VistA Community Meeting
5
The Eclipse Editor on first use
6/15/2007
15th VistA Community Meeting
6
The Basic Eclipse Editor (after clicking on the ‘Go
To Workbench’ arrow)
6/15/2007
15th VistA Community Meeting
7
Unzipping the VistALink Plug-in
6/15/2007
15th VistA Community Meeting
8
The M icon and VistA menu added
by the M-Editor Plug-in
6/15/2007
15th VistA Community Meeting
9
The VistA menu Items
6/15/2007
15th VistA Community Meeting
10
Setting VistA Preferences -1
6/15/2007
15th VistA Community Meeting
11
Setting Preferences for the
VistALink Connection
6/15/2007
15th VistA Community Meeting
12
Setting Preferences for the
M-Editor functionality
6/15/2007
15th VistA Community Meeting
13
After Clicking OK for the Preferences and
then Clicking on the Green ‘M’ icon
6/15/2007
15th VistA Community Meeting
14
After Selecting the Routine, You
have to sign on to the server
6/15/2007
15th VistA Community Meeting
15
And the routine is loaded
6/15/2007
15th VistA Community Meeting
16
The center section is the editing area, and multiple
routines may be open at one time (tabs)
6/15/2007
15th VistA Community Meeting
17
The Left Panel contains projects – only files which
are in a project may be edited – the default is
mcode. An ‘m’ extension is used for the files.
6/15/2007
15th VistA Community Meeting
18
The right panel contains an outline of routine tags.
Selecting one of these will jump to that location in
the routine.
6/15/2007
15th VistA Community Meeting
19
Adding a new section of code. The
error is intentional.
6/15/2007
15th VistA Community Meeting
20
The left gutter is marked where lines have been
added or changed. The tab is also marked to
indicate a modified routine.
6/15/2007
15th VistA Community Meeting
21
The outline also shows the added
tag.
6/15/2007
15th VistA Community Meeting
22
On saving the routine (cntrl-S or the icon), it
indicates an error encountered.
6/15/2007
15th VistA Community Meeting
23
The problems are identified in the M-Editor Console
at the bottom. It points out the error, and several
variables which are at risk (neither arguments or
newed).
6/15/2007
15th VistA Community Meeting
24
On saving a routine
• The routine is written to the project (mcode by
default).
• The server is checked to insure that the routine
on the server hasn’t changed since it was
loaded into Eclipse.
• If the server version hasn’t changed (or you
approve the write over), the routine is saved on
the server.
• The part of XINDEX checking for errors is run
with the routine. Any warnings or errors cause a
dialog box to pop-up to insure that the user is
aware of the problems.
6/15/2007
15th VistA Community Meeting
25
On Saving A Routine - 2
• The routine is checked for variables which are
not arguments and which have not been newed.
In most cases, you probably want to protect
them.
• Variables which are expected to be visible
outside the routine can be identified with a
special comment
e.g. ; ZEXCEPT: IO,DUZ KERNEL VARIABLES
• If an M-Unit test has been identified for the
routine, the unit test is run and the roll & scroll
results are shown (periods for passed tests,
Texts for failures or errors).
6/15/2007
15th VistA Community Meeting
26
On Saving A Routine - 3
• The default action on saving is to enter or
update the routine in the ROUTINE file,
and to update the date and time for the
routine on the first line.
6/15/2007
15th VistA Community Meeting
27
So, I fixed the error and NEWed the
variables.
6/15/2007
15th VistA Community Meeting
28
On Saving again
• A dialog box appeared indicating no
problems identified.
6/15/2007
15th VistA Community Meeting
29
Some Benefits of the Project
Entries
• The mcode project in the left panel now contains
the most recent version of the routine that was
edited.
• Right Click on the routine, and a number of
options are available.
– Properties – An M-Editor section allows an M-Unit
routine to be specified.
– Compare With local history allows the current routine
to be compared with prior versions (the length of time
the routines are saved is determined by a preference
(General – Workspace – Local History))
– Replace With allows the current routine to be
replaced with an earlier version.
6/15/2007
15th VistA Community Meeting
30
M-EditorProperties for XTMDUTIL
6/15/2007
15th VistA Community Meeting
31
Compare with Local History lets you walk through
the changes. You can then use the Replace With
to restore a prior version.
6/15/2007
15th VistA Community Meeting
32
If a routine is specified for loading that doesn’t
exist on the server, it provides a place to generate
the comments for the first two lines (and specify an
M-Unit routine for the new routine)
6/15/2007
15th VistA Community Meeting
33
And then opens the new routine in
the editor for further editing
6/15/2007
15th VistA Community Meeting
34
There are other functions on the
VistA menu available as well
• A listing of routines with names beginning
with specified characters
• A listing of globals with names beginning
with specified characters
• A listing of global values (both a simple
listing and a listing which can be copied
and pasted into another account).
• These are all non-editable, but can be
copied for editing elsewhere.
6/15/2007
15th VistA Community Meeting
35
A request for a Routine Directory
listing
6/15/2007
15th VistA Community Meeting
36
Generates the listing below
6/15/2007
15th VistA Community Meeting
37
A request for a global directory
listing
6/15/2007
15th VistA Community Meeting
38
And a list of global names
beginning with X
6/15/2007
15th VistA Community Meeting
39
A request for a global listing – note
the “Setup for copying” check box
6/15/2007
15th VistA Community Meeting
40
A normal global listing
6/15/2007
15th VistA Community Meeting
41
And a global listing setup for
copying
6/15/2007
15th VistA Community Meeting
42
Work in progress – In addition to the Red M on
Green, there is a bug on an M
6/15/2007
15th VistA Community Meeting
43
Selecting the Option or the M-bug icon displays a
dialog box for the code to be processed
6/15/2007
15th VistA Community Meeting
44
An OK on the dialog box causes the Eclipse to
change to a debugging perspective for M
6/15/2007
15th VistA Community Meeting
45
The upper left section displays the stack, the
current line of code, the last command executed
and the next to be executed, it also contains the
icons for controlling progress.
6/15/2007
15th VistA Community Meeting
46
The upper right area has panels for breakpoints in
the code, variable values, setting watch variables,
and their display, and initialization values
6/15/2007
15th VistA Community Meeting
47
The middle and bottom portions contain the code
being processed and the console for text display
and input
6/15/2007
15th VistA Community Meeting
48
Debugging
• Initially, the debugger displays only the line
to be processed.
• The debugger can be set to step over
commands or to run (in the latter case,
stops will be made when watch variables
change or when a line of code specified as
a breakpoint is reached).
6/15/2007
15th VistA Community Meeting
49
The code that will be processed
6/15/2007
15th VistA Community Meeting
50
Setting two breakpoints
6/15/2007
15th VistA Community Meeting
51
Setting two watch variables (Y and
VAL1)
6/15/2007
15th VistA Community Meeting
52
After a couple of steps
6/15/2007
15th VistA Community Meeting
53
The mass of variables can be
selected with filters (at the bottom)
6/15/2007
15th VistA Community Meeting
54
After running, it stopped because of the watch
variable Y, the current line of code is the third from
the top of the code shown. Also, text was written
to the console.
6/15/2007
15th VistA Community Meeting
55
This stopped due to one of the
breakpoints
6/15/2007
15th VistA Community Meeting
56
This stopped due to the watch value VAL1 going
from undefined to 3
6/15/2007
15th VistA Community Meeting
57
The watch value VAL1 bounces between
undefined and defined, note the level of the stack
as it calculates a factorial
6/15/2007
15th VistA Community Meeting
58
Stopped due to the other breakpoint just before it
leaves with the factorial value
6/15/2007
15th VistA Community Meeting
59
And processing was finished
6/15/2007
15th VistA Community Meeting
60
Summary
• The Eclipse IDE can be used to edit (and
shortly) debug MUMPS code.
• And you don’t have to know any Java to
do it.
6/15/2007
15th VistA Community Meeting
61
Questions? And maybe some
answers
6/15/2007
15th VistA Community Meeting
62