File: cormanlisp.lisp

package info (click to toggle)
xemacs21-packages 2009.02.17.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 116,928 kB
  • ctags: 88,975
  • sloc: lisp: 1,232,060; ansic: 16,570; java: 13,514; xml: 6,477; sh: 4,611; makefile: 4,036; asm: 3,007; perl: 839; cpp: 500; ruby: 257; csh: 96; haskell: 93; awk: 49; python: 47
file content (143 lines) | stat: -rw-r--r-- 4,502 bytes parent folder | download | duplicates (9)
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
;;; -*- Mode: Lisp; tab-width: 4 -*-
;;; cormanlisp.lisp --

;;; This file is part of ILISP.
;;; Version: 5.8 - 5.10
;;;
;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
;;;               1993, 1994 Ivan Vasquez
;;;               1994, 1995, 1996 Marco Antoniotti and Rick Busdiecker
;;;               1996 Marco Antoniotti and Rick Campbell
;;;		  	      2000 Reini Urban
;;;
;;; Other authors' names for which this Copyright notice also holds
;;; may appear later in this file.
;;;
;;; ILISP is freely redistributable under the terms found in the file
;;; COPYING.

;;;
;;; Cormanlisp initializations
;;; Author: Reini Urban <rurban@x-ray.at>
;;;
(in-package "ILISP")

(defun ilisp-source-files (symbol package type)
  "Print each file for PACKAGE:SYMBOL's TYPE definition on a line and
return T if successful."
  (declare (ignore type))
  (ilisp-errors
   (let* ((symbol (ilisp-find-symbol symbol package))
	  (type t)
	  ;;(type (if (equal type "any") t (ilisp-find-symbol type "keyword")))
	  (paths (when symbol (debug::function-source-file symbol))))
     (if paths
	 (progn
	   (if (eq type t)
	       (dolist (path (remove-duplicates paths
						:key #'cdr :test #'equal))
		 (print (namestring (cdr path))))
	       (print (namestring paths)))
	   t)
	 nil))))

(export '(ilisp-source-files))

;;; ILISP Patches for cormanlisp <= 2.0

(in-package :common-lisp)

(defun inspect (symbol)
  (describe symbol))

;; not really needed with my cl-ilisp.lisp patch, but for legacy sake
(defun special-form-p (symbol)
  (special-operator-p symbol))

(unless (fboundp 'compile-file-pathname)

(defvar fasl-file-extension ".fasl")
;;;
;;; Common Lisp COMPILE-FILE-PATHNAME function.
;;;
;;; CLtL2: "If an implementation supports additional keyword arguments to
;;; compile-file, compile-file-pathname must accept the same arguments."
;;;
(defun compile-file-pathname (input-file &key 
                                         (output-file nil)
                                         (verbose *compile-verbose*)
                                         (print *compile-print*)
                                         (external-format :default))
  (create-pathname-from-string
   (compile-file-name  (namestring (pathname input-file))
					  :output-file output-file
					  :verbose     verbose
					  :print       print
					  :external-format external-format)))

(defun compile-file-name (input-file &key 
									 (output-file nil)
									 (verbose *compile-verbose*)
									 (print *compile-print*)
									 (external-format :default))
  "Returns the compiled filename string for the input-file string"
  (declare (ignore verbose external-format print))
  (if (null output-file)
      (if (string-equal
           (subseq input-file 
                   (- (length input-file)(length lisp-file-extension))
                   (length input-file))
           lisp-file-extension)
          (concatenate 'string 
                       (subseq input-file 
                               0
                               (- (length input-file)
								  (length lisp-file-extension)))
                       fasl-file-extension)
        (concatenate 'string input-file fasl-file-extension))
     (namestring (pathname output-file))))

) ; eof compile-file-pathname patch

(unless (fboundp 'readtable-case)
  
;;;
;;; Common Lisp READTABLE-CASE accessor
;;;
;;; Note: at booting check-type,warn,defun setf are not defined
;;;
(defun readtable-case (readtbl)
  (if (macro-function 'check-type)	; booting
	  (check-type readtbl readtable)
	;; else
    (if (not (readtablep readtbl))
		(error "Argument is no valid readtable: ~A" readtbl)))
  (uref readtbl readtable-case-offset))

(defun set-readtable-case (readtbl value)
  "For compatibility only. All values except :UPCASE are ignored."
  (let ((valid-case '(:upcase))
		(ignored-case '(:downcase :preserve :invert)))
	(if (macro-function 'check-type)	; booting
		(progn
		  (check-type readtbl readtable)
		  (check-type value symbol)))
	(cond 
	 ((member value valid-case)
	  (setf (uref readtbl readtable-case-offset) value))
	 ((member value ignored-case)
	  (error "SET-READTABLE-CASE: only :UPCASE supported: ~A" 
			value))
	 (T
	  (error "Argument is no valid readtable-case: ~A, expected ~A"
			 value valid-case)))))

;;; bootstrapping
(set-readtable-case *readtable* ':upcase)
(set-readtable-case *common-lisp-readtable* ':upcase)

(defsetf readtable-case set-readtable-case)

)  ; eof readtable-case patch

(in-package :ilisp)