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 an (optional) Unix-like "shebang" line. If absent, the script must explicitely be run using veda run-ilx
;
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
;
Every subsequent line is considered part of the script, and everything but the shebang line, if any, 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 a single function, VedaRunScriptArgs
, which can be used to query the arguments [script-arg]... passed on the command-line:
(defun VedaRunScriptArgs (@optional n) ...)
If n is nil
or missing, that function returns a list of all the script arguments:
(VedaRunScriptArgs)
;=> ("arg1" "arg2" ...)
Otherwise, n is interpreted as the 1-based index of the argument to retrieve:
(VedaRunScriptArgs 3)
;=> "arg3", or nil
As a special case, a n of zero provides access to the script name:
(VedaRunScriptArgs 0)
;=> "/path/to/script"
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!