r5339: *** empty log message ***

This commit is contained in:
Kevin M. Rosenberg
2003-07-19 20:32:48 +00:00
parent 617fff5950
commit 59760539ab

View File

@ -22,7 +22,7 @@
;; Original version from ACL 6.1: ;; Original version from ACL 6.1:
;; uri.cl,v 2.3.6.4.2.1 2001/08/09 17:42:39 layer ;; uri.cl,v 2.3.6.4.2.1 2001/08/09 17:42:39 layer
;; ;;
;; $Id: src.lisp,v 1.6 2003/07/19 18:21:43 kevin Exp $ ;; $Id: src.lisp,v 1.7 2003/07/19 20:32:48 kevin Exp $
(defpackage #:puri (defpackage #:puri
(:use #:cl) (:use #:cl)
@ -59,13 +59,31 @@
(in-package #:puri) (in-package #:puri)
(eval-when (compile) (declaim (optimize (speed 3)))) (eval-when (:compile-toplevel)
(declaim (optimize (speed 3))))
#-(or allegro lispworks) #-(or allegro lispworks)
(define-condition parse-error (error) ()) (define-condition parse-error (error) ())
#-allegro
(defun parse-body (forms &optional env)
"Parses a body, returns (VALUES docstring declarations forms)"
(declare (ignore env))
;; fixme -- need to add parsing of multiple declarations
(let (docstring declarations)
(when (stringp (car forms))
(setq docstring (car forms))
(setq forms (cdr forms)))
(when (and (listp (car forms))
(symbolp (caar forms))
(string-equal (symbol-name '#:declare)
(symbol-name (caar forms))))
(setq declarations (car forms))
(setq forms (cdr forms)))
(values docstring declarations forms)))
(defun shrink-vector (str size) (defun shrink-vector (str size)
#+allegro #+allegro
(excl::.primcall 'sys::shrink-svector str size) (excl::.primcall 'sys::shrink-svector str size)
@ -91,10 +109,11 @@
(apply #'format stream fmt args)) (apply #'format stream fmt args))
#-allegro (defvar *current-case-mode* :case-insensitive-upper) #-allegro (defvar *current-case-mode* :case-insensitive-upper)
#+allegro (eval-when (compile load eval) #+allegro (eval-when (:compile-toplevel :load-toplevel :execute)
(import '(excl:*current-case-mode* (import '(excl:*current-case-mode*
excl:delimited-string-to-list excl:delimited-string-to-list
excl::.parse-error excl::.parse-error
excl::parse-body
excl::internal-reader-error excl::internal-reader-error
excl:if*))) excl:if*)))
@ -221,7 +240,7 @@
((nid :initarg :nid :initform nil :accessor urn-nid) ((nid :initarg :nid :initform nil :accessor urn-nid)
(nss :initarg :nss :initform nil :accessor urn-nss))) (nss :initarg :nss :initform nil :accessor urn-nss)))
(eval-when (compile eval) (eval-when (:compile-toplevel :execute)
(defmacro clear-caching-on-slot-change (name) (defmacro clear-caching-on-slot-change (name)
`(defmethod (setf ,name) :around (new-value (self uri)) `(defmethod (setf ,name) :around (new-value (self uri))
(declare (ignore new-value)) (declare (ignore new-value))
@ -372,7 +391,7 @@
(defparameter *reserved-fragment-characters* (defparameter *reserved-fragment-characters*
(reserved-char-vector (remove #\# *excluded-characters*))) (reserved-char-vector (remove #\# *excluded-characters*)))
(eval-when (compile eval) (eval-when (:compile-toplevel :execute)
(defun gen-char-range-list (start end) (defun gen-char-range-list (start end)
(do* ((res '()) (do* ((res '())
(endcode (1+ (char-int end))) (endcode (1+ (char-int end)))
@ -816,12 +835,8 @@ URI ~s contains illegal character ~s at position ~d."
host *reserved-authority-characters* escape)) host *reserved-authority-characters* escape))
(when port ":") (when port ":")
(when port (when port
;;;; too slow until ACL 6.0: #-allegro (format nil "~D" port)
;;; (format nil "~d" port) #+allegro (with-output-to-string (s)
;;; (princ-to-string port)
#-allegro (princ-to-string port)
#+allegro
(with-output-to-string (s)
(excl::maybe-print-fast s port)) (excl::maybe-print-fast s port))
) )
(when path (when path
@ -1183,6 +1198,7 @@ URI ~s contains illegal character ~s at position ~d."
;; bootstrapping (uri= changed from function to method): ;; bootstrapping (uri= changed from function to method):
(when (fboundp 'uri=) (fmakunbound 'uri=)) (when (fboundp 'uri=) (fmakunbound 'uri=))
(defgeneric uri= (uri1 uri2))
(defmethod uri= ((uri1 uri) (uri2 uri)) (defmethod uri= ((uri1 uri) (uri2 uri))
(when (not (eq (uri-scheme uri1) (uri-scheme uri2))) (when (not (eq (uri-scheme uri1) (uri-scheme uri2)))
(return-from uri= nil)) (return-from uri= nil))
@ -1259,8 +1275,7 @@ Executes the forms once for each uri with var bound to the current uri"
(let ((f (gensym)) (let ((f (gensym))
(g-ignore (gensym)) (g-ignore (gensym))
(g-uri-space (gensym)) (g-uri-space (gensym))
(body #+allegro (third (excl::parse-body forms env)) (body (third (parse-body forms env))))
#-allegro forms))
`(let ((,g-uri-space (or ,uri-space *uris*))) `(let ((,g-uri-space (or ,uri-space *uris*)))
(prog nil (prog nil
(flet ((,f (,var &optional ,g-ignore) (flet ((,f (,var &optional ,g-ignore)
@ -1300,7 +1315,17 @@ excl::
;; timings ;; timings
;; (don't run under emacs with M-x fi:common-lisp) ;; (don't run under emacs with M-x fi:common-lisp)
#+ignore #+allegro
(eval-when (:compile-toplevel :load-toplevel :execute)
(import 'excl::gc))
#-allegro
(defun gc (&rest options)
(declare (ignore options))
#+sbcl (sb-ext::gc)
#+cmu (ext::gc)
)
(defun time-uri-module () (defun time-uri-module ()
(declare (optimize (speed 3) (safety 0) (debug 0))) (declare (optimize (speed 3) (safety 0) (debug 0)))
(let ((uri "http://www.franz.com/a/b;x;y;z/c/foo?bar=baz&xxx#foo") (let ((uri "http://www.franz.com/a/b;x;y;z/c/foo?bar=baz&xxx#foo")