X-Git-Url: http://git.kpe.io/?p=lml.git;a=blobdiff_plain;f=utils.lisp;h=9c2f9799ec661f199606af985fe5adebaf72715d;hp=6ce238437347d831eb09e705fc639bd4570060db;hb=HEAD;hpb=5151ac10e8472126199e05ff8e5ab382ecba3c68 diff --git a/utils.lisp b/utils.lisp index 6ce2384..9c2f979 100644 --- a/utils.lisp +++ b/utils.lisp @@ -1,4 +1,4 @@ -;;; $Id: utils.lisp,v 1.8 2003/06/06 21:59:30 kevin Exp $ +;;; $Id$ ;;;; ;;;; General purpose utilities @@ -22,12 +22,12 @@ (defun print-n-chars (char n stream) (declare (fixnum n) - (optimize (speed 3) (safety 0) (space 0))) + (optimize (speed 3) (safety 0) (space 0))) (do ((i 0 (1+ i))) ((= i n) char) (declare (fixnum i)) (write-char char stream))) - + (defun indent-spaces (n &optional (stream *standard-output*)) "Indent n*2 spaces to output stream" (print-n-chars #\space (+ n n) stream)) @@ -36,19 +36,19 @@ "Opens a reads a file. Returns the contents as a single string" (when (probe-file file) (with-open-file (in file :direction :input) - (do ((line (read-line in nil 'eof) - (read-line in nil 'eof))) - ((eql line 'eof)) - (write-string line strm) - (write-char #\newline strm))))) + (do ((line (read-line in nil 'eof) + (read-line in nil 'eof))) + ((eql line 'eof)) + (write-string line strm) + (write-char #\newline strm))))) (defun date-string (ut) (check-type ut integer) (multiple-value-bind (sec min hr day mon year dow daylight-p zone) (decode-universal-time ut) (declare (ignore daylight-p zone)) - (format nil "~[Mon~;Tue~;Wed~;Thu~;Fri~;Sat~;Sun~], ~d ~[Jan~;Feb~;Mar~;Apr~;May~;Jun~;Jul~;Aug~;Sep~;Oct~;Nov~;Dec~] ~d ~2,'0d:~2,'0d:~2,'0d" - dow day (1- mon) year hr min sec))) + (format nil "~[Mon~;Tue~;Wed~;Thu~;Fri~;Sat~;Sun~], ~d ~[Jan~;Feb~;Mar~;Apr~;May~;Jun~;Jul~;Aug~;Sep~;Oct~;Nov~;Dec~] ~d ~2,'0d:~2,'0d:~2,'0d" + dow day (1- mon) year hr min sec))) (defun lml-quit (&optional (code 0)) "Function to exit the Lisp implementation."