Macros are composed of individual statements. Compound statements consisting of two or more statements are enclosed with curly braces { }.  

A statement can be one of the following:

You can stop execution using the stop statement.

If you run a Source Insight command with a dialog box from a macro, the dialog box appears.

Function and variable names are not case sensitive.

Statement syntax is generally the same as in C or Java, except that semi-colons are not required, and are ignored.

Statement Examples

Here are a few example statements:

hbuf = OpenBuf("file.c")    // call internal function OpenBuf

SaveBufAs(hbuf, "filenew.c")  // call internal function SaveBufAs

Select_All    // call user-level command "Select All"

Copy             // call user-level command "Copy"

Line_Up       // call user-level command "Line Up"

x = add2(n)   // call user-defined macro function add2.

Statement Elements

The following table summarizes the macro language statements.

Table 5.1: Macro Statements




Exits a while loop.

if (cond)… else

Tests a condition.


Continues a while loop at the top.


Declares a global variable.

return n <or>


Returns n from a function. If a semi-colon follows return, then the nil string is returned.


Stops executing the macro.

strictvars true/false

Turns on or off strict variable decla­rations mode.


Declares a function-local variable.

while (cond)

Loops while cond is true.