veda-run-ilx - Run a SKILL/SKILL++ script from the command-line
veda run-ilx script [script-arg]...
veda-run-ilx script [script-arg]...
Runs a SKILL/SKILL++ script in skill
, dbAccess
, virtuoso -nograph
or virtuoso
, depending on its requirements.
Scripts are ordinary SKILL files, preceded by a specially-formatted comment header, e.g.:
#!/usr/bin/env veda-run-ilx
# @language skill
# @requires testing
printf("Hello, World!\n")
In the above,
Line 1 is a Unix-like "shebang" line;
Line 2 specifies that the script contains SKILL code. Use @language scheme
to trigger SKILL++ evaluation;
Line 3 causes the testing
package (and its dependencies, if any) to be loaded prior to the execution of the code. Use a comma-separated list for multiple packages, e.g. @requires foo, bar, baz
;
Line 4, as well as any line not starting with #
, is passed verbatim to the chosen interpreter.
In addition to the installed Veda packages, a number of implementation pseudo-packages are recognized, and cause the selection of an interpreter with the required features. E.g., @requires db
triggers evaluation in dbAccess
, which is the "minimal" interpreter exposing the Cadence db*
API. Here is the list of recognized pseudo-packages and their corresponding minimal interpreter:
hi
: virtuoso
;sch
: virtuoso -nograph
;virtuoso
: virtuoso -nograph
;db
: dbAccess
;dd
: dbAccess
;tech
: dbAccess
;cdf
: dbAccess
;ipc
: dbAccess
.The default interpreter, chosen in the absence of a request for any implementation package, is the bare-bones skill
interpreter.
Please see VEDA_SKILL_BIN
and VEDA_*_BIN
in veda help
for more information on how interpreters are located.
The run-ilx
command defines one globally available, no-arguments function, VedaRunScriptArgs
, which can be used to query the [script-arg]... passed on the command-line:
(VedaRunScriptArgs)
The VedaRun*
namespace prefix is reserved for future extensions.
cf. EXAMPLES section below.
Given the following hello.ilx
file:
#!/usr/bin/env veda-run-ilx
# @language scheme
;; Defining a "main" function is considered good style.
(defun Hello (args)
(let ((who (if args
(buildString args ", ")
"World")))
(printf "Hello, %s!\n" who)))
;; Go.
(Hello (VedaRunScriptArgs))
one can do:
$ chmod 755 hello.ilx
$ ./hello.ilx
Hello, World!
$ ./hello.ilx Coyote
Hello, Coyote!
$ ./hello.ilx "Wile E. Coyote" "Road Runner"
Hello, Wile E. Coyote, Road Runner!