/usr/lib/gcl-2.6.12/lsp/gcl_autoload.lsp is in gcl 2.6.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | ;; Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
;; This file is part of GNU Common Lisp, herein referred to as GCL
;;
;; GCL is free software; you can redistribute it and/or modify it under
;; the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; GCL is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
;; License for more details.
;;
;; You should have received a copy of the GNU Library General Public License
;; along with GCL; see the file COPYING. If not, write to the Free Software
;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;;; AUTOLOAD
;;; Go into LISP.
(in-package 'lisp)
;(defvar *features*)
(defun lisp-implementation-type () "GNU Common Lisp (GCL)")
(defun machine-type () #+sun "SUN"
#+hp-ux "HP-UX"
#+eclipse "ECLIPSE"
#+vax "VAX"
)
;(defun machine-type () "DEC VAX11/780")
(defun machine-version () (machine-type))
;(defun machine-version () nil)
(defun machine-instance () (machine-type))
;(defun machine-instance () nil)
(defun software-type ()
#+aosv "AOS/VS"
#+bsd "BSD"
#+system-v "SYSTEM-V"
#+hp-ux "HP-UX")
;(defun software-type () "UNIX BSD")
(defun software-version () (software-type))
;(defun software-version () "4.2BSD")
;(defun short-site-name () "RIMS")
(defun short-site-name () nil)
;(defun long-site-name ()
; "Research Institute for Mathematical Sciences, Kyoto University")
(defun long-site-name () nil)
;;; Compiler functions.
(defun proclaim (d)
(when (eq (car d) 'special) (mapc #'si:*make-special (cdr d))))
(defun proclamation (d)
(and (eq (car d) 'special)
(dolist (var (cdr d) t)
(unless (si:specialp var) (return nil)))))
(defun compile-file (&rest args)
(error "COMPILE-FILE is not defined in this load module."))
(defun compile (&rest args)
(error "COMPILE is not defined in this load module."))
(defun disassemble (&rest args)
(error "DISASSEMBLE is not defined in this load module."))
;;; Editor.
;
(defun get-decoded-time ()
(decode-universal-time (get-universal-time)))
#+never
(defun get-universal-time ()
(multiple-value-bind (sec min h d m y dow dstp tz)
(get-decoded-time)
(encode-universal-time sec min h d m y tz)))
; Set the default system editor to a fairly certain bet.
#-winnt(defvar *gcl-editor* "vi")
#+winnt(defvar *gcl-editor* "notepad")
(defun new-ed (editor-name)
"Change the editor called by (ed) held in *gcl-editor*."
(setf *gcl-editor* editor-name))
(defun ed (&optional name)
"Edit a file using the editor named in *gcl-editor*; customise with new-ed()."
(if (null name)
(system *gcl-editor*)
(cond ((stringp name)
(system (format nil "~A ~A" *gcl-editor* name))) ; If string, assume file name.
((pathnamep name)
(system (format nil "~A ~A" *gcl-editor* (namestring name)))) ; If pathname.
(t
(let ((body (symbol-function name)))
(cond ((compiled-function-p body) (error "You can't edit compiled functions."))
((and body
(consp body)
(eq (car body) 'lambda-block)) ; If lambda block, save file and edit.
(let ((ed-file (concatenate 'string
(temp-dir)
(format nil "~A" (cadr body))
".lisp")))
(with-open-file
(st ed-file :direction :output)
(print `(defun ,name ,@ (cddr body)) st))
(system (format nil "~A ~A" *gcl-editor* ed-file))))
(t (system (format nil "~A ~A" *gcl-editor* name))))))))) ; Use symbol as filename
;;; Allocator.
(import 'si::allocate)
(export '(allocate
;allocated-pages maximum-allocatable-pages
;allocate-contiguous-pages
;allocated-contiguous-pages maximum-contiguous-pages
;allocate-relocatable-pages allocated-relocatable-pages
sfun gfun cfun cclosure spice structure))
;(defvar type-character-alist
; '((cons . #\.)
; (fixnum . #\N)
; (bignum . #\B)
; (ratio . #\R)
; (short-float . #\F)
; (long-float . #\L)
; (complex . #\C)
; (character . #\#)
; (symbol . #\|)
; (package . #\:)
; (hash-table . #\h)
; (array . #\a)
; (vector . #\v)
; (string . #\")
; (bit-vector . #\b)
; (structure . #\S)
; (sfun . #\g)
; (stream . #\s)
; (random-state . #\$)
; (readtable . #\r)
; (pathname . #\p)
; (cfun . #\f)
; (vfun . #\V)
; (cclosure . #\c)
; (spice . #\!)))
;
;(defun get-type-character (type)
; (let ((a (assoc type type-character-alist)))
; (unless a
; (error "~S is not an implementation type.~%~
; It should be one of:~%~
; ~{~10T~S~^~30T~S~^~50T~S~%~}~%"
; type
; (mapcar #'car type-character-alist)))
; (cdr a)))
;(defun allocate (type quantity &optional really-allocate)
; (si:alloc (get-type-character type) quantity really-allocate))
;(defun allocated-pages (type)
; (si:npage (get-type-character type)))
;(defun maximum-allocatable-pages (type)
; (si:maxpage (get-type-character type)))
;(defun allocate-contiguous-pages (quantity &optional really-allocate)
; (si::alloc-contpage quantity really-allocate))
;(defun allocated-contiguous-pages ()
; (si:ncbpage))
;(defun maximum-contiguous-pages ()
; (si::maxcbpage))
;(defun allocate-relocatable-pages (quantity &optional really-allocate)
; (si::alloc-relpage quantity))
;(defun allocated-relocatable-pages ()
; (si::nrbpage))
;; FIXME This has to come straight from enum.h. CM 20050114
(defvar *type-list*
'(cons
fixnum bignum ratio short-float long-float complex
character symbol package hash-table
array vector string bit-vector
structure stream random-state readtable pathname
cfun cclosure sfun gfun vfun afun closure cfdata spice))
(defun heaprep nil
(let ((f (list
"word size: ~a bits~%"
"page size: ~a bytes~%"
"heap start: 0x~x~%"
"heap max : 0x~x~%"
"shared library start: 0x~x~%"
"cstack start: 0x~x~%"
"cstack mark offset: ~a bytes~%"
"cstack direction: ~[downward~;upward~;~]~%"
"cstack alignment: ~a bytes~%"
"cstack max: ~a bytes~%"
"immfix start: 0x~x~%"
"immfix size: ~a fixnums~%"
"physical memory: ~a pages~%"))
(v (multiple-value-list (si::heap-report))))
(do ((v v (cdr v)) (f f (cdr f))) ((not (car v)))
(format t (car f)
(let ((x (car v)))
(cond ((>= x 0) x)
((+ x (* 2 (1+ most-positive-fixnum))))))))))
(defun room (&optional x)
(let ((l (multiple-value-list (si:room-report)))
maxpage leftpage ncbpage maxcbpage ncb cbgbccount npage maxnpage
rbused rbfree nrbpage maxrbpage
info-list link-alist)
(setq maxpage (nth 0 l) leftpage (nth 1 l)
ncbpage (nth 2 l) maxcbpage (nth 3 l) ncb (nth 4 l)
cbgbccount (nth 5 l)
holepage (nth 6 l)
rbused (nth 7 l) rbfree (nth 8 l) nrbpage (nth 9 l)
maxrbpage (nth 10 l)
rbgbccount (nth 11 l)
l (nthcdr 12 l))
(do ((l l (nthcdr 5 l))
(tl *type-list* (cdr tl))
(j 0 (+ j (if (nth 3 l) (nth 3 l) 0)))
(i 0 (+ i (if (nth 2 l) (nth 2 l) 0))))
((null l) (setq npage i maxnpage j))
(let ((typename (car tl))
(nused (nth 0 l))
(nfree (nth 1 l))
(npage (nth 2 l))
(maxpage (nth 3 l))
(gbccount (nth 4 l)))
(if nused
(push (list typename npage maxpage
(if (zerop (+ nused nfree))
0
(/ nused 0.01 (+ nused nfree)))
(if (zerop gbccount) nil gbccount))
info-list)
(let ((a (assoc (nth nfree *type-list*) link-alist)))
(if a
(nconc a (list typename))
(push (list (nth nfree *type-list*) typename)
link-alist))))))
(terpri)
(dolist (info (reverse info-list))
(apply #'format t "~8D/~D~19T~6,1F%~@[~8D~]~35T~{~A~^ ~}"
(append (cdr info)
(if (assoc (car info) link-alist)
(list (assoc (car info) link-alist))
(list (list (car info))))))
(terpri)
)
(terpri)
(format t "~8D/~D~26T~@[~8D~]~35Tcontiguous (~D blocks)~%"
ncbpage maxcbpage (if (zerop cbgbccount) nil cbgbccount) ncb)
(format t "~9T~D~35Thole~%" holepage)
(format t "~8D/~D~19T~6,1F%~@[~8D~]~35Trelocatable~%~%"
nrbpage maxrbpage (/ rbused 0.01 (+ rbused rbfree))
(if (zerop rbgbccount) nil rbgbccount))
(format t "~10D pages for cells~%~%" npage)
(format t "~10D total pages in core~%" (+ npage ncbpage nrbpage))
(format t "~10D current core maximum pages~%" (+ maxnpage maxcbpage maxrbpage))
(format t "~10D pages reserved for gc~%" maxrbpage)
(format t "~10D pages available for adding to core~%" leftpage)
(format t "~10D pages reserved for core exhaustion~%~%" (- maxpage (+ maxnpage maxcbpage (ash maxrbpage 1) leftpage)))
(format t "~10D maximum pages~%" maxpage)
(values)
)
(when x
(format t "~%~%")
(format t "Key:~%~%WS: words per struct~%UP: allocated pages~%MP: maximum pages~%FI: fraction of cells in use on allocated pages~%GC: number of gc triggers allocating this type~%~%")
(heaprep))
(values))
;;; C Interface.
(defmacro Clines (&rest r) nil)
(defmacro defCfun (&rest r) nil)
(defmacro defentry (&rest r) nil)
(defmacro defla (&rest r) (cons 'defun r))
;;; Help.
(export '(help help*))
(defun help (&optional (symbol nil s))
(if s (si::print-doc symbol)
(progn
(princ "
Welcome to GNU Common Lisp (GCL for short).
Here are some functions you should learn first.
(HELP symbol) prints the online documentation associated with the
symbol. For example, (HELP 'CONS) will print the useful information
about the CONS function, the CONS data type, and so on.
(HELP* string) prints the online documentation associated with those
symbols whose print-names have the string as substring. For example,
(HELP* \"PROG\") will print the documentation of the symbols such as
PROG, PROGN, and MULTIPLE-VALUE-PROG1.
(SI::INFO <some string>) chooses from a list of all references in the
on-line documentation to <some string>.
(APROPOS <some string>) or (APROPOS <some string> '<a package>) list
all symbols containing <some string>.
(DESCRIBE '<symbol>) or (HELP '<symbol>) describe particular symbols.
(BYE) or (BY) ends the current GCL session.
Good luck! The GCL Development Team")
(values))))
(defun help* (string &optional (package (find-package "LISP")))
(si::apropos-doc string package))
;;; Pretty-print-formats.
;;;
;;; The number N as the property of a symbol SYMBOL indicates that,
;;; in the form (SYMBOL f1 ... fN fN+1 ... fM), the subforms fN+1,...,fM
;;; are the 'body' of the form and thus are treated in a special way by
;;; the KCL pretty-printer.
(setf (get 'lambda 'si:pretty-print-format) 1)
(setf (get 'lambda-block 'si:pretty-print-format) 2)
(setf (get 'lambda-closure 'si:pretty-print-format) 4)
(setf (get 'lambda-block-closure 'si:pretty-print-format) 5)
(setf (get 'block 'si:pretty-print-format) 1)
(setf (get 'case 'si:pretty-print-format) 1)
(setf (get 'catch 'si:pretty-print-format) 1)
(setf (get 'ccase 'si:pretty-print-format) 1)
(setf (get 'clines 'si:pretty-print-format) 0)
(setf (get 'compiler-let 'si:pretty-print-format) 1)
(setf (get 'cond 'si:pretty-print-format) 0)
(setf (get 'ctypecase 'si:pretty-print-format) 1)
(setf (get 'defcfun 'si:pretty-print-format) 2)
(setf (get 'define-setf-method 'si:pretty-print-format) 2)
(setf (get 'defla 'si:pretty-print-format) 2)
(setf (get 'defmacro 'si:pretty-print-format) 2)
(setf (get 'defsetf 'si:pretty-print-format) 3)
(setf (get 'defstruct 'si:pretty-print-format) 1)
(setf (get 'deftype 'si:pretty-print-format) 2)
(setf (get 'defun 'si:pretty-print-format) 2)
(setf (get 'do 'si:pretty-print-format) 2)
(setf (get 'do* 'si:pretty-print-format) 2)
(setf (get 'do-symbols 'si:pretty-print-format) 1)
(setf (get 'do-all-symbols 'si:pretty-print-format) 1)
(setf (get 'do-external-symbols 'si:pretty-print-format) 1)
(setf (get 'dolist 'si:pretty-print-format) 1)
(setf (get 'dotimes 'si:pretty-print-format) 1)
(setf (get 'ecase 'si:pretty-print-format) 1)
(setf (get 'etypecase 'si:pretty-print-format) 1)
(setf (get 'eval-when 'si:pretty-print-format) 1)
(setf (get 'flet 'si:pretty-print-format) 1)
(setf (get 'labels 'si:pretty-print-format) 1)
(setf (get 'let 'si:pretty-print-format) 1)
(setf (get 'let* 'si:pretty-print-format) 1)
(setf (get 'locally 'si:pretty-print-format) 0)
(setf (get 'loop 'si:pretty-print-format) 0)
(setf (get 'macrolet 'si:pretty-print-format) 1)
(setf (get 'multiple-value-bind 'si:pretty-print-format) 2)
(setf (get 'multiple-value-prog1 'si:pretty-print-format) 1)
(setf (get 'prog 'si:pretty-print-format) 1)
(setf (get 'prog* 'si:pretty-print-format) 1)
(setf (get 'prog1 'si:pretty-print-format) 1)
(setf (get 'prog2 'si:pretty-print-format) 2)
(setf (get 'progn 'si:pretty-print-format) 0)
(setf (get 'progv 'si:pretty-print-format) 2)
(setf (get 'return 'si:pretty-print-format) 0)
(setf (get 'return-from 'si:pretty-print-format) 1)
(setf (get 'tagbody 'si:pretty-print-format) 0)
(setf (get 'the 'si:pretty-print-format) 1)
(setf (get 'throw 'si:pretty-print-format) 1)
(setf (get 'typecase 'si:pretty-print-format) 1)
(setf (get 'unless 'si:pretty-print-format) 1)
(setf (get 'unwind-protect 'si:pretty-print-format) 0)
(setf (get 'when 'si:pretty-print-format) 1)
(setf (get 'with-input-from-string 'si:pretty-print-format) 1)
(setf (get 'with-open-file 'si:pretty-print-format) 1)
(setf (get 'with-open-stream 'si:pretty-print-format) 1)
(setf (get 'with-output-to-string 'si:pretty-print-format) 1)
(in-package 'si)
(defvar *lib-directory* (namestring (truename "../")))
(import '(*lib-directory* *load-path* *system-directory*) 'si::user)
|