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

Last change on this file since 13773 was 13067, checked in by rme, 10 years ago

Update copyright notices.

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