X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=utils.cl;h=8dc05c1f248461addceb72eeba3fb24c8fdcba42;hb=99df1b1ec110a5d304042442c3e8cb8b1d17abe8;hp=77feece957087f1df6dfe8089b188473b81e1fe5;hpb=f212998e69e8b67604a1f96faaf1ecacf693c5c3;p=lml.git diff --git a/utils.cl b/utils.cl index 77feece..8dc05c1 100644 --- a/utils.cl +++ b/utils.cl @@ -1,4 +1,4 @@ -;;; $Id: utils.cl,v 1.1 2002/09/16 01:13:49 kevin Exp $ +;;; $Id: utils.cl,v 1.5 2002/09/16 08:44:09 kevin Exp $ ;;;; ;;;; General purpose utilities @@ -23,7 +23,7 @@ (defun indent-spaces (n &optional (stream *standard-output*)) "Indent n*2 spaces to output stream" - (let ((fmt (format nil "~~~D~~T" (+ n n)))) + (let ((fmt (format nil "~~~DT" (+ n n)))) (format stream fmt))) (defun print-file-contents (file &optional (strm *standard-output*)) @@ -49,3 +49,28 @@ year hr min sec)))) +(defun lml-quit (&optional code) + "Function to exit the Lisp implementation. Copied from CLOCC's QUIT function." + #+allegro (excl:exit code) + #+clisp (#+lisp=cl ext:quit #-lisp=cl lisp:quit code) + #+cmu (ext:quit code) + #+cormanlisp (win32:exitprocess code) + #+gcl (lisp:bye code) + #+lispworks (lw:quit :status code) + #+lucid (lcl:quit code) + #+sbcl (sb-ext:quit :unix-status (typecase code (number code) (null 0) (t 1))) + #-(or allegro clisp cmu cormanlisp gcl lispworks lucid sbcl) + (error 'not-implemented :proc (list 'quit code))) + + +(defun lml-cwd () + "Returns the current working directory. Based on CLOCC's DEFAULT-DIRECTORY function." + #+allegro (excl:current-directory) + #+clisp (#+lisp=cl ext:default-directory #-lisp=cl lisp:default-directory) + #+cmu (ext:default-directory) + #+cormanlisp (ccl:get-current-directory) + #+lispworks (hcl:get-working-directory) + #+lucid (lcl:working-directory) + #-(or allegro clisp cmu cormanlisp lispworks lucid) (truename ".")) + +