824N/A * (c) Copyright 1988-1994 Adobe Systems Incorporated. 824N/A * Permission to use, copy, modify, distribute, and sublicense this software 824N/A * and its documentation for any purpose and without fee is hereby granted, 824N/A * provided that the above copyright notices appear in all copies and that 824N/A * both those copyright notices and this permission notice appear in 824N/A * supporting documentation and that the name of Adobe Systems Incorporated 824N/A * not be used in advertising or publicity pertaining to distribution of the 824N/A * software without specific, written prior permission. No trademark license 824N/A * to use the Adobe trademarks is hereby granted. If the Adobe trademark 824N/A * "Display PostScript"(tm) is used to describe this software, its 824N/A * functionality or for any other purpose, such use shall be limited to a 824N/A * statement that this software works in conjunction with the Display 824N/A * PostScript system. Proper trademark attribution to reflect Adobe's 824N/A * ownership of the trademark shall be given whenever any such reference to 824N/A * the Display PostScript system is made. 824N/A * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR 824N/A * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 824N/A * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 824N/A * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 824N/A * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE 824N/A * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL 824N/A * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, 824N/A * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN 824N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT 824N/A * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. 824N/A * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems 824N/A * Incorporated which may be registered in certain jurisdictions 824N/A * Author: Adobe Systems Incorporated 824N/A/* Converts from IEEE high-byte-first real to native real. */ 824N/A/* Converts from native real to IEEE high-byte-first real. */ 824N/A/* Converts from IEEE low-byte-first real to native real. */ 824N/A/* Converts from native real to IEEE low-byte-first real. */ 824N/Atypedef union {
/* 32 bit number representations */ 824N/A /* raw bytes, in whatever order they appear in memory */ 824N/Atypedef union {
/* 16 bit number representations */ 824N/A /* we're about to call the error handler, so roll back the 824N/A lastNameIndex to the last known valid index */ 824N/A/**************************************************************/ 824N/A/* Procedures that support the DPSCreateContext context procs */ 824N/A/**************************************************************/ 824N/A /* char * result, copy first, ignore subsequent, null terminate */ 824N/A /* copy entire string into char array */ 824N/A /* copy partial string into char array */ 824N/A else return;
/* ignore string result, no room left */ 824N/A }
/* switch (result->type) */ 824N/A/* called to deal with results from the server */ 824N/A else break;
/* switch */ 824N/A /* we were buffering; drop buffered chars on the floor */ 824N/A /* here with m = BOS total length in bytes, b = cc->objBuf */ 824N/A /* we're here only if cc->objBuf contains a complete BOS */ 824N/A }
/* if we're buffering */ 824N/A /* dispose of any plain text. If no binary conversion, all output 824N/A ((
unsigned char)
buf[n] <
128 || (
unsigned char)
buf[n] >
159); n++);
824N/A /* here with the next binary object sequence from a server */ 824N/A /* check for quadbyte alignment */ 824N/A /* not aligned, we gotta copy the buffer */ 824N/A /* we assert that we can't have an oldBuf if we're not aligned, 824N/A since we only get an oldBuf if we copied to a new buffer, 824N/A and we have already tested nch to be at least DPS_SEQ_MIN */ 824N/A /* copy DPS_SEQ_MIN bytes, so we can use existing buffering code */ 824N/A /* now go to top of loop and go through the buffer update code */ 824N/A /* this is not an extended BOS */ 824N/A else {
/* dispatch this result */ 824N/A }
/* if (nch != 0) ... the next binary object sequence from a server */ 824N/A }
/* while (nch > 0) */ 824N/A}
/* DPSclientPrintProc */ 824N/A/**************************************/ 824N/A/* Context procs for DPSCreateContext */ 824N/A/**************************************/ 824N/A /* unlink context from chain temporarily, so DPSPrintf can be called */ 824N/A /* update any children */ 824N/A /* safe to call with chain */ 824N/A if (
sizeof(
long) ==
4) {
824N/A}
/* innerProcWriteNumstring */ 824N/A}
/* writeTypedObjectArray */ 824N/A/****************************************************************/ 824N/A/* Procedures that support the DPSCreateTextContext context procs */ 824N/A/****************************************************************/ 824N/A/* precondition: (c >= 129 && c <= 159), which means that c is the 824N/A first byte of either a binary token or a binary object sequence */ 824N/A/* returns the number of initial bytes of a given goody that are 824N/A required to figure out how many bytes are needed for the entire goody */ 824N/A if (*t >
149 && *t <
160)
return(
1);
/* unassigned */ 824N/A register unsigned char *b;
824N/A if (r <
32)
/* 32-bit fixed */ 824N/A else if (r <
48) {
/* 16-bit fixed */ 824N/A else if (r ==
48)
/* 32-bit IEEE */ 824N/A else if (r ==
49)
/* 32-bit native */ 824N/A}
/* WriteHomogeneousArrayAsASCII */ 824N/A/* returns the number of bytes needed for the entire goody. buf points 824N/A to enough initial bytes of the goody to figure this out (see above). */ 824N/A register unsigned char *r = (
unsigned char *)&
nBytes;
824N/A /* NOTE: It's ok to call DPSPrintf (which calls DPSWritePostScript) 824N/A from here since we are only sending text, so there's no problem 824N/A with re-entering DPSWritePostScript. Caller guarantees 824N/A that this context has no children. */ 824N/A /* render string bytes correctly */ 824N/A if (c ==
'(' || c ==
')' || c ==
'\\')
824N/A /* not an extended BOS */ 824N/A /* Caller guarantees that this context has no children, 824N/A so it is okay to call DPSWriteData */ 824N/A /* Pass 0: If we're expanding name indices, find all name objects, 824N/A lookup their strings, sum the lengths. 824N/A Write the modified sequence header regardless. 824N/A Pass 1: we're converting indices to strings and/or 824N/A converting numbers. Write each modified object, and 824N/A Pass 2: Find all name objects, lookup and write the strings. */ 824N/A /* we're just converting numbers, so skip while loop */ 824N/A else {
/* numFormat is native */ 824N/A /* keep track of where strings start */ 824N/A else {
/* name is already a string */ 824N/A /* keep track of where strings start */ 824N/A }
/* end if type == DPS_NAME */ 824N/A /* write modified seqHead */ 824N/A /* write top level count */ 824N/A /* write escape code & top level count */ 824N/A}
/* ConvertAndWriteSeqAsData */ 824N/A/* TestHomogeneous will return a non-negative representation code 'r' 824N/A if all of the array elements are "integers", or all are "reals". 824N/A Will return -1 for any other case. */ 824N/A if ((r == -
1) || ((r &
0x07F) ==
32 && (
tmp &
0x07F) == 0))
824N/A r =
tmp;
/* first element, or was 16-bit => bump to 32-bit */ 824N/A else if ((r &
0x07F) == 0 && (
tmp &
0x07F) ==
32)
824N/A /* else fall thru, r == tmp */ 824N/A /* then it must be IEEE */ 824N/A PB(
140);
/* 32-bit native float */ 824N/A PB(
145);
/* literal system name */ 824N/A PB(
147);
/* literal user name index */ 824N/A PB(
148);
/* executable user name index */ 824N/A PB(
149);
/* homogeneous number array */ 824N/A}
/* WriteSeqAsTokens */ 824N/A register unsigned char *b;
824N/A case 132:
/* 32-bit int, hi */ 824N/A case 133:
/* 32-bit int, lo */ 824N/A case 134:
/* 16-bit int, hi */ 824N/A case 135:
/* 16-bit int, lo */ 824N/A case 136:
/* 8-bit int, signed */ 824N/A case 137: {
/* 16 or 32-bit fixed */ 824N/A if (r <
32) {
/* 32-bit */ 824N/A else if (r <
48) {
/* 16-bit */ 824N/A case 138:
/* 32-bit IEEE float, hi */ 824N/A case 139:
/* 32-bit IEEE float, lo */ 824N/A case 140:
/* 32-bit native float */ 824N/A case 141:
/* boolean */ 824N/A case 142:
/* short string */ 824N/A case 143:
/* long string, hi */ 824N/A case 144:
/* long string, lo */ 824N/A /* render string bytes correctly */ 824N/A if (c ==
'(' || c ==
')' || c ==
'\\')
824N/A case 145:
/* literal system name index */ 824N/A case 146:
/* executable system name index */ 824N/A case 147:
/* literal user name index */ 824N/A case 148:
/* executable user name index */ 824N/A case 149: {
/* homogeneous number array */ 824N/A default:;
/* unassigned */ 824N/A}
/* WriteTokenAsAscii */ 824N/A/* WriteEntireGoody converts an entire binary token or binary object 824N/A sequence as specified by ctxt's encoding parameters. Write the 824N/A converted bytes via DPSWriteData. buf points to the complete goody. */ 824N/A /* only supported conversion is binary token to ASCII */ 824N/A /* takes three passes to do conversions */ 824N/A /* first pass just writes modified seqHead */ 824N/A /* second pass converts numbers and writes the sequence */ 824N/A}
/* WriteEntireGoody */ 824N/A/**************************************/ 824N/A/* Context procs for DPSCreateTextContext */ 824N/A/**************************************/ 824N/A /* # bytes needed to determine size */ 824N/A /* here with size of entire goody in m and outBuf set up */ 824N/A }
/* if (cc->outBuf) */ 824N/A /* dispose of any plain text. If no binary conversion, all output 824N/A ((
unsigned char)
buf[n] <
128 || (
unsigned char)
buf[n] >
159); n++);
824N/A if it rips control away */ 824N/A /* here with the next binary object sequence or encoded token */ 824N/A if it rips control away */ 824N/A }
/* while (nch > 0) */ 824N/A}
/* textInnerWritePostScript */ 824N/A /* disconnect temporarily so that high level procs can 824N/A /* disconnect temporarily so that high level procs can 824N/A /* disconnect temporarily so that high level procs can 824N/A /* Subtract 4 because of binary object sequence header */ 824N/A}
/* textWriteNumstring */ 824N/A/********************************************/ 824N/A/* Public procs for dealing with user names */ 824N/A /* handle the case where another context in another space has 824N/A /* handle other cases where another context in another 824N/A space has defined names */ 824N/A/**********************/ 824N/A/* Other public procs */ 824N/A#
if 0
/* Postpone the raise 'til later to avoid RAISEing through Xlib */ 824N/A}
/* DPSDefaultErrorProc */ 824N/A/**************************************/ 824N/A/* Public procs for creating contexts */ 824N/A/* dps_err_invalidAccess is now defined for all clients. */ 824N/A /* Setup a dummy space */ 824N/A}
/* DPSCreateTextContext */ 824N/A}
/* CreateDummyContext */ 824N/A /* textProc will not be used unless DPS initialization fails */ 824N/A {
/* can't create the context */ 824N/A}
/* DPSCreateContext */ 824N/A The chainParent field is non-NIL if this context automatically receives 824N/A a copy of the PostScript code sent to the referenced (parent) context. 824N/A The chainChild field is non-NIL if this context automatically sends along 824N/A to the referenced (child) context a copy of any PostScript code received. 824N/A return -
1;
/* report an error */ 824N/A /* insert new child between parent and existing children */ 824N/A /* if child has children, recursively chain them */ 824N/A if (p !=
NIL) {
/* remove ctxt from parent's chain */ 824N/A if (c !=
NIL) {
/* remove ctxt's child (if any) from ctxt's chain */