National Institute of Advanced Industrial Science and Technology (AIST) This page is a page of the former research institute. We stopped updating on March 31.2001.
E-mail to webmaster (Japanese) E-mail to webmaster (English)
next up previous contents index
Next: Adding Lisp Functions Coded Up: System Functions Previous: Keyed Indexed Files

 

Unix Processes

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]

  ez &optional key [function]   piped-fork &optional (exec) &rest args [function]   rusage [function]



Hirofumi Nakagaki
Fri Mar 22 12:46:38 JST 1996