Important: The information in this document is obsolete and should not be used for new development.
PPCWrite
Use thePPCWritefunction to write message blocks during a session.
FUNCTION PPCWrite (pb: PPCWritePBPtr; async: Boolean): OSErr;
pb- A pointer to a
PPCWriteparameter block.async- A value that specifies whether the function is to be executed asynchronously (
TRUE) or synchronously (FALSE). You should execute thePPCWritefunction asynchronously.
--> ioCompletion PPCCompProcPtr Address of a completion routine <-- ioResult OSErr Result code --> sessRefNum PPCSessRefNum Session reference number --> bufferLength Size Length of data buffer <-- actualLength Size Actual length of data written --> bufferPtr Ptr Pointer to data buffer --> more Boolean TRUEif more data in this block to be written--> userData LongInt Application-specific data --> blockCreator OSType Creator of block written --> blockType OSType Type of block written DESCRIPTION
If your application calls thePPCWritefunction asynchronously, you must specify in theioCompletionfield either the address of a completion routine orNIL. If you setioCompletiontoNIL, you should poll theioResultfield of the PPC parameter block (from your application's main event loop) to determine whether the PPC Toolbox has completed the requested operation. A value in theioResultfield other than 1 indicates that the call is complete. Note that it is unsafe to poll theioResultfield at interrupt time since the PPC Toolbox may be in the process of completing a call. See "PPC Toolbox Calling Conventions" beginning on page 11-14.If you call the
PPCWritefunction asynchronously, you must not change any of the fields in the parameter block until the call completes. The buffer pointed to by the record of data typePPCWritePBRecis owned by the PPC Toolbox until the call completes. These objects must not be deallocated or moved in memory while the call is in progress.The
sessRefNumfield specifies a session identifier. This must be a valid session reference number returned from a previousPPCStart,StartSecureSession, orPPCInformfunction.The
bufferLengthandbufferPtrfields specify the length and location of a buffer the message block is sent to. If thePPCWritefunction returns anoErrresult code, theactualLengthfield returns the actual size of the message block that was written.Set the
morefield toTRUEto indicate that you will be using thePPCWritefunction again to append data to this message block. Set themorefield toFALSEto indicate that this is the end of the data in this message block.The initiating port can specify any information in the
userDatafield. ThePPCReadfunction reports this data to the responding port upon its completion.Set the
userData,blockCreator, andblockTypefields for each message block that you create. These fields can give the receiving application information about how to process the contents of the message block. They are ignored when you append information to a message block.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for thePPCWritefunction are
Trap macro Selector _PPC $0006 The registers on entry and exit for this routine are
Registers on entry A0 Pointer to a parameter block D0 Selector code
Registers on exit D0 Result code RESULT CODES
noErr 0 No error notInitErr -900 PPC Toolbox has not been initialized yet noGlobalsErr -904 System unable to allocate memory, critical error noSessionErr -908 Invalid session reference number badReqErr -909 Bad parameter or invalid state for this operation sessClosedErr -917 The session has closed SEE ALSO
For an example of the use of thePPCWritefunction in conjunction with thePPCReadfunction, see "Exchanging Data During a PPC Session" beginning on page 11-39.