r11464: add signal handling functions
[kmrcl.git] / console.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          console.lisp
6 ;;;; Purpose:       Console interactiion
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Dec 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;a
12 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;; and by onShore Development, Inc.
14 ;;;;
15 ;;;; KMRCL users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
17 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
18 ;;;; *************************************************************************
19
20 (in-package #:kmrcl)
21
22 (defvar *console-msgs* t)
23
24 (defvar *console-msgs-types* nil)
25
26 (defun cmsg (template &rest args)
27   "Format output to console"
28   (when *console-msgs*
29     (setq template (concatenate 'string "~&;; " template "~%"))
30     (apply #'format t template args)))
31
32 (defun cmsg-c (condition template &rest args)
33   "Push CONDITION keywords into *console-msgs-types* to print console msgs
34    for that CONDITION.  TEMPLATE and ARGS function identically to
35    (format t TEMPLATE ARGS) "
36   (when (or (member :verbose *console-msgs-types*)
37             (member condition *console-msgs-types*))
38     (apply #'cmsg template args)))
39
40 (defun cmsg-add (condition)
41   (pushnew condition *console-msgs-types*))
42
43 (defun cmsg-remove (condition)
44   (setf *console-msgs-types* (remove condition *console-msgs-types*)))
45
46 (defun fixme (template &rest args)
47   "Format output to console"
48   (setq template (concatenate 'string "~&;; ** FIXME ** " template "~%"))
49   (apply #'format t template args)
50   (values))