annotate lisp/psgml/psgml-debug.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
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 ;;;;\filename dump.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;;\Last edited: Fri Nov 25 18:30:01 1994 by lenst@dell (Lennart Staflin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;\RCS $Id: psgml-debug.el,v 1.1.1.1 1996/12/18 03:35:18 steve Exp $
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;;\author {Lennart Staflin}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;;\maketitle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;\begin{codeseg}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 (provide 'psgml-debug)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 (require 'psgml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 (require 'psgml-parse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 (require 'psgml-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;(require 'psgml-dtd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 (autoload 'sgml-translate-model "psgml-dtd" "" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;;; Debugging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 (define-key sgml-mode-map "\C-c," 'sgml-goto-cache)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (define-key sgml-mode-map "\C-c\C-x" 'sgml-dump-tree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun sgml-this-element ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (let ((tree (sgml-find-element-of (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (sgml-dump-rec tree)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (defun sgml-goto-cache ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (setq sgml-dtd-info (sgml-pstate-dtd sgml-buffer-parse-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 sgml-top-tree (sgml-pstate-top-tree sgml-buffer-parse-state))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (sgml-find-start-point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (message "%s" (sgml-element-context-string sgml-top-tree)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (defun sgml-dump-tree (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (when arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (sgml-parse-to-here))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (with-output-to-temp-buffer "*Dump*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (sgml-dump-rec (sgml-pstate-top-tree sgml-buffer-parse-state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun sgml-comepos (epos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (if (sgml-strict-epos-p epos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (format "%s:%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (sgml-entity-name (sgml-eref-entity (sgml-epos-eref epos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (sgml-epos-pos epos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (format "%s" epos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (defun sgml-dump-rec (u)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (while u
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (princ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "%s%s start:%s(%s) end:%s(%s) epos:%s/%s net:%s\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (make-string (sgml-tree-level u) ?. )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (sgml-element-gi u)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (sgml-element-start u) (sgml-tree-stag-len u)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (if (sgml-tree-etag-epos u) (sgml-tree-end u)) (sgml-tree-etag-len u)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (sgml-comepos (sgml-tree-stag-epos u))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (sgml-comepos (sgml-tree-etag-epos u))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (sgml-tree-net-enabled u)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (sgml-dump-rec (sgml-tree-content u))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (setq u (sgml-tree-next u))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;;; For edebug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;(put 'when 'edebug-form-hook t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;(put 'unless 'edebug-form-hook t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;(put 'push 'edebug-form-hook '(form sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;;(put 'setf 'edebug-form-hook '(sexp form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (eval-when (load)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (def-edebug-spec sgml-with-parser-syntax (&rest form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (def-edebug-spec sgml-skip-upto (sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (def-edebug-spec sgml-check-delim (sexp &optional sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (def-edebug-spec sgml-parse-delim (sexp &optional sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (def-edebug-spec sgml-is-delim (sexp &optional sexp sexp sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;;; dump
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defun sgml-dump-dtd (&optional dtd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (interactive )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (unless dtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (setq dtd (sgml-pstate-dtd sgml-buffer-parse-state)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (with-output-to-temp-buffer "*DTD dump*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (princ (format "Dependencies: %S\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (sgml-dtd-dependencies dtd)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (loop for et being the symbols of (sgml-dtd-eltypes dtd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 do (sgml-dp-element et))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun sgml-dump-element (el-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (list (completing-read "Element: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (sgml-dtd-eltypes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (sgml-pstate-dtd sgml-buffer-parse-state))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (with-output-to-temp-buffer "*Element dump*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (sgml-dp-element (sgml-lookup-eltype el-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defun sgml-dp-element (el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ((sgml-eltype-defined el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (princ (format "Element %s %s %s%s:\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (sgml-eltype-name el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (if (sgml-eltype-stag-optional el) "O" "-")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (if (sgml-eltype-etag-optional el) "O" "-")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (if (sgml-eltype-mixed el) " mixed" "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ((sgml-model-group-p (sgml-eltype-model el))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (sgml-dp-model (sgml-eltype-model el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (prin1 (sgml-eltype-model el))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (terpri)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (princ (format "Exeptions: +%S -%S\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (sgml-eltype-includes el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (sgml-eltype-excludes el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (princ (format "Attlist: %S\n" (sgml-eltype-attlist el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (princ (format "Plist: %S\n" (symbol-plist el))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (princ (format "Undefined element %s\n" (sgml-eltype-name el)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (terpri))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defun sgml-dp-model (model &optional indent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (or indent (setq indent 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (let ((sgml-code-xlate (sgml-translate-model model)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 for i from 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 for x in sgml-code-xlate do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (cond ((sgml-normal-state-p (car x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (princ (format "%s%d: opts=%s reqs=%s\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (make-string indent ? ) i
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (sgml-untangel-moves (sgml-state-opts (car x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (sgml-untangel-moves (sgml-state-reqs (car x))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (t ; &node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (princ (format "%s%d: &node next=%d\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (make-string indent ? ) i
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (sgml-code-xlate (sgml-&node-next (car x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (loop for m in (sgml-&node-dfas (car x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 do (sgml-dp-model m (+ indent 2))))))))
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 sgml-untangel-moves (moves)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (loop for m in moves
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 collect (list (sgml-move-token m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (sgml-code-xlate (sgml-move-dest m)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;;;; Build autoloads for all interactive functions in psgml-parse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (defun sgml-build-autoloads ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (with-output-to-temp-buffer "*autoload*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 for file in '("psgml-parse" "psgml-edit" "psgml-dtd"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 "psgml-info" "psgml-charent")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (set-buffer (find-file-noselect (concat file ".el")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (while (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (re-search-forward "^(defun +\\([^ ]+\\)" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (let ((name (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (forward-sexp 1) ; skip argument list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (skip-chars-forward " \n\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (when (eq ?\" (following-char)) ; doc string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (setq doc (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (progn (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (skip-chars-forward " \n\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (when (looking-at "(interactive")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if (null doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (message "No doc for %s" name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (princ (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "(autoload '%s \"%s\" %s t)\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 name file doc))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;;;; Test psgml with sgmls test cases
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (defun test-sgml (start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (let (file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (sgml-show-warnings t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (with-output-to-temp-buffer "*Testing psgml*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (setq file (format "/usr/local/src/sgmls-1.1/test/test%03d.sgm"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (file-exists-p file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (princ (format "*** File test%03d ***\n" start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (find-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (condition-case errcode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (sgml-parse-prolog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;;(sgml-next-trouble-spot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (sgml-parse-until-end-of nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (princ errcode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (terpri)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (if (get-buffer sgml-log-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (princ (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (set-buffer sgml-log-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (buffer-string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (terpri)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (terpri)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (sit-for 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq start (1+ start))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;;;; Profiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (defun profile-sgml (&optional file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (or file (setq file (expand-file-name "~/src/psgml/test/shortref.sgml")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (find-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (sgml-need-dtd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (sgml-instrument-parser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (elp-reset-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (dotimes (i 20)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (garbage-collect)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (sgml-reparse-buffer (function sgml-handle-shortref)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (elp-results))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (defun sgml-instrument-parser ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (require 'elp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (setq elp-function-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (elp-restore-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (setq elp-function-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 sgml-parse-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 sgml-parser-loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 sgml-parse-markup-declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 sgml-do-processing-instruction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 sgml-pop-entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 sgml-tree-net-enabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 sgml-do-end-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 sgml-do-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 sgml-deref-shortmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 sgml-handle-shortref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 sgml-do-start-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 sgml-do-general-entity-ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 sgml-set-face-for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 sgml-pcdata-move
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 sgml-shortmap-skipstring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (elp-instrument-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (defun sgml-instrument-dtd-parser ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (require 'elp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (setq elp-function-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (elp-restore-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (setq elp-function-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 sgml-parse-prolog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 sgml-skip-ds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 sgml-parse-markup-declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 sgml-check-doctype-body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 sgml-check-dtd-subset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 sgml-parse-ds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 sgml-declare-attlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 sgml-declare-entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 sgml-declare-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 sgml-declare-shortref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 sgml-parse-parameter-literal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 sgml-check-element-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 sgml-check-primitive-content-token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 sgml-check-model-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; In sgml-check-model-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 sgml-parse-modifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 sgml-make-pcdata
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 sgml-skip-ts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 sgml-make-opt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 sgml-make-*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 sgml-make-+
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 sgml-reduce-,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 sgml-reduce-|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 sgml-make-&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 sgml-make-conc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 sgml-copy-moves
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; is ps*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 sgml-do-parameter-entity-ref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 sgml-make-primitive-content-token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 sgml-push-to-entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 sgml-lookup-entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 sgml-lookup-eltype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 sgml-one-final-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 sgml-remove-redundant-states-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (elp-instrument-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;¤¤\end{codeseg}