The GalepX Script Language

The script language can perform any operation of the GalepX software; it can connect and control GALEP programmers, load and edit projects and buffers, and even configure new documents and windows on the GalepX user interface. It is based on standard C with some modifications; classes are supported, pointers are not, and arrays are always dynamic. The same language is also used for controlling NETPORT modules. It supports two types of script commands: Syntax commands are always available, GalepX commands are specific to GalepX and depend on the state of the software - for instance whether a document is opened and which properties it has. A reference of syntax commands and remote commands can be found in the following sections of this help document.

Script output is directly sent to the client as a character string. A prefix of every string allows to determine whether it's an error, a normal output or the termination of a command. The following prefixes are defined:

#00 Termination of a command. Sent after any command.
#01 Error Error message follows.
#10 Output from the print() command.  

The following conditions lead to error messages:

Connection errors and syntax errors lead to immediate termination of the connection (if there was any), and have to be handled by the client.

Runtime errors can be caught with try { ... } catch() { ... } exception handling in the script. It makes sense to insert a print command in the catch block so that the client can react on the error. At the moment, all runtime errors cause an exception of type string. If an exception is not caught, the connection is terminated.

The fastest method to learn the script language is looking into the script examples folders. They contain simple scripts that cover all usual device programming tasks. For more in-depth scripting, check out the content of the scripts folder - it contains general scripts for all sorts of tasks, even unrelated to device programming - and look into the gsAPI/gxBasic1.h header that contains the GalepX command prototypes and definitions.



► latest version online