;;; dump-package.mhtml -*- Meta-HTML -*- code for debugging packages.
;;;
;;; Copyright (c) 1995 Brian J. Fox
;;; Author: Brian J. Fox (bfox@ai.mit.edu) Aug 1995.
;;;
;;; Usage: <dump-package package-name>
;;; Dump the contents of the given package out.
;;;
<defun dump-package pack>
  <set-var vars[]=<package-vars <get-var pack>>>
  <sort vars>
  <p>
  <h3>Dump of package: <b><get-var pack></b></h3>
  <ul>
    <set-var i=0>
    <font size=-1>
    <while <get-var vars[i]>>
      <set-var name=<get-var vars[i]>>
      <li><subst-in-string <get-var name> <get-var pack>:: action=delete>:
      <set-var info[]=<symbol-info <get-var-once name>> size=<get-var info[1]>>
      <if <gt size 1>
	  <prog
	    <ol>
	      <set-var j=0>
	      <while <lt j size>>
	        <set-var value=<get-var-once <get-var-once name>[j]>>
		<subst-in-var value "&" "&amp;" "<" "&lt;" ">" "&gt;">
		<li><get-var value>
		<increment j>
	      </while>
	    </ol>>
	<prog
	  <set-var value=<get-var-once <get-var-once name>>>
	  <subst-in-var value "&" "&amp;" "<" "&lt;" ">" "&gt;">
	  <get-var value>>>
      <increment i>
    </while>
    </font>
  </ul>
</defun>

;;;
;;; Usage: <dump-all-packages>
;;; Calls dump-package on every defined package.
;;;
<defun dump-all-packages>
  <set-var packages[]=<package-names> i=0>
  <while <get-var packages[i]>>
    <dump-package <get-var packages[i]>>
    <br>
    <increment i>
  </while>
  </in-package>
</defun>

