abc::init — Run and initialize ABC, start communication
The procedure looks in the directory given by the variable abc::dir
for
executable file named by variable abc::exe
. Spawns that program
using Expect with the option -s, which prevets ABC from
sourcing initialization files. Then the procedures uses the ABC
command source to read all the named initializaton files.
Their locations and order is defined by a list in the
abc::initList
variable. Errors caused by nonexistent
files are ignored. Failures to parse the file are detected
and cause immediate error return. For a more detailed description
and for standard file sequences, see
abctcl.conf.tcl(5)
The variables abc::dir
, abc::exe
.
and abc::initList
are set by commands in the abctcl.conf.tcl
file
(see
abctcl.conf.tcl(5)
) but can be overriden before the first invocation of
abc::init.
result
(out)Optional argument. If omitted, no information is returned. The following items are present:
errorCode
(out)Error code. See RETURN CODES
below. Also put to the errorCode
global variable.
rawOutput
(out)The unprocessed output of ABC, including the final prompt.
promptNumber
(out)The number included in the final prompt. The ABC prompt has the "abc123> " form. The number indicates successive version of the network stored in ABC.
cmdTime
(out)Time in milliseconds elapsed by the command.
abcVersion
(out)The first line returned by ABC, including version and date of compilation.
spawn_id
(out)Process id as returned by the Expect spawn command.
sourced
(out)List of files that were sucessfully sourced into ABC.
failed
(out)List of files that failed to source into ABC.
timeout
(in)Optional argument. If given, sets the timeout of Expect
for this command. Othervise, the value of the timeout
global variable applies.
The procedure returns an empty string. See abctcl(n) , abc::messages(n) for error reporting and error symbols. The following error symbols can occur:
abc::dir
does not exist or is not a directory.abc::exe
does not exist or is not executable.This sequence initializes ABC with error reporting and recovery. script:
if { [catch { abc::init res }] } { puts $errorCode puts ".failed" foreach initFile $res(sourced) { puts $initFile } exit } else { foreach initFile $res(sourced) { puts -nonewline "$initFile ... " } puts ".ok" puts "greeting:" puts $res(abcVersion) puts "final prompt number: $res(promptNumber)" puts "raw output follows:" puts $res(rawOutput) }