[CM] sc.lisp and dumposc

Joshua Parmenter joshp@u.washington.edu
Tue, 28 Nov 2006 13:52:30 -0800


--Apple-Mail-1--387527029
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

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




--Apple-Mail-1--387527029
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Hi all,<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>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.=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>(defun dumposc (file =
&amp;rest args)</DIV><DIV>=A0 (let ((out (if (null args) t (car args))) =
(fil nil))</DIV><DIV>=A0 =A0 (unwind-protect</DIV><DIV>=A0 =A0 =A0 =A0 =
(progn</DIV><DIV>=A0 =A0 =A0 =A0=A0 (setf fil (open-file file ':input =
':byte))</DIV><DIV>=A0 =A0 =A0 =A0=A0 (when fil</DIV><DIV>=A0 =A0 =A0 =A0 =
=A0=A0 (format out "~%[")</DIV><DIV>=A0 =A0 =A0 =A0 =A0=A0 (do ((len =
0)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (one nil)</DIV><DIV>=A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 (vec nil))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0=
 ((not len) nil)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0=A0 (setf len =
(sc-read-bytes fil 4))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0=A0 (when =
len</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 (setf len (u8vector-&gt;int =
len))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 (setf vec (sc-read-bytes =
fil len)))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0=A0 (parse-osc-vec =
vec</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 (lambda (time cmd =
args)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out (if one =
",~%" "~%"))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out "[~s" =
time)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out ", [~s" =
cmd)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (dolist (c args) (if =
(floatp c)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out =
", ~F" c)</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out =
", ~s" c)))</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (format out =
"]]")</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setf one =
t))))</DIV><DIV>=A0 =A0 =A0 =A0 =A0=A0 (format out =
"~%]~%")))</DIV><DIV>=A0 =A0 =A0 (when fil (close-file fil =
':input)))</DIV><DIV>=A0 =A0 (if fil out nil)))</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Can this be changed in the =
source?</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Thanks,</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Josh</DIV><DIV><BR><DIV> =
<SPAN class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; =
"><DIV>******************************************</DIV><DIV>Joshua =
Parmenter</DIV><DIV>University of Washington</DIV><DIV>Center for =
Digital Arts and Experimental Media</DIV><DIV>School of =
Music</DIV><DIV>Seattle, Washington 98195</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><A =
href=3D"http://www.realizedsound.net/josh/">http://www.realizedsound.net/j=
osh/</A></DIV><DIV><A =
href=3D"http://www.dxarts.washington.edu">http://www.dxarts.washington.edu=
</A></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV></SPAN></SPAN><BR =
class=3D"Apple-interchange-newline"></SPAN></SPAN></SPAN></SPAN></SPAN> =
</DIV><BR></DIV></BODY></HTML>=

--Apple-Mail-1--387527029--