Skip to content

Instantly share code, notes, and snippets.

@miyamuko
Created August 5, 2010 10:44
Show Gist options
  • Save miyamuko/509541 to your computer and use it in GitHub Desktop.
Save miyamuko/509541 to your computer and use it in GitHub Desktop.
xyzzy Lisp から現在のアプリケーションのデバッガに文字列を送信
;; xyzzy Lisp から現在のアプリケーションのデバッガに文字列を送信
;;
;; == 送信した文字列を見る方法 ==
;;
;; * 方法1:
;; VisualStudio から xyzzy をデバッグ実行すると
;; VisualStudio のウィンドウ内で見れるとおもう(たぶん)
;;
;; * 方法2:
;; Sysinternals Suite に含まれる DebugView.exe を起動
;; (起動しておくだけでいい)
;; http://technet.microsoft.com/ja-jp/sysinternals/bb842062.aspx
;;
;; == 関数プロトタイプ ==
;;
;; VOID OutputDebugString(
;; LPCTSTR lpOutputString // 表示する文字列へのポインタ
;; );
;;
;; インポートライブラリ: kernel32.lib を使用
;; Unicode: Windows NT/2000 は Unicode 版と ANSI 版を実装
;;
;; http://msdn.microsoft.com/ja-jp/library/cc428973.aspx
;;
(c:define-dll-entry c:void OutputDebugStringA (winapi:LPCTSTR) "kernel32")
(defvar *dbglog-prefix* nil)
(defvar *dbglog-suffix* "#xyzzy")
(defun dbglog (fmt &rest args)
(let* ((msg (apply 'format nil fmt args))
(log (format nil "~@[~A ~]~A~@[ ~A~]" *dbglog-prefix* msg *dbglog-suffix*)))
(OutputDebugStringA (si:make-string-chunk log))))
#|
;; テスト
(let ((x 10)
(y '(1 2 3)))
(dbglog "x = ~S, y = ~S" x y))
|#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment