home *** CD-ROM | disk | FTP | other *** search
- /*
- dpsNeXT.h
-
- This file describes the interface to the DPS routines specific to the
- NeXT implementation of the DPS library.
-
- Copyright (c) 1988 NeXT, Inc. as an unpublished work.
- All rights reserved.
- */
-
- #ifndef DPSNEXT_H
- #define DPSNEXT_H
-
- #import "dpsOpenStep.h"
-
- #ifndef EVENT_H
- #include "event.h"
- #endif EVENT_H
-
- #ifndef DPSCLIENT_H
- #include "dpsclient.h"
- #endif DPSCLIENT_H
-
- #ifndef ERROR_H
- #include <objc/error.h>
- #endif ERROR_H
-
- #import <stdio.h>
- #import <mach/port.h>
- #import <mach/message.h>
- #import <streams/streams.h>
- #import <objc/zone.h>
-
- #define NX_FOREVER (6307200000.0) /* 200 years of seconds */
-
- #define DPS_ALLCONTEXTS ((DPSContext)-1) /* refers to all existing contexts */
-
- /*=== TYPES ===*/
-
- typedef int (*DPSEventFilterFunc)( NXEvent *ev );
- /* Callback proc for filtering events of a context. It is passed the
- event just read from the context before it is put in the global
- event queue. If the proc returns TRUE, the event will be inserted
- into the queue as usual, otherwise it not put in the queue.
- */
-
- typedef void (*DPSPortProc)( msg_header_t *msg, void *userData );
- /* Callback proc for ports registered by DPSAddPort. */
-
- typedef struct __DPSTimedEntry *DPSTimedEntry;
-
- typedef void (*DPSTimedEntryProc)(
- DPSTimedEntry te,
- double now,
- void *userData );
- /* Callback proc for timed entries registered by DPSAddTimedEntry. */
-
- typedef void (*DPSFDProc)( int fd, void *userData );
- /* Callback proc for fds registered by DPSAddFD. */
-
- typedef struct _DPSTaggedMsg {
- msg_header_t header;
- msg_type_t type;
- int values[2];
- } DPSTaggedMsg;
- /* Start of a message passed to DPSSendTaggedMsg. */
-
- typedef void (*DPSPingProc)(DPSContext ctxt, void *userData);
- /* Callback proc for DPSAsynchronousWaitContext. */
-
- extern void DPSAsynchronousWaitContext(DPSContext ctxt, DPSPingProc handler, void *userData);
- /* Calls handler when all PS code has been processed for this context. */
-
- /*=== PROCEDURES ===*/
-
- extern DPSContext DPSCreateContext(
- const char *hostName,
- const char *serverName,
- DPSTextProc textProc,
- DPSErrorProc errorProc );
- /* Creates a connection to the window server with default timeout. */
-
- extern DPSContext DPSCreateContextWithTimeoutFromZone(
- const char *hostName,
- const char *serverName,
- DPSTextProc textProc,
- DPSErrorProc errorProc,
- int timeout,
- NXZone *zone );
- /* Creates a connection to the window server with specified ms timeout. */
-
- extern DPSContext DPSCreateNonsecureContext(
- const char *hostName,
- const char *serverName,
- DPSTextProc textProc,
- DPSErrorProc errorProc,
- int timeout,
- NXZone *zone );
- /* Creates a non secure connection to the window server. */
-
- extern DPSContext DPSCreateStreamContext(
- NXStream *st,
- int debugging,
- DPSProgramEncoding progEnc,
- DPSNameEncoding nameEnc,
- DPSErrorProc errorProc );
- /* Creates a context that writes to a NXStream. */
-
- extern int DPSSetTracking( int flag );
- /* Enables or disables the coalescing of mouse events. */
-
- extern void DPSStartWaitCursorTimer(void);
- /* Starts the wait cursor timeout. To be used before a time-consuming
- operations that is NOT initiated by a user event.
- */
-
- extern void DPSAddPort(
- port_t newPort,
- DPSPortProc handler,
- int maxSize,
- void *userData,
- int priority );
- /* Adds a MACH port to be listened to. */
-
- extern void DPSRemovePort( port_t port );
- /* Removes a MACH port previously added. */
-
- extern void DPSAddNotifyPortProc(DPSPortProc handler, void *userData);
- /* register handler to be called for any messages on the notify port */
-
- extern void DPSRemoveNotifyPortProc(DPSPortProc handler);
- /* unregister handler for notify messages */
-
- extern DPSTimedEntry DPSAddTimedEntry(
- double period,
- DPSTimedEntryProc handler,
- void *userData,
- int priority );
- /* Creates a timed entry. */
-
- extern void DPSRemoveTimedEntry( DPSTimedEntry te );
- /* Destroys a timed entry. */
-
- extern void DPSAddFD(
- int fd,
- DPSFDProc routine,
- void *data,
- int priority );
- /* Adds a file descriptor to be listened to. */
-
- extern void DPSRemoveFD( int fd );
- /* Removes a file descriptor previously added. */
-
- extern void DPSSetDeadKeysEnabled(DPSContext ctxt, int flag);
- /* Enables and disabled dead key processing for a context's events. */
-
- extern DPSEventFilterFunc DPSSetEventFunc(
- DPSContext ctxt,
- DPSEventFilterFunc func );
- /* Installs a function to filter events from a given context. */
-
- extern int _DPSGetOrPeekEvent( DPSContext ctxt, NXEvent *eventStorage,
- int mask, double wait, int threshold, int peek );
- #define DPSGetEvent( ctxt, evPtr, mask, timeout, thresh ) \
- _DPSGetOrPeekEvent( (ctxt), (evPtr), (mask), (timeout), (thresh), 0 )
- /* Finds a matching event, removing it from the queue. */
-
- #define DPSPeekEvent( ctxt, evPtr, mask, timeout, thresh ) \
- _DPSGetOrPeekEvent( (ctxt), (evPtr), (mask), (timeout), (thresh), 1 )
- /* Finds a matching event, but does not remove it from the queue. */
-
- extern int DPSPostEvent( NXEvent *event, int atStart );
- /* Posts an event to the front or back of the client side event queue. */
-
- extern void DPSDiscardEvents( DPSContext ctxt, int mask );
- /* Removes matching events from the event queue. DPS_ALLCONTEXTS can
- be used as the first argument to match to all contexts.
- */
-
- extern int DPSTraceContext( DPSContext ctxt, int flag );
- /* Turns on and off debugging tracing of a context's input and output.
- DPS_ALLCONTEXTS can be used as the first argument to match to
- all contexts.
- */
-
- void DPSTraceEvents(DPSContext ctxt, int flag);
- /* Turns on and off debugging tracing of the events a context receives.
- DPS_ALLCONTEXTS can be used as the first argument to match to
- all contexts.
- */
-
- extern void DPSPrintError( FILE *fp, const DPSBinObjSeqRec *error );
- /* Prints out a binary encoded error to the fp. */
-
- extern void DPSPrintErrorToStream( NXStream *st, const DPSBinObjSeqRec *error );
- /* Prints our a binary encoded error to the stream. */
-
- extern const char *DPSNameFromTypeAndIndex( short type, int index );
- /* This routine returns the text for the user name with the given index of
- the given type. Type 0 is for usernames, and type -1 is for systems
- names. The string returned is owned by the library (treat it as readonly).
- */
-
- extern int DPSSendTaggedMsg(DPSContext ctxt, DPSTaggedMsg *msg);
- /* Sends a tagged message to the Window Server. Returns tag number to pass
- to some PS operator which accepts the message data as an argument.
- */
-
- extern int DPSSendPort(DPSContext ctxt, port_t port, int sendAllRights);
- /* sends a single port in a tagged message. Returns tag number to pass to
- some PS operator which accepts the port as an argument.
- */
-
- void DPSSendEOF(DPSContext ctxtArg);
- /* sends an EOF marker to the context */
-
-
- #endif DPSNEXT_H
-