From: Robert Bralic
Subject: How to make piping with Common LISP...!!
Date:
Message-ID: <eudbke$6ui$1@ss408.t-com.hr>
Does anybody knows..
On Linux ( CLISP, CMUCL)..!!
Thanks in advance...!!
From: ······@gmail.com
Subject: Re: How to make piping with Common LISP...!!
Date:
Message-ID: <1175105022.405588.100470@o5g2000hsb.googlegroups.com>
On Mar 28, 2:13 am, "Robert Bralic" <·············@si.t-com.hr> wrote:
> Does anybody knows..
> On Linux ( CLISP, CMUCL)..!!
> Thanks in advance...!!
I assume piping as in shell |, right? This worked for me in SBCL, I am
sure CMUCL has something similar...
(defmacro with-open-pipe ((command args &key input output error io
persist) &body forms)
(let ((process (gensym "PROCESS")))
`(let* ((,process (sb-ext:run-
program ,command ,args :input :stream :output :stream :error :stream
:wait nil ))
,@(when input `((,input (sb-ext:process-input ,process))))
,@(when output `((,output (sb-ext:process-
output ,process))))
,@(when error `((,error (sb-ext:process-error ,process))))
,@(when io `((,io (make-two-way-stream
(sb-ext:process-output ,process)
(sb-ext:process-input ,process)))))
)
,(if persist
`(progn ,@forms)
`(unwind-protect (progn ,@forms)
,@(when input `((close ,input)))
,@(when output `((close ,output)))
,@(when error `((close ,error)))
,@(when io `((close ,io)))
(sb-ext:process-close ,process) )))))
(defun dmm ()
(with-open-pipe ("/home/tester/vxi11/vxi11chat" '("10.0.0.152"
"gpib0,22") :input dmmin :io dmm :persi
st t)
(defun dmm-config (string)
(format dmm "~a~%" string)
(force-output dmm))
(defun dmm-ask (string)
(dmm-config string)
(read-line dmm))
(defun dmm-close ()
(close dmmin :abort t) ) ) )
YMMV,
Paul B.
From: Pascal Bourguignon
Subject: Re: How to make piping with Common LISP...!!
Date:
Message-ID: <87ps6sv6rm.fsf@voyager.informatimago.com>
"Robert Bralic" <·············@si.t-com.hr> writes:
> Does anybody knows..
> On Linux ( CLISP, CMUCL)..!!
> Thanks in advance...!!
C/USER[15]> (apropos "PIPE")
EXT:MAKE-PIPE-INPUT-STREAM function
EXT:MAKE-PIPE-IO-STREAM function
EXT:MAKE-PIPE-OUTPUT-STREAM function
:PIPE constant
:PIPE-BUF constant
:SIGPIPE constant
--
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org