EasyManua.ls Logo

Euresys Coaxlink - Built-in Objects and Modules

Euresys Coaxlink
45 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Coaxlink Programmer's GuideEuresys GenApi scripts
}
}
function assert(condition) {
if (!condition) {
throw 'failed assertion';
}
}
doc/builtins.js
// This file describes the builtins (functions or objects) of Euresys GenApi
// Script. It can be executed by running 'gentl script
// coaxlink://doc/builtins.js'.
// The builtin object 'console' contains a single function, log, which can be
// used to output text to the standard output.
console.log('Hello from ' + module.filename);
console.log('If several arguments are passed,', 'they are joined with spaces');
// The builtin object 'memento' contains the following functions: error,
// warning, notice, info, debug, verbose (each corresponding to a different
// verbosity level in Memento). They are similar to console.log, except that
// the text is sent to Memento.
memento.error('error description');
memento.warning('warning description');
memento.notice('important notification');
memento.info('message');
memento.debug('debug information');
memento.verbose('more debug information');
// Explicit type conversion/information functions:
console.log('Boolean(0) = ' + Boolean(0)); // false
console.log('Boolean(3) = ' + Boolean(3)); // true
console.log('Number(false) = ' + Number(false)); // 0
console.log('Number(true) = ' + Number(true)); // 1
console.log('Number("3.14") = ' + Number("3.14")); // 3.14
console.log('Number("0x16") = ' + Number("0x16")); // 22
console.log('Number("1e-9") = ' + Number("1e-9")); // 1e-9
console.log('String(false) = ' + String(false)); // "false"
console.log('String(true) = ' + String(true)); // "true"
console.log('String(3.14) = ' + String(3.14)); // "3.14"
console.log('String([1, 2]) = ' + String([1, 2])); // "1,2"
console.log('isNaN(0/0) = ' + isNaN(0/0)); // true
console.log('isNaN(Infinity) = ' + isNaN(Infinity)); // false
console.log('isRegExp(/re/) = ' + isRegExp(/re/)); // true
console.log('isRegExp("/re/") = ' + isRegExp("/re/")); // false
console.log('Array.isArray({}) = ' + Array.isArray({})); // false
console.log('Array.isArray([]) = ' + Array.isArray([])); // true
// The builtin object 'Math' contains a few functions:
console.log('floor(3.14) = ' + Math.floor(3.14));
console.log('abs(-1.5) = ' + Math.abs(1.5));
console.log('pow(2, 5) = ' + Math.pow(2, 5));
console.log('log2(2048) = ' + Math.log2(2048));
// String manipulation
console.log('"Duo & Duo".replace(/Duo/, "Quad") = "' +
"Duo & Duo".replace(/Duo/, "Quad") + '"'); // "Quad & Duo"
console.log('"Duo & Duo".replace(/Duo/g, "Quad") = "' +
"Duo & Duo".replace(/Duo/g, "Quad") + '"'); // "Quad & Quad"
console.log('"Hello, Coaxlink".toLowerCase() = "' +
"Hello, Coaxlink".toLowerCase() + '"'); // "hello, coaxlink"
console.log('"Coaxlink Quad G3".includes("Quad") = ' +
"Coaxlink Quad G3".includes("Quad")); // true
console.log('"Coaxlink Quad".includes("G3") = ' +
"Coaxlink Quad".includes("G3")); // false
30

Related product manuals