![Euresys Coaxlink Скачать руководство пользователя страница 25](http://html1.mh-extra.com/html/euresys/coaxlink/coaxlink_programmers-manual_2436136025.webp)
Euresys GenApi scripts
Coaxlink Programmer's Guide
Euresys GenApi scripts
The Euresys GenApi Script language is documented in a few GenApi scripts. For convenience, they are also included
here.
doc/basics.js
// Euresys GenApi Script uses a syntax inspired by JavaScript, but is not
// exactly JavaScript. Using the extension .js for scripts is just a way to get
// proper syntax highlighting in text editors.
//
// This file describes the basics of Euresys GenApi Script. It can be executed
// by running 'gentl script <path-to-coaxlink-scripts-dir>/doc/basics.js', or
// more simply 'gentl script coaxlink://doc/basics.js'.
// Euresys GenApi Script is case-sensitive.
// Statements are always separated by semicolons (JavaScript is more
// permissive).
// Single-line comment
/* Multi-line comment
(cannot be nested)
*/
// Function declaration
function
multiply(a, b) {
return
a * b;
}
// Functions can be nested
function
sumOfSquares(a, b) {
function
square(x) {
return
x * x;
}
return
square(a) + square(b);
}
// Variable declaration
function
Variables() {
var
x = 1;
// 1
var
y = 2 * x;
// 2
var
z;
// undefined
}
// Data types
function
DataTypes() {
// Primitive types: Boolean, Number, String, undefined
function
Booleans() {
var
x = true;
var
y = false;
}
function
Numbers() {
var
x = 3.14159;
var
y = -1;
var
z = 6.022e23;
}
function
Strings() {
var
empty =
""
;
var
x =
"euresys"
;
var
y =
'coaxlink'
;
25