From 7b6b64f76d4c6daf52937a3de69e292d71ea10f4 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Fri, 5 Dec 2008 20:12:59 +0100 Subject: [PATCH] Add debug helpers. --- base/debug.lisp | 30 ++++++++++++++++++++++++++++++ base/pkgdcl.lisp | 4 ++++ iolib.base.asd | 1 + 3 files changed, 35 insertions(+) create mode 100644 base/debug.lisp diff --git a/base/debug.lisp b/base/debug.lisp new file mode 100644 index 0000000..d7af259 --- /dev/null +++ b/base/debug.lisp @@ -0,0 +1,30 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*- +;;; +;;; --- Debug helpers. +;;; + +(in-package :iolib.base) + +(defparameter *debug* t) + +(defmacro debug-only (&body body) + (if *debug* + `(progn + ,@body) + (values))) + +(defmacro debug-only* (&body body) + `(if *debug* + (progn + ,@body) + (values))) + +(defmacro production-only (&body body) + (if *debug* + (values) + `(progn + ,@body))) + +(defmacro production-only* (&body body) + `(unless *debug* + ,@body)) diff --git a/base/pkgdcl.lisp b/base/pkgdcl.lisp index eb4e5b0..47138ca 100644 --- a/base/pkgdcl.lisp +++ b/base/pkgdcl.lisp @@ -11,6 +11,10 @@ (:export ;; Conditions #:bug + ;; Debugging + #:*debug* + #:debug-only #:debug-only* + #:production-only #:production-only* ;; Types #:function-designator ;; RETURN* diff --git a/iolib.base.asd b/iolib.base.asd index e313f4f..8200cd0 100644 --- a/iolib.base.asd +++ b/iolib.base.asd @@ -12,6 +12,7 @@ :components ((:file "pkgdcl") (:file "return-star" :depends-on ("pkgdcl")) (:file "types" :depends-on ("pkgdcl")) + (:file "debug" :depends-on ("pkgdcl" "return-star")) (:file "conditions" :depends-on ("pkgdcl" "return-star")) (:file "defobsolete" :depends-on ("pkgdcl" "return-star")) (:file "reader" :depends-on ("pkgdcl" "return-star")) -- 2.11.4.GIT