Subject: [clisp-list] macro problems

From: Karsten Poeck <[email-masked]>
Date: Mon Jun 21 12:17:02 2004

Hello,

I found two minor problems while trying to compile cl-http in clisp.

In the following macro :start is twice passed to position-if for end-tag.
Unfortunately I don't see at first glance which :start is correct.

(defmacro with-parsed-ncsa-line ((key line &key (line-offset 0) (line-end
nil line-end-supplied-p)
				      (url-var 'url-string) (raw-coordinates-var 'raw-coordinates))
                                   &body body)
    `(let* ((end-key ,(typecase key (string (length key))(t `(length ,key))))
            (line-len ,(if line-end-supplied-p line-end `(length ,line)))
            (start (string-search ,key ,line 0 end-key ,line-offset line-len))
            (end-tag (position-if #'white-space-char-p ,line :start (the
fixnum (+ start end-key)) :start start :end line-len))
;;; above this line
            (start-url (position-if-not #'white-space-char-p ,line :start
end-tag :end line-len))
            (end-url (position-if #'white-space-char-p ,line :start
start-url :end line-len))
            (,url-var (subseq ,line start-url end-url))
            (,raw-coordinates-var (subseq ,line end-url line-len)))
       (declare (fixnum line-len start end-tag start-url end-url end-key))
       ,@body))

Dump-one shouldn't pass ::estimated-length for clisp and allegro
#+(or MCL clisp allegro)
(defun dump-one (thing filename &optional estimated-length)
    (declare (ignore estimated-length))
    (with-open-file (str filename :direction :output :element-type
'(unsigned-byte 8)
		       :if-exists :supersede)
      (write-byte (obtain-version-number) str)
      (let ((*print-readably* t))			; so dump-other will signal errors
        (dump-thing thing str))
      (write-byte +end-tag+ str)))

There are some other places where #+clisp conditionals are needed.
As soon I have figured out whether they are needed are clisp behaviour is
incorrect I will post.

I am aware that clisp does not offer multitasking and cl-http will not be
two usefull without that, but my programms are
usually more correct w.r.t. ansi after being compiled with clisp

saludos

Karsten