home *** CD-ROM | disk | FTP | other *** search
- /*
- NSDPSContext.h
-
- A DPSContext Object
- Copyright 1993, NeXT, Inc.
- NeXT, March 1993
- */
-
- #import <Foundation/Foundation.h>
- #import "dpsclient.h"
-
- /* NXRunLoop mode used when DPS is waiting for return vals or pings */
- extern NSString *NSDPSRunLoopMode;
-
- @class NSDPSContext;
-
- /* method used for asynchronous ping notification */
- @protocol NSDPSContextNotification
- - (void)contextFinishedExecuting:(NSDPSContext *)context;
- @end
-
- @interface NSDPSContext : NSObject {
- /* standard DPSContext fields */
- char *priv;
- DPSSpace space;
- DPSProgramEncoding programEncoding;
- DPSNameEncoding nameEncoding;
- struct _t_DPSProcsRec const *procs;
- void (*textProc)();
- void (*errorProc)();
- DPSResults resultTable;
- unsigned int resultTableLength;
- DPSContext chainParent, chainChild;
-
- @private
- /* the output data */
- NSMutableData *outData;
- /* the output stream */
- void *outStream;
- /* Did we create the output stream? If so, make sure we close it, etc. */
- BOOL ownOutputStream;
- /* YES if the context draws to the screen (server context) */
- BOOL drawingToScreen;
- /* amount of current binArray left */
- unsigned int binArrayLeft;
- /* length of curr seq % 4 */
- char BOSLengthMod4;
- /* makes trace output nicer for debugging */
- char debugging;
- /* ping after every wrap? */
- char syncMode;
- /* a chained context being used for tracing */
- NSDPSContext *traceCtxt;
- /* state for converting binary object sequences to ascii */
- char *asciiBuffer;
- char *asciiBufCurr;
- /* a list of the offsets of any numstrings in the wrap */
- int *numStrings;
- int numNumStrings;
- /* ??? maybe add arrays of lengths and strings to buffer ptrs to strings
- instead of their data. asciiBuffer would only contain tokens. */
- }
-
- + (void)setAllContextsSynchronized:(BOOL)flag;
- + (BOOL)areAllContextsSynchronized;
- + (void)setAllContextsOutputTraced:(BOOL)flag;
- + (BOOL)areAllContextsOutputTraced;
-
- + (NSDPSContext *)currentContext;
- + (void)setCurrentContext:(NSDPSContext *)context;
-
- + (NSString *)stringForDPSError:(const DPSBinObjSeqRec *)error;
-
- - initWithMutableData:(NSMutableData *)data forDebugging:(BOOL)debug languageEncoding:(DPSProgramEncoding)langEnc nameEncoding:(DPSNameEncoding)nameEnc textProc:(DPSTextProc)tProc errorProc:(DPSErrorProc)errorProc;
- - (NSMutableData *)mutableData;
-
- /* returns the corresponding DPSContext */
- - (DPSContext)DPSContext;
-
- /* drawing status */
- - (BOOL)isDrawingToScreen;
-
- /* methods for the standard DPS API */
-
- /* methods used by pswrap generated functions to emit binary PS */
- - (void)writeBinaryObjectSequence:(const void *)data length:(unsigned int)bytes;
- - (void)writeBOSArray:(const void *)data count:(unsigned int)items ofType:(DPSDefinedType)type;
- - (void)writeBOSString:(const void *)data length:(unsigned int)bytes;
- - (void)writeBOSNumString:(const void *)data length:(unsigned int)count ofType:(DPSDefinedType)type scale:(int)scale;
- - (void)awaitReturnValues;
- - (void)updateNameMap;
-
- /* methods to send raw data */
- - (void)writeData:(NSData *)buf;
- - (void)writePostScriptWithLanguageEncodingConversion:(NSData *)buf;
- - (void)printFormat:(NSString *)format, ...;
- - (void)printFormat:(NSString *)format arguments:(va_list)argList;
-
- /* methods to control the context */
- - (void)flush;
- - (void)resetCommunication;
- /* only partially implemented in NEXTSTEP */
- - (void)interruptExecution;
- /* not implemented in NEXTSTEP */
- - (void)wait;
- - (void)notifyObjectWhenFinishedExecuting:(id <NSDPSContextNotification>)object;
-
- /* methods to control text and error procs */
- - (void)setTextProc:(DPSTextProc)proc;
- - (DPSTextProc)textProc;
- - (void)setErrorProc:(DPSErrorProc)proc;
- - (DPSErrorProc)errorProc;
-
- /* setting and getting the chained context */
- - (void)chainChildContext:(NSDPSContext *)child;
- - (void)unchainContext;
- - (NSDPSContext *)childContext;
- - (NSDPSContext *)parentContext;
-
- /* controling the wait cursor. These are NOP's for contexts that don't draw to the screen */
- - (void)startWaitCursorTimer;
- - (void)setWaitCurorEnabled:(BOOL)flag;
- - (BOOL)isWaitCurorEnabled;
-
- /* debugging aids */
- - (void)setSynchronized:(BOOL)flag;
- - (BOOL)isSynchronized;
- - (void)setOutputTraced:(BOOL)flag;
- - (BOOL)isOutputTraced;
-
- @end
-
- /* converts from a DPSContext to a NSDPSContext object */
- extern NSDPSContext *DPSContextObject(DPSContext ctxt);
-