[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Help with usage of process ...

From: Matt Welland
Subject: [Chicken-users] Help with usage of process ...
Date: Thu, 8 Oct 2015 23:14:50 -0700

I'm trying to use the posix process call to run the graphviz dot program, hand it some input data and collect the output. I'm not able to figure out how to correctly use process to do this. My code is below. Any hints would be much appreciated.

(define (tests:run-dot indat outtype) ;; outtype is plain, fig, dot, etc.
  (print "indat: ")
  (map print indat)
  (let-values (((inp oup pid)(process "dot" (list "-T" outtype))))
    (let ((th1 (make-thread (lambda ()
                  (with-output-to-port oup
                (lambda ()
                  (map print indat))))
                "dot writer")))
      (thread-start! th1)
      (let ((res (with-input-from-port inp
           (lambda ()
    (thread-join! th1)
    (close-output-port oup)
    (close-input-port inp)
    ;; (process-wait pid)

For reference this is the equivalent of the following from the commandline:

address@hidden:~/data/megatest/ext-tests$ dot -Tplain << EOF
> digraph tests {
> a -> b
> }
graph 1 0.75 1.5
node a 0.375 1.25 0.75 0.5 a solid ellipse black lightgrey
node b 0.375 0.25 0.75 0.5 b solid ellipse black lightgrey
edge a b 4 0.375 0.99579 0.375 0.88865 0.375 0.7599 0.375 0.64045 solid black

reply via email to

[Prev in Thread] Current Thread [Next in Thread]