Compiling Macros (testing the syntax)

Navigation:  Macros > Testing Macros >

Compiling Macros (testing the syntax)

Previous pageReturn to chapter overviewNext page

When a Macro is used during diary generation, the Macro used by Q++Studio is not the source code as you type it into the code editor. Q++Studio uses a compiled, or assembled, version of your code. If you try to use an un-compiled Macro in a Script, you will get the design-time message.


Macro code is compiled for 2 reasons.


Compilation verifies that the code you have written obeys the syntax of Macros. The time to be verifying this is when your nose is in the code editor, not when you are trying to generate a diary.


Most importantly, compiled code is faster. It is faster because it replaces all the nested function calls, the loops and structures used in your code by a few simplistic commands that require no interpretation : move a value into a variable (MOV), call a function (CALL), and jump to another line of compiled code (GOxx). This code is hard to follow for humans, but computers love to churn out lots of small simple tasks one after the other.


Q++Studio will attempt to compile your code :


When you request it explicitely by pressing CTRL and F9.


When you save a macro, including when you close it.


Whenever you try to test a Macro using the F7, F8 and F9 keys.


If compilation is not successful, you will get compiler messages at the bottom of the Q++Studio Macros Editor. These messages begin with the line number that caused them, and the word or symbol that triggered the message is usually in double quotes. An example would be :


Line 4 "nCttr" : undeclared FOR counter variable


Click on any of the messages to highlight in red the line that generated the message. Press F1 to get help on the particular message currently selected. The section Compiler Messages, lists and explains all the compiler messages.


See also :

Compiled Code

Comparing Macro Code and Compiled Code

Topic 108232 updated on 03-May-2018.
Topic URL: