annotate lisp/ilisp/allegro.lisp @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; -*- Mode: Lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; allegro.lisp --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; This file is part of ILISP.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 0
diff changeset
6 ;;; Version: 5.8
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; 1993, 1994 Ivan Vasquez
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 0
diff changeset
10 ;;; 1994, 1995, 1996 Marco Antoniotti and Rick Busdiecker
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 0
diff changeset
11 ;;; 1996 Marco Antoniotti and Rick Campbell
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; Other authors' names for which this Copyright notice also holds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; may appear later in this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 0
diff changeset
16 ;;; Send mail to 'ilisp-request@naggum.no' to be included in the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 0
diff changeset
17 ;;; ILISP mailing list. 'ilisp@naggum.no' is the general ILISP
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; mailing list were bugs and improvements are discussed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; ILISP is freely redistributable under the terms found in the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; COPYING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Allegro initializations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Author: Chris McConnell, ccm@cs.cmu.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (in-package "ILISP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (defun ilisp-callers (symbol package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 "Print a list of all of the functions that call FUNCTION and return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 T if successful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (let ((function (ilisp-find-symbol symbol package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (callers nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (*print-level* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (*print-length* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (*package* (find-package 'lisp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (when (and function (fboundp function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (labels ((in-expression (function expression)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (cond ((null expression) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ((listp expression)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (let ((header (first expression)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (if (or (eq header function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (and (eq header 'function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (eq (second expression) function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (dolist (subexp expression)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (when (in-expression function subexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (return t)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (excl::who-references
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #'(lambda (function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (push (excl::fn_symdef function) callers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (do-all-symbols (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (when (and (fboundp symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (not (compiled-function-p (symbol-function symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (in-expression function (symbol-function symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (push symbol callers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (dolist (caller callers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (print caller))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defun ilisp-source-files (symbol package type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "Print each file for PACKAGE:SYMBOL's TYPE definition on a line and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 return T if successful."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (let* ((symbol (ilisp-find-symbol symbol package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (type (if (equal type "any") t (ilisp-find-symbol type "keyword")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (paths (when symbol (excl:source-file symbol type))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (if paths
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (if (eq type t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (dolist (path (remove-duplicates paths
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 :key #'cdr :test #'equal))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (print (namestring (cdr path))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (print (namestring paths)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (dolist (symbol '(ilisp-callers ilisp-source-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (export symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (unless (compiled-function-p #'ilisp-callers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (format t "\"ILISP: File is not compiled, use M-x ilisp-compile-inits\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87