annotate lisp/oobr/br-python.el @ 215:1f0dabaa0855 r20-4b6

Import from CVS: tag r20-4b6
author cvs
date Mon, 13 Aug 2007 10:07:35 +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 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: br-python.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Support routines for Python inheritance browsing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: oop, tools, python
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Harri Pasanen, based on Smalltalk and C++ browsers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; by Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; ORG: Tekla Oy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; ORIG-DATE: 5-Apr-96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; LAST-MOD: 12-Apr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Copyright (C) 1990-1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; See the file BR-COPY for license information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; This file is part of the OO-Browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; See 'python-class-def-regexp' for regular expression that matches class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; definitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (mapcar 'require '(br-lib hypb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; User visible variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar python-lib-search-dirs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "List of directories below which Python Library source files are found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 Subdirectories of Library source are also searched. A Library is a stable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 group of classes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defvar python-sys-search-dirs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "List of directories below which Python System source files are found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 Subdirectories of System source are also searched. A System class is one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 that is not yet reusable and is likely to change before release.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defconst python-narrow-view-to-class nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "*Non-nil means narrow buffer to just the matching class definition when displayed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; following is reserved for future, currently does not work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (defconst python-duplicate-classnames-across-modules nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 "*Non-nil means that the module name is prepended to class names.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; Internal functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defun python-get-classes-from-source (filename &optional skip-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 skip-tags-cleanup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 "Scans FILENAME and returns cons of class list with parents-class alist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Handles multiple inheritance. Assumes file existence and readability have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 already been checked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (let ((no-kill (get-file-buffer filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 classes class parents parent-cons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if no-kill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (set-buffer no-kill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (funcall br-view-file-function filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (or skip-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (progn (setq signatures (python-scan-features))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (goto-char (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (while (re-search-forward python-class-def-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (setq has-parents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (= ?\( (char-after (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (setq class (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 parent-cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; Return parents as a list, or nil if no parents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (if has-parents (python-scan-parents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 class))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; Assume class name not found within a comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq classes (cons class classes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 parents (cons parent-cons parents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (or skip-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; Scan members defined within class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (setq signatures
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 signatures
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (python-scan-features-in-class class (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (python-locate-class-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (if skip-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (python-get-feature-tags buffer-file-name (python-sort-features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 signatures))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (or skip-tags-cleanup (br-feature-tags-save)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (or no-kill (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (cons classes (delq nil parents)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defun python-scan-parents ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 "Return list of parents names from a Python class definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 Point must be after the '(' that begins the parent list and before the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 first parent entry when this function is called."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (let ((parent-list) (again t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (while (and again (re-search-forward python-parent-class-name nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (setq again (= ?, (char-after (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 parent (buffer-substring (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (match-end 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 parent-list (cons parent parent-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (nreverse parent-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defun python-locate-class-end ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "Look up the end of class. Point is assumed to be in the class definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 Do this by looking up the first line that begins with python-identifier-chars."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (let ((result-point (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (concat "^[" python-identifier-chars "]") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (setq result-point (- (match-beginning 0) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (if (python-within-string-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (python-locate-class-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 result-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 result-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (defun python-get-parents-from-source (filename class-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 "Scan source in FILENAME and return list of parents of CLASS-NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 Assume file existence has already been checked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (or (null class-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (car (car (br-rassoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 class-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (cdr (python-get-classes-from-source filename)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (defun python-select-path (paths-htable-elt &optional feature-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 "Select proper pathname from PATHS-HTABLE-ELT based upon value of optional FEATURE-P.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 Selection is between path of class definition and path for features associated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 with the class."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (cdr paths-htable-elt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (defun python-set-case (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 "Return string TYPE identifier for use as a class name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (defun python-set-case-type (class-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "Return string CLASS-NAME for use as a type identifier."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 class-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defun python-to-comments-begin ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Skip back from current point past any preceding Python comments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 Presently NoOp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun python-class-definition-regexp (class &optional regexp-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "Return regexp to uniquely match the definition of CLASS name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 Optional REGEXP-FLAG non-nil means CLASS has already been quoted for use in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 regular expression. (not meaningful for Python)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (concat python-class-name-before class whitespace))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;;; Internal variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (defconst python-type-tag-separator "@"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "String that separates a tag's type from its normalized definition form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 This should be a single character which is unchanged when quoted for use as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 literal in a regular expression.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (defconst python-identifier-chars "a-zA-Z0-9_"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 "String of chars and char ranges that may be used within a Python identifier.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defconst python-identifier (concat "\\([a-zA-Z_][" python-identifier-chars "]*\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "Regular expression matching a Python identifier.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (defconst whitespace "[ \t]*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (defconst python-parent-class-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (concat whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "\\(" python-identifier "\\.\\)*" ; possible module name precedes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 python-identifier whitespace)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 "Regular expression matching optional Python parent class")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (defconst python-class-name-before "^class[ \t]+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "Regexp preceding the class name in a class definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 Note: this does not allow for nested classes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (defconst python-class-name-after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (concat whitespace python-parent-class-name whitespace ":")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 "Regexp following the class name in a class definition.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (defconst python-class-def-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (concat python-class-name-before python-identifier whitespace)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ; (concat python-class-name-before python-identifier python-class-name-after)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 "Regular expression used to match to class definitions in source text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 Class name identifier is grouped expression 1. Parent identifier is grouped
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 expression 2.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (defconst python-lang-prefix "python-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "Prefix string that starts \"br-python.el\" symbol names.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (defconst python-src-file-regexp ".\\.py$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 "Regular expression matching a unique part of Python source file name and no others.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defvar python-children-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "Htable whose elements are of the form: (LIST-OF-CHILD-CLASSES . CLASS-NAME).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 Used to traverse Python inheritance graph. 'br-build-children-htable' builds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 this list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defvar python-parents-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 Used to traverse Python inheritance graph. 'br-build-parents-htable' builds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 this list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (defvar python-paths-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 "Htable whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 'br-build-paths-htable' builds this list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (defvar python-lib-parents-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 Only classes from stable software libraries are used to build the list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (defvar python-lib-paths-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "Htable whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Only classes from stable software libraries are used to build the list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (defvar python-sys-parents-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 Only classes from systems that are likely to change are used to build the list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (defvar python-sys-paths-htable nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 "Alist whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 Only classes from systems that are likely to change are used to build the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (defvar python-lib-prev-search-dirs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "Used to check if 'python-lib-classes-htable' must be regenerated.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (defvar python-sys-prev-search-dirs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 "Used to check if 'python-sys-classes-htable' must be regenerated.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (defvar python-env-spec nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "Non-nil value means Environment specification has been given but not yet built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 Nil means current Environment has been built, though it may still require updating.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (provide 'br-python)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255