next up previous
Next: Annotation Filling Up: EMME/2 NEWS 16 June 1994 Previous: Computing Matrix Convolutions

 

Enhanced Macro Programming Language

Release 7 introduces two major new developments regarding the macro programming language. The first one will allow the implementation of macros in a more structured and hierarchical manner, and the second provides means for developing and testing macros more efficiently.

While in previous releases only one level of macro calls was supported, Release 7 allows arbitrary macro nesting. This implies that macros at any level can invoke other macros as subprocedures, using the standard command for invoking macros ``~<macro ...''. Command line parameters can be passed as usual to the called macro. Since the text and numerical registers are implemented in such a way that each macro has its own private set of register values, each macro can use all registers without having to worry about possible conflicts with macros at higher or lower levels. The initial values of the registers correspond to the current register values of the invoking macro. Thus, it is possible to pass information from the calling macro to the called macro via the registers. The text register t9 is special, since its value is global to all levels. This makes it possible to use t9 to pass return values back to the calling macro. With this new possibility of nested macros, writing macros for implementing complex procedures becomes much easier, as all functional blocks can be coded and tested as separate macros. These can then be used individually or be invoked to perform sub-tasks in other procedures. Also it becomes possible to integrate macros written by someone into one's own procedures as ``black boxes'', without having to understand all the details of the implementation, nor any need for editing them.

Everyone personally involved in writing macros knows that between having the idea for a macro and actually getting it to run correctly, there is often a long and painful period of macro debugging. The new single step trace debugging mode should help substantially in making this phase of macro developing shorter and less painful. Up to now, no help for macro debugging was provided other than switch 15, which makes all macro commands visible on the screen. This meant that debugging a macro consisted of a long series of trial runs, each run starting from scratch and ending as soon as the first problem was encountered. With Release 7 it is now possible, by setting bit 4 of the o-register, to activate the macro debugging mode. In this mode, each time a macro line is displayed on the screen, the system waits for a user response before proceeding. The simplest response, a carriage return, causes the system to proceed and execute the displayed macro line. But other debugging commands can be used instead, such as commands to

When the so-called fallback-to-debug mode is activated (using bit 5 of the o-register) the macro executes normally as long as no error or user interrupt is detected. But instead of terminating the macro processing completely upon detection of an error or interrupt, which is what happens in standard mode, the macro processing is switched to single step debugging mode. This way, the problem can be analyzed by using the various debugging commands and, in many cases, the macro run can even be continued after having taken the necessary corrective measures.


next up previous
Next: Annotation Filling Up: EMME/2 NEWS 16 June 1994 Previous: Computing Matrix Convolutions


Heinz Spiess, EMME/2 Support Center, Thu Jun 6 14:58:10 MET DST 1996