Commit 0e15afc5 authored by Zach Beane's avatar Zach Beane
Browse files

Rudimentary simple-stream support.

Enough to get requests partially accepted. Not yet handled.
parent 7ef197b7
......@@ -102,7 +102,14 @@ values otherwise."
(defun excl:find-external-format (name &key errorp)
(declare (ignore errorp))
(error "(find-external-format ~S) -- not implemented" name))
(declare (ignore name))
:latin-1)
(defun excl:crlf-base-ef (external-format)
external-format)
(defun excl:ef-name (external-format)
external-format)
(defun excl:fixnump (integer)
(typep integer 'fixnum))
......@@ -227,3 +234,48 @@ values otherwise."
((identifier
:initarg :identifier
:reader excl:stream-error-identifier)))
;;; Streams
(defgeneric excl:device-open (stream slot-names initargs))
(defgeneric excl:device-close (stream abort))
(defgeneric excl:device-read (stream buffer start end blocking))
(defgeneric excl:device-write (stream buffer start end blocking))
(defvar excl::*std-control-out-table* nil)
(defclass excl:single-channel-simple-stream (fundamental-stream)
((excl::buffer
:initform (make-array 1024 :element-type '(unsigned-byte 8)))
(excl::output-handle)
(excl::buffer-ptr)
(excl::control-out)
(external-format
:initarg :external-format
:initform :default
:accessor zacl-cl:stream-external-format)))
(defmethod shared-initialize :after ((stream
excl:single-channel-simple-stream)
slot-names
&rest initargs &key &allow-other-keys)
(excl:device-open stream slot-names initargs))
(defmethod stream-write-string ((stream excl:single-channel-simple-stream) string &optional start end )
(unless start (setf start 0))
(unless end (setf end (length string)))
(write-string string (socket-stream (slot-value stream 'excl::output-handle))
:start start
:end end))
(defmacro excl:add-stream-instance-flags (stream &rest flags)
(declare (ignore stream flags))
nil)
(defun excl:write-vector (vector stream &key (start 0) (end (length vector)))
;; The real write-vector has more complicated blocking
;; behavior. Save that for later.
(write-sequence vector stream :start start :end end)
end)
......@@ -58,6 +58,17 @@
#:make-queue
#:qpush
#:qpop)
(:import-from #:trivial-gray-streams
#:fundamental-stream
#:fundamental-binary-output-stream
#:fundamental-binary-input-stream
#:fundamental-character-output-stream
#:fundamental-character-input-stream
#:stream-read-char
#:stream-write-char
#:stream-write-string
#:stream-read-byte
#:stream-read-byte)
(:import-from #:trivial-garbage
#:make-weak-hash-table
#:finalize)
......@@ -107,12 +118,22 @@
(:intern #:stream-property-list
#:with-dynamic-extend-usb8-array
#:unix-signal
#:make-basic-lock)
#:make-basic-lock
#:*std-control-out-table*)
(:export #:if*
#:then
#:thenret
#:else)
(:export #:synchronizing-structure
(:export #:single-channel-simple-stream
#:device-open
#:device-close
#:device-read
#:device-write
#:add-stream-instance-flags
#:write-vector
#:crlf-base-ef
#:ef-name
#:synchronizing-structure
#:socket-error
#:with-locked-structure
#:incf-atomic
......
......@@ -21,7 +21,7 @@
"Source files of aserve, taken from aserve/load.cl")
(defparameter *build-time-features*
'(:smp :smp-macros))
'(:smp :smp-macros :allegro))
(defun call-with-zacl-build-environment (fun)
(let ((*readtable* zacl-reader:*allegro-rewriting-readtable*)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment