C++ Code

LayoutEditor supports macros in a C / C++ style. The C/C++ style is very similar to standard C / C++, but not all syntax is supported. These syntax will work in LayoutEditor macros:


bool boolean datatype, can be true or false

int signed integer, 32bit range (-2147483648 to 2147483647)

long or int64 will create a integer with 64bit range

double double precision float, +/- 1.7e +/- 308 (~15 digits)

float identical with double

string as an object, please see class string

int i=0;
double d=0.45;
double f=1E10;
bool b=false;

arrays The datatypes int, double and string can be used as array. The resulting variables are identical to the classes stringList, intList and doubleList.

string sl[4];

sl[0]="string at pos 0";
sl[2]="a further stringstring";
sl[3]="another string";

sl.append("one more string");

// sl will be a stringList with the size 1

Control Structures

for (start condition;stop condition;step command){commands; beak; continue;}

while (condition) {commands; break; continue;}

do {commands; break; continue; } while (condition)

if (condition) {commands} else {commands} // else is optional

return parameter // leaving the subfunction

switch (parameter) { case parameter: command break; default: command }

break and continue are supported. A break will end the loop. A continue will directly start the next loop iteration.

int i,k;

for (i=0;i<10;i++){ k=k+5;}

while (k>10) {k=k/2;}

do { k++; } while (k<20);

if (i+k==23) k=k*5;

switch (i) {
case 0: i=4;
default: i=0;

Objective Commands

pointers are supported as in C++, however a new and delete will not work. Please use the class methods to generate new pointer objects. New classes cannot be defined. Just the shipped classes can be used. Conventional function definition can be used in macros as long it is defined before the main function.

int sqr( int i){
return i*i;

int main(){
int k=sqr(5);
point p(4,5);


Compiler Commands

Two ways to insert comments:

// one line comment

/* multi line
comment */

to include another file to the macro use:

#include "filename"

Including standard C/C++ header files will not link its standard C/C++ library. To use standard C/C++ extensions, please use its associated classes like math.


debug(varName1,varName2,...); will write the variable information to the debug output,

debug.clear(); will clear the debug output,

debug.show(); will open a text editor with the debug output,

debug.saveTo("filename"); will save the debug output to filename,

debug.console(true); will also output debug information to the console, works on Linux and Mac OS X only,

Debugging is global and debug output will remain in the memory after macro termination. So it can be display with a further macro until the LayoutEditor is terminated or the debug output is cleared.

Starting with release 20190807 also a cout("mytext"); can be used to generate a console output.