Created
November 26, 2010 01:13
-
-
Save bowbow99/716148 to your computer and use it in GitHub Desktop.
継続とマクロでお手軽ブレークポイント - athosの日記 http://d.hatena.ne.jp/athos/20091226/p1 を #xyzzy + condition-restart で
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require "condition-restart") | |
| (define-condition breakpoint (condition) | |
| (name places) | |
| (:report (lambda (bp stream) | |
| (format stream "ぶれーく! ~S" (breakpoint-name bp))))) | |
| (defmacro bp (name &rest places) | |
| `(tagbody breakpoint | |
| (restart-case | |
| (signal 'breakpoint :name ',name :places '(,@places)) | |
| (continue () :report "続行") | |
| ,@(mapcar (lambda (place) | |
| `(,(intern (format nil "|~S|" place)) (#1=#:value) | |
| :report (lambda (stream) | |
| (format stream "~S => ~S を変更する" | |
| ',place ,place)) | |
| :interactive (lambda () | |
| (list (condition-restart::read-value-for ',place))) | |
| (setf ,place #1#) | |
| (go breakpoint))) | |
| places)))) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Common Lisp には break http://www.lispworks.com/documentation/HyperSpec/Body/f_break.htm があるのでいらない...