[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with fsspecs vs. paramblocks
- To: duff@azrael.mitre.org (David A. Duff), info-mcl@ministry.cambridge.apple.com
- Subject: Re: help with fsspecs vs. paramblocks
- From: e@flavors.com (Doug Currie, Flavors Technology, Inc.)
- Date: Tue, 10 May 1994 19:02:08 -0500
At 5:03 PM 94.05.10 +0000, David A. Duff wrote:
>i have what i hope is a simple question about how to access mac file
>structures from lisp.
Since I haven't seen a reply today,
I guess I'll be the one to dash your hopes!
>in picking apart the code, i've found that the #_OpenMovieFile trap
>wants to be passed a structure of type :fsspec. what i have is a lisp
>pathname. i've poked around in the examples and didn't find many places
An fsspec is good; it represents a Mac file by a structure containing an
abstract representation of the volume and directory containing it, and the
simple file name. This makes it possible to deal with several volumes with
the same name, for example, something that's hard to do with LISP or Mac
pathnames.
Well, here's how to get a fsspec from a LISP pathname...
(defun grok-fss (pathname)
(let ((fsh (make-record :fsspec)))
(with-pstrs ((fn (ccl:mac-namestring pathname)))
(let ((err (with-dereferenced-handles ((fsp fsh))
(#_FSMakeFSSpec 0 0 fn fsp))))
(format t "~%err: ~d vol: ~d dir: ~d name ~a"
err
(rref fsh :fsspec.vRefNum)
(rref fsh :fsspec.parID)
(rref fsh :fsspec.name))
(dispose-record fsh)))))
#|
? (grok-fss "home:examples;mac-file-io.lisp")
err: 0 vol: -5 dir: 23430 name mac-file-io.lisp
NIL
?
|#
Of course you should actually check the error code, and you may want to
return the record rather than dispose it.
>where fsspec's were used. i did find some interesting code in the file
>ccl:examples:mac-file-io.lisp which defines FS-open. looks like i'm
>getting warm, but this function returns a paramblock (?! whatever that
>is). it appears from casual poking around that many of the traps
>related to operations on files seem to work with paramblocks, yet the
>quicktime trap for opening a movie wants an fsspec. how do i get an
>fsspec from a paramblock?
As for getting an fsspec from a paramblock, you could try calling
(#_FSMakeFSSpec
(pref paramblock :hparamblockrec.ioVRefNum)
0
(pref paramblock :hparamblockrec.ioNamePtr)
fsp)
or even calling it with
(pref paramblock :hparamblockrec.ioDirID)
instead of 0... unfortunately, it all depends on what kind of paramblock it
is, and what's been done to it. As Apple keeps evolving its file systems,
the combinations seem endless.
e