Hi all,

Noticed a strange problem with CM (and sc.lisp) and SBCL today in the way scientific notation is formatted with dumposc. Basically, a value like 3.0e-4 will be formatted like 3.e-4 . This causes a problem in the SC interpreter since the '.' , if not followed by a numeral, is interpreted as a message operator. Checking for floats in the parse- osc-vec section of dumposc seems to take care of the problem. SBCL is the only LISP where the problem seem to come up (openmcl doesn't care). Here is a changed version of dumposc. An if statement is added in the dolist part.

(defun dumposc (file &rest args)
  (let ((out (if (null args) t (car args))) (fil nil))
    (unwind-protect
        (progn
         (setf fil (open-file file ':input ':byte))
         (when fil
           (format out "~%[")
           (do ((len 0)
                (one nil)
                (vec nil))
               ((not len) nil)
             (setf len (sc-read-bytes fil 4))
             (when len
               (setf len (u8vector->int len))
               (setf vec (sc-read-bytes fil len)))
             (parse-osc-vec vec
              (lambda (time cmd args)
                (format out (if one ",~%" "~%"))
                (format out "[~s" time)
                (format out ", [~s" cmd)
                (dolist (c args) (if (floatp c)
                    (format out ", ~F" c)
                    (format out ", ~s" c)))
                (format out "]]")
                (setf one t))))
           (format out "~%]~%")))
      (when fil (close-file fil ':input)))
    (if fil out nil)))

Can this be changed in the source?

Thanks,

Josh

******************************************
Joshua Parmenter
University of Washington
Center for Digital Arts and Experimental Media
School of Music
Seattle, Washington 98195

http://www.realizedsound.net/josh/
http://www.dxarts.washington.edu



Reply via email to