Meta commands are parsed by the preprocessor.
With the #include command you can import an existing file like a library.
"lib/modules/screen.whl" proc main() drawNumber(10, 5, 90) end
With the #define command you can create constants, the constants are replaced with the defined value by the preprocessor.
"lib/modules/screen.whl" MY_NUMBER 55 proc main() ; Draw the number 55: drawNumber(10, 5, MY_NUMBER) end
The #ifdef meta command allows you to conditionally compile a block of code.
The #ifdef command checks if a value is defined, if the value is defined then the code between the #ifdef and the #end line is compiled.
This command only checks if a value is defined, the actual value is irrelevant.
The following example shows how to log a number if a value is defined:
"lib/modules/screen.whl" LOG_NUMBER "The number should be added to the console log..." proc main() number n LOG_NUMBER printN(n) end
With the #else command you can compile code if the #ifdef condition fails:
"lib/modules/screen.whl" proc main() number n LOG_NUMBER printN(n) clearConsole() end
It's also posible to define constants in the IDE from the Defines option in the Compiler menu. Values configured here can be used in different programs and are stored in the settings.
With the #project command you can set the name of the program. The name should be given as string value.
"This is my project" proc main() end
The #optimizer command turns the optimizer on or off, valid values are "on" or "off" strings. The optimizer is turned on by default.
"off" ; Turn the optimizer off... proc main() end
The #datatype meta command tells the VM what kind of heap memory to allocate. There are three possible values:
"int" proc main() end
With the #heap command the amount of allocated memory for the virtual machine can be set. The default setting is 1024 memory entries (floats). The heap value should be given as a positive number. In the following example the amount of heap is increased to 4096 memory entries, this equals 16 kBytes.
4096 ; Set the heap size to 4096 floats... proc main() end
The #stringcount command sets the maximum number of strings which can be allocated. The default setting is 64.
64 ; Set the number of strings to 64... proc main() end
The #stringlength command sets the maximum string length which can be allocated. This value should be larger than 0 and less than 128. The default setting is 64.
64 ; Set the maximum string lenght to 64... proc main() end
The #rangecheck command turns the runtime range checking on or off, valid values are "on" or "off" strings. The range checking is turned on by default. Turning range checking off improves the performance of you application, this can be helpfull when deploying your application on the EV3.
"off" ; Turn range checking off... proc main() end
The #image command can be used to create images, with the #image command the filename can be declared. The filename should have an .rgf extension. The #image command should be followed by one or more #data commands, these contain the image data. Each #data command expects a string parameter with the same length as the first data command. The data string may only contain "0" or "1" characters.
"myImage.rgf" "0100010" "1001001" "0100010" proc main() end
The #text command can be used to create text files, with the #text command the filename can be declared. The filename should have an .rtf extension. The #text command should be followed by one or more #line commands, these contain the text lines. Each #line command expects a string parameter.
"myText.rtf" "The quick brown fox..." "jumped over the lazy dogs back." proc main() end
The #break command sets a breakpoint on a line, difference between this command and a breakpoint in the gutter is that the breakpoint set with the #break command is saved in the file.
number n proc main() n = 11 ; Set a breakpoint... end
With the #resource command you can declare a resource which will be downloaded to the EV3 when you
install your compiled program. There are four valid resource file extensions: .rtf, .rgf, .rsf, .rbf, .wfrm.
The resource file should exist within the Wheel path.
"resources/images/expressions/Smile.rgf" proc main() end
The #display command allows you to show the sensors and/or motors in the simulator,
it expects one parameter: a comma separated list of plugin names to be shown.
The command is executed when the source file is loaded in the IDE and when the program is compiled,
when the following file is loaded then the simulator EV3 and EV3 Sensors plugins will be shown:
"EV3,EV3 Sensors" proc main() end
To display the console the "Console" parameter can be used:
"Console" proc main() end
The #noformatter prevents code after that meta command from being formatted.
This command enables code formatting again and should only be used after the #noformat meta command.
Set a device alias. This command expects two string parameters, a uuid string and the alias for the uuid.
"5107039b87e0459898e438d27b9e2c40" "My Powered Up device" proc main() end