8.   LAMP Macros


Command Files | Command Files with loops | Compileable Macros (*.pro files) | IDL Basics | Passing of Common Variables | An Example Macro: demo.pro | How LAMP deals with macros | Statistics errors handling | Simple IDL programming


Command Files

Command files are simply a list of functions or commands written into a file as they would be typed in the formula-entry area. The file can then be called up in the formula-entry and Do input text area and the functions it contains will be executed, line by line.

Files can be written in a window which is opened by pressing User Macros? button and selecting the Create a new: Batch option, the filename should be given a *.prox form, select Write new file to save it in your directory.

This would be executed by entering @demo in the formula-entry or Do input text area.


Command Files with Loops using the XBU interpreter

You have access to the XBU interpreter from item "Lamp/Layout" in the menu-bar of Lamp.
You will be able to execute a command file in which you can insert statements like While , for , if. This tool is very usefull for writing simple codes without programming and compiling. You also write some conditionnal codes in the runtime version of Lamp (see the Help in the XBU interface).


Compileable Macros (*.pro files)

More elaborate IDL functions and commands (such as t2e used to convert time-of-flight channels into energy units) can be written, compiled and saved as macros using LAMP. They can then be executed in the formula-entry area.

A macro procedure can be written by pressing the User Macros? button and selecting the Create a new: Macro option, the filename should be given a *.pro form. After writing the file pressing Write new file will compile and save it, any compile errors will appear in the shell window from which LAMP was started.