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.

Using SHELF

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

What is delf/elf and how do I run it?top of page

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) :

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.

How to write a simple Elf program top of page

  1. Start the [d]elf program with the -tools option.

    % delf -tools

  2. Select the Text Editor (the third icon from the left; a piece of paper with the lower right corner folded up).
  3. 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

  4. Choose File-->Compile.
  5. Select the Elf Tools Main Menu, and press the F8 key (or select Tools-->Run Macro).
  6. When prompted for a macro name, enter Hello_World and press <enter>.
  7. The program should exectue and display a dialog box with the string "Hello World" inside.
  8. 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.

How to debug a simple Elf program top of page

  1. Click on the debugger icon (the fourth icon from the left; the bug with the circle and bar)
  2. 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.
  3. Position the cursor on the line beginning "my_string."
  4. 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.

  5. Choose *->Run Macro... and enter "Hello_World."
  6. A green arrow will appear, indicating that your program is currently at the line "my_string..."
  7. Click twice on my_string in that line. In the output window, you will see MY_STRING=null.
  8. Press <ctrl>-n or click on the "single arrow" expressline icon to go to the next statement. The green arrow will advance one line.
  9. Click twice on my_string, you will see MY_STRING="Hello World"
  10. Press <ctrl>-c or click on the "double arrow" expressline icon to continue execution of your program.

How to write a simple Builder program top of page

  1. To write your first Builder program, start the [d]elf program with the -builder option.

    % delf -builder

  2. Click on the Designer Button in the left hand toolbar
  3. In the Designer dialog box, click Create, and then click Edit.
  4. A small dialog box will appear, containing only a Dismiss button.
  5. In the dialog box, choose Controls-->Label, and click on the dialog box where you want the label.
  6. Choose Controls-->Push Button, and click on the dialog box where you want the button.
  7. In the Dialog Editor, choose File-->Exit and when prompted, choose Save.
  8. In the Designer dialog box, click Dismiss.
  9. 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.
  10. A left mouse click on Label will select it. A right mouse click on Label will bring up Edit Methods...
  11. 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

  12. 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).
  13. A left mouse click on Button will select it. A right mouse click on Button will bring up Edit Methods...
  14. 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

  15. Type <ctrl>-e to exit, and choose save when prompted.
  16. Choose the Run Button in the left hand toolbar in the main Builder window.
  17. Your dialog box should appear with text label "Starting Label." Click the button marked Button. The label's text should change to "Hello World."
  18. 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"?

How to debug a simple Builder Program top of page

  1. With the program loaded into Builder, click on the Debugger Button. A debugger window will pop up.
  2. 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.
  3. Click on the line this.value@... and press <ctrl>-b.
  4. Press <ctrl>-r. Your program will begin running.
  5. Click the button in the dialog box. The debugger will stop at the breakpoint line. This is indicated with a green arrow.
  6. Double-click on "str" to see its value ("Hello world".)
  7. Press <ctrl>-n to go to the next statement (the endset line.)
  8. Press <ctrl>-c to continue the program.

For more information top of page

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:


To find out how to extend the basic functionality of SHELF, refer to our Extending SHELF document.