/*
*
* (c) Copyright 1988-1994 Adobe Systems Incorporated.
* All rights reserved.
*
* Permission to use, copy, modify, distribute, and sublicense this software
* and its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notices appear in all copies and that
* both those copyright notices and this permission notice appear in
* supporting documentation and that the name of Adobe Systems Incorporated
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. No trademark license
* to use the Adobe trademarks is hereby granted. If the Adobe trademark
* "Display PostScript"(tm) is used to describe this software, its
* functionality or for any other purpose, such use shall be limited to a
* statement that this software works in conjunction with the Display
* PostScript system. Proper trademark attribution to reflect Adobe's
* ownership of the trademark shall be given whenever any such reference to
* the Display PostScript system is made.
*
* ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
* ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
* TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
* PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
*
* Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
* Incorporated which may be registered in certain jurisdictions
*
* Author: Adobe Systems Incorporated
*/
/* $XFree86: xc/lib/dps/dpsXpriv.c,v 1.7 2002/03/05 21:50:14 herrb Exp $ */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#ifdef GC
#endif /* GC */
#ifdef VMS
/* Xlib does not like UNIX defined to any value under VMS. */
#include <decw$include/X.h>
#else /* VMS */
#endif /* VMS */
#include "dpsprivate.h"
#include "DPS/dpsconfig.h"
#include "publictypes.h"
#include "dpsXpriv.h"
#include "DPS/dpsXclient.h"
#include "DPS/dpsexcept.h"
#include "dpsassert.h"
#ifdef ISC
#include <sys/bsdtypes.h>
#endif
#ifdef __QNX__
#endif
#define SELECT_TYPE int *
#else
#endif
typedef struct _RegstDPY
{
int firstEvent;
/* XDPSContextTimedOut is set to true by the BlockForEvent routine
when expected return values are not received within a certain
amount of time. In this case, BlockForEvent will return and the
higher callers may take appropriate action to avoid deadlocks. */
/* XDPSQuitBlocking is set to false by the BlockForEvent routine and
becomes true if either a zombie status event or an output event
is received for the context waiting for return values. */
int XDPSQuitBlocking = false;
/* operands for "setobjectformat" if we must agree with server. */
{
return (rdpy);
return (NIL);
}
void XDPSPrivZapDpy(
{
{
else
break;
}
}
/* ARGSUSED */
static int UsuallyFalse (
char *arg)
{
}
void XDPSForceEvents (
{
(void) XSetErrorHandler(proc);
}
}
static void OutputEventHandler (
register XDPSLOutputEvent *event)
{
return;
{
XDPSQuitBlocking = true;
}
}
static int BlockForEvent (
{
XDPSQuitBlocking = false;
/* XDPSQuitBlocking becomes true if a zombie status event or
any output event is received by the status event handler for
the currently-awaiting-results context. */
while (1) {
/* Ignore interrupt signals */
errno = 0;
continue;
}
return (-1); /* Broken connection (errno == EBADF) */
} else {
if (XDPSQuitBlocking) break;
/* The noop is necessary to force proper behavior when the
connection goes away - listen carefully! When the dpy
connection is closed, the above select returns indicating
activity on the connection. We call XDPSForceEvents, which
calls XCheckIfEvent, which ultimately may call XFlush
(if there are no events queued). The XNoOp call puts
a message in the outgoing queue, so that XFlush is forced
to write on the connection. When it tries to write, the
error condition will be noted and XIOError will be called,
usually causing the application to terminate. Note that
the error won't happen until the second time thru this
loop, but that's ok. */
}
}
return (0);
}
void XDPSSetContextEncoding (
{
/* This routine should not be called if ctxt is a text context */
{
return;
}
else
}
/* ARGSUSED */
char *buf;
long unsigned int count;
{
{
return;
}
}
/* ARGSUSED */
void DPSInitClient(
void (*releaseProc) (char *, char *))
{
XDPSSetProcs ();
}
{
return ((DPSNumFormat) -1);
else
}
int x,
int y,
unsigned int eventmask,
int actual,
int secure)
{
int event_base;
if (DPSInitialize() != 0) return(NULL);
{
/* DPS extension on this dpy? */
if (event_base >= 0 &&
{
else
/* Everybody must talk ieee! */
#if SWAPBITS
#else /* SWAPBITS */
#endif /* SWAPBITS */
}
else
return (NULL);
}
{
wh->x = x;
wh->y = y;
return (wh);
}
else
return (NULL);
}
{
if (clientPrintProc == NIL)
return ((DPSNumFormat) -1);
else
{
}
}
void DPSIncludePrivContext (
{
if (clientPrintProc == NIL)
if (!newWh) DPSOutOfMemory();
{
/* Did we have to change object format for parent context? */
/* Note: the child context must inherit the object format of
its parent. When this happens in the server there
will be no need for the following code segment. */
{
}
}
else
{
}
}
/* ARGSUSED */
void DPSSendPostScript (
register XDPSPrivContext wh,
char *buffer,
long int count,
boolean (*returnControl)(void))
{
else {
if (count > 0)
if (blocking) {
0);
}
}
}
}
/* ARGSUSED */
void DPSSendInterrupt (
{
}
/* ARGSUSED */
void DPSSendEOF (
{
}
/* ARGSUSED */
void DPSSendTerminate (
{
}
void XDPSSendUnfreeze (
{
}
/* ARGSUSED */
void DPSSendDestroySpace(
{
}
void DPSOutOfMemory (void)
{
exit (1);
}