A User Language Program is a plain text file which is written in a C-like syntax. User Language Programs use the extension .ulp. You can create a ULP file with any text editor (provided it does not insert any additional control characters into the file) or you can use the builtin text editor. A User Language Program consists of two major items, definitions and statements.
Definitions are used to define constants, variables and functions to be used by statements.
A simple ULP could look like this:
#usage "Add the characters in the word 'Hello'\n"
"Usage: RUN sample.ulp"
// Definitions:
string hello = "Hello";
int count(string s)
{
int c = 0;
for (int i = 0; s[i]; ++i)
c += s[i];
return c;
}
// Statements:
output("sample") {
printf("Count is: %d\n", count(hello));
}
If the #usage directive is present, its value will be used in the Control Panel to display a description of the program.
If the result of the ULP shall be a specific command that shall be executed in the editor window, the exit() function can be used to send that command to the editor window.