From: ckl
Subject: dumping contents of a package
Date: 
Message-ID: <360A4559.88825D60@cadservices.nl>
Hello,

Can anyone tell a way to dump the contents of a package.
(I want an output of all functions in a certain package)

Thanks, Christiaan ten Klooster

From: Barry Margolin
Subject: Re: dumping contents of a package
Date: 
Message-ID: <BStO1.33$7h2.945009@burlma1-snr1.gtei.net>
In article <·················@cadservices.nl>,
ckl  <··········@cadservices.nl> wrote:
>Can anyone tell a way to dump the contents of a package.
>(I want an output of all functions in a certain package)

use DO-SYMBOLS:

(do-symbols (s '<package-name>)
  (when (symbol-function s)
    (print s)))

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
From: Lyman S. Taylor
Subject: Re: dumping contents of a package
Date: 
Message-ID: <6uefdg$1vt@pravda.cc.gatech.edu>
In article <···················@burlma1-snr1.gtei.net>,
Barry Margolin  <······@bbnplanet.com> wrote:
>In article <·················@cadservices.nl>,
>ckl  <··········@cadservices.nl> wrote:
>>Can anyone tell a way to dump the contents of a package.
>>(I want an output of all functions in a certain package)
>
>use DO-SYMBOLS:
>
>(do-symbols (s '<package-name>)
>  (when (symbol-function s)
          ^^^^^^^^^^^^^^^^^^^  

(fboundp s )  may work a bit better. and 

   (and (fboundp s ) (not (or (macro-function s ) 
                              (special-operator-p s ))))

if you are specifically interested in only functions (not macros and special
stuff ).  SPECIAL-OPERATOR-P may be masquerading as SPECIAL-FORM-P. 


And if you're not interested in imported stuff..

   (and (eq .. package looking in ... 
            (symbol-package s ))
        (fboundp s ) 
        (or ... )  )


P.S. You may also wish to take a gander at  WITH-PACKAGE-ITERATOR  


http://www.harlequin.com/education/books/HyperSpec/Body/mac_with-package-iterator.html#with-package-iterator



-- 
Lyman S. Taylor			Scully: "I have a date."
(·····@cc.gatech.edu)		Mulder: "Can you cancel?"
				Scully: "Unlike you, Mulder, I would 
						like to have a life."
				Mulder: "I have a life!"
From: Rainer Joswig
Subject: Re: dumping contents of a package
Date: 
Message-ID: <joswig-2509981406010001@pbg3.lavielle.com>
In article <··········@pravda.cc.gatech.edu>, ·····@cc.gatech.edu (Lyman
S. Taylor) wrote:

> In article <···················@burlma1-snr1.gtei.net>,
> Barry Margolin  <······@bbnplanet.com> wrote:
> >In article <·················@cadservices.nl>,
> >ckl  <··········@cadservices.nl> wrote:
> >>Can anyone tell a way to dump the contents of a package.
> >>(I want an output of all functions in a certain package)
> >
> >use DO-SYMBOLS:
> >
> >(do-symbols (s '<package-name>)
> >  (when (symbol-function s)
>           ^^^^^^^^^^^^^^^^^^^  
> 
> (fboundp s )  may work a bit better. and 
> 
>    (and (fboundp s ) (not (or (macro-function s ) 
>                               (special-operator-p s ))))
> 
> if you are specifically interested in only functions (not macros and special
> stuff ).  SPECIAL-OPERATOR-P may be masquerading as SPECIAL-FORM-P. 
> 
> 
> And if you're not interested in imported stuff..
> 
>    (and (eq .. package looking in ... 
>             (symbol-package s ))
>         (fboundp s ) 
>         (or ... )  )
> 
> 
> P.S. You may also wish to take a gander at  WITH-PACKAGE-ITERATOR  
> 
> 
> 

#+(and clim mcl)
(define-command (com-show-package-interface :command-table
symbols-commands :name t)
    ((package '(or string package)))
  (let* ((frame *application-frame*)
         (stream (frame-standard-output frame)))
    (when (stringp package)
      (let ((the-package (find-package package)))
        (if the-package
            (setf package the-package)
          (setf package (find-package (string-upcase package))))
        package))
    (unless (packagep package)
      (error "Expected a package and got ~a." package))
    (let (classes functions generic-functions macros variables)
      (do-external-symbols (symbol package)
        (when (find-class symbol nil) (push symbol classes))
        (when (fboundp symbol)
          (if (macro-function symbol)
              (push symbol macros)
            (if (typep (symbol-function symbol) 'generic-function)
                (push symbol generic-functions)
              (push symbol functions))))
        (when (boundp symbol) (push symbol variables)))
      (flet ((sort-it (what) (sort what #'string-lessp :key #'symbol-name)))
        (setf classes (sort-it classes)
              functions (sort-it functions)
              macros (sort-it macros)
              variables (sort-it variables)
              generic-functions (sort-it generic-functions)))
      (flet ((row (items header accessor stream)
                  (when items
                    (formatting-row (stream)
                      (formatting-cell (stream)
                        (princ header stream))
                      (formatting-cell (stream)
                        (formatting-item-list (stream :n-columns 3)
                          (loop for item in items
                                do (formatting-cell (stream)
                                     (let ((object (funcall accessor item)))
                                       (with-output-as-presentation
(stream object (presentation-type-of object))
                                         (princ item stream)))))))))))
        (formatting-table (stream)
          (row (list package) "Package" #'identity stream)
          (row (package-use-list package) "Uses" #'identity stream)
          (row (package-used-by-list package) "Used by" #'identity stream)
          (row classes "Classes" #'find-class stream)
          (row functions "Functions" #'symbol-function stream)
          (row generic-functions "Generic-Functions" #'symbol-function stream)
          (row macros "Macros" #'macro-function stream)
          (row variables "Variables" #'identity stream))))))