Date:
June 11, 1999
NOTE: In the following document, the string
"shelf_x.y" represents the actual pathname of the directory into
which you installed SHELF. For example, if you install shelf in /opt/shelf_1.3,
then "shelf_x.y/src" represents /opt/shelf_1.3/src
on your machine.
What is delf/elf and how do I run it?
How to write a simple Elf program
How to debug a simple Elf program
How to write a simple Builder program
How to debug a simple Builder Program
For more information
delf and elf
represent the ELF interpreter that executes ELF and Builder programs. The delf
program is a debug version of the elf
program that can be debugged by a standard debugger such as gdb.
If you are only developing ELF and Builder applications without modifying the
underlying SHELF functionality, you don't need to run or compile the debug version.
The following command line options are availalbe with elf/delf
(hereafter collectively referred to as [d]elf)
:
- [d]elf -builder
- [d]elf -tools
- [d]elf <name.??>
where name can be :
- name.ab - a Builder program file
- name.abo - a compiled Builder
program file
- name.am - an ELF macro ASCII
file (the main function should match the file name; e.g. foo.am
should contain ELF macro foo)
- name.elo - a compiled ELF
macro file
- name.ax - an ELF program file,
built by the elf_program_assemble@ macro
The -builder switch starts the
Builder development toolset. This toolset includes the object-oriented Builder
debugger, GUI builder, and dataset mapping tools.
The -tools switch starts the
non-object-oriented toolset. This include the dialog box editor, the database
browser, a simple text editor, and the debugger.
- Start the [d]elf program with
the -tools option.
% delf -tools
- Select the Text Editor (the third icon from the left; a piece of paper
with the lower right corner folded up).
- Enter the following "hello world" Macro:
MACRO Hello_World
var my_string /* A variable to hold the Hello World - Not necessary, shows how to define vars */
my_string="Hello World" /* The string to be printed in a dialog box */
info_message@(my_string) /* Creates a dialog box with hello world in it */
endmacro
- Choose File-->Compile.
- Select the Elf Tools Main Menu, and press the F8
key (or select Tools-->Run Macro).
- When prompted for a macro name, enter Hello_World
and press <enter>.
- The program should exectue and display a dialog box with the string
"Hello World" inside.
- To save your program in the Text Editor, select File-->Save
As; save your file as Hello_World.am
in the delta directory or your
home directory.
- Click on the debugger icon (the fourth icon from the left; the bug with
the circle and bar)
- Choose File->Open and
navigate to the directory where you saved your macro. Select Hello_World.am
and press the Open button. Your program source will be loaded in the middle window.
- Position the cursor on the line beginning "my_string."
- Press <ctrl>-b or click on the "upraised palm" expressline
icon to insert a breakpoint at that line.
Note: if you receive the error message "Can't set break point,"
the macro probably has not been compiled in the current session. In the
Debugger, click on *-->Install Macro File
(or File-->Install Macro File
in the Elf Tools Main Menu) and select Hello_World.am.
- Choose *->Run Macro... and
enter "Hello_World."
- A green arrow will appear, indicating that your program is currently at
the line "my_string..."
- Click twice on my_string in
that line. In the output window, you will see MY_STRING=null.
- Press <ctrl>-n or click on the "single arrow"
expressline icon to go to the next statement. The green arrow will advance one line.
- Click twice on my_string, you
will see MY_STRING="Hello World"
- Press <ctrl>-c or click on the "double arrow" expressline
icon to continue execution of your program.
- To write your first Builder program, start the [d]elf
program with the -builder option.
% delf -builder
- Click on the Designer Button in the left hand toolbar
- In the Designer dialog box, click Create, and then click Edit.
- A small dialog box will appear, containing only a Dismiss button.
- In the dialog box, choose Controls-->Label,
and click on the dialog box where you want the label.
- Choose Controls-->Push Button,
and click on the dialog box where you want the button.
- In the Dialog Editor, choose File-->Exit
and when prompted, choose Save.
- In the Designer dialog box, click Dismiss.
- If you choose View-->Expand All in
the main Builder window, you will see the widgets that compose dialog box you
created: the Dismiss button and the label.
- A left mouse click on Label will select it. A right mouse click on Label
will bring up Edit Methods...
- Enter the following program (after the @@@
OBJECTS line), which will allow you to change the label's text:
''Function to initialize the Label
set initialize_event
this.value@("Starting Label") '' Initialize the label
endset
''Function to change the Label
set change( str)
this.value@(str) '' Set the label to the passed string
endset
- Type <ctrl>-e to exit, and choose save when prompted. (NOTE:
Currently, there is a bug -- information is not saved when closing the editor
application along with the window manager. To save your work, you MUST use the
exit menu item or <ctrl>-e).
- A left mouse click on Button will select it. A right mouse click on Button
will bring up Edit Methods...
- Enter the following program (after the @@@
OBJECTS line), which will cause the button to change the label's text:
''Program to change the Label
set clicked_event
var object label
label = this.sibling@("Label") ' Find the label widget via its name
label.change( "Hello world") ' Trigger the label's change macro
endset
- Type <ctrl>-e to exit, and choose save when prompted.
- Choose the Run Button in the left hand toolbar in the main Builder window.
- Your dialog box should appear with text label "Starting Label."
Click the button marked Button. The label's text should change to "Hello World."
- Choose File-->Save to save
the Builder application to disk.
Challange: Can you add another button to the dialog box that will change
the text label to "Goodbye"?
- With the program loaded into Builder, click on the Debugger Button. A
debugger window will pop up.
- In the top left window, click on Label. A right mouse click on Label will
bring up Load Methods. The code
for the label object should display.
- Click on the line this.value@...
and press <ctrl>-b.
- Press <ctrl>-r. Your program will begin running.
- Click the button in the dialog box. The debugger will stop at the
breakpoint line. This is indicated with a green arrow.
- Double-click on "str" to see its value ("Hello world".)
- Press <ctrl>-n to go to the next statement (the endset line.)
- Press <ctrl>-c to continue the program.
The Applixware product (available at linux.applixware.com)
contains all the ELF and Builder editing and debugging tools, as well as
online help and tutorials.
The following books are also available for purchase through linux.applixware.com:
- ELF User's Guide: An introduction to the ELF language
- ELF Base Macros: The generic ELF macros available to the programmer
- ELF Communications Guide: An in-depth guide to using the ELF
communications facilities
- Builder User's Guide: An introduction to the Builder (object ELF)
language and facilities
- Builder Programmer's Reference: the Builder classes available to
the programmer, with examples.
To find out how to extend the basic functionality of SHELF, refer to our Extending
SHELF document.