Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 2 - Edition Manager / Subscribing to Non-Edition Files


Calling a Format I/O Function

To indicate to the Edition Manager which format I/O function to use, use the CallFormatIOProc function.

err := CallFormatIOProc (selector, PB, routine);
Set the selector parameter to one of the format I/O verbs. The format I/O verbs include

The PB parameter of the CallFormatIOProc function contains a format I/O parameter block.

TYPE FormatIOParamBlock = 
   RECORD
      ioRefNum:      LongInt;       {reference number}
      format:        FormatType;    {edition format type}
      formatIndex:   LongInt;       {opener-specific enumeration }
                                    { of formats}
      offset:        LongInt;       {offset into format}
      buffPtr:       Ptr;           {data starts here}
      buffLen:       LongInt;       {length of data}
   END;
The routine parameter of the CallFormatIOProc function is a pointer to a format
I/O function.

The following list shows which fields of FormatIOParamBlock are used by the format I/O verbs:
Format I/O verb ParameterDescriptionCalled by
ioHasFormat-->ioRefNumI/O reference number returned by opener.EditionHasFormat, GetStandardFormats, and ReadEdition functions
 -->formatCheck for this format.
 <--formatIndexAn optional enumeration of the supplied format.
 <--buffLenIf found, return the length size or -1 if size is unknown.
 <--Return valueA noErr or noTypeErr code.
     
ioReadFormat-->ioRefNumI/O reference number returned by opener.ReadEdition and GetStandardFormats functions
 -->formatGet this format.
 -->formatIndexValue returned by ioHasFormat.
 -->offsetRead format beginning from this offset.
 -->buffPtrPut data beginning here.
 <->buffLenSpecify buffer length to read, and return actual amount received. 
 <--Return valueA noErr code, or appropriate error code. 
ioNewFormat-->ioRefNumI/O reference number returned by opener.SetEditionFormatMarkand WriteEdition functions
 -->formatCreate this format.
 <--formatIndexAn optional enumeration of the supplied format.
 <--Return valueA noErr code, or appropriate error code.
ioWriteFormat-->ioRefNumI/O reference number returned by opener.WriteEdition function
 -->formatGet this format. 
 -->formatIndexValue returned by ioNewFormat. 
 -->offsetWrite format beginning from this offset. 
 -->buffPtrGet data beginning here. 
 <->buffLenSpecify buffer length to write. 
 <--Return valueA noErr code or appropriate error code. 

The marks for each format are kept by the Edition Manager. The format I/O function only needs to be able to read or write, beginning at any offset. If you know that your application always reads an entire format sequentially, you can ignore the offset.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996