home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSDPSContext.h < prev    next >
Text File  |  1996-10-17  |  5KB  |  143 lines

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