home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks2 / DPSClient.framework / Headers / dpsNeXT.h < prev    next >
Text File  |  1995-01-16  |  7KB  |  219 lines

  1. /*
  2.     dpsNeXT.h
  3.     
  4.     This file describes the interface to the DPS routines specific to the
  5.     NeXT implementation of the DPS library.
  6.     
  7.     Copyright (c) 1988 NeXT, Inc. as an unpublished work.
  8.     All rights reserved.
  9. */
  10.  
  11. #ifndef DPSNEXT_H
  12. #define DPSNEXT_H
  13.  
  14. #import "dpsOpenStep.h"
  15.  
  16. #ifndef EVENT_H
  17. #include "event.h"
  18. #endif EVENT_H
  19.  
  20. #ifndef DPSCLIENT_H
  21. #include "dpsclient.h"
  22. #endif DPSCLIENT_H
  23.  
  24. #ifndef ERROR_H
  25. #include <objc/error.h>
  26. #endif ERROR_H
  27.  
  28. #import <stdio.h>
  29. #import <mach/port.h>
  30. #import <mach/message.h>
  31. #import <streams/streams.h>
  32. #import <objc/zone.h>
  33.  
  34. #define NX_FOREVER    (6307200000.0)    /* 200 years of seconds */
  35.  
  36. #define DPS_ALLCONTEXTS    ((DPSContext)-1) /* refers to all existing contexts */
  37.  
  38. /*=== TYPES ===*/
  39.  
  40. typedef int (*DPSEventFilterFunc)( NXEvent *ev );
  41.   /* Callback proc for filtering events of a context.  It is passed the
  42.      event just read from the context before it is put in the global
  43.      event queue.  If the proc returns TRUE, the event will be inserted
  44.      into the queue as usual, otherwise it not put in the queue.
  45.   */
  46.  
  47. typedef void (*DPSPortProc)( msg_header_t *msg, void *userData );
  48.   /* Callback proc for ports registered by DPSAddPort. */
  49.  
  50. typedef struct __DPSTimedEntry *DPSTimedEntry;
  51.  
  52. typedef void (*DPSTimedEntryProc)(
  53.     DPSTimedEntry te,
  54.     double now,
  55.     void *userData );
  56.   /* Callback proc for timed entries registered by DPSAddTimedEntry. */
  57.  
  58. typedef void (*DPSFDProc)( int fd, void *userData );
  59.   /* Callback proc for fds registered by DPSAddFD. */
  60.  
  61. typedef struct _DPSTaggedMsg {
  62.     msg_header_t header;
  63.     msg_type_t type;
  64.     int values[2];
  65. } DPSTaggedMsg;
  66.   /* Start of a message passed to DPSSendTaggedMsg. */
  67.  
  68. typedef void (*DPSPingProc)(DPSContext ctxt, void *userData);
  69.   /* Callback proc for DPSAsynchronousWaitContext. */
  70.  
  71. extern void DPSAsynchronousWaitContext(DPSContext ctxt, DPSPingProc handler, void *userData);
  72.   /* Calls handler when all PS code has been processed for this context. */
  73.  
  74. /*=== PROCEDURES ===*/
  75.  
  76. extern DPSContext DPSCreateContext(
  77.     const char *hostName,
  78.     const char *serverName,
  79.     DPSTextProc textProc,
  80.     DPSErrorProc errorProc );
  81.   /* Creates a connection to the window server with default timeout. */
  82.  
  83. extern DPSContext DPSCreateContextWithTimeoutFromZone(
  84.     const char *hostName,
  85.     const char *serverName,
  86.     DPSTextProc textProc,
  87.     DPSErrorProc errorProc,
  88.     int timeout,
  89.     NXZone *zone );
  90.   /* Creates a connection to the window server with specified ms timeout. */
  91.  
  92. extern DPSContext DPSCreateNonsecureContext(
  93.     const char *hostName,
  94.     const char *serverName,
  95.     DPSTextProc textProc,
  96.     DPSErrorProc errorProc,
  97.     int timeout,
  98.     NXZone *zone );
  99.   /* Creates a non secure connection to the window server. */
  100.  
  101. extern DPSContext DPSCreateStreamContext(
  102.     NXStream *st,
  103.     int debugging,
  104.     DPSProgramEncoding progEnc,
  105.     DPSNameEncoding nameEnc,
  106.     DPSErrorProc errorProc );
  107.   /* Creates a context that writes to a NXStream. */
  108.  
  109. extern int DPSSetTracking( int flag );
  110.   /* Enables or disables the coalescing of mouse events. */
  111.  
  112. extern void DPSStartWaitCursorTimer(void);
  113.   /* Starts the wait cursor timeout.  To be used before a time-consuming
  114.      operations that is NOT initiated by a user event.
  115.    */
  116.  
  117. extern void DPSAddPort(
  118.     port_t newPort,
  119.     DPSPortProc handler,
  120.     int maxSize,
  121.     void *userData,
  122.     int priority );
  123.   /* Adds a MACH port to be listened to. */
  124.  
  125. extern void DPSRemovePort( port_t port );
  126.   /* Removes a MACH port previously added. */
  127.  
  128. extern void DPSAddNotifyPortProc(DPSPortProc handler, void *userData);
  129.   /* register handler to be called for any messages on the notify port */
  130.  
  131. extern void DPSRemoveNotifyPortProc(DPSPortProc handler);
  132.   /* unregister handler for notify messages */
  133.  
  134. extern DPSTimedEntry DPSAddTimedEntry(
  135.     double period,
  136.     DPSTimedEntryProc handler,
  137.     void *userData,
  138.     int priority );
  139.   /* Creates a timed entry. */
  140.  
  141. extern void DPSRemoveTimedEntry( DPSTimedEntry te );
  142.   /* Destroys a timed entry. */
  143.  
  144. extern void DPSAddFD(
  145.     int fd,
  146.     DPSFDProc routine,
  147.     void *data,
  148.     int priority );
  149.   /* Adds a file descriptor to be listened to. */
  150.  
  151. extern void DPSRemoveFD( int fd );
  152.   /* Removes a file descriptor previously added. */
  153.  
  154. extern void DPSSetDeadKeysEnabled(DPSContext ctxt, int flag);
  155.   /* Enables and disabled dead key processing for a context's events. */
  156.  
  157. extern DPSEventFilterFunc DPSSetEventFunc(
  158.     DPSContext ctxt,
  159.     DPSEventFilterFunc func );
  160.   /* Installs a function to filter events from a given context. */
  161.  
  162. extern int _DPSGetOrPeekEvent( DPSContext ctxt, NXEvent *eventStorage,
  163.             int mask, double wait, int threshold, int peek );
  164. #define DPSGetEvent( ctxt, evPtr, mask, timeout, thresh )    \
  165.     _DPSGetOrPeekEvent( (ctxt), (evPtr), (mask), (timeout), (thresh), 0 )
  166.   /* Finds a matching event, removing it from the queue. */
  167.  
  168. #define DPSPeekEvent( ctxt, evPtr, mask, timeout, thresh )    \
  169.     _DPSGetOrPeekEvent( (ctxt), (evPtr), (mask), (timeout), (thresh), 1 )
  170.   /* Finds a matching event, but does not remove it from the queue. */
  171.  
  172. extern int DPSPostEvent( NXEvent *event, int atStart );
  173.   /* Posts an event to the front or back of the client side event queue. */
  174.  
  175. extern void DPSDiscardEvents( DPSContext ctxt, int mask );
  176.   /* Removes matching events from the event queue.  DPS_ALLCONTEXTS can
  177.      be used as the first argument to match to all contexts.
  178.    */
  179.  
  180. extern int DPSTraceContext( DPSContext ctxt, int flag );
  181.   /* Turns on and off debugging tracing of a context's input and output.
  182.      DPS_ALLCONTEXTS can be used as the first argument to match to
  183.      all contexts.
  184.    */
  185.  
  186. void DPSTraceEvents(DPSContext ctxt, int flag);
  187.   /* Turns on and off debugging tracing of the events a context receives.
  188.      DPS_ALLCONTEXTS can be used as the first argument to match to
  189.      all contexts.
  190.    */
  191.  
  192. extern void DPSPrintError( FILE *fp, const DPSBinObjSeqRec *error );
  193.   /* Prints out a binary encoded error to the fp. */
  194.  
  195. extern void DPSPrintErrorToStream( NXStream *st, const DPSBinObjSeqRec *error );
  196.   /* Prints our a binary encoded error to the stream. */
  197.  
  198. extern const char *DPSNameFromTypeAndIndex( short type, int index );
  199.   /* This routine returns the text for the user name with the given index of
  200.      the given type.  Type 0 is for usernames, and type -1 is for systems
  201.      names.  The string returned is owned by the library (treat it as readonly).
  202.    */
  203.  
  204. extern int DPSSendTaggedMsg(DPSContext ctxt, DPSTaggedMsg *msg);
  205.   /* Sends a tagged message to the Window Server.  Returns tag number to pass
  206.      to some PS operator which accepts the message data as an argument.
  207.    */
  208.  
  209. extern int DPSSendPort(DPSContext ctxt, port_t port, int sendAllRights);
  210.   /* sends a single port in a tagged message.  Returns tag number to pass to
  211.      some PS operator which accepts the port as an argument.
  212.    */
  213.  
  214. void DPSSendEOF(DPSContext ctxtArg);
  215.   /* sends an EOF marker to the context */
  216.  
  217.  
  218. #endif DPSNEXT_H
  219.