home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / AppKit.framework / Headers / NSDPSContext.h < prev    next >
Text File  |  1995-01-16  |  4KB  |  135 lines

  1. /*
  2.     NSDPSContext.h
  3.  
  4.     A DPSContext Object
  5.     Copyright 1993, NeXT, Inc.
  6.     NeXT, March 1993
  7. */
  8.  
  9. #import <Foundation/Foundation.h>
  10. #import "dpsclient.h"
  11.  
  12. /* NXRunLoop mode used when DPS is waiting for return vals or pings */
  13. extern NSString *NSDPSRunLoopMode;
  14.  
  15. @class NSDPSContext;
  16.  
  17. /* method used for asynchronous ping notification */
  18. @protocol NSDPSContextNotification
  19. - (void)contextFinishedExecuting:(NSDPSContext *)context;
  20. @end
  21.  
  22. @interface NSDPSContext : NSObject {
  23.   /* standard DPSContext fields */
  24.     char *priv;
  25.     DPSSpace space;
  26.     DPSProgramEncoding programEncoding;
  27.     DPSNameEncoding nameEncoding;
  28.     struct _t_DPSProcsRec const *procs;
  29.     void (*textProc)();
  30.     void (*errorProc)();
  31.     DPSResults resultTable;
  32.     unsigned int resultTableLength;
  33.     DPSContext chainParent, chainChild;
  34.  
  35.  @private
  36.   /* the output data */
  37.     NSMutableData *outData;
  38.   /* the output stream */
  39.     void *outStream;
  40.   /* Did we create the output stream?  If so, make sure we close it, etc. */
  41.     BOOL ownOutputStream;
  42.   /* YES if the context draws to the screen (server context) */
  43.     BOOL drawingToScreen;
  44.   /* amount of current binArray left */
  45.     unsigned int binArrayLeft;
  46.   /* length of curr seq % 4 */
  47.     char BOSLengthMod4;
  48.   /* makes trace output nicer for debugging */
  49.     char debugging;
  50.   /* ping after every wrap? */
  51.     char syncMode;
  52.   /* a chained context being used for tracing */
  53.     NSDPSContext *traceCtxt;
  54.   /* state for converting binary object sequences to ascii */
  55.     char *asciiBuffer;
  56.     char *asciiBufCurr;
  57.   /* a list of the offsets of any numstrings in the wrap */
  58.     int *numStrings;
  59.     int numNumStrings;
  60.   /* ??? maybe add arrays of lengths and strings to buffer ptrs to strings
  61.      instead of their data.  asciiBuffer would only contain tokens. */
  62. }
  63.  
  64. + (void)setAllContextsSynchronized:(BOOL)flag;
  65. + (BOOL)areAllContextsSynchronized;
  66. + (void)setAllContextsOutputTraced:(BOOL)flag;
  67. + (BOOL)areAllContextsOutputTraced;
  68.  
  69. + (NSDPSContext *)currentContext;
  70. + (void)setCurrentContext:(NSDPSContext *)context;
  71.  
  72. + (NSString *)stringForDPSError:(const DPSBinObjSeqRec *)error;
  73.  
  74. - initWithMutableData:(NSMutableData *)data forDebugging:(BOOL)debug languageEncoding:(DPSProgramEncoding)langEnc nameEncoding:(DPSNameEncoding)nameEnc textProc:(DPSTextProc)tProc errorProc:(DPSErrorProc)errorProc;
  75. - (NSMutableData *)mutableData;
  76.  
  77. /* returns the corresponding DPSContext */
  78. - (DPSContext)DPSContext;
  79.  
  80. /* drawing status */
  81. - (BOOL)isDrawingToScreen;
  82.  
  83. /* methods for the standard DPS API */
  84.  
  85. /* methods used by pswrap generated functions to emit binary PS */
  86. - (void)writeBinaryObjectSequence:(const void *)data length:(unsigned int)bytes;
  87. - (void)writeBOSArray:(const void *)data count:(unsigned int)items ofType:(DPSDefinedType)type;
  88. - (void)writeBOSString:(const void *)data length:(unsigned int)bytes;
  89. - (void)writeBOSNumString:(const void *)data length:(unsigned int)count ofType:(DPSDefinedType)type scale:(int)scale;
  90. - (void)awaitReturnValues;
  91. - (void)updateNameMap;
  92.  
  93. /* methods to send raw data */
  94. - (void)writeData:(NSData *)buf;
  95. - (void)writePostScriptWithLanguageEncodingConversion:(NSData *)buf;
  96. - (void)printFormat:(NSString *)format, ...;
  97. - (void)printFormat:(NSString *)format arguments:(va_list)argList;
  98.  
  99. /* methods to control the context */
  100. - (void)flush;
  101. - (void)resetCommunication;
  102.     /* only partially implemented in NEXTSTEP */
  103. - (void)interruptExecution;
  104.     /* not implemented in NEXTSTEP */
  105. - (void)wait;
  106. - (void)notifyObjectWhenFinishedExecuting:(id <NSDPSContextNotification>)object;
  107.  
  108. /* methods to control text and error procs */
  109. - (void)setTextProc:(DPSTextProc)proc;
  110. - (DPSTextProc)textProc;
  111. - (void)setErrorProc:(DPSErrorProc)proc;
  112. - (DPSErrorProc)errorProc;
  113.  
  114. /* setting and getting the chained context */
  115. - (void)chainChildContext:(NSDPSContext *)child;
  116. - (void)unchainContext;
  117. - (NSDPSContext *)childContext;
  118. - (NSDPSContext *)parentContext;
  119.  
  120. /* controling the wait cursor.  These are NOP's for contexts that don't draw to the screen */
  121. - (void)startWaitCursorTimer;
  122. - (void)setWaitCurorEnabled:(BOOL)flag;
  123. - (BOOL)isWaitCurorEnabled;
  124.  
  125. /* debugging aids */
  126. - (void)setSynchronized:(BOOL)flag;
  127. - (BOOL)isSynchronized;
  128. - (void)setOutputTraced:(BOOL)flag;
  129. - (BOOL)isOutputTraced;
  130.  
  131. @end
  132.  
  133. /* converts from a DPSContext to a NSDPSContext object */
  134. extern NSDPSContext *DPSContextObject(DPSContext ctxt);
  135.