Although the user-language program (ULP) language is C-like, it is not exactly C. For example, the equivalent to the C “float” type is called “real” and there is no “boolean” type. This appendix gives a summary of the ULP language, in particular where it differs from the C syntax.
You will find information on using ULPs in Chapter 10. You will also find the built-in help files of EAGLE (accessible from the Help menu) useful.
The following primitive types are defined.
The “string” data type is more like a Java “string” class than a C character array. You can concatenate strings using the + operator and also use a number of built-in functions to manipulate strings.
Arrays use the same [ ] syntax as C, but can be created dynamically from built-in functions, as the example below of splitting a string into a string array illustrates.
These are the same as C. So, bitwise “and” and “or” are “&” and “|” respectively. Logical equivalents are: “&&” and “||”. The not operator is “!” and xor id “^”.
These are the same as C. You have access to the usual control structure commands such as “if”, “while”, “for”, “break”, etc.
A number of EAGLE specific constants are defined for the ULP.
The ULP language includes a number of built-in dialog types that you can use in your programs.
• dlgDirectory—Prompts for a directory from the file system and returns the path
• dlgFileOpen—Prompts for a file to open and returns the file path
• dlgMessageBox—Displays a message to the user
See the online help for the full syntax for these commands.
There are many other built-in functions available in the ULP language, for tasks such as reading and writing files, performing HTTP requests, and even manipulating XML. See the online documentation for these functions in the built-in help system.