Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 98 lines (85 sloc) 3.382 kb
badc7a8 @smithzvk Added some new packages, notably my compatibility functions
authored
1
2 (in-package :toolbox)
3
4 ;; None are mine, but very handy.
5
6 ;; Read environment variables
7 (defun getenv (name &optional default)
8 "Get an environment variable."
9 #+cmu
10 (let (( x (assoc name ext:*environment-list*
11 :test #'string= )))
12 (if x (cdr x) default) )
13 #-cmu
14 (or #+allegro (sys:getenv name)
15 #+clisp (ext:getenv name)
16 #+ecl (si:getenv name)
17 #+sbcl (sb-unix::posix-getenv name)
18 #+lispworks (lispworks:environment-variable name)
19 #-(or allegro clisp ecl sbcl lispworks)
20 (progn (warn "Don't know how to get environment variables in this Lisp. Using the default."))
21 default ))
22
23 ;; Read command line arguements
24 (defun command-line ()
25 "Get `groomed' command line arguments. These should just be the
26 arguments left to you program."
27
28 #+sbcl (cdr sb-ext:*posix-argv*)
29 #+lispworks system:*line-arguments*
30 #+cmu extensions:*command-line-words*
31 #+clisp ext:*args*
32 #-(or sbcl lispworks cmu clisp)
33 (error "Don't know how to get command line arguments in this Lisp.") )
34
35 (defun raw-command-line ()
36 "Get the raw command line. Not very useful as it may contain all
37 sorts of implementation dependent stuff. See COMMAND-LINE for
38 something a bit more useful."
39
40 #+sbcl sb-ext:*posix-argv*
57c60ea @smithzvk A lot of modifications. Long ago lost track, sorry. Bunches of new
authored
41 #+clisp (ext:argv)
42 ;; I don't have these imps
badc7a8 @smithzvk Added some new packages, notably my compatibility functions
authored
43 #+(or lispworks allegro)
44 (command-line)
45 ;; Seems that command-line is the best I can do
46 #+(or cmu)
47 (command-line)
48 #-(or sbcl clisp lispworks allegro cmu)
49 (error "Don't know how to get command line arguments in this Lisp.") )
50
51
57c60ea @smithzvk A lot of modifications. Long ago lost track, sorry. Bunches of new
authored
52 ;; From CLiki
53 (defun quit (&optional code)
54 ;; This group from "clocc-port/ext.lisp"
55 #+allegro (excl:exit code)
56 #+clisp (#+lisp=cl ext:quit #-lisp=cl lisp:quit code)
57 #+cmu (ext:quit code)
58 #+cormanlisp (win32:exitprocess code)
59 #+gcl (lisp:bye code) ; XXX Or is it LISP::QUIT?
60 #+lispworks (lw:quit :status code)
61 #+lucid (lcl:quit code)
62 #+sbcl (sb-ext:quit
63 :unix-code (typecase code (number code) (null 0) (t 1)))
64 ;; This group from Maxima
65 #+kcl (lisp::bye) ; XXX Does this take an arg?
66 #+scl (ext:quit code) ; XXX Pretty sure this *does*.
67 #+(or openmcl mcl) (ccl::quit)
68 #+abcl (cl-user::quit)
69 #+ecl (si:quit)
70 ;; This group from
71 #+poplog (poplog::bye) ; XXX Does this take an arg?
72 #-(or allegro clisp cmu cormanlisp gcl lispworks lucid sbcl
73 kcl scl openmcl mcl abcl ecl)
74 (error 'not-implemented :proc (list 'quit code)))
75 ;; (defun quit (&optional (exit-code 0))
76 ;; #+openmcl (ccl:quit exit-code)
77 ;; #+sbcl (sb-ext:quit :unix-status exit-code)
78 ;; #+clisp (ext:quit exit-code)
79 ;; #+(or cmu allegro) (declare (ignore exit-code))
80 ;; #+cmu (ext:quit)
81 ;; #+lispworks (lispworks:quit :status exit-code)
82 ;; #+allegro (excl:exit)
83 ;; #-(or openmcl sbcl cmu allegro lispworks)
84 ;; (error "Don't know how to quit this Lisp.") )
7eac887 @smithzvk Added compatibility macro WITHOUT-INTERRUPTS.
authored
85
86
87 ;;; Multiprocessing
88
89 (defmacro without-interrupts (&body body)
90 #+sbcl `(sb-sys:without-interrupts ,@body)
3c79397 Added a few new expansions for WITHOUT-INTERRUPTS.
Zach Kost-Smith authored
91 #+ecl `(mp:without-interrupts ,@body)
92 #+cmucl `(system:without-interrupts ,@body)
93 #+ccl `(ccl:without-interrupts ,@body)
94 #-(or sbcl ecl cmucl ccl)
7eac887 @smithzvk Added compatibility macro WITHOUT-INTERRUPTS.
authored
95 (progn
96 (warn "I don't know how to disable interrupts in this implementation")
97 `(progn ,@body) ))
Something went wrong with that request. Please try again.