Important: The information in this document is obsolete and should not be used for new development.
Calling a Format I/O Function
To indicate to the Edition Manager which format I/O function to use, use theCallFormatIOProc
function.
err := CallFormatIOProc (selector, PB, routine);Set theselector
parameter to one of the format I/O verbs. The format I/O verbs include
The
ioHasFormat
ioReadFormat
ioNewFormat
ioWriteFormat
PB
parameter of theCallFormatIOProc
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;Theroutine
parameter of theCallFormatIOProc
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 Parameter Description Called by ioHasFormat --> ioRefNum I/O reference number returned by opener. EditionHasFormat
,GetStandardFormats
, andReadEdition
functions--> format Check for this format. <-- formatIndex An optional enumeration of the supplied format. <-- buffLen If found, return the length size or -1 if size is unknown. <-- Return value A noErr
ornoTypeErr
code.ioReadFormat --> ioRefNum I/O reference number returned by opener. ReadEdition
andGetStandardFormats
functions--> format Get this format. --> formatIndex Value returned by ioHasFormat
.--> offset Read format beginning from this offset. --> buffPtr Put data beginning here. <-> buffLen Specify buffer length to read, and return actual amount received. <-- Return value A noErr
code, or appropriate error code.ioNewFormat --> ioRefNum I/O reference number returned by opener. SetEditionFormatMark
andWriteEdition
functions--> format Create this format. <-- formatIndex An optional enumeration of the supplied format. <-- Return value A noErr
code, or appropriate error code.ioWriteFormat --> ioRefNum I/O reference number returned by opener. WriteEdition
function--> format Get this format. --> formatIndex Value returned by ioNewFormat
.--> offset Write format beginning from this offset. --> buffPtr
Get data beginning here. <-> buffLen
Specify buffer length to write. <-- Return value A 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.