lsend, gsend

lsend, gsend — send commands to Cogent and Gamma programs.

Synopsis

lsend [-ghlVX] [task]gsend [-ghlVX] [task]

Arguments

task

A Cogent or Gamma program name (as a string, previously attached by name_attach, init_ipc, or qnx_name_attach), or a process ID (which is O/S dependent).

-g

Accept Gamma input. This is generally used from lsend, and is the equivalent of running gsend. It is the default for gsend.

-h

Print a help message and exit.

-l

Accept Lisp input. This is generally used from gsend, and is the equivalent of running lsend. It is the default for lsend.

-V

Print the version number.

-X

Exit immediately (usually used with -V).

Returns

A prompt with the task name displayed.

Description

The lsend utility attaches to a running Gamma program and allows the user to send commands without exiting the event loop of the attached process. Any statement may be issued, including changing the definitions of existing functions. lsend statements use Lisp syntax, which consists of the name of the command or function, followed by a space-separated list of arguments, all enclosed in parentheses, like this:

(command arg1 arg2 arg3 ...)
(function arg1 arg2 arg3 ...)

The gsend utility is simply a symbolic link to lsend, and is the equivalent of calling lsend with the -g option. gsend statements use Gamma syntax, which is slightly different from Lisp syntax. The command or function name is outside the parentheses, and the arguments are separated by commas, like this:

command (arg1, arg2, arg3, ...)
function (arg1, arg2, arg3, ...)

To exit lsend or gsend, use Ctrl-C or Ctl-D. Anything else you type will be parsed and passed on to the task you have been communicating with.

[Note]

Event processing stops in the Gamma program for the duration of either of these commands.

Example

Sending a Lisp command to an example Gamma process named OtherProcess:

[sh]$ lsend "OtherProcess"
OtherProcess> (cos 5.5)
0.70866977429126
OtherProcess> 
		

Sending a Gamma command to the same process:

[sh]$ gsend "OtherProcess"
OtherProcess>cos (5.5)
0.70866977429126
OtherProcess>

The example process:

Gamma> init_ipc ("OtherProcess");
t
Gamma> while(t) next_event();
		

It is possible to send several commands at once, by typing them one after another. Here is an example using lsend with the Cascade Historian, running under the task name Hist:

[sh]$  lsend Hist
Hist> (disable p*)(enable ptbogus)(history p6)
t
Hist> (error "histdb: enable: No history found for: ptbogus")
Hist> t
Hist>

lsend sends commands and shows the return values until all the commands have been attempted. Each command is processed separately by the Cascade Historian. lsend displays a prompt and the return value for each command separately.

See the Sending Commands section of the Cogent Tools Demo for another example of this command in use.