plt/check-info.ss
;;;
;;; Time-stamp: <06/03/11 12:10:20 noel>
;;;
;;; Copyright (C) 2005 by Noel Welsh.
;;;

;;; This library is free software; you can redistribute it
;;; and/or modify it under the terms of the GNU Lesser
;;; General Public License as published by the Free Software
;;; Foundation; either version 2.1 of the License, or (at
;;; your option) any later version.

;;; This library is distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the
;;; implied warranty of MERCHANTABILITY or FITNESS FOR A
;;; PARTICULAR PURPOSE.  See the GNU Lesser General Public
;;; License for more details.

;;; You should have received a copy of the GNU Lesser
;;; General Public License along with this library; if not,
;;; write to the Free Software Foundation, Inc., 59 Temple
;;; Place, Suite 330, Boston, MA 02111-1307 USA

;;; Author: Noel Welsh <[email protected]>
;;
;;
;; Commentary:

(module check-info mzscheme

  (require (lib "include.ss"))

  (provide (all-defined))
  
  (include "../generic/check-info.ss")

  ;; parameter check-stack : (list-of check-info)
  (define check-stack
    (make-parameter
     (list)
     (lambda (v)
       (if (list? v)
           v
           (raise-type-error 'check-stack "list" v)))))

  ;; with-check-info* : (list-of check-info) thunk -> any
  (define (with-check-info* info thunk)
    (parameterize
      ((check-stack (append (check-stack) info)))
      (thunk)))

  (define-syntax with-check-info
    (syntax-rules ()
      ((_ ((name val) ...) body ...)
       (with-check-info*
        (list (make-check-info name val) ...)
        (lambda ()
          body ...)))))

  )