annotate lisp/callers-of-rpt.el @ 5891:a0e751d6c3ad

Import the #'clear-string API from GNU, use it in tls.c src/ChangeLog addition: 2015-04-18 Aidan Kehoe <kehoea@parhasard.net> * sequence.c (Fclear_string): New, API from GNU. Zero a string's contents, making sure the text is not kept around even when the string's data is reallocated because of a changed character length. * sequence.c (syms_of_sequence): Make it available to Lisp. * lisp.h: Make it available to C code. * tls.c (nss_pk11_password): Use it. * tls.c (gnutls_pk11_password): Use it. * tls.c (openssl_password): Use it. tests/ChangeLog addition: 2015-04-18 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test #'clear-string, just added. Unfortunately there's no way to be certain from Lisp that the old password data has been erased after realloc; it may be worth adding a test to tests.c, but *we'll be reading memory we shouldn't be*, so that gives me pause.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 18 Apr 2015 23:00:14 +0100
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; callers-of-rpt.el --- generate call graph of lisp in XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Karl Hegbloom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Author: Karl Hegbloom <karlheg@inetarena.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
12 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
13 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
14 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
15 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
20 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 428
diff changeset
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;;; Synched up with: not in FSF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;; Grep-2.1 is required.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;; Modify the `xemacs-src-lisp-dir' and `xemacs-pkg-lisp-dir' to reflect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;; where these directories live on your local system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 (defvar xemacs-src-lisp-dir "/usr/src/xemacs-20.0/lisp/"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 "Where the XEmacs 20 lisp sources live.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (defvar xemacs-pkg-lisp-dir "/home/xemacs/packages/"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 "Where the package lisp sources live.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; (makunbound 'caller-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (defconst caller-table (make-hash-table :test 'equal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 "Hash table keyed on the symbols being required. Each element will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 be a list of file-names of programs that depend on them.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;;./apel/atype.el:(require 'emu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;;./apel/atype.el:(require 'alist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;;./apel/emu-e19.el: (require 'emu-xemacs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;;./apel/emu-e19.el: (require 'emu-19)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 (defun make-caller-report ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 "Generate a simple report showing .el files that are `require'd by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 other .el files, and the list of programs that depend on them."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (let ((cmd-out (get-buffer-create "*caller-report find-grep output*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (rpt (get-buffer-create "* caller report *"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 (switch-to-buffer cmd-out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (buffer-disable-undo cmd-out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 (set-syntax-table emacs-lisp-mode-syntax-table cmd-out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 (erase-buffer cmd-out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (message "Running the find | grep...")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; Note: Edit this part as needed for your installation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 (shell-command (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;; First the installed lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 "cd " xemacs-src-lisp-dir " ;"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 "grep -H '(require ' $(find -name '*.el' -print) |"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 " grep -v 'auto-autoloads\\.el\\|callers-of-rpt\\.el' |"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 " grep -v 'el:[ \t]*;\\|require load' ;" ; ones commented off, and cus-edit.el
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ;; Then the packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 "cd " xemacs-pkg-lisp-dir " ;"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 "grep -H '(require ' $(find -name '*.el' -print) |"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 " grep -v 'auto-autoloads\\.el\\|callers-of-rpt\\.el' |"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 " grep -v 'el:[ \t]*;' ;" ; ones commented off
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 cmd-out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (message "Running the find | grep... Done.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 (while (not (eobp))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 (setq file-name (buffer-substring (+ (point) 2) ; skip the leading "./"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 (skip-chars-forward "^:")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 cmd-out))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (re-search-forward "(require '" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 (let* ((key (buffer-substring (point) (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (skip-chars-forward "^) ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 cmd-out))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 (lst (gethash key caller-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (unless (member file-name lst)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (puthash key (cons file-name lst) caller-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 (sit-for 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 (switch-to-buffer rpt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (buffer-disable-undo rpt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 (erase-buffer rpt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (let (keys)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (maphash #'(lambda (key val) (push key keys)) caller-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 (setq keys (sort keys #'string<))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (mapc #'(lambda (key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (insert (format "(%s '(" key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 (let ((lst (gethash key caller-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 (while lst
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 (insert (format "%S" (car lst)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (setq lst (cdr lst))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 (when lst (insert " "))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 (insert "))\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 (sit-for 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 keys))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (byte-compile 'make-caller-report)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 (delete-other-windows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 (make-caller-report)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ;;; callers-of-rpt.el ends here