Running Inline Macro Statements

The Run Macro command starts executing macro statements starting at the line the cursor is on. This allows you to run open coded macro statements in any type of file. This is very useful for testing and debugging macro code.  

Running inline macro statements is also useful for running short utility macro scripts stored inside of a pro­gram comment. Remember to use the stop statement at the end, or the macro interpreter will attempt to run past the end of the comment.

For example, this inline macro inside a C file comment searches for references to the identifier ucmMax and causes recompilation of all the files that refer to it. To use it, the user places the cursor on the first line of the macro and invokes the Run Macro command.

#define ucmMax            120

 

/* Macro: touch all ucmMax references:

 

// to run, place cursor on next line and invoke "Run Macro"

hbuf = NewBuf("TouchRefs") // create output buffer

if (hbuf == 0)

   stop

SearchForRefs(hbuf, "ucmMax", TRUE)

SetCurrentBuf(hbuf)       // put search results in a window

SetBufDirty(hbuf, FALSE); // don't bother asking to save

Stop  

*/