From b7e764221c73de7a90893453005e04045bc3fdbb Mon Sep 17 00:00:00 2001 From: Stelian Ionescu Date: Sun, 11 Mar 2007 00:10:59 +0100 Subject: [PATCH] Minor fixes. --- io-multiplex/common.lisp | 7 +++++-- io.encodings/defpackage.lisp | 2 +- io.encodings/external-format.lisp | 16 ++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/io-multiplex/common.lisp b/io-multiplex/common.lisp index 38ba7c5..82970db 100644 --- a/io-multiplex/common.lisp +++ b/io-multiplex/common.lisp @@ -355,7 +355,7 @@ (defstruct (fd-entry (:constructor make-fd-entry (fd)) (:copier nil)) - (fd 0 :type fixnum) + (fd 0 :type unsigned-byte) (edge-change nil :type symbol) (read-events (make-queue) :type queue) (write-events (make-queue) :type queue) @@ -414,7 +414,7 @@ abs-timeout timeout)) (:copier nil)) ;; a file descriptor or nil in case of a timeout - (fd nil :type (or null fixnum)) + (fd nil :type (or null unsigned-byte)) (type nil :type (or null event-type)) (handler nil :type (or null function)) ;; if an event is not persistent it is removed @@ -513,6 +513,9 @@ ;;;; Misc ;;;; +;; FIXME: Until a way to autodetect platform features is implemented +(iolib-utils:define-constant et:pollrdhup 0) + (defun wait-until-fd-ready (fd event-type &optional timeout) (flet ((choose-poll-flags (type) (ecase type diff --git a/io.encodings/defpackage.lisp b/io.encodings/defpackage.lisp index ddfc35c..f3ef41e 100644 --- a/io.encodings/defpackage.lisp +++ b/io.encodings/defpackage.lisp @@ -5,7 +5,7 @@ (defpackage :io.encodings (:nicknames #:ioenc) (:use #:common-lisp) - (:export ;; Stream classes + (:export ;; External-format handling #:external-format #:make-external-format #:find-external-format #:ef-name #:ef-line-terminator #:ef-octet-size diff --git a/io.encodings/external-format.lisp b/io.encodings/external-format.lisp index 5c9f378..abb933d 100644 --- a/io.encodings/external-format.lisp +++ b/io.encodings/external-format.lisp @@ -30,6 +30,8 @@ (define-condition octet-encoding-error (error) ((string :initarg :string :reader octets-encoding-error-string) + (start :initarg :start :accessor octet-encoding-error-start) + (end :initarg :end :accessor octet-encoding-error-end) (position :initarg :position :reader octets-encoding-error-position) (external-format :initarg :external-format :reader octets-encoding-error-external-format)) @@ -73,7 +75,7 @@ (deftype line-terminator () '(member :unix :mac :dos)) -(defvar *default-external-format* :utf-8) +(defvar *default-external-format* :ascii) (eval-when (:compile-toplevel :load-toplevel :execute) (defvar *default-line-terminator* :unix)) @@ -122,7 +124,7 @@ '(unsigned-byte 8)) (deftype buffer-index () - 'fixnum) + '(unsigned-byte 24)) (defmacro add-external-format (name aliases ef) (let (($alias$ (gensym "ALIAS"))) @@ -534,9 +536,8 @@ :element-type 'octet :adjustable t)) (adjust-threshold (length string)) - (ptr start) - (pos -1) - oldpos oldptr) + (ptr start) oldptr + (pos -1) oldpos) (setf adjust-factor (if (and adjust-factor (<= 1 adjust-factor 4)) adjust-factor (ef-octet-size ef)) @@ -551,7 +552,7 @@ (setf buffer (adjust-array buffer adjust-threshold)))) (error-fn (symbol) (restart-case - (error symbol :array buffer + (error symbol :string buffer :start start :end end :position oldptr :external-format (ef-name ef)) @@ -567,7 +568,6 @@ (setf pos oldpos) (go :exit))))) (loop :while (< ptr end) - :do (setf oldpos pos - oldptr ptr) + :do (setf oldpos pos oldptr ptr) (char-to-octets ef #'input #'output #'error-fn (- end ptr)))) :exit (return-from string-to-octets (shrink-vector buffer (1+ pos)))))) -- 2.11.4.GIT