From: rusi <rustompmody@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: need help debugging edebug (Common lisp problem?)
Date: Mon, 13 Dec 2010 22:00:57 -0800 (PST) [thread overview]
Message-ID: <ea932c9a-1da5-48e2-be7e-24d7febb021c@o23g2000prh.googlegroups.com> (raw)
The following function (from http://delysid.org/emacs/midi.el )
crashes edebug.
It gives
edebug-syntax-error: Invalid read syntax: "Failed matching",
([&optional ["named" symbolp]] [&rest &or ["repeat" form] loop-for-as
loop-with loop-initial-final] [&rest loop-clause])
Note: It loads correctly (or rather silently) if edebug is turned off
I have a feeling its in the loop (cl) macro. Can someone who knows CL
better have a look?
(defun smf-read-mtrk (length)
"Read one MTrk chunk.
NoteOn/NoteOff and NoteOn/NoteOn(vel=0) event
pairs are unified into a Note event with a certain duration."
(let ((end (+ (point) length))
(notes (make-vector 16 nil))
(ticks 0) (running-status 0))
(dotimes (i 16) (aset notes i (make-vector 128 nil)))
(loop while (< (point) end)
do (incf ticks (smf-read-varlen))
for event =
(let ((status (following-char)))
(if (/= (logand status #B10000000 ) #B10000000 )
(if (= running-status 0)
(error "Seen data byte without running status")
(setq status running-status))
(forward-char 1))
(unless (= status #XFF ) (setq running-status status))
(let ((lower (logand status #X0F )))
(case (ash status -4)
(8 (let* ((note (smf-read-byte)) (vel (smf-read-byte))
(old-note (aref (aref notes lower) note)))
(if (not old-note)
(list 'NoteOff lower note vel)
(setcar (cdr old-note) 'Note)
(setcdr (nthcdr 4 old-note)
(list (- ticks (car old-note)) vel))
(aset (aref notes lower) note nil))))
(9 (let* ((note (smf-read-byte)) (vel (smf-read-byte))
(data (cons ticks (list 'NoteOn lower note vel))))
(if (= vel 0)
(let ((old-note (aref (aref notes lower) note)))
(if (not old-note)
(cdr data)
(setcar (cdr old-note) 'Note)
(setcdr (nthcdr 4 old-note)
(list (- ticks (car old-note))))
(aset (aref notes lower) note nil)))
(cdr (aset (aref notes lower) note data)))))
(10 (list 'At lower (smf-read-byte) (smf-read-byte)))
(11 (list 'CC lower (smf-read-byte) (smf-read-byte)))
(12 (list 'PC lower (smf-read-byte)))
(13 (list 'CP lower (smf-read-byte)))
(14 (list 'PW lower (logior (smf-read-byte)
(lsh (smf-read-byte) 7))))
(15 (case lower
(0 (append (list 'SysEx)
(loop repeat (smf-read-varlen) collect
(smf-read-byte))))
(2 (let ((value (logior (smf-read-byte)
(lsh (smf-read-byte) 7))))
(list 'SongPosition value)))
(3 (list 'SongSelect (smf-read-byte)))
(6 (list 'TuneRequest))
(8 (list 'Clock))
(9 (list 'Tick))
(10 (list 'Start))
(11 (list 'Continue))
(12 (list 'Stop))
(14 (list 'ActiveSense))
(15 (smf-read-meta-event))
(t (error "Unknown stuff")))))))
until (eq event t) when event collect (cons ticks event))))
next reply other threads:[~2010-12-14 6:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 6:00 rusi [this message]
2010-12-14 14:59 ` need help debugging edebug (Common lisp problem?) Pascal J. Bourguignon
2010-12-14 20:47 ` bolega
[not found] ` <87vd2w43zf.fsf@fh-trier.de>
2010-12-15 3:50 ` Rustom Mody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea932c9a-1da5-48e2-be7e-24d7febb021c@o23g2000prh.googlegroups.com \
--to=rustompmody@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.