In order to launch unix commands from EusLisp, use the unix:system function. Piped-fork creates a subprocess whose standard input and standard output are connected to EusLisp's bidirectional stream through pipes. Piped-fork returns the stream. Following is a function to count the number of lines contained in a file by using "wc".
(defun count-lines (file) (read (piped-fork "wc" file)))
The next example creates eus process on another workstation identified by "etlic0" and provides a port for distributed computation.
(setq ic0eus (piped-fork "rsh" "etlic0" "eus")) (format ic0eus "(list 1 2 3)~%") (read ic0eus) --> (1 2 3)
For source code editing, you can call ez from the EusLisp. The screen editor ez communicates with EusLisp through message-queues. If you have an ez process already running in parallel with the EusLisp, ez restarts ez and it gains the terminal control. By issuing esc-P or esc-M commands in ez, texts are sent back and evaluated by EusLisp. This is useful for the debugging since entire file does not need to be loaded when you add a little modification to the file. Similar function is available on emacs by M-X run-lisp command.
cd &optional (dir (unix:getenv "HOME")) [function]
piped-fork &optional (exec) &rest args [function]
xfork exec &key (stdin *standard-input*) (stdout *standard-output*)
(stderr *error-output*) (args nil) [function]
(xfork exec :stdin (unix:pipe) :stdout (unix:pipe))
Though xfork returns an io-stream to stdin and stdout with their
directions reversed,
it is not always useful unless they are pipes.
The name of this function, xfork (cross-fork), comes from this reversed io-stream,
namely, the io-stream's input comes from the stdout of the subprocess and the output
comes from the stdin.
k-okada 2013-05-21