File: eusjack.l

package info (click to toggle)
euslisp 9.27%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 55,344 kB
  • sloc: ansic: 41,162; lisp: 3,339; makefile: 256; sh: 208; asm: 138; python: 53
file content (28 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(defvar *jackstream*)
(defvar *jackbuf* (make-string 16384))
(defvar ack nil)
(defun from-remote (s)
   (let (len)
      (setq len (unix:uread (send s :infd) *jackbuf*))
      (unix:write *standard-output* *jackbuf* len)
      (setq ack t)))

(defun openjack (host port)
  (let ((sa (make-socket-address :domain af_inet :host host :port port))
	(exp))
    (setq *jackstream* (make-client-socket-stream sa))
    (unless (io-stream-p *jackstream*) (return-from eusjack *jackstream*))
    (def-async *jackstream*  from-remote)
    ) )

(defun eusjack ()
    (while t
	(format *standard-output* "remote> ")
	(finish-output *standard-output*)
	(setq exp (read))
	(if (eq exp '.) (return-from eusjack nil))
	(setq ack nil)
	(print exp *jackstream*)
	(while (null ack) (unix:usleep 100000))
    )