home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / mcl / 1239 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  2.2 KB

  1. Path: sparky!uunet!olivea!apple!cambridge.apple.com!cornell@freya.cs.umass.edu
  2. From: cornell@freya.cs.umass.edu
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Opening files from the finder after mclv2.0's started
  5. Message-ID: <9208152104.AA05234@giane.cs.umass.edu>
  6. Date: 15 Aug 92 21:04:54 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 48
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: info-mcl@cambridge.apple.com
  11.  
  12. I'm interested in doing this and I don't remember if someone else's
  13. posted a solution (I remember there was a recent request about it but
  14. I spaced it). After a little exploring I determined
  15. ccl::open-application-document is called when I open files from the
  16. Finder that have ccl2 as their creator. Folling is a file that opens
  17. one of my object files if the arg passed to
  18. ccl::open-application-document is appropriate.
  19.  
  20. Issues:
  21. - Is is the (or an) Apple/MCL-approved solution?
  22. - What is the optional mystery arg?
  23. - Is the application instance every different from *application* and
  24. are there ever subclasses of it? (It seems defining methods on the
  25. application class is somewhat useless; in fact the only method mcl
  26. defines is on T, not APPLICATION.)
  27.  
  28.  
  29. ;;;
  30. ;;; finder-open-object-file.lisp
  31. ;;;
  32.  
  33. #|
  34. ================================================================
  35. Purpose ========================================================
  36. ================================================================
  37. Defines an ccl::open-application-document :after method that opens IKit
  38. files.
  39.  
  40. |#
  41.  
  42.  
  43. (defmethod ccl::open-application-document :after ((application t)
  44.                                                   (pathname pathname)
  45.                                                   &optional optional-mystery-arg)
  46.   "An after method that calls open-object-file on pathname if it's an object file."
  47.   (declare (optimize speed)
  48.            (ignore optional-mystery-arg))
  49.   ;;
  50.   (let* ((kw-mac-file-type (mac-file-type pathname))
  51.          (f-wood-file (eq kw-mac-file-type :|WOOD|))
  52.          (f-object-file nil))
  53.     ;; Set f-object-file.
  54.     (when f-wood-file
  55.       (with-open-pheap (pheap pathname)
  56.         (setf f-object-file (ps::f-ikit-pheap pheap))))
  57.     ;;
  58.     (when f-object-file
  59.       (ps::open-object-file pathname))))
  60.