Make 'desc module tree' hide internal module structure.
tswd
9 years ago
160 | 160 | (let ((info (getf (module-infos arg) 'rename-mod))) |
161 | 161 | (print-mod-name-x (car info) stream abbrev no-param) |
162 | 162 | (princ "*DUMMY")) |
163 | (print-mod-name-internal-x modname abbrev t)) | |
163 | (with-in-module (arg) | |
164 | (print-mod-name-internal-x modname abbrev t))) | |
164 | 165 | (let ((params (get-module-parameters arg))) |
165 | 166 | (when (and params (not no-param)) |
166 | 167 | (let ((flg nil)) |
167 | ;; (princ "[") | |
168 | (princ "(") | |
168 | (princ "[") | |
169 | ;; (princ "(") | |
169 | 170 | (dolist (param params) |
170 | 171 | (let ((theory (parameter-theory-module param))) |
171 | 172 | (if flg (princ ", ")) |
172 | 173 | (if (or (null (parameter-context param)) |
173 | 174 | (eq arg (parameter-context param))) |
174 | 175 | (princ (parameter-arg-name param)) |
175 | (progn | |
176 | ;; (format t "~a@" (parameter-arg-name param)) | |
177 | (format t "~a." (parameter-arg-name param)) | |
178 | (print-mod-name-x (parameter-context param) | |
179 | stream | |
180 | abbrev | |
181 | t))) | |
176 | (if (not (eq (parameter-context param) arg)) | |
177 | (progn | |
178 | (format t "~a." (parameter-arg-name param)) | |
179 | (print-mod-name-x (parameter-context param) | |
180 | stream | |
181 | abbrev | |
182 | t)) | |
183 | (format t "~a" (parameter-arg-name param)))) | |
182 | 184 | ;; patch-begin |
183 | 185 | (princ "::") |
184 | ;; (print-mod-name-x theory stream abbrev t) | |
185 | 186 | (print-parameter-theory-name theory stream :abbrev :no-param) |
186 | ;; patch-end | |
187 | 187 | (setq flg t))) |
188 | ;; (princ "]") | |
189 | (princ ")"))))) | |
188 | (princ "]") | |
189 | ;; (princ ")") | |
190 | )))) | |
190 | 191 | (print-chaos-object arg)))) |
191 | 192 | |
192 | 193 | (defun print-mod-name-internal-x (val abbrev &optional (no-param nil)) |
193 | 194 | (declare (values t)) |
194 | 195 | (if (stringp val) |
195 | 196 | (princ val) |
196 | (if (and (consp val) (not (chaos-ast? val))) | |
197 | (if (equal "::" (cadr val)) | |
198 | ;; parameter theory | |
199 | (if abbrev | |
200 | (progn | |
201 | (format t "~a" (car val)) | |
202 | (princ ".") | |
203 | (print-mod-name-x (car (last val)) | |
204 | *standard-output* | |
205 | abbrev no-param)) | |
206 | ;; | |
207 | (let ((cntxt (fourth val))) | |
208 | (if (and cntxt | |
209 | (not (eq *current-module* cntxt))) | |
210 | (progn (format t "~a." (car val)) | |
211 | (print-mod-name-x cntxt *standard-output* t t) | |
212 | (princ "::")) | |
213 | (format t "~a::" (car val))) | |
214 | (print-mod-name-x (caddr val) *standard-output* nil t))) | |
215 | (print-chaos-object val)) | |
216 | (print-modexp val *standard-output* abbrev no-param)))) | |
197 | (if (and (consp val) (not (chaos-ast? val))) | |
198 | (if (equal "::" (cadr val)) | |
199 | ;; parameter theory | |
200 | (if abbrev | |
201 | (progn | |
202 | (format t "~a" (car val)) | |
203 | (princ ".") | |
204 | (print-mod-name-x (car (last val)) *standard-output* abbrev no-param)) | |
205 | (let ((cntxt (fourth val))) | |
206 | (if (and cntxt | |
207 | (not (eq *current-module* cntxt))) | |
208 | (progn (format t "~a." (car val)) | |
209 | (print-mod-name-x cntxt *standard-output* t t) | |
210 | (princ "::")) | |
211 | (format t "~a::" (car val))) | |
212 | (print-mod-name-x (caddr val) *standard-output* abbrev t))) | |
213 | (print-chaos-object val)) | |
214 | (print-modexp val *standard-output* abbrev no-param)))) | |
217 | 215 | |
218 | 216 | (defvar .mod-dup-hash. (make-hash-table :test #'eq)) |
219 | 217 | |
234 | 232 | (:modmorph (princ "!" stream)) |
235 | 233 | (otherwise (princ "??" stream)))) |
236 | 234 | |
235 | (defun mod-name-is-parameter (name) | |
236 | (and (consp name) | |
237 | (not (chaos-ast? name)) | |
238 | (equal "::" (second name)))) | |
239 | ||
237 | 240 | (defun d-module-tree* (dag-node stream p-label &optional my-num) |
238 | 241 | (let* ((mod+imp (dag-node-datum dag-node)) |
239 | 242 | (mod (car mod+imp)) |
240 | 243 | (imp (cdr mod+imp)) |
241 | (*print-line-limit* 80) | |
244 | (*print-line-limit* 100) | |
242 | 245 | (*print-xmode* :fancy) |
243 | 246 | (num (if (and p-label my-num) |
244 | 247 | (format nil "~a-~d" p-label my-num) |
254 | 257 | (let (;; (*print-indent* (+ (max 4 (length num)) *print-indent*))) |
255 | 258 | (*print-indent* (+ 2 *print-indent*))) |
256 | 259 | (when num (princ "(" stream)) |
257 | (print-mod-name-x mod stream) | |
260 | ;; (print-mod-name-x mod stream t) | |
261 | (princ (get-module-print-name mod) stream) | |
258 | 262 | (when num (princ ")" stream)) |
259 | 263 | (if dup? (princ "*" stream) |
260 | 264 | (with-in-module (mod) |
261 | 265 | (let ((subnodes (dag-node-subnodes dag-node))) |
262 | 266 | (when subnodes |
263 | (let ((*print-indent* (+ 2 *print-indent*)) | |
267 | (let (;; (*print-indent* (+ 2 *print-indent*)) | |
264 | 268 | (y-num 1)) |
265 | 269 | (dolist (sub subnodes) |
266 | 270 | (let ((subm (car (dag-node-datum sub))) |
267 | 271 | (sub-imp (cdr (dag-node-datum sub)))) |
268 | 272 | (unless (or (module-hidden subm) |
269 | (eq sub-imp :modmorph) | |
270 | (equal (module-name subm) "NIL")) | |
273 | (mod-name-is-parameter (get-module-print-name subm)) | |
274 | (eq sub-imp :modmorph)) | |
271 | 275 | (print-next-prefix #\Space) |
272 | 276 | (d-module-tree* sub stream num y-num) |
273 | 277 | (incf y-num)))))))))))) |