r5372: Automatic commit for debian_version_1_4-1
[lml2.git] / utils.lisp
index a275a3e95eac802a7b0b8ebbff5c2e9504865e8e..0eef8e48f6bc930c8d64af243c3fcff9d735ae61 100644 (file)
@@ -1,6 +1,18 @@
-;;; $Id: utils.lisp,v 1.2 2003/06/28 08:18:21 kevin Exp $\r
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-\r
+;;;; *************************************************************************\r
+;;;; FILE IDENTIFICATION\r
 ;;;;\r
-;;;; General purpose utilities\r
+;;;; Name:          utils.lisp\r
+;;;; Purpose:       General purpose utilities\r
+;;;; Author:        Kevin M. Rosenberg\r
+;;;; Date Started:  June 2002\r
+;;;;\r
+;;;; $Id: utils.lisp,v 1.5 2003/07/15 21:49:36 kevin Exp $\r
+;;;;\r
+;;;; This file, part of LML2, is copyrighted and open-source software.\r
+;;;; Rights of modification and redistribution are in the LICENSE file.\r
+;;;;\r
+;;;; *************************************************************************\r
 \r
 (in-package #:lml2)\r
 \r
   `(aif ,test-form\r
         (progn ,@body)))\r
 \r
-(defun keyword-symbol? (x)\r
-  "Returns T if object is a symbol in the keyword package"\r
-  (and (symbolp x)\r
-       (string-equal "keyword" (package-name (symbol-package x)))))\r
-\r
-(defun list-to-spaced-string (list)\r
-  (format nil "~{~A~^ ~}" list))\r
-\r
-(defun print-n-chars (char n stream)\r
-  (declare (fixnum n)\r
-          (optimize (speed 3) (safety 0) (space 0)))\r
-  (do ((i 0 (1+ i)))\r
-      ((= i n) char)\r
-    (declare (fixnum i))\r
-    (write-char char stream)))\r
-  \r
-(defun indent-spaces (n &optional (stream *standard-output*))\r
-  "Indent n*2 spaces to output stream"\r
-  (print-n-chars #\space (+ n n) stream))\r
-\r
 (defun print-file-contents (file &optional (strm *standard-output*))\r
   "Opens a reads a file. Returns the contents as a single string"\r
   (when (probe-file file)\r
   #-(or allegro clisp cmu scl sbcl cormanlisp lispworks lucid mcl) (truename "."))\r
 \r
 \r
+#+ignore\r
+(defun fformat (&rest args)\r
+  (declare (dynamic-extent args))\r
+  (apply (if (find-package 'kmrcl)\r
+            (symbol-function (intern (symbol-name #:fformat)\r
+                                     (symbol-name #:kmrcl)))\r
+            #'format)\r
+        args))\r
+\r
+(defmacro fformat (stream control-string &rest args)\r
+  (if stream\r
+      `(funcall (formatter ,control-string) ,stream ,@args)\r
+      `(format nil ,control-string ,@args)))\r
+  \r