RUN-PROGRAM's "environment" keyarg now defaults to T, just like CREATE-PROCESS
[iolib.git] / examples / package.lisp
blobe154b53ff1094c27da98eb01fb96d9c264742f5c
1 ;;;; This file was originally written by Peter Keller (psilord@cs.wisc.edu)
2 ;;;; and this code is released under the same license as IOLib.
4 (defpackage :iolib.examples
5 (:use :cl :iolib :bordeaux-threads)
6 (:export :run-ex1-client
7 :run-ex2-client
8 :run-ex3-client
9 :run-ex4-client
10 :run-ex5a-client
11 :run-ex5b-client
13 :run-ex1-server
14 :run-ex2-server
15 :run-ex3-server
16 :run-ex4-server
17 :run-ex5-server
18 :run-ex6-server
19 :run-ex7-server
20 :run-ex8-server
23 (in-package :iolib.examples)
25 ;;;; This file also contains some simply utilities to help the writing of the
26 ;;;; examples.
28 ;; The example host:port to which clients connect. Servers often bind to
29 ;; any interface, but listen on this port.
30 (defparameter *host* "localhost")
31 (defparameter *port* 9999)
33 ;; A simple, but efficient, queue implementation, used by some examples.
34 (defun make-queue ()
35 (cons nil nil))
37 (defun enqueue (obj q)
38 (if (null (car q))
39 (setf (cdr q) (setf (car q) (list obj)))
40 (setf (cdr (cdr q)) (list obj)
41 (cdr q) (cdr (cdr q))))
42 (car q))
44 (defun dequeue (q)
45 (pop (car q)))
47 (defun empty-queue (q)
48 (null (car q)))