source: trunk/ccl/level-1/l1-boot-1.lisp @ 3895

Last change on this file since 3895 was 3895, checked in by gb, 15 years ago

HOST-PLATFORM, PLATFORM-DESCRIPTION: generalize, a little.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1;;;-*-Mode: LISP; Package: CCL -*-
2;;;
3;;;   Copyright (C) 1994-2001 Digitool, Inc
4;;;   This file is part of OpenMCL. 
5;;;
6;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with OpenMCL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
13;;;
14;;;   The LLGPL is also available online at
15;;;   http://opensource.franz.com/preamble.html
16
17;; L1-boot.lisp
18
19(in-package "CCL")
20
21(defparameter *gensym-counter* 0 "counter for generating unique GENSYM symbols")
22
23(defparameter *inhibit-greeting* nil)
24
25;the below 3 variables are expected to be redefined in the user's init file
26(defparameter *short-site-name* nil)
27(defparameter *long-site-name* nil)
28#|
29(defparameter *machine-instance* nil)
30|#
31
32(defun lisp-implementation-type () "OpenMCL")
33
34
35(defparameter *platform-os-names*
36  `((,platform-os-vxworks . :vxwork)
37    (,platform-os-linux . :linux)
38    (,platform-os-solaris . :solaris)
39    (,platform-os-darwin . :darwin)))
40
41(defparameter *platform-cpu-names*
42  `((,platform-cpu-ppc . :ppc)
43    (,platform-cpu-sparc . :sparc)
44    (,platform-cpu-x86 . :x86)))
45
46(defun host-platform ()
47  (let* ((pf (%get-kernel-global 'host-platform)))
48    (values
49     (or (cdr (assoc (logand pf platform-os-mask)
50                     *platform-os-names*))
51         :unknown)
52     (if (logtest pf platform-word-size-mask)
53       64
54       32)
55     (or (cdr (assoc (logand pf platform-cpu-mask)
56                     *platform-cpu-names*))
57         :unknown))))
58
59
60(defun platform-description ()
61  (multiple-value-bind (os bits cpu) (host-platform)
62    (format nil "~a~a~d" (string-capitalize os) cpu bits)))
63
64(defun lisp-implementation-version ()
65  (%str-cat "Version " (format nil *openmcl-version* (platform-description))))
66
67
68
69
70(defun replace-base-translation (host-dir new-base-dir)
71  (let* ((host (pathname-host host-dir))
72         (host-dir (full-pathname host-dir))
73         (trans (logical-pathname-translations host))
74         (host-wild (merge-pathnames "**/*.*" host-dir)))
75    (setq host-dir (pathname-directory host-dir))
76    (setq new-base-dir (pathname-directory new-base-dir))
77    (setf 
78     (logical-pathname-translations host)
79     (mapcar
80      #'(lambda (pair)
81          (let ((rhs (cadr pair)))
82            (if (and (physical-pathname-p rhs)
83                     (pathname-match-p rhs host-wild))
84              (list (car pair)
85                    (merge-pathnames 
86                     (make-pathname 
87                      :defaults nil 
88                      :directory (append new-base-dir
89                                         (nthcdr (length host-dir) 
90                                                 (pathname-directory rhs))))
91                     rhs))
92              pair)))
93      trans))))
94
95
96
97
98; only do these if exist
99(defun init-logical-directories () 
100  (let ((startup (mac-default-directory)))
101    (replace-base-translation "home:" (or (user-homedir-pathname) startup))
102    (replace-base-translation "ccl:" (ccl-directory))
103    ))
104
105(push #'init-logical-directories *lisp-system-pointer-functions*)
106
107
108(catch :toplevel
109  (setq *loading-file-source-file* nil)  ;Reset from last %fasload...
110  (init-logical-directories)
111  )
112
113
114
115
116
117
Note: See TracBrowser for help on using the repository browser.