Changeset 14879


Ignore:
Timestamp:
09/29/16 21:39:05 (5 years ago)
Author:
Mark Evenson
Message:

EXT:OS-{UNIX,WINDOWS}-P now provide a pre-ASDF runtime check on hosting platform

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compile-system.lisp

    r14817 r14879  
    318318      (load (do-compile "ldb.lisp"))
    319319      (load (do-compile "destructuring-bind.lisp"))
     320      (load (do-compile "featurep.lisp"))
     321
    320322      ;; But not for these.
    321323      (mapc #'do-compile '("adjoin.lisp"
     
    369371                           "extensible-sequences.lisp"
    370372                           "fasl-concat.lisp"
    371                            "featurep.lisp"
    372373                           "fdefinition.lisp"
    373374                           "fill.lisp"
  • trunk/abcl/src/org/armedbear/lisp/featurep.lisp

    r11391 r14879  
    5252        (t
    5353         (error "Unknown operator in feature expression: ~S" form)))))
     54
     55;;;; Cribbed from ASDF 3.1.7; duplicated to establish runtime conditionals before ASDF is constructed
     56(defun os-macosx-p ()
     57  "Is the underlying operating system MacOS X?"
     58  ;; OS-MACOSX is not mutually exclusive with OS-UNIX,
     59  ;; in fact the former implies the latter.
     60  (featurep '(:or :darwin (:and :allegro :macosx) (:and :clisp :macos))))
     61
     62(defun os-unix-p ()
     63  "Is the underlying operating system some Unix variant?"
     64  (or (featurep '(:or :unix :cygwin)) (os-macosx-p)))
     65
     66(defun os-windows-p ()
     67  "Is the underlying operating system Microsoft Windows?"
     68  (and (not (os-unix-p)) (featurep '(:or :win32 :windows :mswindows :mingw32 :mingw64))))
     69
     70(defun os-genera-p ()
     71  "Is the underlying operating system Genera (running on a Symbolics Lisp Machine)?"
     72  (featurep :genera))
     73
     74(defun os-oldmac-p ()
     75  "Is the underlying operating system an (emulated?) MacOS 9 or earlier?"
     76  (featurep :mcl))
     77
     78(defun os-haiku-p ()
     79  "Is the underlying operating system Haiku?"
     80  (featurep :haiku))
     81
     82(export '(os-unix-p os-windows-p))
     83
  • trunk/abcl/src/org/armedbear/lisp/run-program.lisp

    r14871 r14879  
    171171   (if value
    172172       (namestring value)
    173        #+unix "/dev/null"
    174        #+windows "nul"
    175        #-(or unix windows) (error "Don't know how to set up null stream on this platform."))))
     173       (cond
     174         ((ext:os-unix-p)
     175          "/dev/null")
     176         ((ext:os-windows-p)
     177          "nul")
     178         (t
     179          (error "Don't know how to set up null stream on this platform."))))))
    176180
    177181(defun setup-input-redirection (process-builder value if-does-not-exist)
     
    299303  (ignore-errors (java:jcall "exitValue" jprocess)))
    300304
    301 #+unix
    302 (defconstant +pid-field+
    303   (let ((field (java:jcall "getDeclaredField" (java:jclass "java.lang.UNIXProcess") "pid")))
    304     (java:jcall "setAccessible" field java:+true+)
    305     field))
    306 
    307305(defun %process-pid (jprocess)
    308   #+unix (java:jcall "get" +pid-field+ jprocess)
    309   #-unix (error "Can't retrieve PID on this platform."))
     306  (if (ext:os-unix-p)
     307      ;; TODO: memoize this
     308      (let ((field (java:jcall "getDeclaredField" (java:jclass "java.lang.UNIXProcess") "pid")))
     309        (java:jcall "setAccessible" field java:+true+)
     310        (java:jcall "get" field jprocess))
     311      (error "Can't retrieve PID on this platform.")))
    310312
    311313(defun %process-kill (jprocess)
Note: See TracChangeset for help on using the changeset viewer.