[comp.sys.mac.programmer] Parameter blocks

jtn@zodiac.ADS.COM (John Nelson) (11/09/89)

Hi all.  Well I decided to take the plunge and extract file/folder
information using parameter blocks.  Pretty gross stuff and I'm hung
on a problem.  I'm using the low-level routine PBGetFInfo to iterate
over files in a folder but the structure elements in the structure for
the parameter block on page 148 of Inside Macintosh don't exist
according to my compiler!

Specifically when I declare my parameter block pointer to be of type
parmBlkPtr, the LSC compiler complains that ioCompletion is not a
valid union or member.  If I declare my parameter block pointer to be
of type fileParam, the element namePtr is suddenly not defined.

Now on page 117 we see that yes indeed these elements are not defined
when you use these respective pointers... BUT there must be some way
to access both of these elements via the same parameter block pointer!
In fact this is what the documentation implies... that the first 8
elements are included in all structures and varients of the structures.

Sigh... does anyone have a snippet or two of code that they could send me?



-- 

John T. Nelson			UUCP: sun!sundc!potomac!jtn
Advanced Decision Systems	Internet:  jtn@potomac.ads.com
1500 Wilson Blvd #512; Arlington, VA 22209-2401		(703) 243-1611

francis@mirror.UUCP (Joe Francis) (11/15/89)

In article <9730@zodiac.ADS.COM> jtn@zodiac.ADS.COM (John Nelson) writes:
(some stuff deleted)
>Specifically when I declare my parameter block pointer to be of type
>parmBlkPtr, the LSC compiler complains that ioCompletion is not a
>valid union or member.  If I declare my parameter block pointer to be
>of type fileParam, the element namePtr is suddenly not defined.
>
>Now on page 117 we see that yes indeed these elements are not defined
>when you use these respective pointers... BUT there must be some way
>to access both of these elements via the same parameter block pointer!
>In fact this is what the documentation implies... that the first 8
>elements are included in all structures and varients of the structures.
>
In FileMgr.h *ParmBlkRec and ParamBlockRec are defined together as a
union of the structs ioParam, fileParam, and volumeParam.  So instead of
	ParmBlkPtr	pbPtr;

	...
	pbPtr->ioCompletion = 0L;
you need:
	pbPtr->fileParam.ioCompletion = 0L;
for example.
	I hope that helps!