Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.




Client Library Functions



Controlling a PostScript Execution Context



Create a context

DPSContext DPSCreateContext(const char *hostName, const char *serverName, DPSTextProc textProc, DPSErrorProc errorProc)¦
DPSContext DPSCreateContextWithTimeoutFromZone(const char *hostName, const char *serverName, DPSTextProc textProc, DPSErrorProc errorProc, int timeout, NXZone *zone)¦
DPSContext DPSCreateNonsecureContext(const char *hostName, const char *serverName, DPSTextProc textProc, DPSErrorProc errorProc, int timeout, NXZone *zone)¦
DPSContext DPSCreateStreamContext(NXStream *stream, int debugging, DPSProgramEncoding progEnc, DPSNameEncoding nameEnc, DPSErrorProc errorProc)¦
void DPSDestroyContext(DPSContext context)


Create a child context

int DPSChainContext(DPSContext parent, DPSContext child)
void DPSUnchainContext(DPSContext context)


Access the current context

void DPSSetContext(DPSContext context)
DPSContext DPSGetCurrentContext(void)


Control a context

int DPSSynchronizeContext(DPSContext context, int enableFlag)¦
void DPSWaitContext(DPSContext context)
void DPSAsynchronousWaitContext(DPSContext context, DPSPingProc handler, void *userData)

Warning:  The following two context-controlling functions aren't implemented in NeXTSTEP

void DPSInterruptContext()
void DPSResetContext()


Extract space from a context

DPSSpace DPSSpaceFromContext(DPSContext context)


Destroy a space and all contexts in it

void DPSDestroySpace(DPSSpace space)



Sending Data to the Window Server



Send PostScript code to the Window Server

void DPSWritePostScript(DPSContext context, const void *buf,  int count)
void DPSWriteData(DPSContext context, const void *buf, unsigned int count)
void DPSPrintf(DPSContext context, const char *format, ...)
void DPSFlushContext(DPSContext context)
void DPSFlush(void)¦
void DPSSendEOF(DPSContext context)¦


Send an encoded PostScript path to the Window Server

void DPSDoUserPath(void *coords, int numCoords, DPSNumberFormat numType, unsigned char *ops, int numOps, void *bbox, int action)¦
void DPSDoUserPathWithMatrix(void *coords, int numCoords, DPSNumberFormat numType, unsigned char *ops, int numOps, void *bbox, int action, float matrix[6])¦



User Objects and User Names



Create a user object

int DPSDefineUserObject(int index)¦
void DPSUndefineUserObject(int index)¦


Access the system and user name tables

void DPSMapNames(DPSContext context, unsigned int numNames, const char *const *nameArray, long int *const *numPtrArray)
const char * DPSNameFromIndex(int index)
const char * DPSNameFromTypeAndIndex(short type, int index)¦



Event-Handling



Access events from the Window Server

int DPSGetEvent(DPSContext context, NXEvent *anEvent, int mask, double timeout, int threshold)¦
int DPSPeekEvent(DPSContext context, NXEvent *anEvent, int mask, double timeout, int threshold)¦
void DPSDiscardEvents(DPSContext context, int mask)¦


Coalesce events

int DPSSetTracking(int flag)¦


Set the event-filter function

DPSEventFilterFunc DPSSetEventFunc(DPSContext context, DPSEventFilterFunc func)¦


Create an event

int DPSPostEvent(NXEvent *anEvent, int atStart)¦


Create a timed entry

DPSTimedEntry DPSAddTimedEntry(double period, DPSTimedEntryProc handler, void *userData, int priority)¦
void DPSRemoveTimedEntry(DPSTimedEntry teNumber)¦


Initiate a count down for the wait cursor

void DPSStartWaitCursorTimer(void)¦


Allow dead key processing

void DPSSetDeadKeysEnabled(DPSContext context, int flag)¦


Generate an event mask for an event type

int NX_EVENTCODEMASK(int type)



File and Port Monitoring



Monitor a file descriptor

void DPSAddFD(int fd, DPSFDProc handler, void *userData, int priority)¦
void DPSRemoveFD(int fd)¦


Monitor a Mach port

void DPSAddPort(port_t newPort, DPSPortProc handler, int maxSize, void *userData, int priority)¦
void DPSRemovePort(port_t port)¦


Set the notify port call-back function

void DPSAddNotifyPortProc(DPSPortProc handler, void *userData)¦
void DPSRemoveNotifyPortProc(DPSPortProc handler)¦



Text-Handling



Set the text call-back functions

DPSTextProc DPSSetTextProc(DPSContext context, DPSTextProc tp)
DPSTextProc DPSSetTextBackstop(DPSTextProc textProc)
DPSTextProc DPSGetCurrentTextBackstop(void)



Debugging and Error-Handling



Trace data and events

int DPSTraceContext(DPSContext context, int flag)¦
void DPSTraceEvents(DPSContext context, int flag)¦


Handle errors

DPSErrorProc DPSSetErrorProc(DPSContext context, DPSErrorProc ep)
void DPSDefaultErrorProc(DPSContext context, DPSErrorCode errorCode, long unsigned int arg1, long unsigned int arg2)
void DPSSetErrorBackstop(DPSErrorProc errorProc)
DPSErrorProc DPSGetCurrentErrorBackstop(void)
void DPSPrintError(FILE *fp, const DPSBinObjSeqRec error)¦
void DPSPrintErrorToStream(NXStream *stream, const DPSBinObjSeqRec error)¦



Functions Used by pswrap



Wait for return values from the Window Server

void DPSAwaitReturnValues(DPSContext context)


Write strings in binary object sequence

void DPSWriteStringChars(DPSContext context, const char *buf, unsigned int count)


Write PostScript code in a specified format

void DPSWriteTypedObjectArray(DPSContext context, DPSDefinedType type, const void *array, unsigned int length)


Begin a new binary object sequence

void DPSBinObjSeqWrite(DPSContext context, const void *buf, unsigned int count)


Define information expected from the PostScript interpreter

void DPSSetResultTable(DPSContext context, DPSResults table, unsigned int length)


Update a context's name map from the client library's name map

void DPSUpdateNameMap(DPSContext context)