Replace uses of the deprecated function GENTEMP in share
[maxima.git] / archive / src / server.lisp
blob11d4893f2ec8505b692434a73c9235ee1c22fd7c
2 ;; very simple server started on port
4 (and (find-package "MAXIMA") (push :maxima *features*))
6 #+maxima
7 (in-package "MAXIMA")
11 (defun user::setup ( port &optional (host "localhost"))
12 (let* ((sock (open-socket host port)))
13 (setq me sock)
14 #+gcl (setq si::*sigpipe-action* 'si::bye)
15 (setq *socket-connection* sock)
16 (setq *standard-input* sock)
17 (setq *standard-output* sock)
18 (setq *error-output* sock)
19 (setq *terminal-io* sock)
20 (format t "pid=~a~%" (getpid))
21 (force-output sock)
22 (setq *debug-io* sock)
23 (values)
26 ;;; from CLOCC: <http://clocc.sourceforge.net>
27 (defun open-socket (host port &optional bin)
28 "Open a socket connection to HOST at PORT."
29 (declare (type (or integer string) host) (fixnum port) (type boolean bin))
30 (let ((host (etypecase host
31 (string host)
32 (integer (hostent-name (resolve-host-ipaddr host))))))
33 #+allegro (socket:make-socket :remote-host host :remote-port port
34 :format (if bin :binary :text))
35 #+clisp (socket-connect port host :element-type
36 (if bin '(unsigned-byte 8) 'character))
38 #+cmu (sys:make-fd-stream (ext:connect-to-inet-socket host port)
39 :input t :output t :element-type
40 (if bin '(unsigned-byte 8) 'character))
41 #+gcl (si::socket port :host host)
42 #+lispworks (comm:open-tcp-stream host port :direction :io :element-type
43 (if bin 'unsigned-byte 'base-char))
44 #-(or allegro clisp cmu gcl lispworks)
45 (error 'not-implemented :proc (list 'open-socket host port bin))))
49 #+maxima
50 (progn
51 (setq $in_netmath t)
52 (setq $show_openplot nil))